Repository navigation
SOLR-18569: Wait on init for ephemeral node-role cleanup - #5211
gerlowskija merged 4 commits into
Conversation
Solr has long had code in ZkController to check whether the ephemeral `/live_node` entry from a previous process is still around, and wait for ZK to deleted it before proceeding. But `/live_node` entries aren't the only ephemeral nodes that Solr expects to create on startup and that can linger after process exit. The `/node_roles/` tree also contains ephemeral nodes. This commit changes ZkController's init code so that it now waits for these nodes as well. In practice, this prevents Solr from potentially stalling on start up because of an unexpected or unhandled `NodeExists` exception.
|
🤖 AI text below 🤖 (reviewed by Nick Shanin) @gerlowskija, here is a concrete version of a test suggestion for this test. It builds on the idea of checking the leftover entries right after the check returns, and it comes with a run on this change. It is based on the current head of this PR, The problem. In The change. The change is in Diff of this change only: nick-boss-tech@f00c7bd Compare from the PR head to the new commit: nick-boss-tech/solr@6f72e0c...f00c7bd What I ran. Each run was on Linux (aarch64) in a local copy, with the same temporary change where noted.
Limits. All of this ran on one Linux machine, not on Windows or in CI. The one second delay before the deleter removes the leftovers still provides the timing margin, so the test depends on that margin, just as the original did. A tighter handshake would need a point of coordination inside the production wait, and I did not add one, since that would mean changing production code for the test. Would a test-only change like this be useful here, or would you rather keep the test as it is? |
…#6) Co-authored-by: Nick Shanin <nick.boss.us@gmail.com>
Thanks @nick-boss-tech . I wasn't too worried about that case originally. The main indicator of |
Solr has long had code in ZkController to check whether the ephemeral /live_node entry from a previous process is still around, and wait for ZK to deleted it before proceeding. But /live_node entries aren't the only ephemeral nodes that Solr expects to create on startup and that can linger after process exit. The /node_roles/ tree also contains ephemeral nodes. Currently, if any of these exist at startup-time, Solr will hit a NodeExists exception from ZK and fail to start up. This commit changes ZkController's init code so that it now waits for these nodes as well. In practice, this prevents Solr from potentially stalling on start up because of an unexpected or unhandled NodeExists exception. Co-authored-by: Nick Shanin <nick.boss.us@gmail.com> (cherry picked from commit 0d6b2e3)
https://issues.apache.org/jira/browse/SOLR-18569
Description
Solr has long had code in ZkController to check whether the ephemeral
/live_nodeentry from a previous process is still around, and wait for ZK to deleted it before proceeding.But
/live_nodeentries aren't the only ephemeral nodes that Solr expects to create on startup and that can linger after process exit. The/node_roles/tree also contains ephemeral nodes. Currently, if any of these exist at startup-time, Solr will hit a NodeExists exception from ZK and fail to start up.Solution
This commit changes ZkController's init code so that it now waits for these nodes as well. In practice, this prevents Solr from potentially stalling on start up because of an unexpected or unhandled
NodeExistsexception.Tests
New test cases in ZkControllerTest to test how Solr handles these nodes existing when a new Solr node starts up. These tests aren't totally ideal as they involve a sleep or two: open to suggestions if anyone has ideas how to eliminate this.
Checklist
Please review the following and check all that apply:
mainbranch../gradlew check.