Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Snapshot V2] Fix for create snapshot build and test failures #15602

Merged
merged 7 commits into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,
sachinpkale marked this conversation as resolved.
Show resolved Hide resolved
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
Loading