Repository navigation
SOLR-17971: Fix REBALANCELEADERS wait when the Overseer is disabled - #5127
sarkaramrit1993 wants to merge 4 commits into
Conversation
With the Overseer disabled, sub-command results go to DistributedApiAsyncTracker, not the Overseer maps, so the wait loop always ran to maxWaitSeconds and never cleared the async ids.
|
Looks good!
Then maybe the logic should be centralized? (didn't check how elegant this is) |
…ERS and DELETESTATUS
|
Good call, done. Both REBALANCELEADERS and DELETESTATUS now go through |
|
|
||
| // Sub-command async ids must be found and cleared in both Overseer and distributed modes. | ||
| @Test | ||
| public void testRebalanceLeadersClearsAsyncIds() throws Exception { |
There was a problem hiding this comment.
This test does exactly the same assersions when running with the overseer enabled of disabled. Since it checks these internals, it may be worth to also have different assertions in the test.
| if (zkClient().exists(path)) { | ||
| List<String> leftover = | ||
| zkClient().getChildren(path, null).stream() | ||
| .filter(id -> id.startsWith("mn-rebalanceleaders_")) |
There was a problem hiding this comment.
I'm not a fan of having magic constants like that in a test. It does assumptions on how we store the distributed map in ZK, and the test might be obsolete in case of some changes, without anyone one noticing it.
|
Thanks @psalagnac, good catches. Reworked the test in the latest commit:
Distributed mode has no direct leak check, on purpose. There's no public way to list what the async tracker holds and the sub-command ids never reach the client, so a direct check means either ZK internals again or test-only production code. The removal goes through the same Verified it fails against the original code in distributed mode, and against versions that skip removing or releasing the ids in Overseer mode. |
|
Thanks for the cleanup. Any idea what it would take to test this? Since they're supposed to remain internal, it might not be worth making too much things public just to verify it. |
|
Took a look, it needed two small read-only accessors. Sub-command ids are Pushed in 52b2834:
Both Checked it fails when the wait ends without deleting the ids (lists the 6 leftover |
|
Thanks for the patch. I'll merge this in a couple of days. |
https://issues.apache.org/jira/browse/SOLR-17971
With the Overseer disabled, REBALANCELEADERS always waited the full
maxWaitSeconds(60s by default) and then logged a timeout. The leaders still moved.waitAsyncRequests()only looked for sub-command results in the Overseer completed/failure maps, but in distributed mode those results go toDistributedApiAsyncTracker. Because of that, the ids were also never cleared and piled up under/distributedapi/async/persistent.Changes:
waitAsyncRequests()now checks the store for the current mode, same branching asREQUESTSTATUSinClusterCommands. In distributed mode,deleteSingleAsyncId()both tells us the task is done and removes it.contains()beforeremove().Not changed: I went with the tracker directly instead of issuing a
REQUESTSTATUScall per id as the JIRA suggests. It's the same lookup without the extra request.Tests: new
testRebalanceLeadersClearsAsyncIdsinTestRebalanceLeadersasserts norebalanceleaders_ids are left in either store and the call returns before the timeout. Without the fix and the Overseer disabled, it fails with 29 leftover ids. Ran the full class with-Ptests.nightly=truein both modes, plusgradlew check -x test.