Skip to content

Commit 19772b6

Browse files
committed
Fix merge errors
1 parent 3a6203f commit 19772b6

30 files changed

+191
-191
lines changed

server/src/test/java/org/elasticsearch/cluster/routing/allocation/AllocationServiceTests.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
import org.elasticsearch.cluster.ClusterName;
2424
import org.elasticsearch.cluster.ClusterState;
2525
import org.elasticsearch.cluster.EmptyClusterInfoService;
26-
import org.elasticsearch.cluster.metadata.IndexMetaData;
27-
import org.elasticsearch.cluster.metadata.MetaData;
26+
import org.elasticsearch.cluster.metadata.IndexMetadata;
27+
import org.elasticsearch.cluster.metadata.Metadata;
2828
import org.elasticsearch.cluster.node.DiscoveryNode;
2929
import org.elasticsearch.cluster.node.DiscoveryNodes;
3030
import org.elasticsearch.cluster.routing.IndexRoutingTable;
@@ -138,7 +138,7 @@ public ShardAllocationDecision decideShardAllocation(ShardRouting shard, Routing
138138
}, new EmptyClusterInfoService());
139139

140140
final String unrealisticAllocatorName = "unrealistic";
141-
final Map<String,ExistingShardsAllocator> allocatorMap = new HashMap<>();
141+
final Map<String, ExistingShardsAllocator> allocatorMap = new HashMap<>();
142142
final TestGatewayAllocator testGatewayAllocator = new TestGatewayAllocator();
143143
allocatorMap.put(GatewayAllocator.ALLOCATOR_NAME, testGatewayAllocator);
144144
allocatorMap.put(unrealisticAllocatorName, new UnrealisticAllocator());
@@ -149,20 +149,20 @@ public ShardAllocationDecision decideShardAllocation(ShardRouting shard, Routing
149149
nodesBuilder.add(new DiscoveryNode("node2", buildNewFakeTransportAddress(), Version.CURRENT));
150150
nodesBuilder.add(new DiscoveryNode("node3", buildNewFakeTransportAddress(), Version.CURRENT));
151151

152-
final MetaData.Builder metaData = MetaData.builder()
152+
final Metadata.Builder metaData = Metadata.builder()
153153
// create 3 indices with different priorities. The high and low priority indices use the default allocator which (in this test)
154154
// does not allocate any replicas, whereas the medium priority one uses the unrealistic allocator which does allocate replicas
155155
.put(indexMetadata("highPriority", Settings.builder()
156-
.put(IndexMetaData.SETTING_PRIORITY, 10)))
156+
.put(IndexMetadata.SETTING_PRIORITY, 10)))
157157
.put(indexMetadata("mediumPriority", Settings.builder()
158-
.put(IndexMetaData.SETTING_PRIORITY, 5)
158+
.put(IndexMetadata.SETTING_PRIORITY, 5)
159159
.put(ExistingShardsAllocator.EXISTING_SHARDS_ALLOCATOR_SETTING.getKey(), unrealisticAllocatorName)))
160160
.put(indexMetadata("lowPriority", Settings.builder()
161-
.put(IndexMetaData.SETTING_PRIORITY, 3)))
161+
.put(IndexMetadata.SETTING_PRIORITY, 3)))
162162

163163
// also create a 4th index with arbitrary priority and an invalid allocator that we expect to ignore
164164
.put(indexMetadata("invalid", Settings.builder()
165-
.put(IndexMetaData.SETTING_PRIORITY, between(0, 15))
165+
.put(IndexMetadata.SETTING_PRIORITY, between(0, 15))
166166
.put(ExistingShardsAllocator.EXISTING_SHARDS_ALLOCATOR_SETTING.getKey(), "unknown")));
167167

