Skip to content

Commit

Permalink
Fix log expectation inconsistency in flush test (#89571)
Browse files Browse the repository at this point in the history
Fixes #89518
  • Loading branch information
kingherc authored Aug 25, 2022
1 parent bdbfcb3 commit 8cac490
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3924,10 +3924,7 @@ protected void commitIndexWriter(final IndexWriter writer, final Translog transl
Loggers.addAppender(LogManager.getLogger(Engine.class), mockLogAppender);

// Issue the first flushOnIdle request. The flush happens in the background using the flush threadpool.
shard.flushOnIdle(0);
assertFalse(shard.isActive());

// Wait for log message that flush acquired lock immediately
// Then wait for log message that flush acquired lock immediately
mockLogAppender.addExpectation(
new MockLogAppender.SeenEventExpectation(
"should see first flush getting lock immediately",
Expand All @@ -3936,6 +3933,8 @@ protected void commitIndexWriter(final IndexWriter writer, final Translog transl
"acquired flush lock immediately"
)
);
shard.flushOnIdle(0);
assertFalse(shard.isActive());
assertBusy(mockLogAppender::assertAllExpectationsMatched);

// While the first flush is happening, index one more doc (to turn the shard's active flag to true),
Expand Down

0 comments on commit 8cac490

Please sign in to comment.