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

Stale cached results after clearing catalog index #19

Closed
davisagli opened this issue Dec 4, 2016 · 4 comments
Closed

Stale cached results after clearing catalog index #19

davisagli opened this issue Dec 4, 2016 · 4 comments
Assignees
Labels

Comments

@davisagli
Copy link
Member

An index's counter is used as part of its cache key in the request cache that was added in version 3.2. Clearing an index resets the counter, but it doesn't clear the request cache. As a result, queries after clearing the index may get stale results that were cached before the index was cleared.

This is causing a failure in at least one Plone test that does query when there is no content (counter = 0), then adds content and queries (counter = 1), clears and rebuilds the catalog (counter = 0), and does the query again (counter = 0 so gets the cached results, which are missing the content item that was added and still exists).

/cc @andbag

@davisagli davisagli added the bug label Dec 4, 2016
@davisagli davisagli changed the title Clearing catalog resets index counters but doesn't clear request cache Stale cached results after clearing catalog index Dec 4, 2016
@andbag
Copy link
Member

andbag commented Dec 5, 2016

Issue should have already been solved in PR #17 (s. commit 9bd0d7d).

@hannosch
cherry-pick 9bd0d7d into master branch?

@hannosch
Copy link
Contributor

hannosch commented Dec 6, 2016

Sorry for being inactive on ZCatalog. I spent my free time on Zope itself lately. I'll take a look once I'm back from a conference in a week. Unless someone else wants to volunteer before that :)

hannosch added a commit that referenced this issue Jan 31, 2017
Code change in previous cherry-picked commit.
@hannosch
Copy link
Contributor

I've cherry-picked the commit to master and the 3.x branch. I'll leave this open until I cut a 3.2.1 release. I'll do that once the current Zope sprint in Innsbruck is over, to not interfere with the sprinters work.

@hannosch
Copy link
Contributor

ZCatalog 3.2.1 is up on PyPi for a while now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants