Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add paragraph about how to fix ClientStorageError. #139

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions doc/zeo-client-cache.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,7 @@ ZEO Client Cache

For example, the cache file for client '8881' and storage 'spam' is named
"8881-spam.zec".

If you ever see an error message like "ClientStorageError: Client
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The actual underlying error is something like "AssertionError: Server behind client..."; "Client has seen newer transactions than server" is what is logged (which may or may not go somewhere useful).

Perhaps instead of (just?) putting this in the documentation, the actual error and/or log message should be modified to mention removing the cache? Something like "AssertionError: Client cache is out of sync with the server (server behind client: ...). Verify that this is expected and then remove the cache file at %s before restarting." % (self.cache,)" The ClientCache object would need to grow a useful __str__ and/or __repr__ to make this work (without poking into its internals).

Come to that, I'm not sure if those are always the right recovery steps..why would this have happened? Wouldn't it mean transactions were removed from the server? Perhaps the server was restored from an older backup? In that case, maybe the client cache is actually a way to recover data, and deleting it prematurely would be a bad thing?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jamadden Thank you very much for taking your time.

I experienced this error today when I pulled a production db into my local dev environment. The only hint on how to fix this problem (without looking in the source code), was in the Plone 3 documentation:
https://docs.plone.org/3/en/manage/troubleshooting/transactions.html#zeostorage-client-has-seen-newer-transactions-than-server

I thought it would be a good idea to document this in the ZEO docs, but obviously there is a better way.

You are absolutely right - it would be far better to improve the error message over putting this in the documentation.

At the moment - besides my day job - I got some open issues/pull requests already for Zope (+ecosystem) and thus no time to "quickly" implement your solution.

Also, from a quick glance tox is not setup to run coverage, and from looking at the code and the tests it seems the branch ("Cache newer than server") is untested.

elif cache_tid > server_tid:
self.verify_result = "Cache newer than server"
logger.critical(
'Client has seen newer transactions than server!')
raise AssertionError("Server behind client, %r < %r, %s",
server_tid, cache_tid, protocol)

At the end of the branch, there is an AssertionError - no resolution like invalidateCache or invalidateTransaction. Maybe that is on purpose, as you mentioned, it may be not always the best idea to delete the client cache, and maybe especially not automatically.

tl/dr
Obviously, this pull request should be closed.

As you proposed an imho very good solution, would you mind opening an issue or should I do it?

has seen newer transactions than server!", you can easily fix it by
deleting the zec file from above mentioned directory.