mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-24 22:09:24 +00:00
Add more logging to testCorruptedShards to help investigate sporadic failures
This commit is contained in:
parent
1f89e9d94e
commit
92a24de509
@ -60,7 +60,8 @@ import static org.hamcrest.Matchers.notNullValue;
|
|||||||
import static org.hamcrest.Matchers.nullValue;
|
import static org.hamcrest.Matchers.nullValue;
|
||||||
|
|
||||||
@ESIntegTestCase.ClusterScope(scope = ESIntegTestCase.Scope.TEST)
|
@ESIntegTestCase.ClusterScope(scope = ESIntegTestCase.Scope.TEST)
|
||||||
@TestLogging("_root:DEBUG,org.elasticsearch.action.admin.indices.shards:TRACE,org.elasticsearch.cluster.service:TRACE")
|
@TestLogging("_root:DEBUG,org.elasticsearch.action.admin.indices.shards:TRACE,org.elasticsearch.cluster.service:TRACE," +
|
||||||
|
"org.elasticsearch.gateway.TransportNodesListGatewayStartedShards:TRACE")
|
||||||
public class IndicesShardStoreRequestIT extends ESIntegTestCase {
|
public class IndicesShardStoreRequestIT extends ESIntegTestCase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -151,7 +152,6 @@ public class IndicesShardStoreRequestIT extends ESIntegTestCase {
|
|||||||
assertThat(shardStatuses.get(index1).size(), equalTo(2));
|
assertThat(shardStatuses.get(index1).size(), equalTo(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/12416")
|
|
||||||
public void testCorruptedShards() throws Exception {
|
public void testCorruptedShards() throws Exception {
|
||||||
String index = "test";
|
String index = "test";
|
||||||
internalCluster().ensureAtLeastNumDataNodes(2);
|
internalCluster().ensureAtLeastNumDataNodes(2);
|
||||||
@ -175,7 +175,9 @@ public class IndicesShardStoreRequestIT extends ESIntegTestCase {
|
|||||||
for (Integer shardId : indexShards.shardIds()) {
|
for (Integer shardId : indexShards.shardIds()) {
|
||||||
IndexShard shard = indexShards.getShard(shardId);
|
IndexShard shard = indexShards.getShard(shardId);
|
||||||
if (randomBoolean()) {
|
if (randomBoolean()) {
|
||||||
|
logger.debug("--> failing shard [{}] on node [{}]", shardId, node);
|
||||||
shard.failShard("test", new CorruptIndexException("test corrupted", ""));
|
shard.failShard("test", new CorruptIndexException("test corrupted", ""));
|
||||||
|
logger.debug("--> failed shard [{}] on node [{}]", shardId, node);
|
||||||
Set<String> nodes = corruptedShardIDMap.get(shardId);
|
Set<String> nodes = corruptedShardIDMap.get(shardId);
|
||||||
if (nodes == null) {
|
if (nodes == null) {
|
||||||
nodes = new HashSet<>();
|
nodes = new HashSet<>();
|
||||||
@ -194,9 +196,11 @@ public class IndicesShardStoreRequestIT extends ESIntegTestCase {
|
|||||||
for (IndicesShardStoresResponse.StoreStatus status : shardStatus.value) {
|
for (IndicesShardStoresResponse.StoreStatus status : shardStatus.value) {
|
||||||
if (corruptedShardIDMap.containsKey(shardStatus.key)
|
if (corruptedShardIDMap.containsKey(shardStatus.key)
|
||||||
&& corruptedShardIDMap.get(shardStatus.key).contains(status.getNode().getName())) {
|
&& corruptedShardIDMap.get(shardStatus.key).contains(status.getNode().getName())) {
|
||||||
assertThat(status.getStoreException(), notNullValue());
|
assertThat("shard [" + shardStatus.key + "] is failed on node [" + status.getNode().getName() + "]",
|
||||||
|
status.getStoreException(), notNullValue());
|
||||||
} else {
|
} else {
|
||||||
assertNull(status.getStoreException());
|
assertNull("shard [" + shardStatus.key + "] is not failed on node [" + status.getNode().getName() + "]",
|
||||||
|
status.getStoreException());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user