[TYPO3-dev] locking of records

Martin Schoenbeck ms.usenet.nospam at schoenbeck.de
Sun Jan 29 23:08:06 CET 2006


Hi Bernhard,

Bernhard Kraft schrieb:

> so the problem you noted: same record updated in the same second
> will only occur if this is be done by the same user ...

The problem is not, updating the same record within one second by two (real
or not) users. The problem only arises, if anybody writes a record and
within the same second two users read and one of them writes the record.
Then the overwriting by the second of them couldn't be detected. It doesn't
matter, with which user id it is done. 

But the situation can be avoided easily by the optimistic locking code. It
simply has to detect the situation where it would write the same timestamp
again and then either defer the write operation for a second or increment
the timestamp by one second, whatever is easier to implement. And because
it's even with scripts not probable, that such a situation occurs at all,
both solutions won't be problematic. 

In case of incrementing the timestamp, there of course may appear a
situation, where an unconditionally generated timestamp would be less than
the actual one, so it has in fact to be checked, that the new stamp will be
higher than the old one.

Only if scripts do more than one write operation on the same record within
a second on a regular basis, the problem will appear in reality. And even
then only, if in parallel somebody edits that data.

Martin
-- 
Bitte nicht an der E-Mail-Adresse fummeln, die paßt so.




More information about the TYPO3-dev mailing list