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