Skip to content

Commit c2cf6c5

Browse files
committed
SNAPSHOT - Shell of functionality, ready to slot in read only check
1 parent e948894 commit c2cf6c5

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/deprecation/DeprecatedIndexPredicate.java

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,16 @@ public class DeprecatedIndexPredicate {
2020

2121
public static final IndexVersion MINIMUM_WRITEABLE_VERSION_AFTER_UPGRADE = IndexVersions.UPGRADE_TO_LUCENE_10_0_0;
2222

23-
/*
23+
/**
2424
* This predicate allows through only indices that were created with a previous lucene version, meaning that they need to be reindexed
25-
* in order to be writable in the _next_ lucene version.
25+
* in order to be writable in the _next_ lucene version. It excludes searchable snapshots as they are not writable.
2626
*
2727
* It ignores searchable snapshots as they are not writable.
28+
*
29+
* @param metadata the cluster metadata
30+
* @param filterToBlockedStatus if true, only indices that are write blocked will be returned,
31+
* if false, only those without a block are returned
32+
* @return a predicate that returns true for indices that need to be reindexed
2833
*/
2934
public static Predicate<Index> getReindexRequiredPredicate(Metadata metadata, boolean filterToBlockedStatus) {
3035
return index -> {
@@ -33,6 +38,15 @@ public static Predicate<Index> getReindexRequiredPredicate(Metadata metadata, bo
3338
};
3439
}
3540

41+
/**
42+
* This method check if the indices that were created with a previous lucene version, meaning that they need to be reindexed
43+
* in order to be writable in the _next_ lucene version. It excludes searchable snapshots as they are not writable.
44+
*
45+
* @param indexMetadata the index metadata
46+
* @param filterToBlockedStatus if true, only indices that are write blocked will be returned,
47+
* if false, only those without a block are returned
48+
* @return a predicate that returns true for indices that need to be reindexed
49+
*/
3650
public static boolean reindexRequired(IndexMetadata indexMetadata, boolean filterToBlockedStatus) {
3751
return creationVersionBeforeMinimumWritableVersion(indexMetadata)
3852
&& isNotSearchableSnapshot(indexMetadata)

x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/DataStreamDeprecationChecks.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ static DeprecationIssue oldIndicesCheck(DataStream dataStream, ClusterState clus
4848
static DeprecationIssue ignoredOldIndicesCheck(DataStream dataStream, ClusterState clusterState) {
4949
List<Index> backingIndices = dataStream.getIndices();
5050

51-
Set<String> ignoredIndices = getReIndexRequiredIndices(backingIndices, clusterState, false);
51+
Set<String> ignoredIndices = getReIndexRequiredIndices(backingIndices, clusterState, true);
5252

5353
if (ignoredIndices.isEmpty() == false) {
5454
return new DeprecationIssue(

0 commit comments

Comments
 (0)