Skip to content

Commit

Permalink
[CCR] Only use primary shards and get expected count from leader index (
Browse files Browse the repository at this point in the history
  • Loading branch information
martijnvg authored Oct 1, 2018
1 parent a02deba commit d12a64e
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ public void afterBulk(long executionId, BulkRequest request, Throwable failure)

assertSameDocCount("index1", "index2");
assertTotalNumberOfOptimizedIndexing(resolveIndex("index2"), numberOfShards,
client().prepareSearch("index2").get().getHits().totalHits);
client().prepareSearch("index1").get().getHits().totalHits);
unfollowIndex("index2");
assertMaxSeqNoOfUpdatesIsTransferred(resolveIndex("index1"), resolveIndex("index2"), numberOfShards);
}
Expand Down Expand Up @@ -915,7 +915,7 @@ private void assertTotalNumberOfOptimizedIndexing(Index followerIndex, int numbe
for (String node : internalCluster().nodesInclude(followerIndex.getName())) {
IndicesService indicesService = internalCluster().getInstance(IndicesService.class, node);
IndexShard shard = indicesService.getShardOrNull(new ShardId(followerIndex, shardId));
if (shard != null) {
if (shard != null && shard.routingEntry().primary()) {
try {
FollowingEngine engine = ((FollowingEngine) IndexShardTestCase.getEngine(shard));
numOfOptimizedOps[shardId] = engine.getNumberOfOptimizedIndexing();
Expand Down

0 comments on commit d12a64e

Please sign in to comment.