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

SOLR-16701: Race condition on PRS enabled collection deletion #1460

Merged
merged 18 commits into from
Sep 23, 2023
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Separate the exception handling of NoNodeException and PrsZkNodeNotFo…
…undException as their conditions/handling are quite different.
patsonluk committed Sep 22, 2023
commit 853709b170f43f54e187484a96fc1bf5a01f779d
Original file line number Diff line number Diff line change
@@ -1616,10 +1616,7 @@ private DocCollection fetchCollectionState(String coll, Watcher watcher)

ClusterState.CollectionRef collectionRef = state.getCollectionStates().get(coll);
return collectionRef == null ? null : collectionRef.get();
} catch (KeeperException.NoNodeException
| PerReplicaStatesFetcher.PrsZkNodeNotFoundException e) {
assert CommonTestInjection.injectBreakpoint(
ZkStateReader.class.getName() + "/exercised", e);
} catch (KeeperException.NoNodeException e) {
if (watcher != null) {
// Leave an exists watch in place in case a state.json is created later.
Stat exists = zkClient.exists(collectionPath, watcher, true);
@@ -1630,6 +1627,16 @@ private DocCollection fetchCollectionState(String coll, Watcher watcher)
}
}
return null;
} catch (PerReplicaStatesFetcher.PrsZkNodeNotFoundException e) {
CommonTestInjection.injectBreakpoint(ZkStateReader.class.getName() + "/exercised", e);
//could be a race condition that state.json and PRS entries are deleted between the state.json fetch and PRS entry fetch
Stat exists = zkClient.exists(collectionPath, watcher, true);
if (exists == null) {
log.info("PRS entry for collection " + coll + " not found in ZK. It was probably deleted between state.json read and PRS entry read.");
return null;
} else {
throw e; //unexpected, PRS node not found but the collection state.json still exists
}
}
}
}