-
Notifications
You must be signed in to change notification settings - Fork 25k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add version-based validation to reindex requests #38504
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,6 @@ | |
import org.elasticsearch.action.search.SearchRequest; | ||
import org.elasticsearch.common.io.stream.StreamInput; | ||
import org.elasticsearch.common.io.stream.StreamOutput; | ||
import org.elasticsearch.common.lucene.uid.Versions; | ||
import org.elasticsearch.common.xcontent.ToXContentObject; | ||
import org.elasticsearch.common.xcontent.XContentBuilder; | ||
import org.elasticsearch.index.VersionType; | ||
|
@@ -37,7 +36,6 @@ | |
import java.io.IOException; | ||
|
||
import static org.elasticsearch.action.ValidateActions.addValidationError; | ||
import static org.elasticsearch.index.VersionType.INTERNAL; | ||
|
||
/** | ||
* Request to reindex some documents from one index to another. This implements CompositeIndicesRequest but in a misleading way. Rather than | ||
|
@@ -100,11 +98,9 @@ public ActionRequestValidationException validate() { | |
if (false == routingIsValid()) { | ||
e = addValidationError("routing must be unset, [keep], [discard] or [=<some new value>]", e); | ||
} | ||
if (destination.versionType() == INTERNAL) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is stronger than what There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note that the next line here says:
and
These look equivalent to me? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
fair enough (those were folded away and I missed them). Also that would have meant this can't go to 6.x 🤷♂️ |
||
if (destination.version() != Versions.MATCH_ANY && destination.version() != Versions.MATCH_DELETED) { | ||
e = addValidationError("unsupported version for internal versioning [" + destination.version() + ']', e); | ||
} | ||
} | ||
|
||
e = destination.validateVersionAndSeqNoBasedCASParams(e); | ||
|
||
if (getRemoteInfo() != null) { | ||
if (getSearchRequest().source().query() != null) { | ||
e = addValidationError("reindex from remote sources should use RemoteInfo's query instead of source's query", e); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 to default. Nicer.