Skip to content
Merged
Show file tree
Hide file tree
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 @@ -68,10 +68,11 @@ public abstract class AbstractFeatureMigrationIntegTest extends ESIntegTestCase
static final String INTERNAL_MANAGED_INDEX_NAME = ".int-man-old";
static final int INDEX_DOC_COUNT = 100; // arbitrarily chosen
static final int INTERNAL_MANAGED_FLAG_VALUE = 1;
public static final Version NEEDS_UPGRADE_VERSION = TransportGetFeatureUpgradeStatusAction.NO_UPGRADE_REQUIRED_VERSION.previousMajor();
public static final IndexVersion NEEDS_UPGRADE_INDEX_VERSION = IndexVersionUtils.getPreviousMajorVersion(
static final String FIELD_NAME = "some_field";
protected static final IndexVersion NEEDS_UPGRADE_INDEX_VERSION = IndexVersionUtils.getPreviousMajorVersion(
TransportGetFeatureUpgradeStatusAction.NO_UPGRADE_REQUIRED_INDEX_VERSION
);
protected static final int UPGRADED_TO_VERSION = TransportGetFeatureUpgradeStatusAction.NO_UPGRADE_REQUIRED_VERSION.major + 1;

static final SystemIndexDescriptor EXTERNAL_UNMANAGED = SystemIndexDescriptor.builder()
.setIndexPattern(".ext-unman-*")
Expand Down Expand Up @@ -131,11 +132,6 @@ public abstract class AbstractFeatureMigrationIntegTest extends ESIntegTestCase

@Before
public void setup() {
assumeTrue(
"We can only create the test indices we need if they're in the previous major version",
NEEDS_UPGRADE_VERSION.onOrAfter(Version.CURRENT.previousMajor())
);

internalCluster().setBootstrapMasterNodeIndex(0);
masterName = internalCluster().startMasterOnlyNode();
masterAndDataNode = internalCluster().startNode();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,31 +208,31 @@ public void testMigrateInternalManagedSystemIndex() throws Exception {

assertIndexHasCorrectProperties(
finalMetadata,
".int-man-old-reindexed-for-9",
".int-man-old-reindexed-for-" + UPGRADED_TO_VERSION,
INTERNAL_MANAGED_FLAG_VALUE,
true,
true,
Arrays.asList(".int-man-old", ".internal-managed-alias")
);
assertIndexHasCorrectProperties(
finalMetadata,
".int-unman-old-reindexed-for-9",
".int-unman-old-reindexed-for-" + UPGRADED_TO_VERSION,
INTERNAL_UNMANAGED_FLAG_VALUE,
false,
true,
Collections.singletonList(".int-unman-old")
);
assertIndexHasCorrectProperties(
finalMetadata,
".ext-man-old-reindexed-for-9",
".ext-man-old-reindexed-for-" + UPGRADED_TO_VERSION,
EXTERNAL_MANAGED_FLAG_VALUE,
true,
false,
Arrays.asList(".ext-man-old", ".external-managed-alias")
);
assertIndexHasCorrectProperties(
finalMetadata,
".ext-unman-old-reindexed-for-9",
".ext-unman-old-reindexed-for-" + UPGRADED_TO_VERSION,
EXTERNAL_UNMANAGED_FLAG_VALUE,
false,
false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,31 +218,31 @@ public void testMultipleFeatureMigration() throws Exception {
// Finally, verify that all the indices exist and have the properties we expect.
assertIndexHasCorrectProperties(
finalMetadata,
".int-man-old-reindexed-for-9",
".int-man-old-reindexed-for-" + UPGRADED_TO_VERSION,
INTERNAL_MANAGED_FLAG_VALUE,
true,
true,
Arrays.asList(".int-man-old", ".internal-managed-alias")
);
assertIndexHasCorrectProperties(
finalMetadata,
".int-unman-old-reindexed-for-9",
".int-unman-old-reindexed-for-" + UPGRADED_TO_VERSION,
INTERNAL_UNMANAGED_FLAG_VALUE,
false,
true,
Collections.singletonList(".int-unman-old")
);
assertIndexHasCorrectProperties(
finalMetadata,
".ext-man-old-reindexed-for-9",
".ext-man-old-reindexed-for-" + UPGRADED_TO_VERSION,
EXTERNAL_MANAGED_FLAG_VALUE,
true,
false,
Arrays.asList(".ext-man-old", ".external-managed-alias")
);
assertIndexHasCorrectProperties(
finalMetadata,
".ext-unman-old-reindexed-for-9",
".ext-unman-old-reindexed-for-" + UPGRADED_TO_VERSION,
EXTERNAL_UNMANAGED_FLAG_VALUE,
false,
false,
Expand All @@ -251,7 +251,7 @@ public void testMultipleFeatureMigration() throws Exception {

assertIndexHasCorrectProperties(
finalMetadata,
".second-int-man-old-reindexed-for-9",
".second-int-man-old-reindexed-for-" + UPGRADED_TO_VERSION,
SECOND_FEATURE_IDX_FLAG_VALUE,
true,
true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.common.util.concurrent.EsExecutors;
import org.elasticsearch.core.UpdateForV10;
import org.elasticsearch.index.IndexVersion;
import org.elasticsearch.index.IndexVersions;
import org.elasticsearch.indices.SystemIndices;
import org.elasticsearch.injection.guice.Inject;
import org.elasticsearch.persistent.PersistentTasksCustomMetadata;
import org.elasticsearch.persistent.PersistentTasksService;
import org.elasticsearch.tasks.Task;
import org.elasticsearch.threadpool.ThreadPool;
import org.elasticsearch.transport.TransportService;
Expand Down Expand Up @@ -53,13 +53,13 @@ public class TransportGetFeatureUpgradeStatusAction extends TransportMasterNodeA
GetFeatureUpgradeStatusResponse> {

/**
* Once all feature migrations for 9.x -> 10.x have been tested, we can bump this to Version.V_9_0_0
* These versions should be set to current major and current major's index version
*/
public static final Version NO_UPGRADE_REQUIRED_VERSION = Version.V_8_0_0;
public static final IndexVersion NO_UPGRADE_REQUIRED_INDEX_VERSION = IndexVersions.V_8_0_0;
@UpdateForV10(owner = UpdateForV10.Owner.CORE_INFRA)
public static final Version NO_UPGRADE_REQUIRED_VERSION = Version.V_9_0_0;
public static final IndexVersion NO_UPGRADE_REQUIRED_INDEX_VERSION = IndexVersions.UPGRADE_TO_LUCENE_10_0_0;

private final SystemIndices systemIndices;
PersistentTasksService persistentTasksService;

@Inject
public TransportGetFeatureUpgradeStatusAction(
Expand All @@ -68,7 +68,6 @@ public TransportGetFeatureUpgradeStatusAction(
ActionFilters actionFilters,
ClusterService clusterService,
IndexNameExpressionResolver indexNameExpressionResolver,
PersistentTasksService persistentTasksService,
SystemIndices systemIndices
) {
super(
Expand All @@ -83,7 +82,6 @@ public TransportGetFeatureUpgradeStatusAction(
);

this.systemIndices = systemIndices;
this.persistentTasksService = persistentTasksService;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import org.apache.lucene.util.automaton.CharacterRunAutomaton;
import org.apache.lucene.util.automaton.Operations;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.admin.cluster.migration.TransportGetFeatureUpgradeStatusAction;
import org.elasticsearch.action.admin.cluster.snapshots.features.ResetFeatureStateResponse.ResetFeatureStateStatus;
import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest;
import org.elasticsearch.action.admin.indices.delete.TransportDeleteIndexAction;
Expand Down Expand Up @@ -110,7 +111,8 @@
public class SystemIndices {
public static final String SYSTEM_INDEX_ACCESS_CONTROL_HEADER_KEY = "_system_index_access_allowed";
public static final String EXTERNAL_SYSTEM_INDEX_ACCESS_CONTROL_HEADER_KEY = "_external_system_index_access_origin";
public static final String UPGRADED_INDEX_SUFFIX = "-reindexed-for-9";
private static final int UPGRADED_TO_VERSION = TransportGetFeatureUpgradeStatusAction.NO_UPGRADE_REQUIRED_VERSION.major + 1;
public static final String UPGRADED_INDEX_SUFFIX = "-reindexed-for-" + UPGRADED_TO_VERSION;

private static final Automaton EMPTY = Automata.makeEmpty();

Expand Down