Skip to content

Commit

Permalink
[Test] Remove duplicate method in TestShardRouting (#32815)
Browse files Browse the repository at this point in the history
  • Loading branch information
tlrx authored Sep 10, 2018
1 parent 74d4185 commit 079d130
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class BuildPlugin implements Plugin<Project> {
void apply(Project project) {
if (project.pluginManager.hasPlugin('elasticsearch.standalone-rest-test')) {
throw new InvalidUserDataException('elasticsearch.standalone-test, '
+ 'elasticsearch.standalone-rest-test, and elasticsearch.build '
+ 'elasticearch.standalone-rest-test, and elasticsearch.build '
+ 'are mutually exclusive')
}
final String minimumGradleVersion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class PrecommitTasks {
* (which provides NamingConventionsCheck) and :test:logger-usage
* which provides the logger usage check. Since the build tools
* don't use the logger usage check because they don't have any
* of Elasticsearch's loggers and :test:logger-usage actually does
* of Elaticsearch's loggers and :test:logger-usage actually does
* use the NamingConventionsCheck we break the circular dependency
* here.
*/
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/setup/setup-xclient.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ cluster where {xpack} is installed, then you must download and configure the

. Add the {xpack} transport JAR file to your *CLASSPATH*. You can download the {xpack}
distribution and extract the JAR file manually or you can get it from the
https://artifacts.elastic.co/maven/org/elasticsearch/client/x-pack-transport/{version}/x-pack-transport-{version}.jar[Elasticsearch Maven repository].
https://artifacts.elastic.co/maven/org/elasticsearch/client/x-pack-transport/{version}/x-pack-transport-{version}.jar[Elasticsearc Maven repository].
As with any dependency, you will also need its transitive dependencies. Refer to the
https://artifacts.elastic.co/maven/org/elasticsearch/client/x-pack-transport/{version}/x-pack-transport-{version}.pom[X-Pack POM file
for your version] when downloading for offline usage.
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/upgrade/set-paths-tip.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
================================================
When you extract the zip or tarball packages, the `elasticsearch-n.n.n`
directory contains the Elasticsearch `config`, `data`, `logs` and
directory contains the Elasticsearh `config`, `data`, `logs` and
`plugins` directories.
We recommend moving these directories out of the Elasticsearch directory
Expand Down
2 changes: 1 addition & 1 deletion modules/reindex/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ thirdPartyAudit.excludes = [
'org.apache.log.Logger',
]

// Support for testing reindex-from-remote against old Elasticsearch versions
// Support for testing reindex-from-remote against old Elaticsearch versions
configurations {
oldesFixture
es2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ public void testShrink() { // we don't handle shrink yet

ResizeAllocationDecider resizeAllocationDecider = new ResizeAllocationDecider(Settings.EMPTY);
RoutingAllocation routingAllocation = new RoutingAllocation(null, null, clusterState, null, 0);
ShardRouting shardRouting = TestShardRouting.newShardRouting(new ShardId(idx, 0), null, true, RecoverySource
.LocalShardsRecoverySource.INSTANCE, ShardRoutingState.UNASSIGNED);
ShardRouting shardRouting = TestShardRouting.newShardRouting(new ShardId(idx, 0), null, true, ShardRoutingState.UNASSIGNED,
RecoverySource.LocalShardsRecoverySource.INSTANCE);
assertEquals(Decision.ALWAYS, resizeAllocationDecider.canAllocate(shardRouting, routingAllocation));
assertEquals(Decision.ALWAYS, resizeAllocationDecider.canAllocate(shardRouting, clusterState.getRoutingNodes().node("node1"),
routingAllocation));
Expand Down Expand Up @@ -164,8 +164,8 @@ public void testSourceNotActive() {
RoutingAllocation routingAllocation = new RoutingAllocation(null, clusterState.getRoutingNodes(), clusterState, null, 0);
int shardId = randomIntBetween(0, 3);
int sourceShardId = IndexMetaData.selectSplitShard(shardId, clusterState.metaData().index("source"), 4).id();
ShardRouting shardRouting = TestShardRouting.newShardRouting(new ShardId(idx, shardId), null, true, RecoverySource
.LocalShardsRecoverySource.INSTANCE, ShardRoutingState.UNASSIGNED);
ShardRouting shardRouting = TestShardRouting.newShardRouting(new ShardId(idx, shardId), null, true, ShardRoutingState.UNASSIGNED,
RecoverySource.LocalShardsRecoverySource.INSTANCE);
assertEquals(Decision.NO, resizeAllocationDecider.canAllocate(shardRouting, routingAllocation));
assertEquals(Decision.NO, resizeAllocationDecider.canAllocate(shardRouting, clusterState.getRoutingNodes().node("node1"),
routingAllocation));
Expand Down Expand Up @@ -204,8 +204,8 @@ public void testSourcePrimaryActive() {
RoutingAllocation routingAllocation = new RoutingAllocation(null, clusterState.getRoutingNodes(), clusterState, null, 0);
int shardId = randomIntBetween(0, 3);
int sourceShardId = IndexMetaData.selectSplitShard(shardId, clusterState.metaData().index("source"), 4).id();
ShardRouting shardRouting = TestShardRouting.newShardRouting(new ShardId(idx, shardId), null, true, RecoverySource
.LocalShardsRecoverySource.INSTANCE, ShardRoutingState.UNASSIGNED);
ShardRouting shardRouting = TestShardRouting.newShardRouting(new ShardId(idx, shardId), null, true, ShardRoutingState.UNASSIGNED,
RecoverySource.LocalShardsRecoverySource.INSTANCE);
assertEquals(Decision.YES, resizeAllocationDecider.canAllocate(shardRouting, routingAllocation));

String allowedNode = clusterState.getRoutingTable().index("source").shard(sourceShardId).primaryShard().currentNodeId();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1200,7 +1200,8 @@ public void testShardStats() throws IOException {
public void testShardStatsWithFailures() throws IOException {
allowShardFailures();
final ShardId shardId = new ShardId("index", "_na_", 0);
final ShardRouting shardRouting = newShardRouting(shardId, "node", true, RecoverySource.EmptyStoreRecoverySource.INSTANCE, ShardRoutingState.INITIALIZING);
final ShardRouting shardRouting =
newShardRouting(shardId, "node", true, ShardRoutingState.INITIALIZING, RecoverySource.EmptyStoreRecoverySource.INSTANCE);
final NodeEnvironment.NodePath nodePath = new NodeEnvironment.NodePath(createTempDir());


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ public static ShardRouting newShardRouting(String index, int shardId, String cur
return newShardRouting(new ShardId(index, IndexMetaData.INDEX_UUID_NA_VALUE, shardId), currentNodeId, primary, state);
}

public static ShardRouting newShardRouting(ShardId shardId, String currentNodeId, boolean primary, RecoverySource recoverySource, ShardRoutingState state) {
return new ShardRouting(shardId, currentNodeId, null, primary, state, recoverySource, buildUnassignedInfo(state), buildAllocationId(state), -1);
}

public static ShardRouting newShardRouting(ShardId shardId, String currentNodeId, boolean primary, ShardRoutingState state) {
return new ShardRouting(shardId, currentNodeId, null, primary, state, buildRecoveryTarget(primary, state), buildUnassignedInfo(state), buildAllocationId(state), -1);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,7 @@ protected void recoverShardFromSnapshot(final IndexShard shard,
final IndexId indexId = new IndexId(shardId.getIndex().getName(), shardId.getIndex().getUUID());
final DiscoveryNode node = getFakeDiscoNode(shard.routingEntry().currentNodeId());
final RecoverySource.SnapshotRecoverySource recoverySource = new RecoverySource.SnapshotRecoverySource(snapshot, version, index);
final ShardRouting shardRouting = newShardRouting(shardId, node.getId(), true, recoverySource, ShardRoutingState.INITIALIZING);
final ShardRouting shardRouting = newShardRouting(shardId, node.getId(), true, ShardRoutingState.INITIALIZING, recoverySource);

shard.markAsRecovering("from snapshot", new RecoveryState(shardRouting, node, null));
repository.restoreShard(shard, snapshot.getSnapshotId(), version, indexId, shard.shardId(), shard.recoveryState());
Expand Down
2 changes: 1 addition & 1 deletion x-pack/docs/en/watcher/customizing-watches.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ initial payload.
A <<input-search, search>> input contains a `request` object that specifies the
indices you want to search, the {ref}/search-request-search-type.html[search type],
and the search request body. The `body` field of a search input is the same as
the body of an Elasticsearch `_search` request, making the full Elasticsearch
the body of an Elasticsearch `_search` request, making the full Elaticsearch
Query DSL available for you to use.

For example, the following `search` input loads the latest VIX quote:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#
# meta-foo.zip <-- zip file for the meta plugin, with this structure:
#|____elasticsearch/
#| |____ <bundled_plugin_1> <-- The plugin files for bundled_plugin_1 (the content of the elasticsearch directory)
#| |____ <bundled_plugin_1> <-- The plugin files for bundled_plugin_1 (the content of the elastisearch directory)
#| |____ <bundled_plugin_2> <-- The plugin files for bundled_plugin_2
#| |____ meta-plugin-descriptor.properties <-- example contents below:
#
Expand Down

0 comments on commit 079d130

Please sign in to comment.