Skip to content

Commit

Permalink
Renewing retention lease with global-ckp + 1 , as we want operations …
Browse files Browse the repository at this point in the history
…from that seq number (#206)

Signed-off-by: Gaurav Bafna <[email protected]>
  • Loading branch information
gbbafna authored Oct 26, 2021
1 parent a9d9c6f commit 12fe6b5
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,9 @@ class ShardReplicationTask(id: Long, type: String, action: String, description:
val indexShard = followerIndexService.getShard(followerShardId.id)

try {
retentionLeaseHelper.renewRetentionLease(leaderShardId, indexShard.lastSyncedGlobalCheckpoint, followerShardId)
//Retention leases preserve the operations including and starting from the retainingSequenceNumber we specify when we take the lease .
//hence renew retention lease with lastSyncedGlobalCheckpoint + 1
retentionLeaseHelper.renewRetentionLease(leaderShardId, indexShard.lastSyncedGlobalCheckpoint + 1, followerShardId)
} catch (ex: Exception) {
// In case of a failure, we just log it and move on. All failures scenarios are being handled below with
// retries and backoff depending on exception.
Expand Down Expand Up @@ -266,9 +268,11 @@ class ShardReplicationTask(id: Long, type: String, action: String, description:
}
}

//renew retention lease with global checkpoint so that any shard that picks up shard replication task has data until then.

//Retention leases preserve the operations including and starting from the retainingSequenceNumber we specify when we take the lease .
//hence renew retention lease with lastSyncedGlobalCheckpoint + 1 so that any shard that picks up shard replication task has data until then.
try {
retentionLeaseHelper.renewRetentionLease(leaderShardId, indexShard.lastSyncedGlobalCheckpoint, followerShardId)
retentionLeaseHelper.renewRetentionLease(leaderShardId, indexShard.lastSyncedGlobalCheckpoint + 1, followerShardId)
followerClusterStats.stats[followerShardId]!!.followerCheckpoint = indexShard.lastSyncedGlobalCheckpoint
lastLeaseRenewalMillis = System.currentTimeMillis()
} catch (ex: Exception) {
Expand Down

0 comments on commit 12fe6b5

Please sign in to comment.