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 {
|
public boolean ensureSynced(Location location) throws IOException {
|
||||||
try (ReleasableLock lock = readLock.acquire()) {
|
try (ReleasableLock lock = readLock.acquire()) {
|
||||||
if (location.generation == current.generation) { // if we have a new one it's already synced
|
if (location.generation == current.generation) { // if we have a new one it's already synced
|
||||||
|
ensureOpen();
|
||||||
return current.syncUpTo(location.translogLocation + location.size);
|
return current.syncUpTo(location.translogLocation + location.size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -173,10 +173,8 @@ public class TranslogWriter extends TranslogReader {
|
||||||
if (syncNeeded()) {
|
if (syncNeeded()) {
|
||||||
try (ReleasableLock lock = writeLock.acquire()) {
|
try (ReleasableLock lock = writeLock.acquire()) {
|
||||||
ensureOpen();
|
ensureOpen();
|
||||||
final long offset = writtenOffset;
|
checkpoint(writtenOffset, operationCounter, channelReference);
|
||||||
final int opsCount = operationCounter;
|
lastSyncedOffset = writtenOffset;
|
||||||
checkpoint(offset, opsCount, channelReference);
|
|
||||||
lastSyncedOffset = offset;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue