Skip to content

Commit

Permalink
Updating tests
Browse files Browse the repository at this point in the history
Signed-off-by: Bansi Kasundra <kasundra@amazon.com>
  • Loading branch information
kasundra07 committed Jun 23, 2023
1 parent 3bee399 commit dace01c
Showing 1 changed file with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -786,6 +786,8 @@ public void cleanupRemoteStoreStaleLockFiles(
RemoteStoreLockManagerFactory remoteStoreLockManagerFactory,
ActionListener<DeleteResult> listener
) {
logger.info("Remote store cleanup initiated");
logger.info("SnapshotsIds: {}", snapshotIds);
if (isReadOnly()) {
throw new RepositoryException(metadata.name(), "Cannot release locks for a readonly repository");
} else {
Expand All @@ -801,6 +803,7 @@ protected void doRun() throws Exception {
resolveResourcesToReleaseLock(snapshotUUIDs, repositoryData, resourcesToReleaseLockListener);

resourcesToReleaseLockListener.whenComplete(resourcesToReleaseLock -> {
logger.info("resourcesToReleaseLock: {}", resourcesToReleaseLock);
if (resourcesToReleaseLock.isEmpty()) {
logger.info("No lock file to be released");
listener.onResponse(DeleteResult.ZERO);
Expand Down Expand Up @@ -865,7 +868,14 @@ private void resolveResourcesToReleaseLock(
) throws IOException {
final Executor executor = threadPool.executor(ThreadPool.Names.SNAPSHOT);
final Set<String> allSnapshotIds = repositoryData.getSnapshotIds().stream().map(SnapshotId::getUUID).collect(Collectors.toSet());
logger.info("allSnapshotIds: {}", allSnapshotIds);
final Map<String, BlobContainer> indexBlobs = blobStore().blobContainer(indicesPath()).children();
logger.info("indexBlobs size: {}", indexBlobs.size());
logger.info("indexBlobs: {}", indexBlobs);
if (indexBlobs.isEmpty()) {
listener.onResponse(Collections.emptyList());
return;
}
final ActionListener<Collection<List<Tuple<String, Tuple<Integer, RemoteStoreShardShallowCopySnapshot>>>>> allIndicesListener =
new GroupedActionListener<>(
ActionListener.map(
Expand All @@ -874,10 +884,17 @@ private void resolveResourcesToReleaseLock(
),
indexBlobs.size()
);
logger.info("Traversing indexBlobs...");
for (Map.Entry<String, BlobContainer> indexBlob : indexBlobs.entrySet()) {
Map<String, BlobContainer> shardBlobs = indexBlob.getValue().children();
logger.info("shardBlobs size: {}", shardBlobs.size());
logger.info("shardBlobs: {}", shardBlobs);
if (shardBlobs.isEmpty()) {
allIndicesListener.onResponse(null);
}
final ActionListener<List<Tuple<String, Tuple<Integer, RemoteStoreShardShallowCopySnapshot>>>> allShardsListener =
new GroupedActionListener<>(allIndicesListener, shardBlobs.size());
logger.info("Traversing shardBlobs...");
for (Map.Entry<String, BlobContainer> shardBlob : shardBlobs.entrySet()) {
executor.execute(new AbstractRunnable() {
@Override
Expand Down

0 comments on commit dace01c

Please sign in to comment.