CCR/TEST: Add debug log to testFailOverOnFollower
This commit is contained in:
parent
2a60c24043
commit
dbc7c9259c
|
@ -6,17 +6,19 @@
|
||||||
|
|
||||||
package org.elasticsearch.xpack.ccr;
|
package org.elasticsearch.xpack.ccr;
|
||||||
|
|
||||||
|
import org.elasticsearch.action.delete.DeleteResponse;
|
||||||
|
import org.elasticsearch.action.index.IndexResponse;
|
||||||
import org.elasticsearch.cluster.ClusterState;
|
import org.elasticsearch.cluster.ClusterState;
|
||||||
import org.elasticsearch.cluster.metadata.IndexMetaData;
|
import org.elasticsearch.cluster.metadata.IndexMetaData;
|
||||||
import org.elasticsearch.cluster.node.DiscoveryNode;
|
import org.elasticsearch.cluster.node.DiscoveryNode;
|
||||||
import org.elasticsearch.cluster.routing.ShardRouting;
|
import org.elasticsearch.cluster.routing.ShardRouting;
|
||||||
|
import org.elasticsearch.common.Strings;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.common.unit.ByteSizeUnit;
|
import org.elasticsearch.common.unit.ByteSizeUnit;
|
||||||
import org.elasticsearch.common.unit.ByteSizeValue;
|
import org.elasticsearch.common.unit.ByteSizeValue;
|
||||||
import org.elasticsearch.common.unit.TimeValue;
|
import org.elasticsearch.common.unit.TimeValue;
|
||||||
import org.elasticsearch.common.xcontent.XContentType;
|
import org.elasticsearch.common.xcontent.XContentType;
|
||||||
import org.elasticsearch.index.IndexSettings;
|
import org.elasticsearch.index.IndexSettings;
|
||||||
import org.elasticsearch.node.NodeClosedException;
|
|
||||||
import org.elasticsearch.test.InternalTestCluster;
|
import org.elasticsearch.test.InternalTestCluster;
|
||||||
import org.elasticsearch.xpack.CcrIntegTestCase;
|
import org.elasticsearch.xpack.CcrIntegTestCase;
|
||||||
import org.elasticsearch.xpack.core.ccr.action.PutFollowAction;
|
import org.elasticsearch.xpack.core.ccr.action.PutFollowAction;
|
||||||
|
@ -48,15 +50,15 @@ public class FollowerFailOverIT extends CcrIntegTestCase {
|
||||||
for (int i = 0; i < threads.length; i++) {
|
for (int i = 0; i < threads.length; i++) {
|
||||||
threads[i] = new Thread(() -> {
|
threads[i] = new Thread(() -> {
|
||||||
while (stopped.get() == false) {
|
while (stopped.get() == false) {
|
||||||
try {
|
|
||||||
if (frequently()) {
|
if (frequently()) {
|
||||||
String id = Integer.toString(frequently() ? docID.incrementAndGet() : between(0, 10)); // sometimes update
|
String id = Integer.toString(frequently() ? docID.incrementAndGet() : between(0, 10)); // sometimes update
|
||||||
leaderClient().prepareIndex("leader-index", "doc", id).setSource("{\"f\":" + id + "}", XContentType.JSON).get();
|
IndexResponse indexResponse = leaderClient().prepareIndex("leader-index", "doc", id)
|
||||||
|
.setSource("{\"f\":" + id + "}", XContentType.JSON).get();
|
||||||
|
logger.info("--> index id={} seq_no={}", indexResponse.getId(), indexResponse.getSeqNo());
|
||||||
} else {
|
} else {
|
||||||
String id = Integer.toString(between(0, docID.get()));
|
String id = Integer.toString(between(0, docID.get()));
|
||||||
leaderClient().prepareDelete("leader-index", "doc", id).get();
|
DeleteResponse deleteResponse = leaderClient().prepareDelete("leader-index", "doc", id).get();
|
||||||
}
|
logger.info("--> delete id={} seq_no={}", deleteResponse.getId(), deleteResponse.getSeqNo());
|
||||||
} catch (NodeClosedException ignored) {
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -69,6 +71,7 @@ public class FollowerFailOverIT extends CcrIntegTestCase {
|
||||||
follow.getFollowRequest().setMaxWriteRequestOperationCount(randomIntBetween(32, 2048));
|
follow.getFollowRequest().setMaxWriteRequestOperationCount(randomIntBetween(32, 2048));
|
||||||
follow.getFollowRequest().setMaxWriteRequestSize(new ByteSizeValue(randomIntBetween(1, 4096), ByteSizeUnit.KB));
|
follow.getFollowRequest().setMaxWriteRequestSize(new ByteSizeValue(randomIntBetween(1, 4096), ByteSizeUnit.KB));
|
||||||
follow.getFollowRequest().setMaxOutstandingWriteRequests(randomIntBetween(1, 10));
|
follow.getFollowRequest().setMaxOutstandingWriteRequests(randomIntBetween(1, 10));
|
||||||
|
logger.info("--> follow params {}", Strings.toString(follow.getFollowRequest()));
|
||||||
followerClient().execute(PutFollowAction.INSTANCE, follow).get();
|
followerClient().execute(PutFollowAction.INSTANCE, follow).get();
|
||||||
ensureFollowerGreen("follower-index");
|
ensureFollowerGreen("follower-index");
|
||||||
atLeastDocsIndexed(followerClient(), "follower-index", between(20, 60));
|
atLeastDocsIndexed(followerClient(), "follower-index", between(20, 60));
|
||||||
|
|
Loading…
Reference in New Issue