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.
This commit is contained in:
Yannick Welsch 2020-06-16 13:55:22 +02:00
parent a5bc5ae030
commit 1e235a7f55
2 changed files with 3 additions and 3 deletions

View File

@ -603,7 +603,7 @@ public class CcrRetentionLeaseIT extends CcrIntegTestCase {
// we assert that retention leases are being advanced // we assert that retention leases are being advanced
assertThat( assertThat(
retentionLease.retainingSequenceNumber(), retentionLease.retainingSequenceNumber(),
equalTo(leaderGlobalCheckpoints.get(shardsStats.get(i).getShardRouting().id()))); equalTo(leaderGlobalCheckpoints.get(shardsStats.get(i).getShardRouting().id()) + 1));
} }
}); });
} }

View File

@ -455,7 +455,7 @@ public class ShardFollowTasksExecutor extends PersistentTasksExecutor<ShardFollo
CcrRetentionLeases.asyncAddRetentionLease( CcrRetentionLeases.asyncAddRetentionLease(
params.getLeaderShardId(), params.getLeaderShardId(),
retentionLeaseId, retentionLeaseId,
followerGlobalCheckpoint.getAsLong(), followerGlobalCheckpoint.getAsLong() + 1,
remoteClient(params), remoteClient(params),
wrappedListener); wrappedListener);
} catch (NoSuchRemoteClusterException rce) { } catch (NoSuchRemoteClusterException rce) {
@ -480,7 +480,7 @@ public class ShardFollowTasksExecutor extends PersistentTasksExecutor<ShardFollo
CcrRetentionLeases.asyncRenewRetentionLease( CcrRetentionLeases.asyncRenewRetentionLease(
params.getLeaderShardId(), params.getLeaderShardId(),
retentionLeaseId, retentionLeaseId,
followerGlobalCheckpoint.getAsLong(), followerGlobalCheckpoint.getAsLong() + 1,
remoteClient(params), remoteClient(params),
listener); listener);
} }