-
Notifications
You must be signed in to change notification settings - Fork 25.2k
Correcting the index version filter in migration reindex logic #118487
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
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 |
---|---|---|
|
@@ -13,10 +13,14 @@ | |
import org.elasticsearch.action.ActionType; | ||
import org.elasticsearch.action.IndicesRequest; | ||
import org.elasticsearch.action.support.IndicesOptions; | ||
import org.elasticsearch.cluster.metadata.Metadata; | ||
import org.elasticsearch.common.io.stream.StreamInput; | ||
import org.elasticsearch.common.io.stream.StreamOutput; | ||
import org.elasticsearch.common.util.FeatureFlag; | ||
import org.elasticsearch.features.NodeFeature; | ||
import org.elasticsearch.index.Index; | ||
import org.elasticsearch.index.IndexVersion; | ||
import org.elasticsearch.index.IndexVersions; | ||
import org.elasticsearch.xcontent.ConstructingObjectParser; | ||
import org.elasticsearch.xcontent.ParseField; | ||
import org.elasticsearch.xcontent.ToXContent; | ||
|
@@ -39,10 +43,24 @@ public class ReindexDataStreamAction extends ActionType<ReindexDataStreamAction. | |
public static final ParseField SOURCE_FIELD = new ParseField("source"); | ||
public static final ParseField INDEX_FIELD = new ParseField("index"); | ||
|
||
/* | ||
* The version before which we do not support writes in the _next_ major version of Elasticsearch. For example, Elasticsearch 10.x will | ||
* not support writing to indices created before version 9.0.0. | ||
*/ | ||
private static final IndexVersion MINIMUM_WRITEABLE_VERSION_AFTER_UPGRADE = IndexVersions.UPGRADE_TO_LUCENE_10_0_0; | ||
|
||
public ReindexDataStreamAction() { | ||
super(NAME); | ||
} | ||
|
||
/* | ||
* This predicate allows through only indices that were created with a previous lucene version, meaning that they need to be reindexed | ||
* in order to be writable in the _next_ lucene version. | ||
*/ | ||
public static Predicate<Index> getOldIndexVersionPredicate(Metadata metadata) { | ||
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. nit: maybe change predicate name to 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. Err maybe not. I see that the current naming is meant to explain that you are making a predicate from the metadata |
||
return index -> metadata.index(index).getCreationVersion().onOrBefore(MINIMUM_WRITEABLE_VERSION_AFTER_UPGRADE); | ||
} | ||
|
||
public enum Mode { | ||
UPGRADE | ||
} | ||
|
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.
Good explanation and naming 👍