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
This commit is contained in:
parent
84d4e5bcb1
commit
cc674e7d74
|
@ -493,12 +493,13 @@ public class TranslogTests extends ESTestCase {
|
|||
translog.getDeletionPolicy().setLocalCheckpointOfSafeCommit(randomLongBetween(3, Long.MAX_VALUE));
|
||||
translog.trimUnreferencedReaders();
|
||||
{
|
||||
long lastModifiedAge = System.currentTimeMillis() - translog.getCurrent().getLastModifiedTime();
|
||||
final TranslogStats stats = stats();
|
||||
assertThat(stats.estimatedNumberOfOperations(), equalTo(4));
|
||||
assertThat(stats.getTranslogSizeInBytes(), equalTo(355L));
|
||||
assertThat(stats.getUncommittedOperations(), equalTo(0));
|
||||
assertThat(stats.getUncommittedSizeInBytes(), equalTo(firstOperationPosition));
|
||||
assertThat(stats.getEarliestLastModifiedAge(), greaterThan(0L));
|
||||
assertThat(stats.getEarliestLastModifiedAge(), greaterThanOrEqualTo(lastModifiedAge));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue