Skip to content

Commit

Permalink
Fix read/write method for Diff Manifest in case Shard diff file is nu…
Browse files Browse the repository at this point in the history
…ll. (opensearch-project#14938)

Signed-off-by: Shailendra Singh <[email protected]>
  • Loading branch information
shailendra0811 authored and harshavamsi committed Aug 20, 2024
1 parent f686e64 commit 57b25dd
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ public ClusterStateDiffManifest(
clusterStateCustomUpdated = new ArrayList<>(clusterStateCustomDiff.getDiffs().keySet());
clusterStateCustomUpdated.addAll(clusterStateCustomDiff.getUpserts().keySet());
clusterStateCustomDeleted = clusterStateCustomDiff.getDeletes();
List<String> indicie1s = indicesRoutingUpdated;
}

public ClusterStateDiffManifest(
Expand Down Expand Up @@ -190,7 +189,7 @@ public ClusterStateDiffManifest(StreamInput in) throws IOException {
this.hashesOfConsistentSettingsUpdated = in.readBoolean();
this.clusterStateCustomUpdated = in.readStringList();
this.clusterStateCustomDeleted = in.readStringList();
this.indicesRoutingDiffPath = in.readString();
this.indicesRoutingDiffPath = in.readOptionalString();
}

@Override
Expand Down Expand Up @@ -535,7 +534,8 @@ public int hashCode() {
indicesRoutingDeleted,
hashesOfConsistentSettingsUpdated,
clusterStateCustomUpdated,
clusterStateCustomDeleted
clusterStateCustomDeleted,
indicesRoutingDiffPath
);
}

Expand All @@ -562,7 +562,7 @@ public void writeTo(StreamOutput out) throws IOException {
out.writeBoolean(hashesOfConsistentSettingsUpdated);
out.writeStringCollection(clusterStateCustomUpdated);
out.writeStringCollection(clusterStateCustomDeleted);
out.writeString(indicesRoutingDiffPath);
out.writeOptionalString(indicesRoutingDiffPath);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ public long getIndexRoutingFilesCleanupAttemptFailedCount() {
}

public void indicesRoutingDiffFileCleanupAttemptFailed() {
indexRoutingFilesCleanupAttemptFailedCount.incrementAndGet();
indicesRoutingDiffFilesCleanupAttemptFailedCount.incrementAndGet();
}

public long getIndicesRoutingDiffFileCleanupAttemptFailedCount() {
return indexRoutingFilesCleanupAttemptFailedCount.get();
return indicesRoutingDiffFilesCleanupAttemptFailedCount.get();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@ public void testIndicesRoutingDiffFilesCleanupFailureStats() throws Exception {
assertEquals(0, remoteClusterStateCleanupManager.getStats().getIndicesRoutingDiffFileCleanupAttemptFailedCount());
});

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

0 comments on commit 57b25dd

Please sign in to comment.