Skip to content

Commit

Permalink
Do orphan timestamp cleanup before completing the snapshot (opensearc…
Browse files Browse the repository at this point in the history
…h-project#16365) (opensearch-project#16385)

(cherry picked from commit f1c98a4)

Signed-off-by: Gaurav Bafna <[email protected]>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
1 parent 3ef3455 commit 96fdbfd
Showing 1 changed file with 3 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -800,12 +800,12 @@ public void onResponse(RepositoryData repositoryData) {
);
return;
}
listener.onResponse(snapshotInfo);
cleanOrphanTimestamp(repositoryName, repositoryData);
logger.info("created snapshot-v2 [{}] in repository [{}]", repositoryName, snapshotName);
listener.onResponse(snapshotInfo);
// For snapshot-v2, we don't allow concurrent snapshots . But meanwhile non-v2 snapshot operations
// can get queued . This is triggering them.
runNextQueuedOperation(repositoryData, repositoryName, true);
cleanOrphanTimestamp(repositoryName, repositoryData);
}

@Override
Expand Down Expand Up @@ -840,14 +840,8 @@ private void cleanOrphanTimestamp(String repoName, RepositoryData repositoryData
if (orphanPinnedEntities.isEmpty()) {
return;
}

logger.info("Found {} orphan timestamps. Cleaning it up now", orphanPinnedEntities.size());
if (tryEnterRepoLoop(repoName)) {
deleteOrphanTimestamps(pinnedEntities, orphanPinnedEntities);
leaveRepoLoop(repoName);
} else {
logger.info("Concurrent snapshot create/delete is happening. Skipping clean up of orphan timestamps");
}
deleteOrphanTimestamps(pinnedEntities, orphanPinnedEntities);
}

private boolean isOrphanPinnedEntity(String repoName, Collection<String> snapshotUUIDs, String pinnedEntity) {
Expand Down

0 comments on commit 96fdbfd

Please sign in to comment.