Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions server/src/main/java/org/elasticsearch/index/IndexService.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
import org.elasticsearch.index.shard.SearchOperationListener;
import org.elasticsearch.index.shard.ShardId;
import org.elasticsearch.index.shard.ShardNotFoundException;
import org.elasticsearch.index.shard.ShardNotInPrimaryModeException;
import org.elasticsearch.index.shard.ShardPath;
import org.elasticsearch.index.similarity.SimilarityService;
import org.elasticsearch.index.store.Store;
Expand Down Expand Up @@ -835,14 +836,11 @@ private void sync(final Consumer<IndexShard> sync, final String source) {
case STARTED:
try {
shard.runUnderPrimaryPermit(
() -> {
if (shard.isRelocatedPrimary() == false) {
sync.accept(shard);
}
},
() -> sync.accept(shard),
e -> {
if (e instanceof AlreadyClosedException == false
&& e instanceof IndexShardClosedException == false) {
&& e instanceof IndexShardClosedException == false
&& e instanceof ShardNotInPrimaryModeException == false) {
logger.warn(
new ParameterizedMessage(
"{} failed to execute {} sync", shard.shardId(), source), e);
Expand Down