durusmail: durus-users: About the cache consistence
About the cache consistence
2005-12-15
2005-12-15
About the cache consistence
Jesus Cea
2005-12-15
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

In my experiments with Durus I found frequent conflicts that can be
easily avoided knowing a bit about the inner working of Durus.

Suppose an Apache server, with several processes using Durus. There are
frequent object modifications. Each process is idle frequently,
nevertheless.

I suppose most people simply do something like:

incomming request
while True:
  try :
    ... aplication logic ...
    connection.commit()
  except IOError :
    ... reestablish the connection ...
  except Conflict :
    pass # to repeat the procedure
  else :
    break # All was fine

The first iteration tru the "while" loop can easily gets a "Conflict"
error, since this particular process could be idle for minutes and its
cache is "outdated". But we don't know that until "commit", if all
objects referenced are already in the local "cache". Moreover, the
connection could have been severed.

I would suggest to add a single line "connection.abort()" just below the
"try", before any aplication logic. This line would check the connection
and validate the cache before any heavy aplication code.

Is this approach legitime?. Valuable?.

In documentation (I haven't study the code yet) it's said that
"commit()" and "abort()", both, sincronice the cache. I prefer "abort()"
to avoid inadverted errors.

Any advice?

- --
Jesus Cea Avion                         _/_/      _/_/_/        _/_/_/
jcea@argo.es http://www.argo.es/~jcea/ _/_/    _/_/  _/_/    _/_/  _/_/
                                      _/_/    _/_/          _/_/_/_/_/
PGP Key Available at KeyServ   _/_/  _/_/    _/_/          _/_/  _/_/
"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 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iQCVAwUBQ6HI5Zlgi5GaxT1NAQJT6wP/aQt6LWOPh/KJ9YoXvl/LYGUHXtIZ4wms
oB+nR9BZ9Y7DP9xDOWCB85BqX/PZl+BjMdwqJhuRLyx16zSrWhePgSgQYUF5eMXg
IaKNXxiP9gNp/bpfDHxGdfAr6A151QlkLctfdLSTjBlIgfut8C1vbVED/dKUZ1vC
0cwyTQaGcTY=
=+dr5
-----END PGP SIGNATURE-----
reply