Skip to content

Commit d0f5583

Browse files
committed
cleanup
1 parent 886afe5 commit d0f5583

File tree

1 file changed

+1
-17
lines changed

1 file changed

+1
-17
lines changed

server/src/main/java/org/elasticsearch/cluster/block/ClusterBlocks.java

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,7 @@ public Set<ClusterBlock> global() {
7272
return global;
7373
}
7474

75-
// Review note: project-aware flavor of global() used in TransportSearch and TransportFieldCaps
76-
// which were already project-aware
75+
// Project-aware flavor of global() used to find global or project-global blocks for a specific project.
7776
public Set<ClusterBlock> global(ProjectId projectId) {
7877
return Sets.union(global, projectBlocks(projectId).projectGlobals());
7978
}
@@ -99,7 +98,6 @@ public Set<ClusterBlock> global(ClusterBlockLevel level) {
9998
}
10099

101100
// For a specific project, global could be either project global or cluster global
102-
// Review note: changed TransportAddIndexBlock to use this since it is project-aware
103101
public Set<ClusterBlock> global(ProjectId projectId, ClusterBlockLevel level) {
104102
var levelHolder = levelHolders.get(level);
105103
return Sets.union(levelHolder.global, levelHolder.projects.getOrDefault(projectId, ProjectBlocks.EMPTY).projectGlobals());
@@ -163,9 +161,6 @@ public boolean disableStatePersistence() {
163161
return false;
164162
}
165163

166-
// Review note: seems to be used only with STATE_NOT_RECOVERED by different node-level services. May or may not need to
167-
// consider project globals once/if we have a project block that is similar to STATE_NOT_RECOVERED for project creation/resurrection
168-
// time (essentially something similar to PROJECT_UNDER_DELETION_BLOCK, but retryable).
169164
public boolean hasGlobalBlock(ClusterBlock block) {
170165
return global.contains(block);
171166
}
@@ -179,12 +174,10 @@ public boolean hasGlobalBlockWithId(final int blockId) {
179174
return false;
180175
}
181176

182-
// Review note: used by monitoring/localExporter and watcher, both currently not project aware.
183177
public boolean hasGlobalBlockWithLevel(ClusterBlockLevel level) {
184178
return global(level).size() > 0;
185179
}
186180

187-
// Review note: Used by TransportAbstractBulk which is already project-aware
188181
public boolean hasGlobalBlockWithLevel(ProjectId projectId, ClusterBlockLevel level) {
189182
return global(projectId, level).size() > 0;
190183
}
@@ -207,7 +200,6 @@ public boolean hasIndexBlock(String index, ClusterBlock block) {
207200
return hasIndexBlock(Metadata.DEFAULT_PROJECT_ID, index, block);
208201
}
209202

210-
// Review note: Not changing index-specific checks.
211203
public boolean hasIndexBlock(ProjectId projectId, String index, ClusterBlock block) {
212204
final var projectBlocks = projectBlocksMap.get(projectId);
213205
if (projectBlocks == null) {
@@ -220,7 +212,6 @@ public boolean hasIndexBlock(ProjectId projectId, String index, ClusterBlock blo
220212
return clusterBlocks.contains(block);
221213
}
222214

223-
// Review note: Not changing index-specific checks.
224215
public boolean hasIndexBlockLevel(ProjectId projectId, String index, ClusterBlockLevel level) {
225216
return blocksForIndex(projectId, level, index).isEmpty() == false;
226217
}
@@ -229,7 +220,6 @@ public boolean hasIndexBlockWithId(ProjectId projectId, String index, int blockI
229220
return getIndexBlockWithId(projectId, index, blockId) != null;
230221
}
231222

232-
// Review note: Not changing index-specific checks.
233223
@Nullable
234224
public ClusterBlock getIndexBlockWithId(final ProjectId projectId, final String index, final int blockId) {
235225
final var projectBlocks = projectBlocksMap.get(projectId);
@@ -246,15 +236,13 @@ public ClusterBlock getIndexBlockWithId(final ProjectId projectId, final String
246236
return null;
247237
}
248238

249-
// Review note: only a watcher action uses this since it is not project-aware
250239
public void globalBlockedRaiseException(ClusterBlockLevel level) throws ClusterBlockException {
251240
ClusterBlockException blockException = globalBlockedException(level);
252241
if (blockException != null) {
253242
throw blockException;
254243
}
255244
}
256245

257-
// Review note: All new callers seemed project-aware/scoped actions.
258246
public void globalBlockedRaiseException(ProjectId projectId, ClusterBlockLevel level) throws ClusterBlockException {
259247
ClusterBlockException blockException = globalBlockedException(projectId, level);
260248
if (blockException != null) {
@@ -270,10 +258,6 @@ private boolean globalBlocked(ProjectId projectId, ClusterBlockLevel level) {
270258
return global(projectId, level).isEmpty() == false;
271259
}
272260

273-
// Review note: this has some 200 callers mostly Transport actions. Not sure but maybe I have to
274-
// review callers and update those that are project-scoped. TransportGetDataStreamLifecycle is one example
275-
// that i've updated here, although many don't seem to be user facing or available
276-
// directly in serverless. Could also be a follow up to update the callers.
277261
public ClusterBlockException globalBlockedException(ClusterBlockLevel level) {
278262
if (globalBlocked(level) == false) {
279263
return null;

0 commit comments

Comments
 (0)