Skip to content

Commit

Permalink
incremental metadata update cannot have null params
Browse files Browse the repository at this point in the history
Signed-off-by: Shivansh Arora <[email protected]>
  • Loading branch information
shiv0408 committed Aug 26, 2024
1 parent b6e3338 commit e8bbd5b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
import org.opensearch.repositories.Repository;
import org.opensearch.repositories.blobstore.BlobStoreRepository;
import org.opensearch.threadpool.ThreadPool;
import reactor.util.annotation.NonNull;

import java.io.Closeable;
import java.io.IOException;
Expand Down Expand Up @@ -285,12 +286,20 @@ public RemoteClusterStateManifestInfo writeFullMetadata(ClusterState clusterStat
*
* @return {@link RemoteClusterStateManifestInfo} object containing uploaded manifest detail
*/
@Nullable
public RemoteClusterStateManifestInfo writeIncrementalMetadata(
ClusterState previousClusterState,
ClusterState clusterState,
ClusterMetadataManifest previousManifest
) throws IOException {
if (previousClusterState == null) {
throw new IllegalArgumentException("previousClusterState cannot be null");
}
if (clusterState == null) {
throw new IllegalArgumentException("clusterState cannot be null");
}
if (previousManifest == null) {
throw new IllegalArgumentException("previousManifest cannot be null");
}
logger.trace("WRITING INCREMENTAL STATE");

final long startTimeNanos = relativeTimeNanosSupplier.getAsLong();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ public void testFailWriteIncrementalMetadataWhenManifestNull() {
.metadata(Metadata.builder().coordinationMetadata(coordinationMetadata))
.build();
assertThrows(
NullPointerException.class,
IllegalArgumentException.class,
() -> remoteClusterStateService.writeIncrementalMetadata(previousClusterState, clusterState, null)
);
}
Expand Down

0 comments on commit e8bbd5b

Please sign in to comment.