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
6 changes: 0 additions & 6 deletions muted-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -329,12 +329,6 @@ tests:
- class: org.elasticsearch.xpack.test.rest.XPackRestIT
method: test {p0=transform/transforms_start_stop/Test start/stop/start continuous transform}
issue: https://github.com/elastic/elasticsearch/issues/126755
- class: org.elasticsearch.search.SearchServiceSingleNodeTests
method: testBeforeShardLockDuringShardCreate
issue: https://github.com/elastic/elasticsearch/issues/126812
- class: org.elasticsearch.search.SearchServiceSingleNodeTests
method: testLookUpSearchContext
issue: https://github.com/elastic/elasticsearch/issues/126813
- class: org.elasticsearch.xpack.test.rest.XPackRestIT
method: test {p0=transform/transforms_stats/Test get multiple transform stats where one does not have a task}
issue: https://github.com/elastic/elasticsearch/issues/126863
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import org.elasticsearch.action.support.WriteRequest;
import org.elasticsearch.client.internal.Client;
import org.elasticsearch.cluster.metadata.IndexMetadata;
import org.elasticsearch.cluster.routing.RecoverySource;
import org.elasticsearch.cluster.routing.ShardRouting;
import org.elasticsearch.cluster.routing.ShardRoutingState;
import org.elasticsearch.cluster.routing.TestShardRouting;
Expand Down Expand Up @@ -1255,8 +1256,22 @@ public void testBeforeShardLockDuringShardCreate() {
TestShardRouting.newShardRouting(
new ShardId(indexService.index(), 0),
randomAlphaOfLength(5),
randomBoolean(),
ShardRoutingState.INITIALIZING
true,
ShardRoutingState.INITIALIZING,
RecoverySource.EmptyStoreRecoverySource.INSTANCE
),
indexService.getIndexSettings().getSettings()
);
assertEquals(1, service.getActiveContexts());

boolean primary = randomBoolean();
service.beforeIndexShardCreated(
TestShardRouting.newShardRouting(
new ShardId(indexService.index(), 0),
randomAlphaOfLength(5),
primary,
ShardRoutingState.INITIALIZING,
primary ? RecoverySource.ExistingStoreRecoverySource.INSTANCE : RecoverySource.PeerRecoverySource.INSTANCE
),
indexService.getIndexSettings().getSettings()
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,16 @@ public static ShardRouting newShardRouting(ShardId shardId, String currentNodeId
return newShardRouting(shardId, currentNodeId, primary, state, ShardRouting.Role.DEFAULT);
}

public static ShardRouting newShardRouting(
ShardId shardId,
String currentNodeId,
boolean primary,
ShardRoutingState state,
RecoverySource recoverySource
) {
return newShardRouting(shardId, currentNodeId, primary, state, recoverySource, ShardRouting.Role.DEFAULT);
}

public static ShardRouting newShardRouting(
ShardId shardId,
String currentNodeId,
Expand All @@ -154,6 +164,30 @@ public static ShardRouting newShardRouting(
);
}

public static ShardRouting newShardRouting(
ShardId shardId,
String currentNodeId,
boolean primary,
ShardRoutingState state,
RecoverySource recoverySource,
ShardRouting.Role role
) {
assertNotEquals(ShardRoutingState.RELOCATING, state);
return new ShardRouting(
shardId,
currentNodeId,
null,
primary,
state,
recoverySource,
buildUnassignedInfo(state),
buildRelocationFailureInfo(state),
buildAllocationId(state),
ShardRouting.UNAVAILABLE_EXPECTED_SHARD_SIZE,
role
);
}

public static ShardRouting newShardRouting(
String index,
int shardId,
Expand Down