From 1e235a7f55ad73f0bdf43ee4118b4da3dfd35766 Mon Sep 17 00:00:00 2001 From: Yannick Welsch Date: Tue, 16 Jun 2020 13:55:22 +0200 Subject: [PATCH] Fix off-by-one on CCR lease (#58158) The leases issued by CCR keep one extra operation around on the leader shards. This is not harmful to the leader cluster, but means that there's potentially one delete that can't be cleaned up. --- .../java/org/elasticsearch/xpack/ccr/CcrRetentionLeaseIT.java | 2 +- .../xpack/ccr/action/ShardFollowTasksExecutor.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/x-pack/plugin/ccr/src/internalClusterTest/java/org/elasticsearch/xpack/ccr/CcrRetentionLeaseIT.java b/x-pack/plugin/ccr/src/internalClusterTest/java/org/elasticsearch/xpack/ccr/CcrRetentionLeaseIT.java index 41c34a678d3..f8a28bacaa9 100644 --- a/x-pack/plugin/ccr/src/internalClusterTest/java/org/elasticsearch/xpack/ccr/CcrRetentionLeaseIT.java +++ b/x-pack/plugin/ccr/src/internalClusterTest/java/org/elasticsearch/xpack/ccr/CcrRetentionLeaseIT.java @@ -603,7 +603,7 @@ public class CcrRetentionLeaseIT extends CcrIntegTestCase { // we assert that retention leases are being advanced assertThat( retentionLease.retainingSequenceNumber(), - equalTo(leaderGlobalCheckpoints.get(shardsStats.get(i).getShardRouting().id()))); + equalTo(leaderGlobalCheckpoints.get(shardsStats.get(i).getShardRouting().id()) + 1)); } }); } diff --git a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/action/ShardFollowTasksExecutor.java b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/action/ShardFollowTasksExecutor.java index 54a614cd9d3..cfd04ed4e90 100644 --- a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/action/ShardFollowTasksExecutor.java +++ b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/action/ShardFollowTasksExecutor.java @@ -455,7 +455,7 @@ public class ShardFollowTasksExecutor extends PersistentTasksExecutor