Clean up even more instances of "metaData"

We recently cleaned up the use of the word "metadata" across the
codebase. Even more additional uses have trickled in, likely from
in-progress work. This commit cleans up these last few additional
instances.

Relates #54519
This commit is contained in:
Jason Tedor 2020-04-10 08:51:40 -04:00
parent 9eeae59a83
commit a370668fcc
No known key found for this signature in database
GPG Key ID: FA89F05560F16BC5
4 changed files with 39 additions and 39 deletions

View File

@ -64,13 +64,13 @@ public class CleanupSnapshotStepTests extends AbstractStepTestCase<CleanupSnapsh
IndexMetadata.builder(indexName).settings(settings(Version.CURRENT).put(LifecycleSettings.LIFECYCLE_NAME, policyName))
.numberOfShards(randomIntBetween(1, 5)).numberOfReplicas(randomIntBetween(0, 5));
IndexMetadata indexMetaData = indexMetadataBuilder.build();
IndexMetadata indexMetadata = indexMetadataBuilder.build();
ClusterState clusterState =
ClusterState.builder(emptyClusterState()).metadata(Metadata.builder().put(indexMetaData, true).build()).build();
ClusterState.builder(emptyClusterState()).metadata(Metadata.builder().put(indexMetadata, true).build()).build();
CleanupSnapshotStep cleanupSnapshotStep = createRandomInstance();
cleanupSnapshotStep.performAction(indexMetaData, clusterState, null, new AsyncActionStep.Listener() {
cleanupSnapshotStep.performAction(indexMetadata, clusterState, null, new AsyncActionStep.Listener() {
@Override
public void onResponse(boolean complete) {
assertThat(complete, is(true));
@ -91,13 +91,13 @@ public class CleanupSnapshotStepTests extends AbstractStepTestCase<CleanupSnapsh
Map<String, String> ilmCustom = org.elasticsearch.common.collect.Map.of("snapshot_repository", "repository_name");
indexMetadataBuilder.putCustom(LifecycleExecutionState.ILM_CUSTOM_METADATA_KEY, ilmCustom);
IndexMetadata indexMetaData = indexMetadataBuilder.build();
IndexMetadata indexMetadata = indexMetadataBuilder.build();
ClusterState clusterState =
ClusterState.builder(emptyClusterState()).metadata(Metadata.builder().put(indexMetaData, true).build()).build();
ClusterState.builder(emptyClusterState()).metadata(Metadata.builder().put(indexMetadata, true).build()).build();
CleanupSnapshotStep cleanupSnapshotStep = createRandomInstance();
cleanupSnapshotStep.performAction(indexMetaData, clusterState, null, new AsyncActionStep.Listener() {
cleanupSnapshotStep.performAction(indexMetadata, clusterState, null, new AsyncActionStep.Listener() {
@Override
public void onResponse(boolean complete) {
assertThat(complete, is(true));
@ -122,14 +122,14 @@ public class CleanupSnapshotStepTests extends AbstractStepTestCase<CleanupSnapsh
IndexMetadata.builder(indexName).settings(settings(Version.CURRENT).put(LifecycleSettings.LIFECYCLE_NAME, policyName))
.putCustom(LifecycleExecutionState.ILM_CUSTOM_METADATA_KEY, ilmCustom)
.numberOfShards(randomIntBetween(1, 5)).numberOfReplicas(randomIntBetween(0, 5));
IndexMetadata indexMetaData = indexMetadataBuilder.build();
IndexMetadata indexMetadata = indexMetadataBuilder.build();
ClusterState clusterState =
ClusterState.builder(emptyClusterState()).metadata(Metadata.builder().put(indexMetaData, true).build()).build();
ClusterState.builder(emptyClusterState()).metadata(Metadata.builder().put(indexMetadata, true).build()).build();
try (NoOpClient client = getDeleteSnapshotRequestAssertingClient(snapshotName)) {
CleanupSnapshotStep step = new CleanupSnapshotStep(randomStepKey(), randomStepKey(), client);
step.performAction(indexMetaData, clusterState, null, new AsyncActionStep.Listener() {
step.performAction(indexMetadata, clusterState, null, new AsyncActionStep.Listener() {
@Override
public void onResponse(boolean complete) {
}

View File

@ -69,13 +69,13 @@ public class CreateSnapshotStepTests extends AbstractStepTestCase<CreateSnapshot
ilmCustom.put("snapshot_repository", repository);
indexMetadataBuilder.putCustom(LifecycleExecutionState.ILM_CUSTOM_METADATA_KEY, ilmCustom);
IndexMetadata indexMetaData = indexMetadataBuilder.build();
IndexMetadata indexMetadata = indexMetadataBuilder.build();
ClusterState clusterState =
ClusterState.builder(emptyClusterState()).metadata(Metadata.builder().put(indexMetaData, true).build()).build();
ClusterState.builder(emptyClusterState()).metadata(Metadata.builder().put(indexMetadata, true).build()).build();
CreateSnapshotStep createSnapshotStep = createRandomInstance();
createSnapshotStep.performAction(indexMetaData, clusterState, null, new AsyncActionStep.Listener() {
createSnapshotStep.performAction(indexMetadata, clusterState, null, new AsyncActionStep.Listener() {
@Override
public void onResponse(boolean complete) {
fail("expecting a failure as the index doesn't have any snapshot name in its ILM execution state");
@ -94,13 +94,13 @@ public class CreateSnapshotStepTests extends AbstractStepTestCase<CreateSnapshot
IndexMetadata.Builder indexMetadataBuilder =
IndexMetadata.builder(indexName).settings(settings(Version.CURRENT).put(LifecycleSettings.LIFECYCLE_NAME, policyName))
.numberOfShards(randomIntBetween(1, 5)).numberOfReplicas(randomIntBetween(0, 5));
IndexMetadata indexMetaData = indexMetadataBuilder.build();
IndexMetadata indexMetadata = indexMetadataBuilder.build();
ClusterState clusterState =
ClusterState.builder(emptyClusterState()).metadata(Metadata.builder().put(indexMetaData, true).build()).build();
ClusterState.builder(emptyClusterState()).metadata(Metadata.builder().put(indexMetadata, true).build()).build();
CreateSnapshotStep createSnapshotStep = createRandomInstance();
createSnapshotStep.performAction(indexMetaData, clusterState, null, new AsyncActionStep.Listener() {
createSnapshotStep.performAction(indexMetadata, clusterState, null, new AsyncActionStep.Listener() {
@Override
public void onResponse(boolean complete) {
fail("expecting a failure as the index doesn't have any snapshot name in its ILM execution state");
@ -129,14 +129,14 @@ public class CreateSnapshotStepTests extends AbstractStepTestCase<CreateSnapshot
IndexMetadata.builder(indexName).settings(settings(Version.CURRENT).put(LifecycleSettings.LIFECYCLE_NAME, policyName))
.putCustom(LifecycleExecutionState.ILM_CUSTOM_METADATA_KEY, ilmCustom)
.numberOfShards(randomIntBetween(1, 5)).numberOfReplicas(randomIntBetween(0, 5));
IndexMetadata indexMetaData = indexMetadataBuilder.build();
IndexMetadata indexMetadata = indexMetadataBuilder.build();
ClusterState clusterState =
ClusterState.builder(emptyClusterState()).metadata(Metadata.builder().put(indexMetaData, true).build()).build();
ClusterState.builder(emptyClusterState()).metadata(Metadata.builder().put(indexMetadata, true).build()).build();
try (NoOpClient client = getCreateSnapshotRequestAssertingClient(repository, snapshotName, indexName)) {
CreateSnapshotStep step = new CreateSnapshotStep(randomStepKey(), randomStepKey(), client);
step.performAction(indexMetaData, clusterState, null, new AsyncActionStep.Listener() {
step.performAction(indexMetadata, clusterState, null, new AsyncActionStep.Listener() {
@Override
public void onResponse(boolean complete) {
}

View File

@ -75,13 +75,13 @@ public class MountSnapshotStepTests extends AbstractStepTestCase<MountSnapshotSt
IndexMetadata.Builder indexMetadataBuilder =
IndexMetadata.builder(indexName).settings(settings(Version.CURRENT).put(LifecycleSettings.LIFECYCLE_NAME, policyName))
.numberOfShards(randomIntBetween(1, 5)).numberOfReplicas(randomIntBetween(0, 5));
IndexMetadata indexMetaData = indexMetadataBuilder.build();
IndexMetadata indexMetadata = indexMetadataBuilder.build();
ClusterState clusterState =
ClusterState.builder(emptyClusterState()).metadata(Metadata.builder().put(indexMetaData, true).build()).build();
ClusterState.builder(emptyClusterState()).metadata(Metadata.builder().put(indexMetadata, true).build()).build();
MountSnapshotStep mountSnapshotStep = createRandomInstance();
mountSnapshotStep.performAction(indexMetaData, clusterState, null, new AsyncActionStep.Listener() {
mountSnapshotStep.performAction(indexMetadata, clusterState, null, new AsyncActionStep.Listener() {
@Override
public void onResponse(boolean complete) {
fail("expecting a failure as the index doesn't have any repository name in its ILM execution state");
@ -104,13 +104,13 @@ public class MountSnapshotStepTests extends AbstractStepTestCase<MountSnapshotSt
String repository = "repository";
ilmCustom.put("snapshot_repository", repository);
indexMetadataBuilder.putCustom(LifecycleExecutionState.ILM_CUSTOM_METADATA_KEY, ilmCustom);
IndexMetadata indexMetaData = indexMetadataBuilder.build();
IndexMetadata indexMetadata = indexMetadataBuilder.build();
ClusterState clusterState =
ClusterState.builder(emptyClusterState()).metadata(Metadata.builder().put(indexMetaData, true).build()).build();
ClusterState.builder(emptyClusterState()).metadata(Metadata.builder().put(indexMetadata, true).build()).build();
MountSnapshotStep mountSnapshotStep = createRandomInstance();
mountSnapshotStep.performAction(indexMetaData, clusterState, null, new AsyncActionStep.Listener() {
mountSnapshotStep.performAction(indexMetadata, clusterState, null, new AsyncActionStep.Listener() {
@Override
public void onResponse(boolean complete) {
fail("expecting a failure as the index doesn't have any snapshot name in its ILM execution state");
@ -139,14 +139,14 @@ public class MountSnapshotStepTests extends AbstractStepTestCase<MountSnapshotSt
IndexMetadata.builder(indexName).settings(settings(Version.CURRENT).put(LifecycleSettings.LIFECYCLE_NAME, policyName))
.putCustom(LifecycleExecutionState.ILM_CUSTOM_METADATA_KEY, ilmCustom)
.numberOfShards(randomIntBetween(1, 5)).numberOfReplicas(randomIntBetween(0, 5));
IndexMetadata indexMetaData = indexMetadataBuilder.build();
IndexMetadata indexMetadata = indexMetadataBuilder.build();
ClusterState clusterState =
ClusterState.builder(emptyClusterState()).metadata(Metadata.builder().put(indexMetaData, true).build()).build();
ClusterState.builder(emptyClusterState()).metadata(Metadata.builder().put(indexMetadata, true).build()).build();
try (NoOpClient client = getRestoreSnapshotRequestAssertingClient(repository, snapshotName, indexName, RESTORED_INDEX_PREFIX)) {
MountSnapshotStep step = new MountSnapshotStep(randomStepKey(), randomStepKey(), client, RESTORED_INDEX_PREFIX);
step.performAction(indexMetaData, clusterState, null, new AsyncActionStep.Listener() {
step.performAction(indexMetadata, clusterState, null, new AsyncActionStep.Listener() {
@Override
public void onResponse(boolean complete) {
assertThat(complete, is(true));
@ -173,17 +173,17 @@ public class MountSnapshotStepTests extends AbstractStepTestCase<MountSnapshotSt
IndexMetadata.builder(indexName).settings(settings(Version.CURRENT).put(LifecycleSettings.LIFECYCLE_NAME, policyName))
.putCustom(LifecycleExecutionState.ILM_CUSTOM_METADATA_KEY, ilmCustom)
.numberOfShards(randomIntBetween(1, 5)).numberOfReplicas(randomIntBetween(0, 5));
IndexMetadata indexMetaData = indexMetadataBuilder.build();
IndexMetadata indexMetadata = indexMetadataBuilder.build();
ClusterState clusterState =
ClusterState.builder(emptyClusterState()).metadata(Metadata.builder().put(indexMetaData, true).build()).build();
ClusterState.builder(emptyClusterState()).metadata(Metadata.builder().put(indexMetadata, true).build()).build();
{
RestoreSnapshotResponse responseWithOKStatus = new RestoreSnapshotResponse(new RestoreInfo("test", List.of(), 1, 1));
try (NoOpClient clientPropagatingOKResponse = getClientTriggeringResponse(responseWithOKStatus)) {
MountSnapshotStep step = new MountSnapshotStep(randomStepKey(), randomStepKey(), clientPropagatingOKResponse,
RESTORED_INDEX_PREFIX);
step.performAction(indexMetaData, clusterState, null, new AsyncActionStep.Listener() {
step.performAction(indexMetadata, clusterState, null, new AsyncActionStep.Listener() {
@Override
public void onResponse(boolean complete) {
assertThat(complete, is(true));
@ -202,7 +202,7 @@ public class MountSnapshotStepTests extends AbstractStepTestCase<MountSnapshotSt
try (NoOpClient clientPropagatingACCEPTEDResponse = getClientTriggeringResponse(responseWithACCEPTEDStatus)) {
MountSnapshotStep step = new MountSnapshotStep(randomStepKey(), randomStepKey(), clientPropagatingACCEPTEDResponse,
RESTORED_INDEX_PREFIX);
step.performAction(indexMetaData, clusterState, null, new AsyncActionStep.Listener() {
step.performAction(indexMetadata, clusterState, null, new AsyncActionStep.Listener() {
@Override
public void onResponse(boolean complete) {
assertThat(complete, is(true));

View File

@ -80,8 +80,8 @@ public class SwapAliasesAndDeleteSourceIndexStepTests extends AbstractStepTestCa
aliasBuilder.indexRouting(randomAlphaOfLengthBetween(1, 10));
}
aliasBuilder.writeIndex(randomBoolean());
AliasMetadata aliasMetaData = aliasBuilder.build();
IndexMetadata sourceIndexMetaData = sourceIndexMetadataBuilder.putAlias(aliasMetaData).build();
AliasMetadata aliasMetadata = aliasBuilder.build();
IndexMetadata sourceIndexMetadata = sourceIndexMetadataBuilder.putAlias(aliasMetadata).build();
String targetIndexPrefix = "index_prefix";
String targetIndexName = targetIndexPrefix + sourceIndexName;
@ -89,26 +89,26 @@ public class SwapAliasesAndDeleteSourceIndexStepTests extends AbstractStepTestCa
List<AliasActions> expectedAliasActions = Arrays.asList(
AliasActions.removeIndex().index(sourceIndexName),
AliasActions.add().index(targetIndexName).alias(sourceIndexName),
AliasActions.add().index(targetIndexName).alias(aliasMetaData.alias())
.searchRouting(aliasMetaData.searchRouting()).indexRouting(aliasMetaData.indexRouting())
AliasActions.add().index(targetIndexName).alias(aliasMetadata.alias())
.searchRouting(aliasMetadata.searchRouting()).indexRouting(aliasMetadata.indexRouting())
.writeIndex(null));
try (NoOpClient client = getIndicesAliasAssertingClient(expectedAliasActions)) {
SwapAliasesAndDeleteSourceIndexStep step = new SwapAliasesAndDeleteSourceIndexStep(randomStepKey(), randomStepKey(),
client, targetIndexPrefix);
IndexMetadata.Builder targetIndexMetaDataBuilder = IndexMetadata.builder(targetIndexName).settings(settings(Version.CURRENT))
IndexMetadata.Builder targetIndexMetadataBuilder = IndexMetadata.builder(targetIndexName).settings(settings(Version.CURRENT))
.numberOfShards(randomIntBetween(1, 5)).numberOfReplicas(randomIntBetween(0, 5));
ClusterState clusterState = ClusterState.builder(emptyClusterState())
.metadata(
Metadata.builder()
.put(sourceIndexMetaData, true)
.put(targetIndexMetaDataBuilder)
.put(sourceIndexMetadata, true)
.put(targetIndexMetadataBuilder)
.build()
).build();
step.performAction(sourceIndexMetaData, clusterState, null, new Listener() {
step.performAction(sourceIndexMetadata, clusterState, null, new Listener() {
@Override
public void onResponse(boolean complete) {
}