Fix over-replication caused by balancing when inventory is not updated yet#13114
Merged
abhishekagarwal87 merged 18 commits intoapache:masterfrom Sep 29, 2022
Merged
Fix over-replication caused by balancing when inventory is not updated yet#13114abhishekagarwal87 merged 18 commits intoapache:masterfrom
abhishekagarwal87 merged 18 commits intoapache:masterfrom
Conversation
kfaraz
commented
Sep 21, 2022
| * Fix Apache #12881 to fix this test. | ||
| */ | ||
| @Test | ||
| public void testBalancingWithStaleInventoryCausesOverReplication() |
Contributor
Author
There was a problem hiding this comment.
Moved this test to SegmentLoadingTest.testBalancingWithStaleViewDoesNotOverReplicate()
imply-cheddar
approved these changes
Sep 29, 2022
Contributor
imply-cheddar
left a comment
There was a problem hiding this comment.
One small comment, otherwise LGTM
Comment on lines
+295
to
+306
| ConcurrentMap<SegmentId, BalancerSegmentHolder> movingSegments = | ||
| currentlyMovingSegments.get(toServer.getTier()); | ||
| movingSegments.put(segmentId, segment); | ||
| final LoadPeonCallback callback = moveSuccess -> movingSegments.remove(segmentId); | ||
| try { | ||
| ConcurrentMap<SegmentId, BalancerSegmentHolder> movingSegments = | ||
| currentlyMovingSegments.get(toServer.getTier()); | ||
| movingSegments.put(segmentId, segment); | ||
| callback = () -> movingSegments.remove(segmentId); | ||
| coordinator.moveSegment( | ||
| params, | ||
| fromServer, | ||
| toServer, | ||
| segmentToMove, | ||
| callback | ||
| ); | ||
| coordinator | ||
| .moveSegment(params, fromServer, toServer, segmentToMove, callback); | ||
| return true; | ||
| } | ||
| catch (Exception e) { | ||
| log.makeAlert(e, StringUtils.format("[%s] : Moving exception", segmentId)).emit(); | ||
| if (callback != null) { | ||
| callback.execute(); | ||
| } | ||
| log.makeAlert(e, "[%s] : Moving exception", segmentId).emit(); | ||
| callback.execute(false); |
Contributor
There was a problem hiding this comment.
Are these changes fixing something or just style? It looks like just style trying to remove the null check from the callback by moving the work of building it outside of the try is that correct?
Contributor
Author
There was a problem hiding this comment.
Yes, just a style change for readability.
Contributor
Author
|
Thanks a lot for the review, @imply-cheddar ! |
abhishekagarwal87
approved these changes
Sep 29, 2022
This was referenced Dec 18, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes item (1) in #12881
Description
The current implementation of segment balancing often leads to over-replication.
This can happen in the following (fairly common) scenario:
This is a frequent occurrence but under normal circumstances, it is not noticeable
because load rules quickly drop the over-replicated segment from A. But if load rules get
stuck for some reason (e.g. trying to reach target replication levels on a different tier),
the number of over-replicated segments keeps increasing, thereby overloading historicals.
Changes
The HTTP response status is enough to determine load success or failure.
SegmentLoadingNegativeTestMain classes to review:
LoadPeonCallbackDruidCoordinatorCuratorLoadQueuePeonHttpLoadQueuePeonBalanceSegmentsThis PR has: