mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-08 22:14:59 +00:00
[Test] Remove duplicate method in TestShardRouting (#32815)
This commit is contained in:
parent
74d41857c6
commit
079d130d8c
@ -66,7 +66,7 @@ class BuildPlugin implements Plugin<Project> {
|
|||||||
void apply(Project project) {
|
void apply(Project project) {
|
||||||
if (project.pluginManager.hasPlugin('elasticsearch.standalone-rest-test')) {
|
if (project.pluginManager.hasPlugin('elasticsearch.standalone-rest-test')) {
|
||||||
throw new InvalidUserDataException('elasticsearch.standalone-test, '
|
throw new InvalidUserDataException('elasticsearch.standalone-test, '
|
||||||
+ 'elasticsearch.standalone-rest-test, and elasticsearch.build '
|
+ 'elasticearch.standalone-rest-test, and elasticsearch.build '
|
||||||
+ 'are mutually exclusive')
|
+ 'are mutually exclusive')
|
||||||
}
|
}
|
||||||
final String minimumGradleVersion
|
final String minimumGradleVersion
|
||||||
|
@ -63,7 +63,7 @@ class PrecommitTasks {
|
|||||||
* (which provides NamingConventionsCheck) and :test:logger-usage
|
* (which provides NamingConventionsCheck) and :test:logger-usage
|
||||||
* which provides the logger usage check. Since the build tools
|
* which provides the logger usage check. Since the build tools
|
||||||
* don't use the logger usage check because they don't have any
|
* 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
|
* use the NamingConventionsCheck we break the circular dependency
|
||||||
* here.
|
* here.
|
||||||
*/
|
*/
|
||||||
|
@ -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}
|
. 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
|
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
|
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
|
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.
|
for your version] when downloading for offline usage.
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
================================================
|
================================================
|
||||||
|
|
||||||
When you extract the zip or tarball packages, the `elasticsearch-n.n.n`
|
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.
|
`plugins` directories.
|
||||||
|
|
||||||
We recommend moving these directories out of the Elasticsearch directory
|
We recommend moving these directories out of the Elasticsearch directory
|
||||||
|
@ -71,7 +71,7 @@ thirdPartyAudit.excludes = [
|
|||||||
'org.apache.log.Logger',
|
'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 {
|
configurations {
|
||||||
oldesFixture
|
oldesFixture
|
||||||
es2
|
es2
|
||||||
|
@ -134,8 +134,8 @@ public class ResizeAllocationDeciderTests extends ESAllocationTestCase {
|
|||||||
|
|
||||||
ResizeAllocationDecider resizeAllocationDecider = new ResizeAllocationDecider(Settings.EMPTY);
|
ResizeAllocationDecider resizeAllocationDecider = new ResizeAllocationDecider(Settings.EMPTY);
|
||||||
RoutingAllocation routingAllocation = new RoutingAllocation(null, null, clusterState, null, 0);
|
RoutingAllocation routingAllocation = new RoutingAllocation(null, null, clusterState, null, 0);
|
||||||
ShardRouting shardRouting = TestShardRouting.newShardRouting(new ShardId(idx, 0), null, true, RecoverySource
|
ShardRouting shardRouting = TestShardRouting.newShardRouting(new ShardId(idx, 0), null, true, ShardRoutingState.UNASSIGNED,
|
||||||
.LocalShardsRecoverySource.INSTANCE, ShardRoutingState.UNASSIGNED);
|
RecoverySource.LocalShardsRecoverySource.INSTANCE);
|
||||||
assertEquals(Decision.ALWAYS, resizeAllocationDecider.canAllocate(shardRouting, routingAllocation));
|
assertEquals(Decision.ALWAYS, resizeAllocationDecider.canAllocate(shardRouting, routingAllocation));
|
||||||
assertEquals(Decision.ALWAYS, resizeAllocationDecider.canAllocate(shardRouting, clusterState.getRoutingNodes().node("node1"),
|
assertEquals(Decision.ALWAYS, resizeAllocationDecider.canAllocate(shardRouting, clusterState.getRoutingNodes().node("node1"),
|
||||||
routingAllocation));
|
routingAllocation));
|
||||||
@ -164,8 +164,8 @@ public class ResizeAllocationDeciderTests extends ESAllocationTestCase {
|
|||||||
RoutingAllocation routingAllocation = new RoutingAllocation(null, clusterState.getRoutingNodes(), clusterState, null, 0);
|
RoutingAllocation routingAllocation = new RoutingAllocation(null, clusterState.getRoutingNodes(), clusterState, null, 0);
|
||||||
int shardId = randomIntBetween(0, 3);
|
int shardId = randomIntBetween(0, 3);
|
||||||
int sourceShardId = IndexMetaData.selectSplitShard(shardId, clusterState.metaData().index("source"), 4).id();
|
int sourceShardId = IndexMetaData.selectSplitShard(shardId, clusterState.metaData().index("source"), 4).id();
|
||||||
ShardRouting shardRouting = TestShardRouting.newShardRouting(new ShardId(idx, shardId), null, true, RecoverySource
|
ShardRouting shardRouting = TestShardRouting.newShardRouting(new ShardId(idx, shardId), null, true, ShardRoutingState.UNASSIGNED,
|
||||||
.LocalShardsRecoverySource.INSTANCE, ShardRoutingState.UNASSIGNED);
|
RecoverySource.LocalShardsRecoverySource.INSTANCE);
|
||||||
assertEquals(Decision.NO, resizeAllocationDecider.canAllocate(shardRouting, routingAllocation));
|
assertEquals(Decision.NO, resizeAllocationDecider.canAllocate(shardRouting, routingAllocation));
|
||||||
assertEquals(Decision.NO, resizeAllocationDecider.canAllocate(shardRouting, clusterState.getRoutingNodes().node("node1"),
|
assertEquals(Decision.NO, resizeAllocationDecider.canAllocate(shardRouting, clusterState.getRoutingNodes().node("node1"),
|
||||||
routingAllocation));
|
routingAllocation));
|
||||||
@ -204,8 +204,8 @@ public class ResizeAllocationDeciderTests extends ESAllocationTestCase {
|
|||||||
RoutingAllocation routingAllocation = new RoutingAllocation(null, clusterState.getRoutingNodes(), clusterState, null, 0);
|
RoutingAllocation routingAllocation = new RoutingAllocation(null, clusterState.getRoutingNodes(), clusterState, null, 0);
|
||||||
int shardId = randomIntBetween(0, 3);
|
int shardId = randomIntBetween(0, 3);
|
||||||
int sourceShardId = IndexMetaData.selectSplitShard(shardId, clusterState.metaData().index("source"), 4).id();
|
int sourceShardId = IndexMetaData.selectSplitShard(shardId, clusterState.metaData().index("source"), 4).id();
|
||||||
ShardRouting shardRouting = TestShardRouting.newShardRouting(new ShardId(idx, shardId), null, true, RecoverySource
|
ShardRouting shardRouting = TestShardRouting.newShardRouting(new ShardId(idx, shardId), null, true, ShardRoutingState.UNASSIGNED,
|
||||||
.LocalShardsRecoverySource.INSTANCE, ShardRoutingState.UNASSIGNED);
|
RecoverySource.LocalShardsRecoverySource.INSTANCE);
|
||||||
assertEquals(Decision.YES, resizeAllocationDecider.canAllocate(shardRouting, routingAllocation));
|
assertEquals(Decision.YES, resizeAllocationDecider.canAllocate(shardRouting, routingAllocation));
|
||||||
|
|
||||||
String allowedNode = clusterState.getRoutingTable().index("source").shard(sourceShardId).primaryShard().currentNodeId();
|
String allowedNode = clusterState.getRoutingTable().index("source").shard(sourceShardId).primaryShard().currentNodeId();
|
||||||
|
@ -1200,7 +1200,8 @@ public class IndexShardTests extends IndexShardTestCase {
|
|||||||
public void testShardStatsWithFailures() throws IOException {
|
public void testShardStatsWithFailures() throws IOException {
|
||||||
allowShardFailures();
|
allowShardFailures();
|
||||||
final ShardId shardId = new ShardId("index", "_na_", 0);
|
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());
|
final NodeEnvironment.NodePath nodePath = new NodeEnvironment.NodePath(createTempDir());
|
||||||
|
|
||||||
|
|
||||||
|
@ -39,10 +39,6 @@ public class TestShardRouting {
|
|||||||
return newShardRouting(new ShardId(index, IndexMetaData.INDEX_UUID_NA_VALUE, shardId), currentNodeId, primary, state);
|
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) {
|
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);
|
return new ShardRouting(shardId, currentNodeId, null, primary, state, buildRecoveryTarget(primary, state), buildUnassignedInfo(state), buildAllocationId(state), -1);
|
||||||
}
|
}
|
||||||
|
@ -726,7 +726,7 @@ public abstract class IndexShardTestCase extends ESTestCase {
|
|||||||
final IndexId indexId = new IndexId(shardId.getIndex().getName(), shardId.getIndex().getUUID());
|
final IndexId indexId = new IndexId(shardId.getIndex().getName(), shardId.getIndex().getUUID());
|
||||||
final DiscoveryNode node = getFakeDiscoNode(shard.routingEntry().currentNodeId());
|
final DiscoveryNode node = getFakeDiscoNode(shard.routingEntry().currentNodeId());
|
||||||
final RecoverySource.SnapshotRecoverySource recoverySource = new RecoverySource.SnapshotRecoverySource(snapshot, version, index);
|
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));
|
shard.markAsRecovering("from snapshot", new RecoveryState(shardRouting, node, null));
|
||||||
repository.restoreShard(shard, snapshot.getSnapshotId(), version, indexId, shard.shardId(), shard.recoveryState());
|
repository.restoreShard(shard, snapshot.getSnapshotId(), version, indexId, shard.shardId(), shard.recoveryState());
|
||||||
|
@ -49,7 +49,7 @@ initial payload.
|
|||||||
A <<input-search, search>> input contains a `request` object that specifies the
|
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],
|
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
|
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.
|
Query DSL available for you to use.
|
||||||
|
|
||||||
For example, the following `search` input loads the latest VIX quote:
|
For example, the following `search` input loads the latest VIX quote:
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#
|
#
|
||||||
# meta-foo.zip <-- zip file for the meta plugin, with this structure:
|
# meta-foo.zip <-- zip file for the meta plugin, with this structure:
|
||||||
#|____elasticsearch/
|
#|____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
|
#| |____ <bundled_plugin_2> <-- The plugin files for bundled_plugin_2
|
||||||
#| |____ meta-plugin-descriptor.properties <-- example contents below:
|
#| |____ meta-plugin-descriptor.properties <-- example contents below:
|
||||||
#
|
#
|
||||||
|
Loading…
x
Reference in New Issue
Block a user