-
Notifications
You must be signed in to change notification settings - Fork 24.8k
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
[test] Fix IndexShardTests#testScheduledRefresh #110312
Changes from all commits
b68e38f
9ed2634
45e9ddb
d3781ab
a37a174
c57ce1a
5afadce
26be0a1
1921630
0720dee
759c80a
8793296
8829cba
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3849,7 +3849,6 @@ public void testIsSearchIdle() throws Exception { | |
closeShards(primary); | ||
} | ||
|
||
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/101008") | ||
@TestIssueLogging( | ||
issueUrl = "https://github.com/elastic/elasticsearch/issues/101008", | ||
value = "org.elasticsearch.index.shard.IndexShard:TRACE" | ||
|
@@ -3925,11 +3924,16 @@ public void testScheduledRefresh() throws Exception { | |
logger.info("--> ensure search idle"); | ||
assertTrue(primary.isSearchIdle()); | ||
assertTrue(primary.searchIdleTime() >= TimeValue.ZERO.millis()); | ||
long periodicFlushesBefore = primary.flushStats().getPeriodic(); | ||
primary.flushOnIdle(0); | ||
assertBusy(() -> assertThat(primary.flushStats().getPeriodic(), greaterThan(periodicFlushesBefore))); | ||
|
||
long externalRefreshesBefore = primary.refreshStats().getExternalTotal(); | ||
logger.info("--> scheduledRefresh(future5)"); | ||
kingherc marked this conversation as resolved.
Show resolved
Hide resolved
|
||
PlainActionFuture<Boolean> future5 = new PlainActionFuture<>(); | ||
primary.scheduledRefresh(future5); | ||
assertTrue(future5.actionGet()); // make sure we refresh once the shard is inactive | ||
primary.scheduledRefresh(ActionListener.noop()); | ||
// We can't check whether scheduledRefresh returns true because it races with a potential | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since @fcofdez approved, I am also fine with the current state and we see if in the future there's any issues with any other concurrent refreshes going on. I believe this comment may not be up to date now. Since above we assertBusy that the flush has happened, probably the scheduled refresh here will also be true. I'd just remove the comment to avoid confusion. |
||
// refresh triggered by the flush. We just check that one the refreshes ultimately wins. | ||
kingherc marked this conversation as resolved.
Show resolved
Hide resolved
|
||
assertBusy(() -> assertThat(primary.refreshStats().getExternalTotal(), equalTo(externalRefreshesBefore + 1))); | ||
try (Engine.Searcher searcher = primary.acquireSearcher("test")) { | ||
assertEquals(3, searcher.getIndexReader().numDocs()); | ||
} | ||
|
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.
Also can you change the comment above
while shard is search active and ensure scheduleRefresh(...) makes documen visible:
?
because the shard was search idle and that's why scheduled refresh is false there.