Skip to content

Commit

Permalink
Fix TranslogTests#testStats (#66227)
Browse files Browse the repository at this point in the history
If creating the latest translog file and retrieving a translog stats
happen within the same millisecond, then the earliestLastModifiedAge
will be zero.

Closes #66092
  • Loading branch information
dnhatn committed Dec 13, 2020
1 parent 758a2ab commit d6d022d
Showing 1 changed file with 1 addition and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,7 @@ public void testStats() throws IOException {

markCurrentGenAsCommitted(translog);
{
lastModifiedAge = System.currentTimeMillis() - translog.getCurrent().getLastModifiedTime();
final TranslogStats stats = stats();
assertThat(stats.estimatedNumberOfOperations(), equalTo(4));
assertThat(stats.getTranslogSizeInBytes(), equalTo(expectedSizeInBytes));
Expand Down

0 comments on commit d6d022d

Please sign in to comment.