Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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();
Copy link
Contributor

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.

primary.flushOnIdle(0);
assertBusy(() -> assertThat(primary.flushStats().getPeriodic(), greaterThan(periodicFlushesBefore)));

long externalRefreshesBefore = primary.refreshStats().getExternalTotal();
logger.info("--> scheduledRefresh(future5)");
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
Copy link
Contributor

Choose a reason for hiding this comment

The 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.
assertBusy(() -> assertThat(primary.refreshStats().getExternalTotal(), equalTo(externalRefreshesBefore + 1)));
try (Engine.Searcher searcher = primary.acquireSearcher("test")) {
assertEquals(3, searcher.getIndexReader().numDocs());
}
Expand Down