Skip to content

Commit

Permalink
Use less prittle way to get cache-verification status
Browse files Browse the repository at this point in the history
And also, we no longer do old-style cache verification.
  • Loading branch information
Jim Fulton committed May 27, 2016
1 parent 8e1d0ce commit 8c25d2b
Showing 1 changed file with 9 additions and 28 deletions.
37 changes: 9 additions & 28 deletions src/ZEO/tests/invalidation-age.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,26 +69,17 @@ We'll open another client, and commit some transactions:
... transaction.commit()
>>> db.close()

If we reopen the first client, we'll do quick verification. We'll
turn on logging so we can see this:

>>> import logging, sys
>>> old_logging_level = logging.getLogger().getEffectiveLevel()
>>> logging.getLogger().setLevel(logging.INFO)
>>> handler = logging.StreamHandler(sys.stdout)
>>> logging.getLogger().addHandler(handler)
If we reopen the first client, we'll do quick verification.

>>> db = ZEO.DB(addr, client='test') # doctest: +ELLIPSIS
('localhost', ...
('localhost', ...) Recovering 2 invalidations

>>> logging.getLogger().removeHandler(handler)
>>> db._storage._server.client.verify_result
'quick verification'

>>> [v.x for v in db.open().root().values()]
[1, 1, 0, 0, 0, 0, 0, 0, 0]

Now, if we disconnect and commit more than 5 transactions, we'll see
that verification is necessary:
that we had to clear the cache:

>>> db.close()
>>> db = ZEO.DB(addr)
Expand All @@ -99,14 +90,9 @@ that verification is necessary:
... transaction.commit()
>>> db.close()

>>> logging.getLogger().addHandler(handler)
>>> db = ZEO.DB(addr, client='test') # doctest: +ELLIPSIS
('localhost', ...
('localhost', ...) Verifying cache
('localhost', ...) endVerify finishing
('localhost', ...) endVerify finished

>>> logging.getLogger().removeHandler(handler)
>>> db = ZEO.DB(addr, client='test')
>>> db._storage._server.client.verify_result
'cache too old, clearing'

>>> [v.x for v in db.open().root().values()]
[2, 2, 2, 2, 2, 2, 2, 2, 2]
Expand All @@ -128,16 +114,11 @@ do quick verification:
>>> db.close()


>>> logging.getLogger().addHandler(handler)
>>> db = ZEO.DB(addr, client='test') # doctest: +ELLIPSIS
('localhost', ...
('localhost', ...) Recovering 9 invalidations

>>> logging.getLogger().removeHandler(handler)
>>> db._storage._server.client.verify_result
'quick verification'

>>> [v.x for v in db.open().root().values()]
[3, 3, 3, 3, 3, 3, 3, 3, 3]

>>> db.close()

>>> logging.getLogger().setLevel(old_logging_level)

0 comments on commit 8c25d2b

Please sign in to comment.