Skip to content

Commit

Permalink
Add fix for :server:japicmp failure in 2.x backport
Browse files Browse the repository at this point in the history
Signed-off-by: Anshu Agarwal <anshukag@amazon.com>
  • Loading branch information
Anshu Agarwal committed Sep 3, 2024
1 parent ef47252 commit e773ee1
Show file tree
Hide file tree
Showing 4 changed files with 99 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,27 @@ public void getRepositoryData(ActionListener<RepositoryData> listener) {
in.getRepositoryData(listener);
}

@Override
public void finalizeSnapshot(
ShardGenerations shardGenerations,
long repositoryStateId,
Metadata clusterMetadata,
SnapshotInfo snapshotInfo,
Version repositoryMetaVersion,
Function<ClusterState, ClusterState> stateTransformer,
ActionListener<RepositoryData> listener
) {
in.finalizeSnapshot(
shardGenerations,
repositoryStateId,
clusterMetadata,
snapshotInfo,
repositoryMetaVersion,
stateTransformer,
listener
);
}

@Override
public void finalizeSnapshot(
ShardGenerations shardGenerations,
Expand Down
24 changes: 24 additions & 0 deletions server/src/main/java/org/opensearch/repositories/Repository.java
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,30 @@ default Repository create(RepositoryMetadata metadata, Function<String, Reposito
*/
void getRepositoryData(ActionListener<RepositoryData> listener);

/**
* Finalizes snapshotting process
* <p>
* This method is called on cluster-manager after all shards are snapshotted.
*
* @param shardGenerations updated shard generations
* @param repositoryStateId the unique id identifying the state of the repository when the snapshot began
* @param clusterMetadata cluster metadata
* @param snapshotInfo SnapshotInfo instance to write for this snapshot
* @param repositoryMetaVersion version of the updated repository metadata to write
* @param stateTransformer a function that filters the last cluster state update that the snapshot finalization will execute and
* is used to remove any state tracked for the in-progress snapshot from the cluster state
* @param listener listener to be invoked with the new {@link RepositoryData} after completing the snapshot
*/
void finalizeSnapshot(
ShardGenerations shardGenerations,
long repositoryStateId,
Metadata clusterMetadata,
SnapshotInfo snapshotInfo,
Version repositoryMetaVersion,
Function<ClusterState, ClusterState> stateTransformer,
ActionListener<RepositoryData> listener
);

/**
* Finalizes snapshotting process
* <p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2019,6 +2019,28 @@ private DeleteResult cleanUpStaleSnapshotShardPathsFile(List<String> matchingSha
return new DeleteResult(matchingShardPaths.size(), totalBytes);
}

@Override
public void finalizeSnapshot(
final ShardGenerations shardGenerations,
final long repositoryStateId,
final Metadata clusterMetadata,
SnapshotInfo snapshotInfo,
Version repositoryMetaVersion,
Function<ClusterState, ClusterState> stateTransformer,
final ActionListener<RepositoryData> listener
) {
finalizeSnapshot(
shardGenerations,
repositoryStateId,
clusterMetadata,
snapshotInfo,
repositoryMetaVersion,
stateTransformer,
Priority.NORMAL,
listener
);
}

@Override
public void finalizeSnapshot(
final ShardGenerations shardGenerations,
Expand Down
32 changes: 32 additions & 0 deletions server/src/main/java/org/opensearch/snapshots/SnapshotInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,38 @@ public SnapshotInfo(SnapshotsInProgress.Entry entry) {
);
}

public SnapshotInfo(
SnapshotId snapshotId,
List<String> indices,
List<String> dataStreams,
long startTime,
String reason,
long endTime,
int totalShards,
List<SnapshotShardFailure> shardFailures,
Boolean includeGlobalState,
Map<String, Object> userMetadata,
Boolean remoteStoreIndexShallowCopy
) {
this(
snapshotId,
indices,
dataStreams,
snapshotState(reason, shardFailures),
reason,
Version.CURRENT,
startTime,
endTime,
totalShards,
totalShards - shardFailures.size(),
shardFailures,
includeGlobalState,
userMetadata,
remoteStoreIndexShallowCopy,
0
);
}

public SnapshotInfo(
SnapshotId snapshotId,
List<String> indices,
Expand Down

0 comments on commit e773ee1

Please sign in to comment.