shouldRollGeneration should execute under read lock (#41696)
Translog#shouldRollGeneration should execute under the read lock since it accesses the current writer.
This commit is contained in:
parent
2a8a64d3f1
commit
809ed3b721
|
@ -561,9 +561,10 @@ public class Translog extends AbstractIndexShardComponent implements IndexShardC
|
|||
* @return {@code true} if the current generation should be rolled to a new generation
|
||||
*/
|
||||
public boolean shouldRollGeneration() {
|
||||
final long size = this.current.sizeInBytes();
|
||||
final long threshold = this.indexSettings.getGenerationThresholdSize().getBytes();
|
||||
return size > threshold;
|
||||
try (ReleasableLock ignored = readLock.acquire()) {
|
||||
return this.current.sizeInBytes() > threshold;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue