Commit 8c25d2bf authored by Jim Fulton's avatar Jim Fulton

Use less prittle way to get cache-verification status

And also, we no longer do old-style cache verification.
parent 8e1d0ce4
...@@ -69,26 +69,17 @@ We'll open another client, and commit some transactions: ...@@ -69,26 +69,17 @@ We'll open another client, and commit some transactions:
... transaction.commit() ... transaction.commit()
>>> db.close() >>> db.close()
If we reopen the first client, we'll do quick verification. We'll If we reopen the first client, we'll do quick verification.
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)
>>> db = ZEO.DB(addr, client='test') # doctest: +ELLIPSIS >>> db = ZEO.DB(addr, client='test') # doctest: +ELLIPSIS
('localhost', ... >>> db._storage._server.client.verify_result
('localhost', ...) Recovering 2 invalidations 'quick verification'
>>> logging.getLogger().removeHandler(handler)
>>> [v.x for v in db.open().root().values()] >>> [v.x for v in db.open().root().values()]
[1, 1, 0, 0, 0, 0, 0, 0, 0] [1, 1, 0, 0, 0, 0, 0, 0, 0]
Now, if we disconnect and commit more than 5 transactions, we'll see 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.close()
>>> db = ZEO.DB(addr) >>> db = ZEO.DB(addr)
...@@ -99,14 +90,9 @@ that verification is necessary: ...@@ -99,14 +90,9 @@ that verification is necessary:
... transaction.commit() ... transaction.commit()
>>> db.close() >>> db.close()
>>> logging.getLogger().addHandler(handler) >>> db = ZEO.DB(addr, client='test')
>>> db = ZEO.DB(addr, client='test') # doctest: +ELLIPSIS >>> db._storage._server.client.verify_result
('localhost', ... 'cache too old, clearing'
('localhost', ...) Verifying cache
('localhost', ...) endVerify finishing
('localhost', ...) endVerify finished
>>> logging.getLogger().removeHandler(handler)
>>> [v.x for v in db.open().root().values()] >>> [v.x for v in db.open().root().values()]
[2, 2, 2, 2, 2, 2, 2, 2, 2] [2, 2, 2, 2, 2, 2, 2, 2, 2]
...@@ -128,16 +114,11 @@ do quick verification: ...@@ -128,16 +114,11 @@ do quick verification:
>>> db.close() >>> db.close()
>>> logging.getLogger().addHandler(handler)
>>> db = ZEO.DB(addr, client='test') # doctest: +ELLIPSIS >>> db = ZEO.DB(addr, client='test') # doctest: +ELLIPSIS
('localhost', ... >>> db._storage._server.client.verify_result
('localhost', ...) Recovering 9 invalidations 'quick verification'
>>> logging.getLogger().removeHandler(handler)
>>> [v.x for v in db.open().root().values()] >>> [v.x for v in db.open().root().values()]
[3, 3, 3, 3, 3, 3, 3, 3, 3] [3, 3, 3, 3, 3, 3, 3, 3, 3]
>>> db.close() >>> db.close()
>>> logging.getLogger().setLevel(old_logging_level)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment