lucene4: replace IndexCommit.getVersion() with IndexCommit.getGeneration()
This commit is contained in:
parent
787b7a3900
commit
daf347e67e
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -265,13 +265,13 @@ public class IndexShardGatewayService extends AbstractIndexShardComponent implem
|
|||
SnapshotStatus snapshotStatus = indexShard.snapshot(new Engine.SnapshotHandler<SnapshotStatus>() {
|
||||
@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();
|
||||
|
|
Loading…
Reference in New Issue