Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,11 @@ public void onRejection(Exception rejectedException) {
}

static void prohibitAppendWritesInBackingIndices(DocWriteRequest<?> writeRequest, Metadata metadata) {
DocWriteRequest.OpType opType = writeRequest.opType();
if ((opType == OpType.CREATE || opType == OpType.INDEX) == false) {
// op type not create or index, then bail early
return;
}
IndexAbstraction indexAbstraction = metadata.getIndicesLookup().get(writeRequest.index());
if (indexAbstraction == null) {
return;
Expand All @@ -365,7 +370,6 @@ static void prohibitAppendWritesInBackingIndices(DocWriteRequest<?> writeRequest
// so checking if write op is append-only and if so fail.
// (Updates and deletes are allowed to target a backing index)

DocWriteRequest.OpType opType = writeRequest.opType();
// CREATE op_type is considered append-only and
// INDEX op_type is considered append-only when no if_primary_term and if_seq_no is specified.
// (the latter maybe an update, but at this stage we can't determine that. In order to determine
Expand Down Expand Up @@ -524,10 +528,8 @@ protected void doRun() {
throw new IllegalArgumentException("only write ops with an op_type of create are allowed in data streams");
}

if (docWriteRequest.opType() == OpType.CREATE || docWriteRequest.opType() == OpType.INDEX) {
prohibitAppendWritesInBackingIndices(docWriteRequest, metadata);
prohibitCustomRoutingOnDataStream(docWriteRequest, metadata);
}
prohibitCustomRoutingOnDataStream(docWriteRequest, metadata);
prohibitAppendWritesInBackingIndices(docWriteRequest, metadata);
docWriteRequest.routing(metadata.resolveWriteIndexRouting(docWriteRequest.routing(), docWriteRequest.index()));
docWriteRequest.process();

Expand Down