Remove action.allow_id_generation setting (#23120)
This was an undocumented and unsettable setting that allowed id generation. Resolves #23088
This commit is contained in:
parent
1ba73d9797
commit
13446937a5
|
@ -82,7 +82,6 @@ import java.util.stream.Collectors;
|
|||
public class TransportBulkAction extends HandledTransportAction<BulkRequest, BulkResponse> {
|
||||
|
||||
private final AutoCreateIndex autoCreateIndex;
|
||||
private final boolean allowIdGeneration;
|
||||
private final ClusterService clusterService;
|
||||
private final IngestService ingestService;
|
||||
private final TransportShardBulkAction shardBulkAction;
|
||||
|
@ -115,7 +114,6 @@ public class TransportBulkAction extends HandledTransportAction<BulkRequest, Bul
|
|||
this.shardBulkAction = shardBulkAction;
|
||||
this.createIndexAction = createIndexAction;
|
||||
this.autoCreateIndex = autoCreateIndex;
|
||||
this.allowIdGeneration = this.settings.getAsBoolean("action.bulk.action.allow_id_generation", true);
|
||||
this.relativeTimeProvider = relativeTimeProvider;
|
||||
this.ingestForwarder = new IngestActionForwarder(transportService);
|
||||
clusterService.addStateApplier(this.ingestForwarder);
|
||||
|
@ -267,7 +265,7 @@ public class TransportBulkAction extends HandledTransportAction<BulkRequest, Bul
|
|||
mappingMd = indexMetaData.mappingOrDefault(indexRequest.type());
|
||||
}
|
||||
indexRequest.resolveRouting(metaData);
|
||||
indexRequest.process(mappingMd, allowIdGeneration, concreteIndex.getName());
|
||||
indexRequest.process(mappingMd, concreteIndex.getName());
|
||||
break;
|
||||
case UPDATE:
|
||||
TransportUpdateAction.resolveAndValidateRouting(metaData, concreteIndex.getName(), (UpdateRequest) docWriteRequest);
|
||||
|
|
|
@ -72,7 +72,6 @@ public class TransportShardBulkAction extends TransportWriteAction<BulkShardRequ
|
|||
public static final String ACTION_NAME = BulkAction.NAME + "[s]";
|
||||
|
||||
private final UpdateHelper updateHelper;
|
||||
private final boolean allowIdGeneration;
|
||||
private final MappingUpdatedAction mappingUpdatedAction;
|
||||
|
||||
@Inject
|
||||
|
@ -83,7 +82,6 @@ public class TransportShardBulkAction extends TransportWriteAction<BulkShardRequ
|
|||
super(settings, ACTION_NAME, transportService, clusterService, indicesService, threadPool, shardStateAction, actionFilters,
|
||||
indexNameExpressionResolver, BulkShardRequest::new, BulkShardRequest::new, ThreadPool.Names.BULK);
|
||||
this.updateHelper = updateHelper;
|
||||
this.allowIdGeneration = settings.getAsBoolean("action.allow_id_generation", true);
|
||||
this.mappingUpdatedAction = mappingUpdatedAction;
|
||||
}
|
||||
|
||||
|
@ -281,7 +279,7 @@ public class TransportShardBulkAction extends TransportWriteAction<BulkShardRequ
|
|||
case UPDATED:
|
||||
IndexRequest indexRequest = translate.action();
|
||||
MappingMetaData mappingMd = metaData.mappingOrDefault(indexRequest.type());
|
||||
indexRequest.process(mappingMd, allowIdGeneration, request.index());
|
||||
indexRequest.process(mappingMd, request.index());
|
||||
updateOperationResult = executeIndexRequestOnPrimary(indexRequest, primary, mappingUpdatedAction);
|
||||
if (updateOperationResult.hasFailure() == false) {
|
||||
// update the version on request so it will happen on the replicas
|
||||
|
|
|
@ -526,7 +526,7 @@ public class IndexRequest extends ReplicatedWriteRequest<IndexRequest> implement
|
|||
}
|
||||
|
||||
|
||||
public void process(@Nullable MappingMetaData mappingMd, boolean allowIdGeneration, String concreteIndex) {
|
||||
public void process(@Nullable MappingMetaData mappingMd, String concreteIndex) {
|
||||
if (mappingMd != null) {
|
||||
// might as well check for routing here
|
||||
if (mappingMd.routing().required() && routing == null) {
|
||||
|
@ -542,9 +542,9 @@ public class IndexRequest extends ReplicatedWriteRequest<IndexRequest> implement
|
|||
}
|
||||
}
|
||||
|
||||
// generate id if not already provided and id generation is allowed
|
||||
if (allowIdGeneration && id == null) {
|
||||
assert autoGeneratedTimestamp == -1;
|
||||
// generate id if not already provided
|
||||
if (id == null) {
|
||||
assert autoGeneratedTimestamp == -1 : "timestamp has already been generated!";
|
||||
autoGeneratedTimestamp = Math.max(0, System.currentTimeMillis()); // extra paranoia
|
||||
id(UUIDs.base64UUID());
|
||||
}
|
||||
|
|
|
@ -122,10 +122,10 @@ public class IndexRequestTests extends ESTestCase {
|
|||
|
||||
public void testAutoGenIdTimestampIsSet() {
|
||||
IndexRequest request = new IndexRequest("index", "type");
|
||||
request.process(null, true, "index");
|
||||
request.process(null, "index");
|
||||
assertTrue("expected > 0 but got: " + request.getAutoGeneratedTimestamp(), request.getAutoGeneratedTimestamp() > 0);
|
||||
request = new IndexRequest("index", "type", "1");
|
||||
request.process(null, true, "index");
|
||||
request.process(null, "index");
|
||||
assertEquals(IndexRequest.UNSET_AUTO_GENERATED_TIMESTAMP, request.getAutoGeneratedTimestamp());
|
||||
}
|
||||
|
||||
|
|
|
@ -490,7 +490,7 @@ public abstract class ESIndexLevelReplicationTestCase extends IndexShardTestCase
|
|||
|
||||
IndexingAction(IndexRequest request, ActionListener<IndexResponse> listener, ReplicationGroup replicationGroup) {
|
||||
super(request, listener, replicationGroup, "indexing");
|
||||
request.process(null, true, request.index());
|
||||
request.process(null, request.index());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue