Skip to content
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

Fix edge case for active flag for flush on idle #97332

Merged

Conversation

kingherc
Copy link
Contributor

@kingherc kingherc commented Jul 3, 2023

Basically the active flag needs to be set to true after the op has been processed by the engine. Else there is an edge case, which may leave unprocessed ops and active false, without a next flush on idle scheduled. Introducing a test for this edge case.

Fixes #97154

Basically the active flag needs to be set to true after the op
has been processed by the engine. Else there is an edge case,
which may leave unprocessed ops and active false, without a next
flush on idle scheduled. Introducing a test for this edge case.

Fixes elastic#97154
@kingherc kingherc added >enhancement :Distributed/Engine Anything around managing Lucene and the Translog in an open shard. Team:Distributed Meta label for distributed team v8.10.0 labels Jul 3, 2023
@kingherc kingherc self-assigned this Jul 3, 2023
@elasticsearchmachine
Copy link
Collaborator

Hi @kingherc, I've created a changelog YAML for you.

@kingherc kingherc marked this pull request as ready for review July 3, 2023 16:46
@kingherc kingherc requested a review from tlrx July 3, 2023 16:47
@elasticsearchmachine
Copy link
Collaborator

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

t.start();
assertBusy(() -> assertThat(rwl.getQueueLength(), equalTo(1)));
assertFalse(shard.isActive());
} // Allow op to complete
Copy link
Member

Choose a reason for hiding this comment

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

Should we also trigger a flush on idle here? If I understand correctly we want to test a race between an ongoing operation and the flush on idle?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well, the race was happening if the flush on idle completed before the operation was fully processed. Now that we set the active flag after the operation has been processed, we do not have the race anymore.

Putting a flush on idle here will basically be a no-op because the active flag is already false and it will be skipped (the flush on idle actually flushes if the active flag is true).

Copy link
Member

Choose a reason for hiding this comment

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

Right, a flush on idle will now be a noop so my suggestion won't make much sense.

Thanks for confirming my understanding

@kingherc kingherc requested a review from tlrx July 4, 2023 12:45
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 1f49000 into elastic:main Jul 4, 2023
12 checks passed
@kingherc kingherc deleted the test-failure/97154-flush-on-inactive branch July 4, 2023 12:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Distributed/Engine Anything around managing Lucene and the Translog in an open shard. >enhancement Team:Distributed Meta label for distributed team v8.10.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[CI] FlushIT testFlushOnInactive failing
3 participants