From 71cf169f63ccb6c26ecea873b90da4dc8033a2c0 Mon Sep 17 00:00:00 2001 From: Ashish Singh Date: Tue, 18 Apr 2023 11:00:05 +0530 Subject: [PATCH] Add to upload list method during individual file upload Signed-off-by: Ashish Singh --- .../index/RemoteSegmentUploadShardStatsTracker.java | 8 ++++---- .../index/shard/RemoteStoreRefreshListener.java | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/server/src/main/java/org/opensearch/index/RemoteSegmentUploadShardStatsTracker.java b/server/src/main/java/org/opensearch/index/RemoteSegmentUploadShardStatsTracker.java index 3062b1e1b6c85..4d077f2efab24 100644 --- a/server/src/main/java/org/opensearch/index/RemoteSegmentUploadShardStatsTracker.java +++ b/server/src/main/java/org/opensearch/index/RemoteSegmentUploadShardStatsTracker.java @@ -247,10 +247,6 @@ public void updateLatestLocalFileNameLengthMap(Map latestLocalFile this.latestLocalFileNameLengthMap = latestLocalFileNameLengthMap; } - public Set getLatestUploadFiles() { - return latestUploadFiles; - } - public void updateLatestUploadFiles(Set latestUploadFiles) { this.latestUploadFiles = latestUploadFiles; } @@ -325,4 +321,8 @@ public void updateUploadBytesPerSecMovingAverageWindowSize(int updatedSize) { public void updateUploadTimeMovingAverageWindowSize(int updatedSize) { this.uploadTimeMovingAverageReference.set(new MovingAverage(updatedSize)); } + + public void addToLatestUploadFiles(String file) { + this.latestUploadFiles.add(file); + } } diff --git a/server/src/main/java/org/opensearch/index/shard/RemoteStoreRefreshListener.java b/server/src/main/java/org/opensearch/index/shard/RemoteStoreRefreshListener.java index 1204c7abc0732..5e920119c6166 100644 --- a/server/src/main/java/org/opensearch/index/shard/RemoteStoreRefreshListener.java +++ b/server/src/main/java/org/opensearch/index/shard/RemoteStoreRefreshListener.java @@ -322,6 +322,7 @@ UploadStatus uploadNewSegments( remoteDirectory.copyFrom(storeDirectory, file, file, IOContext.DEFAULT); // Upload succeeded statsTracker.incrementUploadBytesSucceeded(fileSize); + statsTracker.addToLatestUploadFiles(file); success = true; } catch (IOException e) { // ToDO: Handle transient and permanent un-availability of the remote store (GitHub #3397)