Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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,)"
TheClientCache
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?
There was a problem hiding this comment.
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.
ZEO/src/ZEO/asyncio/client.py
Lines 488 to 493 in bd7cd06
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?