diff --git a/src/main/java/org/elasticsearch/index/deletionpolicy/SnapshotDeletionPolicy.java b/src/main/java/org/elasticsearch/index/deletionpolicy/SnapshotDeletionPolicy.java index 44d6f51a137..7a392dc47ec 100644 --- a/src/main/java/org/elasticsearch/index/deletionpolicy/SnapshotDeletionPolicy.java +++ b/src/main/java/org/elasticsearch/index/deletionpolicy/SnapshotDeletionPolicy.java @@ -132,10 +132,10 @@ public class SnapshotDeletionPolicy extends AbstractIndexShardComponent implemen * Helper method to snapshot a give commit. */ private SnapshotIndexCommit snapshot(SnapshotIndexCommit commit) throws IOException { - SnapshotHolder snapshotHolder = snapshots.get(commit.getVersion()); + SnapshotHolder snapshotHolder = snapshots.get(commit.getGeneration()); if (snapshotHolder == null) { snapshotHolder = new SnapshotHolder(0); - snapshots.put(commit.getVersion(), snapshotHolder); + snapshots.put(commit.getGeneration(), snapshotHolder); } snapshotHolder.counter++; return new OneTimeReleaseSnapshotIndexCommit(this, commit); diff --git a/src/main/java/org/elasticsearch/index/deletionpolicy/SnapshotIndexCommit.java b/src/main/java/org/elasticsearch/index/deletionpolicy/SnapshotIndexCommit.java index 6d03547f250..c56821a0997 100644 --- a/src/main/java/org/elasticsearch/index/deletionpolicy/SnapshotIndexCommit.java +++ b/src/main/java/org/elasticsearch/index/deletionpolicy/SnapshotIndexCommit.java @@ -58,7 +58,7 @@ public class SnapshotIndexCommit extends IndexCommitDelegate implements Releasab * actually released. */ public boolean release() { - return deletionPolicy.release(getVersion()); + return deletionPolicy.release(getGeneration()); } /** @@ -67,7 +67,7 @@ public class SnapshotIndexCommit extends IndexCommitDelegate implements Releasab */ @Override public void delete() { - if (!deletionPolicy.isHeld(getVersion())) { + if (!deletionPolicy.isHeld(getGeneration())) { delegate.delete(); } } diff --git a/src/main/java/org/elasticsearch/index/gateway/IndexShardGateway.java b/src/main/java/org/elasticsearch/index/gateway/IndexShardGateway.java index ef6e312cca0..bda3ebec998 100644 --- a/src/main/java/org/elasticsearch/index/gateway/IndexShardGateway.java +++ b/src/main/java/org/elasticsearch/index/gateway/IndexShardGateway.java @@ -103,7 +103,7 @@ public interface IndexShardGateway extends IndexShardComponent, CloseableIndexCo * Indicates that the index has changed from the latest snapshot. */ public boolean indexChanged() { - return lastIndexVersion != indexCommit.getVersion(); + return lastIndexVersion != indexCommit.getGeneration(); } /** diff --git a/src/main/java/org/elasticsearch/index/gateway/IndexShardGatewayService.java b/src/main/java/org/elasticsearch/index/gateway/IndexShardGatewayService.java index 04282dbe37f..dce49cb221c 100644 --- a/src/main/java/org/elasticsearch/index/gateway/IndexShardGatewayService.java +++ b/src/main/java/org/elasticsearch/index/gateway/IndexShardGatewayService.java @@ -265,13 +265,13 @@ public class IndexShardGatewayService extends AbstractIndexShardComponent implem SnapshotStatus snapshotStatus = indexShard.snapshot(new Engine.SnapshotHandler() { @Override public SnapshotStatus snapshot(SnapshotIndexCommit snapshotIndexCommit, Translog.Snapshot translogSnapshot) throws EngineException { - if (lastIndexVersion != snapshotIndexCommit.getVersion() || lastTranslogId != translogSnapshot.translogId() || lastTranslogLength < translogSnapshot.length()) { + if (lastIndexVersion != snapshotIndexCommit.getGeneration() || lastTranslogId != translogSnapshot.translogId() || lastTranslogLength < translogSnapshot.length()) { logger.debug("snapshot ({}) to {} ...", reason, shardGateway); SnapshotStatus snapshotStatus = shardGateway.snapshot(new IndexShardGateway.Snapshot(snapshotIndexCommit, translogSnapshot, lastIndexVersion, lastTranslogId, lastTranslogLength, lastTotalTranslogOperations)); - lastIndexVersion = snapshotIndexCommit.getVersion(); + lastIndexVersion = snapshotIndexCommit.getGeneration(); lastTranslogId = translogSnapshot.translogId(); lastTranslogLength = translogSnapshot.length(); lastTotalTranslogOperations = translogSnapshot.estimatedTotalOperations();