David Smiley created SOLR-18671:
-----------------------------------
Summary: Package version delete is not visible to the handling
node immediately (flaky ClusterPackageTest.testAddAndDeletePackageVersion)
Key: SOLR-18671
URL: https://issues.apache.org/jira/browse/SOLR-18671
Project: Solr
Issue Type: Bug
Reporter: David Smiley
🤖 ClusterPackageTest.testAddAndDeletePackageVersion fails intermittently with
"Expected no versions after delete" (ClusterPackageTest.java:112). Seen once in
a full local run on a loaded machine (seed 4F18DFFB05DE6CE5); it did not
reproduce with that seed or in 100 iterations on an idle machine.
*Cause:* the node that handles a package-version delete does not see its own
delete immediately.
* PackageStore.deleteVersion only does a ZooKeeper atomicUpdate. It does not
update the in-memory {{pkgs}}, call {{refreshPackageConf()}}, or return the new
znode version.
* ClusterPackage.deletePackageVersion does not call {{notifyAllNodesToSync}},
so other nodes learn of the delete only via their ZK watchers.
* The local state changes only when the ZK watcher fires on a separate thread.
In the failing run the watcher applied the delete about 12-15 ms after the
DELETE returned, which was during the test's follow-up list request, so the
list returned the stale version.
* The add path does not have this problem: addVersion sets {{pkgs}}, calls
{{refreshPackageConf()}}, returns the version, and
ClusterPackage.addPackageVersion notifies all nodes.
This is old behavior (the previous PackageAPI delete command also skipped the
local update); the test, added with SOLR-18212 (#4178), is the first to check
the result immediately after a delete. It also affects real API clients, who
can list packages right after a delete and get stale results.
*Proposed fix:* make delete behave like add. deleteVersion captures the final
state inside the atomicUpdate lambda, then sets {{pkgs}}, calls
{{refreshPackageConf()}}, and returns the new znode version;
ClusterPackage.deletePackageVersion calls {{notifyAllNodesToSync}} with it.
Verify with ClusterPackageTest (-Ptests.iters=50) and the rest of
org.apache.solr.pkg.*.
🤖 Generated with [Claude Code|https://claude.com/claude-code]
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]