Translog: make sure stats's op count and size are in sync
During translog flush there is a very small window where translog stats reports can be inconsistent. Closes #10041
This commit is contained in:
parent
a8271595dc
commit
3fbd934e30
|
@ -439,7 +439,12 @@ public class FsTranslog extends AbstractIndexShardComponent implements Translog
|
|||
|
||||
@Override
|
||||
public TranslogStats stats() {
|
||||
return new TranslogStats(estimatedNumberOfOperations(), translogSizeInBytes());
|
||||
FsTranslogFile current = this.current;
|
||||
if (current == null) {
|
||||
return new TranslogStats(0, 0);
|
||||
}
|
||||
|
||||
return new TranslogStats(current.estimatedNumberOfOperations(), current.translogSizeInBytes());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue