From 59c140fbcc9e9687cf3cc77f319135496c657baf Mon Sep 17 00:00:00 2001
From: Yusei Tahara <yusei@nexedi.com>
Date: Wed, 10 Jun 2015 10:57:54 +0900
Subject: [PATCH] Make sure that catalog knows portal_type column and reference
 column. If catalog does not know those columns, then it will fetch all
 cataloged objects and will cause memory bloat. This can happen when MariaDB
 server disk is full.

---
 product/ERP5Security/ERP5UserManager.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/product/ERP5Security/ERP5UserManager.py b/product/ERP5Security/ERP5UserManager.py
index dce00993ee..d2d5cd0151 100644
--- a/product/ERP5Security/ERP5UserManager.py
+++ b/product/ERP5Security/ERP5UserManager.py
@@ -69,6 +69,8 @@ def getUserByLogin(portal, login, exact_match=True):
     reference_key = 'ExactMatch'
   else:
     reference_key = 'Keyword'
+  if not (portal.portal_catalog.hasColumn('portal_type') and portal.portal_catalog.hasColumn('reference')):
+    raise RuntimeError('Catalog does not have column information. Make sure RDB is working and disk is not full.')
   result = portal.portal_catalog.unrestrictedSearchResults(
       select_expression='reference',
       portal_type="Person",
-- 
2.30.9