Skip to content

Conversation

@kingherc
Copy link
Contributor

@kingherc kingherc commented Sep 4, 2025

Since it is an optimistic operation, we can let it be skipped if the shard is currently being reset. That way the
IndexingMemoryController will not get stuck if a lot of shards are gradually having their engines being reset.

Relates ES-12413

Since it is an optimistic operation, we can let it be skipped if
the shard is currently being reset. That way the
IndexingMemoryController will not get stuck if a lot of shards
are gradually having their engines being reset.

Relates ES-12413
@kingherc kingherc self-assigned this Sep 4, 2025
@kingherc kingherc added :Distributed Indexing/Engine Anything around managing Lucene and the Translog in an open shard. Team:Distributed Indexing Meta label for Distributed Indexing team >non-issue v9.2.0 labels Sep 4, 2025
@kingherc kingherc requested a review from Copilot September 4, 2025 15:53
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR modifies the flushOnIdle method to use tryWithEngineOrNull instead of getEngineOrNull, making it an optimistic operation that can be skipped when the shard's engine is being reset. This prevents the IndexingMemoryController from getting stuck when multiple shards are having their engines reset.

  • Changed flushOnIdle to use tryWithEngineOrNull for non-blocking engine access
  • Added trace logging when flush is skipped due to engine being unavailable
  • Added comprehensive test to verify the new behavior during concurrent engine reset operations

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
IndexShard.java Modified flushOnIdle to use tryWithEngineOrNull and added trace logging
IndexShardTests.java Added test case to verify flush behavior during engine reset operations

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@kingherc kingherc force-pushed the non-issue/flush-idle-tryengine branch from 3570258 to b5ea934 Compare September 4, 2025 20:46
@kingherc kingherc marked this pull request as ready for review September 5, 2025 04:53
@kingherc kingherc requested review from fcofdez and tlrx September 5, 2025 04:53
@elasticsearchmachine
Copy link
Collaborator

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

@kingherc kingherc force-pushed the non-issue/flush-idle-tryengine branch from b5ea934 to c0ad890 Compare September 5, 2025 09:31
@kingherc kingherc requested a review from yungene September 9, 2025 09:48
@yungene
Copy link
Contributor

yungene commented Sep 10, 2025

LGTM

Copy link
Contributor

@yungene yungene left a comment

Choose a reason for hiding this comment

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

LGTM

@kingherc
Copy link
Contributor Author

@tlrx gentle reminder for reviewing

Copy link
Member

@tlrx tlrx left a comment

Choose a reason for hiding this comment

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

LGTM

@kingherc kingherc merged commit 62fd0fb into elastic:main Sep 15, 2025
34 checks passed
mridula-s109 pushed a commit to mridula-s109/elasticsearch that referenced this pull request Sep 17, 2025
Since it is an optimistic operation, we can let it be skipped if
the shard is currently being reset. That way the
IndexingMemoryController will not get stuck if a lot of shards
are gradually having their engines being reset.

Relates ES-12413
gmjehovich pushed a commit to gmjehovich/elasticsearch that referenced this pull request Sep 18, 2025
Since it is an optimistic operation, we can let it be skipped if
the shard is currently being reset. That way the
IndexingMemoryController will not get stuck if a lot of shards
are gradually having their engines being reset.

Relates ES-12413
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 Team:Distributed Indexing Meta label for Distributed Indexing team v9.2.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants