simplify code and use members directly
This commit is contained in:
parent
b0144c557c
commit
943915e05a
|
@ -542,6 +542,7 @@ public class Translog extends AbstractIndexShardComponent implements IndexShardC
|
|||
public boolean ensureSynced(Location location) throws IOException {
|
||||
try (ReleasableLock lock = readLock.acquire()) {
|
||||
if (location.generation == current.generation) { // if we have a new one it's already synced
|
||||
ensureOpen();
|
||||
return current.syncUpTo(location.translogLocation + location.size);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -173,10 +173,8 @@ public class TranslogWriter extends TranslogReader {
|
|||
if (syncNeeded()) {
|
||||
try (ReleasableLock lock = writeLock.acquire()) {
|
||||
ensureOpen();
|
||||
final long offset = writtenOffset;
|
||||
final int opsCount = operationCounter;
|
||||
checkpoint(offset, opsCount, channelReference);
|
||||
lastSyncedOffset = offset;
|
||||
checkpoint(writtenOffset, operationCounter, channelReference);
|
||||
lastSyncedOffset = writtenOffset;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue