Feature Description
PlannedReparentShard and EmergencyReparentShard both support an --expected-primary flag that acts as a CAS guard. The operation only proceeds if the current shard primary matches the specified alias. However, there's no way to express the inverse: "I expect this shard to have no primary."
This proposes adding a new expect_no_primary field to both PlannedReparentShardRequest and EmergencyReparentShardRequest in the proto. When set to true, the operation would fail with FAILED_PRECONDITION if the shard already has a primary.
Use Case(s)
When a shard has no primary, vtorc can race with an operator (Kubernetes or human) and promote a new primary. Without this flag, the operator's PRS will follow vtorc's ERS and do two quick reparents in succession. With the flag, the PRS can fail if it finds the shard already with a primary.
Feature Description
PlannedReparentShardandEmergencyReparentShardboth support an--expected-primaryflag that acts as a CAS guard. The operation only proceeds if the current shard primary matches the specified alias. However, there's no way to express the inverse: "I expect this shard to have no primary."This proposes adding a new
expect_no_primaryfield to bothPlannedReparentShardRequestandEmergencyReparentShardRequestin the proto. When set to true, the operation would fail withFAILED_PRECONDITIONif the shard already has a primary.Use Case(s)
When a shard has no primary, vtorc can race with an operator (Kubernetes or human) and promote a new primary. Without this flag, the operator's PRS will follow vtorc's ERS and do two quick reparents in succession. With the flag, the PRS can fail if it finds the shard already with a primary.