From b4c2030a479698c170e455a7350d21acd531d242 Mon Sep 17 00:00:00 2001 From: Sachin Kale Date: Tue, 20 Aug 2024 22:34:34 +0530 Subject: [PATCH] Add logs to translog GC Signed-off-by: Sachin Kale --- .../opensearch/index/translog/RemoteFsTranslog.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/server/src/main/java/org/opensearch/index/translog/RemoteFsTranslog.java b/server/src/main/java/org/opensearch/index/translog/RemoteFsTranslog.java index 27cd5d6dbbefe..0384793de4f36 100644 --- a/server/src/main/java/org/opensearch/index/translog/RemoteFsTranslog.java +++ b/server/src/main/java/org/opensearch/index/translog/RemoteFsTranslog.java @@ -595,7 +595,7 @@ public void trimUnreferencedReaders() throws IOException { // This is to fail fast and avoid listing md files un-necessarily. if (RemoteStoreUtils.isPinnedTimestampStateStale()) { - logger.warn("Skipping remote segment store garbage collection as last fetch of pinned timestamp is stale"); + logger.warn("Skipping remote translog garbage collection as last fetch of pinned timestamp is stale"); return; } @@ -603,12 +603,14 @@ public void trimUnreferencedReaders() throws IOException { // Remote generations involves 2 async operations - 1) Delete translog generation files 2) Delete metadata files // We try to acquire 2 permits and if we can not, we return from here itself. if (remoteGenerationDeletionPermits.tryAcquire(REMOTE_DELETION_PERMITS) == false) { + logger.warn("Skipping remote translog garbage collection as failed to acquire the permits"); return; } ActionListener> listMetadataFilesListener = new ActionListener<>() { @Override public void onResponse(List blobMetadata) { + logger.warn("Metadata file size: " + blobMetadata.size()); List metadataFiles = blobMetadata.stream().map(BlobMetadata::name).collect(Collectors.toList()); Set generationsToDelete = new HashSet<>(); try { @@ -653,9 +655,13 @@ public void onResponse(List blobMetadata) { TimeValue.timeValueMillis(minimumAgeInMillis) ); + logger.warn("Metadata files to be deleted after filtering based on age: {}", metadataFilesToBeDeleted.size()); + // 5. Filter out metadata files matching pinned timestamps metadataFilesToBeDeleted.removeAll(implicitLockedFiles); + logger.warn("Metadata files to be deleted after filtering md files matching pinned timestamps: {}", metadataFilesToBeDeleted.size()); + if (metadataFilesToBeDeleted.isEmpty()) { logger.debug("No metadata files to delete"); remoteGenerationDeletionPermits.release(REMOTE_DELETION_PERMITS); @@ -700,6 +706,7 @@ public void onResponse(List blobMetadata) { } generationsToDelete.add(generation); } + logger.warn("Generations to delete: {}", generationsToDelete.size()); if (generationsToDelete.isEmpty() == false) { // 9. Delete stale generations deleteRemoteGenerations(generationsToDelete); @@ -732,6 +739,7 @@ public void onResponse(List blobMetadata) { } catch (Exception e) { remoteGenerationDeletionPermits.release(REMOTE_DELETION_PERMITS); } + logger.warn("In trimUnreferencedReaders, onResponse completed"); } @Override