Skip to content

Commit d6d022d

Browse files
committed
Fix TranslogTests#testStats (#66227)
If creating the latest translog file and retrieving a translog stats happen within the same millisecond, then the earliestLastModifiedAge will be zero. Closes #66092
1 parent 758a2ab commit d6d022d

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

server/src/test/java/org/elasticsearch/index/translog/TranslogTests.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,7 @@ public void testStats() throws IOException {
507507

508508
markCurrentGenAsCommitted(translog);
509509
{
510+
lastModifiedAge = System.currentTimeMillis() - translog.getCurrent().getLastModifiedTime();
510511
final TranslogStats stats = stats();
511512
assertThat(stats.estimatedNumberOfOperations(), equalTo(4));
512513
assertThat(stats.getTranslogSizeInBytes(), equalTo(expectedSizeInBytes));

0 commit comments

Comments
 (0)