don't snapshot a translog that has no content
This commit is contained in:
parent
80c71350cd
commit
df23d8f7ec
|
@ -236,10 +236,12 @@ public abstract class BlobStoreIndexShardGateway extends AbstractIndexShardCompo
|
||||||
// Note, we assume the snapshot is always started from "base 0". We need to seek forward if we want to lastTranslogPosition if we want the delta
|
// Note, we assume the snapshot is always started from "base 0". We need to seek forward if we want to lastTranslogPosition if we want the delta
|
||||||
List<CommitPoint.FileInfo> translogCommitPointFiles = Lists.newArrayList();
|
List<CommitPoint.FileInfo> translogCommitPointFiles = Lists.newArrayList();
|
||||||
int expectedNumberOfOperations = 0;
|
int expectedNumberOfOperations = 0;
|
||||||
boolean snapshotRequired = snapshot.newTranslogCreated();
|
boolean snapshotRequired = false;
|
||||||
if (snapshot.newTranslogCreated()) {
|
if (snapshot.newTranslogCreated()) {
|
||||||
|
if (translogSnapshot.lengthInBytes() > 0) {
|
||||||
snapshotRequired = true;
|
snapshotRequired = true;
|
||||||
expectedNumberOfOperations = translogSnapshot.totalOperations();
|
expectedNumberOfOperations = translogSnapshot.totalOperations();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// if we have a commit point, check that we have all the files listed in it
|
// if we have a commit point, check that we have all the files listed in it
|
||||||
if (!commitPoints.commits().isEmpty()) {
|
if (!commitPoints.commits().isEmpty()) {
|
||||||
|
@ -256,11 +258,21 @@ public abstract class BlobStoreIndexShardGateway extends AbstractIndexShardCompo
|
||||||
translogCommitPointFiles.addAll(commitPoint.translogFiles());
|
translogCommitPointFiles.addAll(commitPoint.translogFiles());
|
||||||
if (snapshot.sameTranslogNewOperations()) {
|
if (snapshot.sameTranslogNewOperations()) {
|
||||||
translogSnapshot.seekForward(snapshot.lastTranslogPosition());
|
translogSnapshot.seekForward(snapshot.lastTranslogPosition());
|
||||||
|
if (translogSnapshot.lengthInBytes() > 0) {
|
||||||
snapshotRequired = true;
|
snapshotRequired = true;
|
||||||
expectedNumberOfOperations = translogSnapshot.totalOperations() - snapshot.lastTotalTranslogOperations();
|
expectedNumberOfOperations = translogSnapshot.totalOperations() - snapshot.lastTotalTranslogOperations();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// a full translog snapshot is required
|
// a full translog snapshot is required
|
||||||
|
if (translogSnapshot.lengthInBytes() > 0) {
|
||||||
|
expectedNumberOfOperations = translogSnapshot.totalOperations();
|
||||||
|
snapshotRequired = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// no commit point, snapshot all the translog
|
||||||
|
if (translogSnapshot.lengthInBytes() > 0) {
|
||||||
expectedNumberOfOperations = translogSnapshot.totalOperations();
|
expectedNumberOfOperations = translogSnapshot.totalOperations();
|
||||||
snapshotRequired = true;
|
snapshotRequired = true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue