Skip to content

Commit 6329301

Browse files
committed
address review comments
1 parent c33e116 commit 6329301

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

server/src/main/java/org/elasticsearch/cluster/project/ProjectStateRegistry.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ public class ProjectStateRegistry extends AbstractNamedDiffable<ClusterState.Cus
4747
public ProjectStateRegistry(StreamInput in) throws IOException {
4848
projectsSettings = in.readMap(ProjectId::readFrom, Settings::readSettingsFromStream);
4949
if (in.getTransportVersion().onOrAfter(TransportVersions.PROJECT_STATE_REGISTRY_RECORDS_DELETIONS)) {
50-
projectsMarkedForDeletion = in.readCollectionAsSet(ProjectId::readFrom);
51-
projectsMarkedForDeletionGeneration = in.readZLong();
50+
projectsMarkedForDeletion = in.readCollectionAsImmutableSet(ProjectId::readFrom);
51+
projectsMarkedForDeletionGeneration = in.readVLong();
5252
} else {
5353
projectsMarkedForDeletion = Collections.emptySet();
5454
projectsMarkedForDeletionGeneration = 0;
@@ -120,7 +120,7 @@ public void writeTo(StreamOutput out) throws IOException {
120120
out.writeMap(projectsSettings);
121121
if (out.getTransportVersion().onOrAfter(TransportVersions.PROJECT_STATE_REGISTRY_RECORDS_DELETIONS)) {
122122
out.writeCollection(projectsMarkedForDeletion);
123-
out.writeZLong(projectsMarkedForDeletionGeneration);
123+
out.writeVLong(projectsMarkedForDeletionGeneration);
124124
} else {
125125
// There should be no deletion unless all MP nodes are at or after PROJECT_STATE_REGISTRY_RECORDS_DELETIONS
126126
assert projectsMarkedForDeletion.isEmpty();
@@ -202,6 +202,7 @@ public Builder markProjectForDeletion(ProjectId projectId) {
202202
public ProjectStateRegistry build() {
203203
final var unknownButUnderDeletion = Sets.difference(projectsMarkedForDeletion, projectsSettings.keys());
204204
if (unknownButUnderDeletion.isEmpty() == false) {
205+
assert unknownButUnderDeletion.stream().noneMatch(projectsSettings::containsKey);
205206
throw new IllegalArgumentException(
206207
"Cannot mark projects for deletion that are not in the registry: " + unknownButUnderDeletion
207208
);

0 commit comments

Comments
 (0)