Skip to content

Commit

Permalink
Revert "Change version from CURRENT to 2.17.0"
Browse files Browse the repository at this point in the history
This reverts commit c7a148a.

Signed-off-by: Sachin Kale <[email protected]>
  • Loading branch information
Sachin Kale committed Sep 3, 2024
1 parent f471deb commit 529db89
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public RestoreSnapshotRequest(StreamInput in) throws IOException {
if (in.getVersion().onOrAfter(Version.V_2_10_0)) {
sourceRemoteStoreRepository = in.readOptionalString();
}
if (in.getVersion().onOrAfter(Version.V_2_17_0)) {
if (in.getVersion().onOrAfter(Version.CURRENT)) {
sourceRemoteTranslogRepository = in.readOptionalString();
}
}
Expand All @@ -188,7 +188,7 @@ public void writeTo(StreamOutput out) throws IOException {
if (out.getVersion().onOrAfter(Version.V_2_10_0)) {
out.writeOptionalString(sourceRemoteStoreRepository);
}
if (out.getVersion().onOrAfter(Version.V_2_17_0)) {
if (out.getVersion().onOrAfter(Version.CURRENT)) {
out.writeOptionalString(sourceRemoteTranslogRepository);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@
import java.io.IOException;
import java.util.Objects;

import static org.opensearch.Version.CURRENT;

/**
* Represents the recovery source of a shard. Available recovery types are:
* <p>
Expand Down Expand Up @@ -333,7 +335,7 @@ public SnapshotRecoverySource(
remoteStoreIndexShallowCopy = false;
sourceRemoteStoreRepository = null;
}
if (in.getVersion().onOrAfter(Version.V_2_17_0)) {
if (in.getVersion().onOrAfter(CURRENT)) {
sourceRemoteTranslogRepository = in.readOptionalString();
pinnedTimestamp = in.readLong();
} else {
Expand Down Expand Up @@ -397,7 +399,7 @@ protected void writeAdditionalFields(StreamOutput out) throws IOException {
out.writeBoolean(remoteStoreIndexShallowCopy);
out.writeOptionalString(sourceRemoteStoreRepository);
}
if (out.getVersion().onOrAfter(Version.V_2_17_0)) {
if (out.getVersion().onOrAfter(CURRENT)) {
out.writeOptionalString(sourceRemoteTranslogRepository);
out.writeLong(pinnedTimestamp);
}
Expand Down
18 changes: 16 additions & 2 deletions server/src/main/java/org/opensearch/index/shard/IndexShard.java
Original file line number Diff line number Diff line change
Expand Up @@ -2913,9 +2913,23 @@ public void restoreFromSnapshotAndRemoteStore(
StoreRecovery storeRecovery = new StoreRecovery(shardId, logger);
SnapshotRecoverySource recoverySource = (SnapshotRecoverySource) recoveryState().getRecoverySource();
if (recoverySource.pinnedTimestamp() != 0) {
storeRecovery.recoverShallowSnapshotV2(this, repository, repositoriesService, listener, remoteStoreSettings.getSegmentsPathFixedPrefix(), threadPool);
storeRecovery.recoverShallowSnapshotV2(
this,
repository,
repositoriesService,
listener,
remoteStoreSettings.getSegmentsPathFixedPrefix(),
threadPool
);
} else {
storeRecovery.recoverFromSnapshotAndRemoteStore(this, repository, repositoriesService, listener, remoteStoreSettings.getSegmentsPathFixedPrefix(), threadPool);
storeRecovery.recoverFromSnapshotAndRemoteStore(
this,
repository,
repositoriesService,
listener,
remoteStoreSettings.getSegmentsPathFixedPrefix(),
threadPool
);
}
} catch (Exception e) {
listener.onFailure(e);
Expand Down

0 comments on commit 529db89

Please sign in to comment.