Skip to content

Commit d2bc9fc

Browse files
authored
Set Version to 2.17 for hashed prefix snapshots (opensearch-project#15656)
Signed-off-by: Ashish Singh <ssashish@amazon.com>
1 parent 2793634 commit d2bc9fc

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

server/src/main/java/org/opensearch/repositories/IndexId.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public IndexId(String name, String id, int shardPathType) {
7878
public IndexId(final StreamInput in) throws IOException {
7979
this.name = in.readString();
8080
this.id = in.readString();
81-
if (in.getVersion().onOrAfter(Version.CURRENT)) {
81+
if (in.getVersion().onOrAfter(Version.V_2_17_0)) {
8282
this.shardPathType = in.readVInt();
8383
} else {
8484
this.shardPathType = DEFAULT_SHARD_PATH_TYPE;
@@ -145,7 +145,7 @@ private int computeHashCode() {
145145
public void writeTo(final StreamOutput out) throws IOException {
146146
out.writeString(name);
147147
out.writeString(id);
148-
if (out.getVersion().onOrAfter(Version.CURRENT)) {
148+
if (out.getVersion().onOrAfter(Version.V_2_17_0)) {
149149
out.writeVInt(shardPathType);
150150
}
151151
}

server/src/main/java/org/opensearch/repositories/RepositoryData.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,7 @@ public List<IndexId> resolveNewIndices(List<String> indicesToResolve, Map<String
551551

552552
// Visible for testing only
553553
public XContentBuilder snapshotsToXContent(final XContentBuilder builder, final Version repoMetaVersion) throws IOException {
554-
return snapshotsToXContent(builder, repoMetaVersion, Version.CURRENT);
554+
return snapshotsToXContent(builder, repoMetaVersion, Version.V_2_17_0);
555555
}
556556

557557
/**
@@ -589,7 +589,7 @@ public XContentBuilder snapshotsToXContent(final XContentBuilder builder, final
589589
for (final IndexId indexId : getIndices().values()) {
590590
builder.startObject(indexId.getName());
591591
builder.field(INDEX_ID, indexId.getId());
592-
if (minNodeVersion.onOrAfter(Version.CURRENT)) {
592+
if (minNodeVersion.onOrAfter(Version.V_2_17_0)) {
593593
builder.field(IndexId.SHARD_PATH_TYPE, indexId.getShardPathType());
594594
}
595595
builder.startArray(SNAPSHOTS);

server/src/main/java/org/opensearch/snapshots/SnapshotsService.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ public ClusterState execute(ClusterState currentState) {
361361

362362
logger.trace("[{}][{}] creating snapshot for indices [{}]", repositoryName, snapshotName, indices);
363363

364-
int pathType = clusterService.state().nodes().getMinNodeVersion().onOrAfter(Version.CURRENT)
364+
int pathType = clusterService.state().nodes().getMinNodeVersion().onOrAfter(Version.V_2_17_0)
365365
? SHARD_PATH_TYPE.get(repository.getMetadata().settings()).getCode()
366366
: IndexId.DEFAULT_SHARD_PATH_TYPE;
367367
final List<IndexId> indexIds = repositoryData.resolveNewIndices(

server/src/test/java/org/opensearch/repositories/IndexIdTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public void testEqualsAndHashCode() {
8686
public void testSerialization() throws IOException {
8787
IndexId indexId = new IndexId(randomAlphaOfLength(8), UUIDs.randomBase64UUID(), randomIntBetween(0, 2));
8888
BytesStreamOutput out = new BytesStreamOutput();
89-
out.setVersion(Version.CURRENT);
89+
out.setVersion(Version.V_2_17_0);
9090
indexId.writeTo(out);
9191
assertEquals(indexId, new IndexId(out.bytes().streamInput()));
9292
}

0 commit comments

Comments
 (0)