Ejemplo n.º 1
0
 def _pause_pack_until_lock(self, cursor, sleep):
     """Pause until we can obtain a nowait commit lock."""
     if sleep is None:
         sleep = time.sleep
     delay = self.options.pack_commit_busy_delay
     while not self.locker.hold_commit_lock(cursor, nowait=True):
         mysql_connection(cursor).rollback()
         log.debug('pack: commit lock busy, sleeping %.4g second(s)', delay)
         sleep(delay)
Ejemplo n.º 2
0
 def _pause_pack_until_lock(self, cursor, sleep):
     """Pause until we can obtain a nowait commit lock."""
     if sleep is None:
         sleep = time.sleep
     delay = self.options.pack_commit_busy_delay
     while not self.locker.hold_commit_lock(cursor, nowait=True):
         mysql_connection(cursor).rollback()
         log.debug('pack: commit lock busy, sleeping %.4g second(s)', delay)
         sleep(delay)
Ejemplo n.º 3
0
 def new_oids(self, cursor):
     """Return a sequence of new, unused OIDs."""
     stmt = "INSERT INTO new_oid VALUES ()"
     cursor.execute(stmt)
     conn = mysql_connection(cursor)
     n = conn.insert_id()
     if n % 100 == 0:
         # Clean out previously generated OIDs.
         stmt = "DELETE FROM new_oid WHERE zoid < %s"
         cursor.execute(stmt, (n,))
     return range(n * 16 - 15, n * 16 + 1)