Use NOWAIT when locking a table
lock is used to enforce a serializable level for all transaction using on the same table. This is not achieved if transactions are waiting for the lock instead of abort and retry with a new transaction because they will still have the initial transaction row values with the repeatable read level. issue4373 review5901002
This commit is contained in:
@@ -356,7 +356,7 @@ class Cursor(CursorInterface):
|
||||
return self.cursor.fetchone()[0]
|
||||
|
||||
def lock(self, table):
|
||||
self.cursor.execute('LOCK "%s" IN EXCLUSIVE MODE' % table)
|
||||
self.cursor.execute('LOCK "%s" IN EXCLUSIVE MODE NOWAIT' % table)
|
||||
|
||||
def has_constraint(self):
|
||||
return True
|
||||
|
||||
Reference in New Issue
Block a user