Skip to content

Commit 5e71b29

Browse files
author
Richard Jones
committed
use row locking in MySQL newid() [SF#1034211]
1 parent 0f65a4f commit 5e71b29

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

CHANGES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ Fixed:
4040
discarding of the message
4141
- mailgw can override the MAIL_DEFAULT_CLASS
4242
- handle Py2.3+ datetime objects as Date specs (sf bug 971300)
43+
- use row locking in MySQL newid() (sf bug 1034211)
4344

4445

4546
2004-07-21 0.7.6

doc/index.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ Christophe Kalt,
9898
Brian Kelley,
9999
James Kew,
100100
Sheila King,
101+
Michael Klatt,
101102
Bastian Kleineidam,
102103
Axel Kollmorgen,
103104
Detlef Lannert,

roundup/backends/back_mysql.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -437,8 +437,8 @@ def drop_class_table_key_index(self, cn, key):
437437
def newid(self, classname):
438438
''' Generate a new id for the given class
439439
'''
440-
# get the next ID
441-
sql = 'select num from ids where name=%s'%self.arg
440+
# get the next ID - "FOR UPDATE" will lock the row for us
441+
sql = 'select num from ids where name=%s FOR UPDATE'%self.arg
442442
self.sql(sql, (classname, ))
443443
newid = int(self.cursor.fetchone()[0])
444444

0 commit comments

Comments
 (0)