Skip to content

Commit

Permalink
Update comments in IndexShardTests#testScheduledRefresh
Browse files Browse the repository at this point in the history
* First scheduledRefresh returns false because search is idle
* Remove the comment about the inability to control the result of scheduleRefresh

Follow-up for elastic#110312
  • Loading branch information
arteam committed Jul 16, 2024
1 parent 68d9bc9 commit ff0c8c2
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3913,8 +3913,8 @@ public void testScheduledRefresh() throws Exception {
});
latch.await();

// Index a document while shard is search active and ensure scheduleRefresh(...) makes documen visible:
logger.info("--> index doc while shard search active");
// Index a document while shard is search is idle and ensure scheduleRefresh(...) returns false:
logger.info("--> index doc while shard search is idle");
indexDoc(primary, "_doc", "2", "{\"foo\" : \"bar\"}");
logger.info("--> scheduledRefresh(future4)");
PlainActionFuture<Boolean> future4 = new PlainActionFuture<>();
Expand All @@ -3931,8 +3931,6 @@ public void testScheduledRefresh() throws Exception {
long externalRefreshesBefore = primary.refreshStats().getExternalTotal();
logger.info("--> scheduledRefresh(future5)");
primary.scheduledRefresh(ActionListener.noop());
// We can't check whether scheduledRefresh returns true because it races with a potential
// 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

0 comments on commit ff0c8c2

Please sign in to comment.