Skip to content

SOLR-18632: Recreated configset with the same name is still served from the stale config cache - #5312

Open
julianchandras wants to merge 1 commit into
apache:mainfrom
julianchandras:SOLR-18632-recreated-configset-cache
Open

julianchandras wants to merge 1 commit into
apache:mainfrom
julianchandras:SOLR-18632-recreated-configset-cache

Conversation

@julianchandras

Copy link
Copy Markdown
Contributor

https://issues.apache.org/jira/browse/SOLR-18632

Description

SOLR-16143 fixed collections created from a configset that was deleted and re-uploaded under the same name getting the old config, by including the znode's ctime in SolrConfig.ResourceProvider.hash. Since SOLR-16336, solrconfig.xml and the schema are both loaded through IndexSchemaFactory.getFromCache, which only compares znode versions and not the computed hash. Since a recreated znode starts again at version 0, the versions comparison matches and the old cached solrconfig.xml and schema are returned.

Solution

IndexSchemaFactory.VersionedConfig now also stores the znode's ctime, and getFromCache only reuses a cached entry if both version and ctime match. To support this, ZkSolrResourceLoader.getZkResourceInfo returns the znode's Stat instead of only its version, and SolrConfig.readXml passes the ctime along.

Written with Claude Code

Tests

Added testRecreatedConfigSetIsNotServedFromCache to MultipleManagedSchemasTest. It creates a collection from _default, deletes the collection and config set, re-uploads _default under the same name with an extra request handler and field, and checks that the re-created collection has both. It fails on main, where the old solrconfig.xml and schema are used, and passes with this change. The existing test in that class only checks that the second create succeeds, which it does even with the stale config.

Also ran TestConfigSetsAPI, TestConfigSetImmutable, TestManagedSchemaAPI, TestCloudSchemaless, TestConfigOverlay and TestSolrConfigHandler.

Also written with Claude Code

Checklist

Please review the following and check all that apply:

  • I have reviewed the guidelines for How to Contribute and my code conforms to the standards described there to the best of my ability.

@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown

Automated PR triage (LLM-generated; may be wrong). Checked once, when the PR was opened or marked ready; not updated on later pushes.

No clear mismatches in the answered judgements.

Warranted? In PR? Confidence Why
✅ Jira issue in title — yes — Already present; not judged.
✅ Changelog fixed fixed high The PR fixes a bug where a recreated configset with the same name was served from the stale config cache, resulting in incorrect solrconfig.​xml and schema being used for new collections.​
✅ Reference Guide update no no high This is an internal bug fix regarding cache invalidation logic in ZkSolrResourceLoader and IndexSchemaFactory; it does not introduce new user-facing parameters, APIs, or configuration options.​
✅ Upgrade notes no no high The change is a bug fix that corrects behavior to match expectations; it does not remove or rename any public APIs, parameters, or configuration elements that would require user action during upgrade.​
✅ Tests yes yes high The PR modifies non-trivial production logic in IndexSchemaFactory and ZkSolrResourceLoader to fix cache invalidation, which warrants new tests to verify the fix, as described in the PR description.​

⚠️ mismatch, ❔ uncertain or unanswered, ✅ agrees. Matching changelog, docs and test files were hidden from the model; the PR description may still mention them. File presence does not establish adequacy. Assessed commit 0848e85fad1290ed604f881abb265b060be3075f.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant