Commit fa9897db authored by Vincent Pelletier's avatar Vincent Pelletier

Use portal_ids (if available) to generate catalog uids.

This is done to allow removing AUTOINCREMENT property of catalog's uid column, which causes table-level locks on innodb, which badly impairs indexation speed especialy when using multiple indexation nodes. If AUTOINCREMENT is kept on catalog, the system keeps working but the table-level lock will still be held (unless you use MySQL 2.1.22 or higher, which is not advised since at the moment it's a development branch).


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@16688 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 8d3d26b2
...@@ -1245,6 +1245,17 @@ class Catalog( Folder, ...@@ -1245,6 +1245,17 @@ class Catalog( Folder,
elif getattr(self, '_v_uid_buffer', None) is None: elif getattr(self, '_v_uid_buffer', None) is None:
self._v_uid_buffer = UidBuffer() self._v_uid_buffer = UidBuffer()
if len(self._v_uid_buffer) == 0: if len(self._v_uid_buffer) == 0:
id_tool = getattr(self.getPortalObject(), 'portal_ids', None)
if id_tool is not None:
if self._max_uid is None:
self._max_uid = Length()
uid_list = id_tool.generateNewLengthIdList(id_group='catalog_uid',
id_count=UID_BUFFER_SIZE, default=self._max_uid())
# TODO: if this method is kept and former uid allocation code is
# discarded, self._max_uid duplicates work done by portal_ids: it
# already keeps track of the highest allocated number for all id
# generator groups.
else:
method_id = self.sql_catalog_produce_reserved method_id = self.sql_catalog_produce_reserved
method = getattr(self, method_id) method = getattr(self, method_id)
# Generate an instance id randomly. Note that there is a small possibility that this # Generate an instance id randomly. Note that there is a small possibility that this
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment