ClientStorage has buggy implementation of lastTransaction()
Affects | Status | Importance | Assigned to | Milestone | ||
---|---|---|---|---|---|---|
ZODB | Status tracked in 3.9 | |||||
3.8 |
Won't Fix
|
High
|
Christian Theune | |||
3.9 |
Fix Released
|
Medium
|
Christian Theune |
Bug Description
The ClientStorage always asks the ZEO cache for the last committed transaction. This at least fails when the cache hasn't seen any entries yet, like right after opening.
The storage API doesn't include a hint that any operation is necessary before calling `lastTransaction` so this should be changed. I can see multiple options:
- make lastTransaction always call `lastTransaction` on the server
- make the cache initialise it's known transaction in the __init__ of ClientStorage
A further thought: is the cache's knowledge about the last transaction *always* the right thing regarding the call to `lastTransaction` or might this be offset due to unprocessed invalidations? Would this violate the storage API?
On Jan 10, 2008, at 3:30 AM, Christian Theune wrote:
> Public bug reported:
I agree that this is a bug.
>
>
> The ClientStorage always asks the ZEO cache for the last committed
> transaction. This at least fails when the cache hasn't seen any
> entries
> yet, like right after opening.
>
> The storage API doesn't include a hint that any operation is necessary
> before calling `lastTransaction` so this should be changed. I can see
> multiple options:
>
> - make lastTransaction always call `lastTransaction` on the server
> - make the cache initialise it's known transaction in the __init__
> of ClientStorage
There are going to be times when you can't know the lastTransaction
because you haven't connected to the server yet. Getting the
lastTransaction before it is set should probably raise a disconnected
error.
The cache lastTid should be set during connection and updated by
invalidation.
There's no point in polling the server at other times, since the data
is being sent to us
> A further thought: is the cache's knowledge about the last transaction
> *always* the right thing regarding the call to `lastTransaction` or
> might this be offset due to unprocessed invalidations?
There is always the possibility that the information is out of date.
Networks are not instantaneous. Polling the storage doesn't make the
information more current. I don't think polling will make the
information more timely.
> Would this
> violate the storage API?
No.
Jim
--
Jim Fulton
Zope Corporation