Scenario
- Create leader cluster
- Create index with index.soft_deletes.retention_lease.period = 5s (***). This period I choose only for test purposes.
- Index document and wait 5s before next step so retention lease expire
- Create follower cluster
- Follow leader’s index
Expected:
- Data is replicated and seen in follower cluster
- Restore status api shows that index was fully copied, because the retention release expired
Actual :
-
Data is replicated and seen in follower cluster
-
Don’t see that index entirely copied
-
Continues warnings in log of the follower in which I see below exception:
{"type": "server", "timestamp": "2020-12-08T10:28:59,459Z", "level": "WARN", "component": "o.e.x.c.a.ShardFollowTasksExecutor", "cluster.name": "elasticsearch2", "node.name": "elasticsearch2-master-0", "message": "[project_green_replicated][1] background management of retention lease [elasticsearch2/project_green_replicated/bUhiTHeyTSOEDjUDKkDEdA-following-leader/project_green/vMKgmrHhQui7j7hP2UZNww] failed while following ", "cluster.uuid": "8phR09OoRJ2mRm-Ctu3O2Q", "node.id": "ppg4KsC7S-Gm58GzWXu1XQ" ,
"stacktrace": ["org.elasticsearch.index.seqno.RetentionLeaseNotFoundException: retention lease with ID [elasticsearch2/project_green_replicated/bUhiTHeyTSOEDjUDKkDEdA-following-leader/project_green/vMKgmrHhQui7j7hP2UZNww] not found ",
"at org.elasticsearch.index.seqno.ReplicationTracker.renewRetentionLease(ReplicationTracker.java:397) ~[elasticsearch-7.10.0.jar:7.10.0]",
"at org.elasticsearch.index.shard.IndexShard.renewRetentionLease(IndexShard.java:2218) ~[elasticsearch-7.10.0.jar:7.10.0]",
"at org.elasticsearch.index.seqno.RetentionLeaseActions$Renew$TransportAction.doRetentionLeaseAction(RetentionLeaseActions.java:206) ~[elasticsearch-7.10.0.jar:7.10.0]",
Might be that my expectations is wrong, especially point b. But this is what I understand from https://www.elastic.co/guide/en/elasticsearch/reference/7.x/xpack-ccr.html#ccr-leader-requirements
Quote from doc:
(***) The index.soft_deletes.retention_lease.period setting defines the maximum time to retain a shard history retention lease before it is considered expired. This setting determines how long the cluster containing your leader index can be offline, which is 12 hours by default. If a shard copy recovers after its retention lease expires, then Elasticsearch will fall back to copying the entire index, because it can no longer replay the missing history.