|
43 | 43 | import org.elasticsearch.cluster.routing.IndexRouting; |
44 | 44 | import org.elasticsearch.cluster.service.ClusterService; |
45 | 45 | import org.elasticsearch.common.collect.Iterators; |
46 | | -import org.elasticsearch.common.streams.StreamType; |
47 | 46 | import org.elasticsearch.common.streams.StreamsPermissionsUtils; |
48 | 47 | import org.elasticsearch.common.util.concurrent.AtomicArray; |
49 | 48 | import org.elasticsearch.common.util.concurrent.ConcurrentCollections; |
|
61 | 60 |
|
62 | 61 | import java.io.IOException; |
63 | 62 | import java.util.ArrayList; |
64 | | -import java.util.Arrays; |
65 | | -import java.util.EnumSet; |
66 | 63 | import java.util.HashMap; |
67 | 64 | import java.util.Iterator; |
68 | 65 | import java.util.List; |
|
74 | 71 | import java.util.function.BiConsumer; |
75 | 72 | import java.util.function.Consumer; |
76 | 73 | import java.util.function.LongSupplier; |
77 | | -import java.util.stream.Collectors; |
78 | 74 |
|
79 | 75 | import static org.elasticsearch.action.bulk.TransportBulkAction.LAZY_ROLLOVER_ORIGIN; |
80 | 76 | import static org.elasticsearch.cluster.metadata.IndexNameExpressionResolver.EXCLUDED_DATA_STREAMS_KEY; |
@@ -283,29 +279,29 @@ private long buildTookInMillis(long startTimeNanos) { |
283 | 279 | } |
284 | 280 |
|
285 | 281 | private Map<ShardId, List<BulkItemRequest>> groupBulkRequestsByShards(ClusterState clusterState) { |
286 | | - ProjectMetadata projectMetadata = projectResolver.getProjectMetadata(clusterState); |
287 | | - |
288 | | - Set<StreamType> enabledStreamTypes = Arrays.stream(StreamType.values()) |
289 | | - .filter(t -> streamsPermissionsUtils.streamTypeIsEnabled(t, projectMetadata)) |
290 | | - .collect(Collectors.toCollection(() -> EnumSet.noneOf(StreamType.class))); |
291 | | - |
292 | | - for (StreamType streamType : enabledStreamTypes) { |
293 | | - for (int i = 0; i < bulkRequest.requests.size(); i++) { |
294 | | - DocWriteRequest<?> req = bulkRequest.requests.get(i); |
295 | | - String prefix = streamType.getStreamName() + "."; |
296 | | - if (req != null && req.index().startsWith(prefix)) { |
297 | | - IllegalArgumentException exception = new IllegalArgumentException( |
298 | | - "Writes to child stream [" |
299 | | - + req.index() |
300 | | - + "] are not allowed, use the parent stream instead: [" |
301 | | - + streamType.getStreamName() |
302 | | - + "]" |
303 | | - ); |
304 | | - IndexDocFailureStoreStatus failureStoreStatus = processFailure(new BulkItemRequest(i, req), projectMetadata, exception); |
305 | | - addFailureAndDiscardRequest(req, i, req.index(), exception, failureStoreStatus); |
306 | | - } |
307 | | - } |
308 | | - } |
| 282 | + // ProjectMetadata projectMetadata = projectResolver.getProjectMetadata(clusterState); |
| 283 | + // |
| 284 | + // Set<StreamType> enabledStreamTypes = Arrays.stream(StreamType.values()) |
| 285 | + // .filter(t -> streamsPermissionsUtils.streamTypeIsEnabled(t, projectMetadata)) |
| 286 | + // .collect(Collectors.toCollection(() -> EnumSet.noneOf(StreamType.class))); |
| 287 | + // |
| 288 | + // for (StreamType streamType : enabledStreamTypes) { |
| 289 | + // for (int i = 0; i < bulkRequest.requests.size(); i++) { |
| 290 | + // DocWriteRequest<?> req = bulkRequest.requests.get(i); |
| 291 | + // String prefix = streamType.getStreamName() + "."; |
| 292 | + // if (req != null && req.index().startsWith(prefix)) { |
| 293 | + // IllegalArgumentException exception = new IllegalArgumentException( |
| 294 | + // "Writes to child stream [" |
| 295 | + // + req.index() |
| 296 | + // + "] are not allowed, use the parent stream instead: [" |
| 297 | + // + streamType.getStreamName() |
| 298 | + // + "]" |
| 299 | + // ); |
| 300 | + // IndexDocFailureStoreStatus failureStoreStatus = processFailure(new BulkItemRequest(i, req), projectMetadata, exception); |
| 301 | + // addFailureAndDiscardRequest(req, i, req.index(), exception, failureStoreStatus); |
| 302 | + // } |
| 303 | + // } |
| 304 | + // } |
309 | 305 |
|
310 | 306 | return groupRequestsByShards( |
311 | 307 | clusterState, |
|
0 commit comments