[TEST] Added (trace) logging to testGetFields_complexField
This commit is contained in:
parent
2024067465
commit
5b919d4e4f
|
@ -122,7 +122,6 @@ public class TransportRefreshAction extends TransportBroadcastOperationAction<Re
|
|||
*/
|
||||
@Override
|
||||
protected GroupShardsIterator shards(ClusterState clusterState, RefreshRequest request, String[] concreteIndices) {
|
||||
logger.trace("resolving shards to refresh based on cluster state version [{}]", clusterState.version());
|
||||
return clusterState.routingTable().allAssignedShardsGrouped(concreteIndices, true, true);
|
||||
}
|
||||
|
||||
|
|
|
@ -128,6 +128,7 @@ public abstract class TransportBroadcastOperationAction<Request extends Broadcas
|
|||
}
|
||||
|
||||
nodes = clusterState.nodes();
|
||||
logger.trace("resolving shards based on cluster state version [{}]", clusterState.version());
|
||||
shardsIts = shards(clusterState, request, concreteIndices);
|
||||
expectedOps = shardsIts.size();
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ package org.elasticsearch.get;
|
|||
|
||||
import com.google.common.base.Predicate;
|
||||
import org.elasticsearch.ElasticsearchIllegalArgumentException;
|
||||
import org.elasticsearch.action.ShardOperationFailedException;
|
||||
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
|
||||
import org.elasticsearch.action.admin.cluster.health.ClusterHealthStatus;
|
||||
import org.elasticsearch.action.admin.indices.flush.FlushResponse;
|
||||
|
@ -38,6 +39,7 @@ import org.elasticsearch.common.settings.ImmutableSettings;
|
|||
import org.elasticsearch.common.xcontent.XContentFactory;
|
||||
import org.elasticsearch.index.engine.VersionConflictEngineException;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.elasticsearch.test.junit.annotations.TestLogging;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -795,6 +797,7 @@ public class GetActionTests extends ElasticsearchIntegrationTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
@TestLogging("index.shard.service:TRACE,cluster.service:TRACE,action.admin.indices.flush:TRACE")
|
||||
public void testGetFields_complexField() throws Exception {
|
||||
client().admin().indices().prepareCreate("my-index")
|
||||
.setSettings(ImmutableSettings.settingsBuilder().put("index.refresh_interval", -1))
|
||||
|
@ -832,9 +835,12 @@ public class GetActionTests extends ElasticsearchIntegrationTest {
|
|||
.endArray()
|
||||
.endObject().bytes();
|
||||
|
||||
logger.info("indexing documents");
|
||||
|
||||
client().prepareIndex("my-index", "my-type1", "1").setSource(source).get();
|
||||
client().prepareIndex("my-index", "my-type2", "1").setSource(source).get();
|
||||
|
||||
logger.info("checking real time retrieval");
|
||||
|
||||
String field = "field1.field2.field3.field4";
|
||||
GetResponse getResponse = client().prepareGet("my-index", "my-type1", "1").setFields(field).get();
|
||||
|
@ -851,6 +857,8 @@ public class GetActionTests extends ElasticsearchIntegrationTest {
|
|||
assertThat(getResponse.getField(field).getValues().get(0).toString(), equalTo("value1"));
|
||||
assertThat(getResponse.getField(field).getValues().get(1).toString(), equalTo("value2"));
|
||||
|
||||
logger.info("waiting for recoveries to complete");
|
||||
|
||||
// Flush fails if shard has ongoing recoveries
|
||||
awaitBusy(new Predicate<Object>() {
|
||||
@Override
|
||||
|
@ -865,9 +873,19 @@ public class GetActionTests extends ElasticsearchIntegrationTest {
|
|||
}
|
||||
}, 1 , TimeUnit.MINUTES);
|
||||
|
||||
logger.info("flushing");
|
||||
FlushResponse flushResponse = client().admin().indices().prepareFlush("my-index").setForce(true).get();
|
||||
// the flush must at least succeed on one shard and not all shards, because we don't wait for yellow/green
|
||||
assertThat(flushResponse.getSuccessfulShards(), greaterThanOrEqualTo(1));
|
||||
if (flushResponse.getSuccessfulShards() == 0) {
|
||||
StringBuilder sb = new StringBuilder("failed to flush at least one shard. total shards [")
|
||||
.append(flushResponse.getTotalShards()).append("], failed shards: [").append(flushResponse.getFailedShards()).append("]");
|
||||
for (ShardOperationFailedException failure: flushResponse.getShardFailures()) {
|
||||
sb.append("\nShard failure: ").append(failure);
|
||||
}
|
||||
fail(sb.toString());
|
||||
}
|
||||
|
||||
logger.info("checking post-flush retrieval");
|
||||
|
||||
getResponse = client().prepareGet("my-index", "my-type1", "1").setFields(field).get();
|
||||
assertThat(getResponse.isExists(), equalTo(true));
|
||||
|
|
Loading…
Reference in New Issue