Skip to content

Commit

Permalink
Suppress warning from background sync on relocated primary (#46247)
Browse files Browse the repository at this point in the history
If a primary as being relocated, then the global checkpoint and
retention lease background sync can emit unnecessary warning logs.
This side effect was introduced in #42241.

Relates #40800
Relates #42241
  • Loading branch information
dnhatn committed Sep 7, 2019
1 parent 8fb6cbd commit 90f5525
Showing 1 changed file with 4 additions and 6 deletions.
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 @@ -839,14 +840,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

0 comments on commit 90f5525

Please sign in to comment.