[Segment Replication] [BUG] Primary to primary recovery (relocation) breaks with segment conflicts. #5242
Closed
Description
From #4665 & related . Primary-Primary recovery operates the same under segment replication as it does today by using Peer recovery.
This process works by copying segments out to the new primary and then any operations received during the copy duration to be replayed, followed by the relocation handoff. With segment replication the old primary shard will continue to copy out to other replicas during the relocation process. Once the new primary is recovered it will reindex the operations received. This means the new primary will reindex operations already sent out to the replication group, causing a segment conflict. This will cause the replicas to fail and recover again from the new primary.
Ideas to fix:
- Bump SegmentInfos counter on the new primary to write segments with a different name. Will mean segments containing the same ops will be copied twice. This conflict & solution is similar to the same problem encountered within failover steps. However, with failover we do not have the luxury of a graceful handoff.
- Recover the soon to be new primary as a replica. Once complete, block the old primary from copying out new segments to the group and force a segrep event to the new primary. Recover from xlog any ops received during segment copy & perform handoff.
- Block old primary from syncing to the rest of the replication group while relocation is in progress. Could cause replicas to fall far of sync with primary & after relocation is complete will trigger expensive syncs.
Metadata
Assignees
Type
Projects
Status
Done