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
#34186)

Closes #34173
  • Loading branch information
martijnvg authored and kcm committed Oct 30, 2018
1 parent 81d0ad7 commit ee37860
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 ee37860

Please sign in to comment.