Refinement in the conflict detection
2006-06-28
Jesus Cea2006-06-28
David Binger2006-06-28
Jesus Cea2006-06-29
David BingerRefinement in the conflict detection
Jesus Cea
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Durus 3.4 is a big forward step in conflict resolution, since only
objects touched in last transaction can cause a conflict at commit.
There is a corner case, nevertheless. Try this:
1. Launch a durus server with an empty storage.
2. Launch a durus client. Create two "PersistentDict", with keys "a" and
"b" in "root", and commit the transaction.
3. Quit the durus client.
4. Launch two new durus clients.
5. In the first client, do a "root.items()" to preload "root" and to
create ghost objects for "a" and "b".
6. In the second client, access to "root->a" persistent dict and add any
value. Commit the transaction.
6. In the first client, access to "root->b" persistent dict and add any
valur. Try to commit the transaction.
It will raise a conflict even if client 1 only touched "b" and client 2
only touched "a".
This issue is that when a client receives (in the commit) the OID list
of potential conflicting objects, it compares it with the objects
accesed in last transaction, INCLUDING the newly created ghost objects
in response to the loading of other objects. Collateral damage.
In "connection.py", "_handle_invalidations()" method, we have the
following code:
"""
conflicts = []
for oid in oids:
obj = self.cache.get(oid)
if obj is None:
continue
if not obj._p_is_ghost():
self.invalid_oids.add(oid)
if obj._p_touched == self.sync_count:
conflicts.append(oid)
"""
I think the last "if" should be only evaluated if the object is not a
ghost (a ghost object SHOULDN'T create a conflict, since there was not
actually used in last transaction, even if "obj.sync_count" is current
because the ghost was compulsory created).
So, instead of
"""
if not obj._p_is_ghost():
self.invalid_oids.add(oid)
if obj._p_touched == self.sync_count:
conflicts.append(oid)
"""
I would suggest to change it to:
"""
if not obj._p_is_ghost():
self.invalid_oids.add(oid)
if obj._p_touched == self.sync_count:
conflicts.append(oid)
"""
- --
Jesus Cea Avion _/_/ _/_/_/ _/_/_/
jcea@argo.es http://www.argo.es/~jcea/ _/_/ _/_/ _/_/ _/_/ _/_/
jabber / xmpp:jcea@jabber.org _/_/ _/_/ _/_/_/_/_/
_/_/ _/_/ _/_/ _/_/ _/_/
"Things are not so easy" _/_/ _/_/ _/_/ _/_/ _/_/ _/_/
"My name is Dump, Core Dump" _/_/_/ _/_/_/ _/_/ _/_/
"El amor es poner tu felicidad en la felicidad de otro" - Leibniz
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iQCVAwUBRKHlUplgi5GaxT1NAQL81AQAnV5ja1Ndswupqwm5dVHqWImvIhYiW6iY
NY/3JS3zNWYQlzBrNmGFydjrGmLXWcNDRMJoKRI32CqlwkcZFM1deZdoDjfXVYRX
hwyp5Zt37qEfsFyVDpM6QY8g4DN5UX6vC4Z/F+Dra6CM/cMxwRvOd2RIbMETvPGw
iDVso+0N+JQ=
=yxVw
-----END PGP SIGNATURE-----