"Brion Vibber" wrote:
I've just checked a patch into the unstable branch
which changes the
order of save operations a bit in a way which should help protect
against the bug, without adding any transactions or locking or
whathaveyou.
The UPDATE to cur is moved up before the INSERT, *and* its WHERE
condition is modified to include the timestamp of the old edit (which
we've been using to detect edit conflicts, after all).
We then ask MySQL how many rows it modified in the UPDATE statement. If
it's zero, we know that there was an edit conflict; we abort the rest of
the save operation and (if I've got it right; I haven't tested it in
actual conflict) show an edit conflict screen.
You're a legend Brion. Don't ever leave us, okay?
-- Tim Starling <tstarlingphysicsunimelbeduau>