Skip to content

Commit a3a4aa9

Browse files
Fix read/write method for Diff Manifest in case Shard diff file is null (#14947) (#14951)
(cherry picked from commit 82c4c1e) Signed-off-by: Shailendra Singh <[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>
1 parent 769fdc8 commit a3a4aa9

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

server/src/main/java/org/opensearch/gateway/remote/ClusterStateDiffManifest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,6 @@ public ClusterStateDiffManifest(
129129
clusterStateCustomUpdated = new ArrayList<>(clusterStateCustomDiff.getDiffs().keySet());
130130
clusterStateCustomUpdated.addAll(clusterStateCustomDiff.getUpserts().keySet());
131131
clusterStateCustomDeleted = clusterStateCustomDiff.getDeletes();
132-
List<String> indicie1s = indicesRoutingUpdated;
133132
}
134133

135134
public ClusterStateDiffManifest(
@@ -190,7 +189,7 @@ public ClusterStateDiffManifest(StreamInput in) throws IOException {
190189
this.hashesOfConsistentSettingsUpdated = in.readBoolean();
191190
this.clusterStateCustomUpdated = in.readStringList();
192191
this.clusterStateCustomDeleted = in.readStringList();
193-
this.indicesRoutingDiffPath = in.readString();
192+
this.indicesRoutingDiffPath = in.readOptionalString();
194193
}
195194

196195
@Override
@@ -535,7 +534,8 @@ public int hashCode() {
535534
indicesRoutingDeleted,
536535
hashesOfConsistentSettingsUpdated,
537536
clusterStateCustomUpdated,
538-
clusterStateCustomDeleted
537+
clusterStateCustomDeleted,
538+
indicesRoutingDiffPath
539539
);
540540
}
541541

@@ -562,7 +562,7 @@ public void writeTo(StreamOutput out) throws IOException {
562562
out.writeBoolean(hashesOfConsistentSettingsUpdated);
563563
out.writeStringCollection(clusterStateCustomUpdated);
564564
out.writeStringCollection(clusterStateCustomDeleted);
565-
out.writeString(indicesRoutingDiffPath);
565+
out.writeOptionalString(indicesRoutingDiffPath);
566566
}
567567

568568
/**

server/src/main/java/org/opensearch/gateway/remote/RemotePersistenceStats.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@ public long getIndexRoutingFilesCleanupAttemptFailedCount() {
5151
}
5252

5353
public void indicesRoutingDiffFileCleanupAttemptFailed() {
54-
indexRoutingFilesCleanupAttemptFailedCount.incrementAndGet();
54+
indicesRoutingDiffFilesCleanupAttemptFailedCount.incrementAndGet();
5555
}
5656

5757
public long getIndicesRoutingDiffFileCleanupAttemptFailedCount() {
58-
return indexRoutingFilesCleanupAttemptFailedCount.get();
58+
return indicesRoutingDiffFilesCleanupAttemptFailedCount.get();
5959
}
6060
}

server/src/test/java/org/opensearch/gateway/remote/RemoteClusterStateCleanupManagerTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -652,7 +652,7 @@ public void testIndicesRoutingDiffFilesCleanupFailureStats() throws Exception {
652652
assertEquals(0, remoteClusterStateCleanupManager.getStats().getIndicesRoutingDiffFileCleanupAttemptFailedCount());
653653
});
654654

655-
doThrow(IOException.class).when(remoteRoutingTableService).deleteStaleIndexRoutingPaths(any());
655+
doThrow(IOException.class).when(remoteRoutingTableService).deleteStaleIndexRoutingDiffPaths(any());
656656
remoteClusterStateCleanupManager.deleteClusterMetadata(clusterName, clusterUUID, activeBlobs, inactiveBlobs);
657657
assertBusy(() -> {
658658
// wait for stats to get updated

0 commit comments

Comments
 (0)