168168
final RoutingTable.Builder routingTableBuilder = RoutingTable.builder()
@@ -173,7 +173,7 @@ public ShardAllocationDecision decideShardAllocation(ShardRouting shard, Routing
173173

174174
final ClusterState clusterState = ClusterState.builder(ClusterName.DEFAULT)
175175
.nodes(nodesBuilder)
176-
.metaData(metaData)
176+
.metadata(metaData)
177177
.routingTable(routingTableBuilder.build())
178178
.build();
179179

@@ -230,14 +230,14 @@ public void testExplainsNonAllocationOfShardWithUnknownAllocator() {
230230
nodesBuilder.add(new DiscoveryNode("node1", buildNewFakeTransportAddress(), Version.CURRENT));
231231
nodesBuilder.add(new DiscoveryNode("node2", buildNewFakeTransportAddress(), Version.CURRENT));
232232

233-
final MetaData.Builder metaData = MetaData.builder().put(indexMetadata("index", Settings.builder()
233+
final Metadata.Builder metadata = Metadata.builder().put(indexMetadata("index", Settings.builder()
234234
.put(ExistingShardsAllocator.EXISTING_SHARDS_ALLOCATOR_SETTING.getKey(), "unknown")));
235235

236-
final RoutingTable.Builder routingTableBuilder = RoutingTable.builder().addAsRecovery(metaData.get("index"));
236+
final RoutingTable.Builder routingTableBuilder = RoutingTable.builder().addAsRecovery(metadata.get("index"));
237237

238238
final ClusterState clusterState = ClusterState.builder(ClusterName.DEFAULT)
239239
.nodes(nodesBuilder)
240-
.metaData(metaData)
240+
.metadata(metadata)
241241
.routingTable(routingTableBuilder.build())
242242
.build();
243243

@@ -268,8 +268,8 @@ public void testExplainsNonAllocationOfShardWithUnknownAllocator() {
268268

269269
private static final String FAKE_IN_SYNC_ALLOCATION_ID = "_in_sync_"; // so we can allocate primaries anywhere
270270

271-
private static IndexMetaData.Builder indexMetadata(String name, Settings.Builder settings) {
272-
return IndexMetaData.builder(name)
271+
private static IndexMetadata.Builder indexMetadata(String name, Settings.Builder settings) {
272+
return IndexMetadata.builder(name)
273273
.settings(settings(Version.CURRENT).put(settings.build()))
274274
.numberOfShards(2).numberOfReplicas(1)
275275
.putInSyncAllocationIds(0, Collections.singleton(FAKE_IN_SYNC_ALLOCATION_ID))

server/src/test/java/org/elasticsearch/gateway/ReplicaShardAllocatorTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ public void testIgnoreRetentionLeaseIfCopyIsEmpty() {
259259
testAllocator.addData(node1, retentionLeases, randomSyncId(),
260260
new StoreFileMetadata("file1", 10, "MATCH_CHECKSUM", MIN_SUPPORTED_LUCENE_VERSION));
261261
testAllocator.addData(node2, null); // has retention lease but store is empty
262-
testAllocator.addData(node3, randomSyncId(), new StoreFileMetaData("file1", 10, "MATCH_CHECKSUM", MIN_SUPPORTED_LUCENE_VERSION));
262+
testAllocator.addData(node3, randomSyncId(), new StoreFileMetadata("file1", 10, "MATCH_CHECKSUM", MIN_SUPPORTED_LUCENE_VERSION));
263263
allocateAllUnassigned(allocation);
264264
assertThat(allocation.routingNodes().shardsWithState(ShardRoutingState.INITIALIZING).size(), equalTo(1));
265265
assertThat(allocation.routingNodes().shardsWithState(ShardRoutingState.INITIALIZING).get(0).currentNodeId(),

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/CleanupSnapshotStep.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import org.elasticsearch.action.support.master.AcknowledgedResponse;
1212
import org.elasticsearch.client.Client;
1313
import org.elasticsearch.cluster.ClusterState;
14-
import org.elasticsearch.cluster.metadata.IndexMetaData;
14+
import org.elasticsearch.cluster.metadata.IndexMetadata;
1515
import org.elasticsearch.common.Strings;
1616
import org.elasticsearch.repositories.RepositoryMissingException;
1717
import org.elasticsearch.snapshots.SnapshotMissingException;
@@ -34,10 +34,10 @@ public boolean isRetryable() {
3434
}
3535

3636
@Override
37-
void performDuringNoSnapshot(IndexMetaData indexMetaData, ClusterState currentClusterState, Listener listener) {
38-
final String indexName = indexMetaData.getIndex().getName();
37+
void performDuringNoSnapshot(IndexMetadata indexMetadata, ClusterState currentClusterState, Listener listener) {
38+
final String indexName = indexMetadata.getIndex().getName();
3939

40-
LifecycleExecutionState lifecycleState = fromIndexMetadata(indexMetaData);
40+
LifecycleExecutionState lifecycleState = fromIndexMetadata(indexMetadata);
4141
final String repositoryName = lifecycleState.getSnapshotRepository();
4242
// if the snapshot information is missing from the ILM execution state there is nothing to delete so we move on
4343
if (Strings.hasText(repositoryName) == false) {
@@ -55,7 +55,7 @@ void performDuringNoSnapshot(IndexMetaData indexMetaData, ClusterState currentCl
5555
@Override
5656
public void onResponse(AcknowledgedResponse acknowledgedResponse) {
5757
if (acknowledgedResponse.isAcknowledged() == false) {
58-
String policyName = indexMetaData.getSettings().get(LifecycleSettings.LIFECYCLE_NAME);
58+
String policyName = indexMetadata.getSettings().get(LifecycleSettings.LIFECYCLE_NAME);
5959
throw new ElasticsearchException("cleanup snapshot step request for repository [" + repositoryName + "] and snapshot " +
6060
"[" + snapshotName + "] policy [" + policyName + "] and index [" + indexName + "] failed to be acknowledged");
6161
}
@@ -69,7 +69,7 @@ public void onFailure(Exception e) {
6969
listener.onResponse(true);
7070
} else {
7171
if (e instanceof RepositoryMissingException) {
72-
String policyName = indexMetaData.getSettings().get(LifecycleSettings.LIFECYCLE_NAME);
72+
String policyName = indexMetadata.getSettings().get(LifecycleSettings.LIFECYCLE_NAME);
7373
listener.onFailure(new IllegalStateException("repository [" + repositoryName + "] is missing. [" + policyName +
7474
"] policy for index [" + indexName + "] cannot continue until the repository is created", e));
7575
} else {

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/CopySettingsStep.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
import org.apache.logging.log4j.LogManager;
99
import org.apache.logging.log4j.Logger;
1010
import org.elasticsearch.cluster.ClusterState;
11-
import org.elasticsearch.cluster.metadata.IndexMetaData;
12-
import org.elasticsearch.cluster.metadata.MetaData;
11+
import org.elasticsearch.cluster.metadata.IndexMetadata;
12+
import org.elasticsearch.cluster.metadata.Metadata;
1313
import org.elasticsearch.common.settings.Settings;
1414
import org.elasticsearch.index.Index;
1515

@@ -55,9 +55,9 @@ public String getIndexPrefix() {
5555
@Override
5656
public ClusterState performAction(Index index, ClusterState clusterState) {
5757
String sourceIndexName = index.getName();
58-
IndexMetaData sourceIndexMetadata = clusterState.metaData().index(sourceIndexName);
58+
IndexMetadata sourceIndexMetadata = clusterState.metadata().index(sourceIndexName);
5959
String targetIndexName = indexPrefix + sourceIndexName;
60-
IndexMetaData targetIndexMetadata = clusterState.metaData().index(targetIndexName);
60+
IndexMetadata targetIndexMetadata = clusterState.metadata().index(targetIndexName);
6161

6262
if (sourceIndexMetadata == null) {
6363
// Index must have been since deleted, ignore it
@@ -82,11 +82,11 @@ public ClusterState performAction(Index index, ClusterState clusterState) {
8282
settings.put(key, value);
8383
}
8484

85-
MetaData.Builder newMetaData = MetaData.builder(clusterState.getMetaData())
86-
.put(IndexMetaData.builder(targetIndexMetadata)
85+
Metadata.Builder newMetaData = Metadata.builder(clusterState.getMetadata())
86+
.put(IndexMetadata.builder(targetIndexMetadata)
8787
.settingsVersion(targetIndexMetadata.getSettingsVersion() + 1)
8888
.settings(settings));
89-
return ClusterState.builder(clusterState).metaData(newMetaData).build();
89+
return ClusterState.builder(clusterState).metadata(newMetaData).build();
9090
}
9191

9292
@Override

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/CreateSnapshotStep.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import org.elasticsearch.action.admin.cluster.snapshots.create.CreateSnapshotRequest;
1010
import org.elasticsearch.client.Client;
1111
import org.elasticsearch.cluster.ClusterState;
12-
import org.elasticsearch.cluster.metadata.IndexMetaData;
12+
import org.elasticsearch.cluster.metadata.IndexMetadata;
1313
import org.elasticsearch.common.Strings;
1414
import org.elasticsearch.rest.RestStatus;
1515
import org.elasticsearch.snapshots.SnapshotException;
@@ -33,12 +33,12 @@ public boolean isRetryable() {
3333
}
3434

3535
@Override
36-
void performDuringNoSnapshot(IndexMetaData indexMetaData, ClusterState currentClusterState, Listener listener) {
37-
final String indexName = indexMetaData.getIndex().getName();
36+
void performDuringNoSnapshot(IndexMetadata indexMetadata, ClusterState currentClusterState, Listener listener) {
37+
final String indexName = indexMetadata.getIndex().getName();
3838

39-
final LifecycleExecutionState lifecycleState = fromIndexMetadata(indexMetaData);
39+
final LifecycleExecutionState lifecycleState = fromIndexMetadata(indexMetadata);
4040

41-
final String policyName = indexMetaData.getSettings().get(LifecycleSettings.LIFECYCLE_NAME);
41+
final String policyName = indexMetadata.getSettings().get(LifecycleSettings.LIFECYCLE_NAME);
4242
final String snapshotRepository = lifecycleState.getSnapshotRepository();
4343
if (Strings.hasText(snapshotRepository) == false) {
4444
listener.onFailure(new IllegalStateException("snapshot repository is not present for policy [" + policyName + "] and index [" +

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/GenerateSnapshotNameStep.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
import org.elasticsearch.action.ActionRequestValidationException;
1111
import org.elasticsearch.action.support.IndicesOptions;
1212
import org.elasticsearch.cluster.ClusterState;
13-
import org.elasticsearch.cluster.metadata.IndexMetaData;
13+
import org.elasticsearch.cluster.metadata.IndexMetadata;
1414
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
15-
import org.elasticsearch.cluster.metadata.MetaData;
15+
import org.elasticsearch.cluster.metadata.Metadata;
1616
import org.elasticsearch.common.Nullable;
1717
import org.elasticsearch.common.Strings;
1818
import org.elasticsearch.common.UUIDs;
@@ -54,7 +54,7 @@ public String getSnapshotRepository() {
5454

5555
@Override
5656
public ClusterState performAction(Index index, ClusterState clusterState) {
57-
IndexMetaData indexMetaData = clusterState.metaData().index(index);
57+
IndexMetadata indexMetaData = clusterState.metadata().index(index);
5858
if (indexMetaData == null) {
5959
// Index must have been since deleted, ignore it
6060
logger.debug("[{}] lifecycle action for index [{}] executed but index no longer exists", getKey().getAction(), index.getName());
@@ -79,9 +79,9 @@ public ClusterState performAction(Index index, ClusterState clusterState) {
7979
newCustomData.setSnapshotName(snapshotName);
8080
newCustomData.setSnapshotRepository(snapshotRepository);
8181

82-
IndexMetaData.Builder indexMetadataBuilder = IndexMetaData.builder(indexMetaData);
82+
IndexMetadata.Builder indexMetadataBuilder = IndexMetadata.builder(indexMetaData);
8383
indexMetadataBuilder.putCustom(ILM_CUSTOM_METADATA_KEY, newCustomData.build().asMap());
84-
newClusterStateBuilder.metaData(MetaData.builder(clusterState.getMetaData()).put(indexMetadataBuilder));
84+
newClusterStateBuilder.metadata(Metadata.builder(clusterState.getMetadata()).put(indexMetadataBuilder));
8585
return newClusterStateBuilder.build();
8686
}
8787

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/MountSnapshotStep.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import org.elasticsearch.action.ActionListener;
1212
import org.elasticsearch.client.Client;
1313
import org.elasticsearch.cluster.ClusterState;
14-
import org.elasticsearch.cluster.metadata.IndexMetaData;
14+
import org.elasticsearch.cluster.metadata.IndexMetadata;
1515
import org.elasticsearch.common.Strings;
1616
import org.elasticsearch.common.settings.Settings;
1717
import org.elasticsearch.index.IndexSettings;
@@ -49,12 +49,12 @@ public String getRestoredIndexPrefix() {
4949
}
5050

5151
@Override
52-
void performDuringNoSnapshot(IndexMetaData indexMetaData, ClusterState currentClusterState, Listener listener) {
53-
final String indexName = indexMetaData.getIndex().getName();
52+
void performDuringNoSnapshot(IndexMetadata indexMetadata, ClusterState currentClusterState, Listener listener) {
53+
final String indexName = indexMetadata.getIndex().getName();
5454

55-
LifecycleExecutionState lifecycleState = fromIndexMetadata(indexMetaData);
55+
LifecycleExecutionState lifecycleState = fromIndexMetadata(indexMetadata);
5656

57-
String policyName = indexMetaData.getSettings().get(LifecycleSettings.LIFECYCLE_NAME);
57+
String policyName = indexMetadata.getSettings().get(LifecycleSettings.LIFECYCLE_NAME);
5858
final String snapshotRepository = lifecycleState.getSnapshotRepository();
5959
if (Strings.hasText(snapshotRepository) == false) {
6060
listener.onFailure(new IllegalStateException("snapshot repository is not present for policy [" + policyName + "] and index [" +
@@ -70,7 +70,7 @@ void performDuringNoSnapshot(IndexMetaData indexMetaData, ClusterState currentCl
7070
}
7171

7272
String mountedIndexName = restoredIndexPrefix + indexName;
73-
if(currentClusterState.metaData().index(mountedIndexName) != null) {
73+
if(currentClusterState.metadata().index(mountedIndexName) != null) {
7474
logger.debug("mounted index [{}] for policy [{}] and index [{}] already exists. will not attempt to mount the index again",
7575
mountedIndexName, policyName, indexName);
7676
listener.onResponse(true);

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/OnAsyncWaitBranchingStep.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import org.apache.logging.log4j.Logger;
1111
import org.apache.lucene.util.SetOnce;
1212
import org.elasticsearch.client.Client;
13-
import org.elasticsearch.cluster.metadata.IndexMetaData;
13+
import org.elasticsearch.cluster.metadata.IndexMetadata;
1414
import org.elasticsearch.common.TriConsumer;
1515
import org.elasticsearch.common.unit.TimeValue;
1616
import org.elasticsearch.common.xcontent.ToXContentObject;
@@ -34,7 +34,7 @@ public class OnAsyncWaitBranchingStep extends AsyncWaitStep {
3434

3535
private StepKey nextStepKeyUnfulfilledWaitAction;
3636
private StepKey nextStepKeyFulfilledWaitAction;
37-
private TriConsumer<Client, IndexMetaData, BranchingStepListener> asyncWaitAction;
37+
private TriConsumer<Client, IndexMetadata, BranchingStepListener> asyncWaitAction;
3838
private SetOnce<Boolean> onCompleteConditionMet;
3939

4040
/**
@@ -48,7 +48,7 @@ public class OnAsyncWaitBranchingStep extends AsyncWaitStep {
4848
* but the user has the option to decide to stop waiting for the condition to be fulfilled
4949
*/
5050
public OnAsyncWaitBranchingStep(StepKey key, StepKey nextStepKeyUnfulfilledWaitAction, StepKey nextStepKeyFulfilledWaitAction,
51-
Client client, TriConsumer<Client, IndexMetaData, BranchingStepListener> asyncWaitAction) {
51+
Client client, TriConsumer<Client, IndexMetadata, BranchingStepListener> asyncWaitAction) {
5252
// super.nextStepKey is set to null since it is not used by this step
5353
super(key, null, client);
5454
this.nextStepKeyUnfulfilledWaitAction = nextStepKeyUnfulfilledWaitAction;
@@ -63,8 +63,8 @@ public boolean isRetryable() {
6363
}
6464

6565
@Override
66-
public void evaluateCondition(IndexMetaData indexMetaData, Listener listener, TimeValue masterTimeout) {
67-
asyncWaitAction.apply(getClient(), indexMetaData, new BranchingStepListener() {
66+
public void evaluateCondition(IndexMetadata indexMetadata, Listener listener, TimeValue masterTimeout) {
67+
asyncWaitAction.apply(getClient(), indexMetadata, new BranchingStepListener() {
6868
@Override
6969
public void onResponse(boolean conditionMet, ToXContentObject informationContext) {
7070
onCompleteConditionMet.set(true);
@@ -120,7 +120,7 @@ StepKey getNextStepKeyFulfilledWaitAction() {
120120
return nextStepKeyFulfilledWaitAction;
121121
}
122122

123-
TriConsumer<Client, IndexMetaData, BranchingStepListener> getAsyncWaitAction() {
123+
TriConsumer<Client, IndexMetadata, BranchingStepListener> getAsyncWaitAction() {
124124
return asyncWaitAction;
125125
}
126126

0 commit comments

Comments
 (0)