|
@@ -360,8 +360,6 @@ public class BlobStoreIndexShardSnapshot implements ToXContentFragment {
|
|
|
*/
|
|
|
private final String snapshot;
|
|
|
|
|
|
- private final long indexVersion;
|
|
|
-
|
|
|
private final long startTime;
|
|
|
|
|
|
private final long time;
|
|
@@ -376,7 +374,6 @@ public class BlobStoreIndexShardSnapshot implements ToXContentFragment {
|
|
|
* Constructs new shard snapshot metadata from snapshot metadata
|
|
|
*
|
|
|
* @param snapshot snapshot name
|
|
|
- * @param indexVersion index version
|
|
|
* @param indexFiles list of files in the shard
|
|
|
* @param startTime snapshot start time
|
|
|
* @param time snapshot running time
|
|
@@ -385,7 +382,6 @@ public class BlobStoreIndexShardSnapshot implements ToXContentFragment {
|
|
|
*/
|
|
|
public BlobStoreIndexShardSnapshot(
|
|
|
String snapshot,
|
|
|
- long indexVersion,
|
|
|
List<FileInfo> indexFiles,
|
|
|
long startTime,
|
|
|
long time,
|
|
@@ -393,9 +389,7 @@ public class BlobStoreIndexShardSnapshot implements ToXContentFragment {
|
|
|
long incrementalSize
|
|
|
) {
|
|
|
assert snapshot != null;
|
|
|
- assert indexVersion >= 0;
|
|
|
this.snapshot = snapshot;
|
|
|
- this.indexVersion = indexVersion;
|
|
|
this.indexFiles = List.copyOf(indexFiles);
|
|
|
this.startTime = startTime;
|
|
|
this.time = time;
|
|
@@ -412,7 +406,7 @@ public class BlobStoreIndexShardSnapshot implements ToXContentFragment {
|
|
|
* @param time time it took to create the clone
|
|
|
*/
|
|
|
public BlobStoreIndexShardSnapshot asClone(String targetSnapshotName, long startTime, long time) {
|
|
|
- return new BlobStoreIndexShardSnapshot(targetSnapshotName, indexVersion, indexFiles, startTime, time, 0, 0);
|
|
|
+ return new BlobStoreIndexShardSnapshot(targetSnapshotName, indexFiles, startTime, time, 0, 0);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -480,7 +474,6 @@ public class BlobStoreIndexShardSnapshot implements ToXContentFragment {
|
|
|
}
|
|
|
|
|
|
private static final String NAME = "name";
|
|
|
- private static final String INDEX_VERSION = "index_version";
|
|
|
private static final String START_TIME = "start_time";
|
|
|
private static final String TIME = "time";
|
|
|
private static final String FILES = "files";
|
|
@@ -490,13 +483,16 @@ public class BlobStoreIndexShardSnapshot implements ToXContentFragment {
|
|
|
private static final String INCREMENTAL_SIZE = "total_size";
|
|
|
|
|
|
private static final ParseField PARSE_NAME = new ParseField(NAME);
|
|
|
- private static final ParseField PARSE_INDEX_VERSION = new ParseField(INDEX_VERSION, "index-version");
|
|
|
private static final ParseField PARSE_START_TIME = new ParseField(START_TIME);
|
|
|
private static final ParseField PARSE_TIME = new ParseField(TIME);
|
|
|
private static final ParseField PARSE_INCREMENTAL_FILE_COUNT = new ParseField(INCREMENTAL_FILE_COUNT);
|
|
|
private static final ParseField PARSE_INCREMENTAL_SIZE = new ParseField(INCREMENTAL_SIZE);
|
|
|
private static final ParseField PARSE_FILES = new ParseField(FILES);
|
|
|
|
|
|
+ // pre-8.9.0 versions included this (unused) field so we must accept its existence
|
|
|
+ private static final String INDEX_VERSION = "index_version";
|
|
|
+ private static final ParseField PARSE_INDEX_VERSION = new ParseField(INDEX_VERSION, "index-version");
|
|
|
+
|
|
|
/**
|
|
|
* Serializes shard snapshot metadata info into JSON
|
|
|
*
|
|
@@ -506,7 +502,7 @@ public class BlobStoreIndexShardSnapshot implements ToXContentFragment {
|
|
|
@Override
|
|
|
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
|
|
|
builder.field(NAME, snapshot);
|
|
|
- builder.field(INDEX_VERSION, indexVersion);
|
|
|
+ builder.field(INDEX_VERSION, 0); // pre-8.9.0 versions require this field to be present and non-negative
|
|
|
builder.field(START_TIME, startTime);
|
|
|
builder.field(TIME, time);
|
|
|
builder.field(INCREMENTAL_FILE_COUNT, incrementalFileCount);
|
|
@@ -527,7 +523,6 @@ public class BlobStoreIndexShardSnapshot implements ToXContentFragment {
|
|
|
*/
|
|
|
public static BlobStoreIndexShardSnapshot fromXContent(XContentParser parser) throws IOException {
|
|
|
String snapshot = null;
|
|
|
- long indexVersion = -1;
|
|
|
long startTime = 0;
|
|
|
long time = 0;
|
|
|
int incrementalFileCount = 0;
|
|
@@ -547,8 +542,8 @@ public class BlobStoreIndexShardSnapshot implements ToXContentFragment {
|
|
|
if (PARSE_NAME.match(currentFieldName, parser.getDeprecationHandler())) {
|
|
|
snapshot = parser.text();
|
|
|
} else if (PARSE_INDEX_VERSION.match(currentFieldName, parser.getDeprecationHandler())) {
|
|
|
- // The index-version is needed for backward compatibility with v 1.0
|
|
|
- indexVersion = parser.longValue();
|
|
|
+ // pre-8.9.0 versions included this (unused) field so we must accept its existence
|
|
|
+ parser.longValue();
|
|
|
} else if (PARSE_START_TIME.match(currentFieldName, parser.getDeprecationHandler())) {
|
|
|
startTime = parser.longValue();
|
|
|
} else if (PARSE_TIME.match(currentFieldName, parser.getDeprecationHandler())) {
|
|
@@ -573,7 +568,6 @@ public class BlobStoreIndexShardSnapshot implements ToXContentFragment {
|
|
|
|
|
|
return new BlobStoreIndexShardSnapshot(
|
|
|
snapshot,
|
|
|
- indexVersion,
|
|
|
indexFiles == null ? List.of() : indexFiles,
|
|
|
startTime,
|
|
|
time,
|