simplify code and use members directly

This commit is contained in:
Simon Willnauer 2015-12-14 18:06:49 +01:00
parent b0144c557c
commit 943915e05a
2 changed files with 3 additions and 4 deletions

View File

@ -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);
}
}

View File

@ -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;
}
}
}