Skip to content

Expose merge events and their memory usage estimate #126667

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

Merged
merged 17 commits into from
Apr 24, 2025

Conversation

pxsalehi
Copy link
Member

@pxsalehi pxsalehi commented Apr 11, 2025

Relates ES-10961

@pxsalehi pxsalehi added WIP :Distributed Indexing/Engine Anything around managing Lucene and the Translog in an open shard. labels Apr 11, 2025
@pxsalehi pxsalehi force-pushed the ps250410-exposeMergeEvents branch from 11667b7 to 6fffd73 Compare April 11, 2025 13:26
@pxsalehi pxsalehi force-pushed the ps250410-exposeMergeEvents branch from 6fffd73 to 643979c Compare April 11, 2025 13:27
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved this out of stateless.

@elasticsearchmachine elasticsearchmachine added the serverless-linked Added by automation, don't add manually label Apr 22, 2025
@pxsalehi pxsalehi marked this pull request as ready for review April 22, 2025 11:01
@pxsalehi pxsalehi removed the WIP label Apr 22, 2025
@elasticsearchmachine elasticsearchmachine added the Team:Distributed Indexing Meta label for Distributed Indexing team label Apr 22, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-distributed-indexing (Team:Distributed Indexing)

Copy link
Contributor

@henningandersen henningandersen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@@ -449,6 +462,14 @@ long estimatedMergeSize() {
return onGoingMerge.getMerge().getStoreMergeInfo().estimatedMergeBytes();
}

public long getEstimateMergeMemoryBytes() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I'd prefer to call this getMergeMemoryEstimateBytes(), similar to the provider (also rename various variales).

@pxsalehi
Copy link
Member Author

I've added 3724a21 as a simple way to make sure abort/complete listeners are not called before queued listeners for a given merge.

@pxsalehi pxsalehi requested a review from nicktindall April 23, 2025 09:14
Copy link
Contributor

@henningandersen henningandersen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to ensure ordering differently if possible?


private void enqueueMergeTask(MergeTask mergeTask) {
synchronized (mergeEventsMutex) {
if (queuedMergeTasks.add(mergeTask)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can assert that it always returns true instead, thus avoid the if-statement, invoke the listener before adding and thus avoid the synchronized?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. See ba7ebb5. This doesn't change anything in the stateless PR though.

Copy link
Contributor

@henningandersen henningandersen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@pxsalehi pxsalehi merged commit f599fe3 into elastic:main Apr 24, 2025
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Distributed Indexing/Engine Anything around managing Lucene and the Translog in an open shard. >non-issue serverless-linked Added by automation, don't add manually Team:Distributed Indexing Meta label for Distributed Indexing team v9.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants