-
Notifications
You must be signed in to change notification settings - Fork 25.3k
Bring over merge metrics from stateless #128617
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
base: main
Are you sure you want to change the base?
Bring over merge metrics from stateless #128617
Conversation
61f0a99
to
79917cd
Compare
Pinging @elastic/es-distributed-indexing (Team:Distributed Indexing) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
Left 2 small comments.
try { | ||
beforeMerge(onGoingMerge); | ||
try { | ||
if (mergeStartTimeNS.compareAndSet(0L, System.nanoTime()) == false) { | ||
throw new IllegalStateException("The merge task is already started or aborted"); | ||
} | ||
mergeTracking.mergeStarted(onGoingMerge); | ||
mergeMetrics.moveQueuedMergeBytesToRunning(onGoingMerge, mergeMemoryEstimateBytes); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should also be invoked on the "abort" merge code path.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. Updated
@@ -79,7 +79,8 @@ public void testMergesExecuteInSizeOrder() throws IOException { | |||
new ShardId("index", "_na_", 1), | |||
IndexSettingsModule.newIndexSettings("index", Settings.EMPTY), | |||
threadPoolMergeExecutorService, | |||
merge -> 0 | |||
merge -> 0, | |||
MergeMetrics.NOOP |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please make these tests (in this class) take a mock(MergeMetrics.class)
and assert the invocations on it (e.g. when merge tasks are run/aborted), in order to have some test coverage for the metrics code too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated some tests to verify the metrics reporting in 629d70a
Relates to an effort to combine the merge schedulers from stateless and stateful. The stateless merge scheduler has MergeMetrics that we want in both stateless and stateful. This PR copies over the merge metrics from the stateless merge scheduler into the combined merge scheduler.
Relates ES-9687