Skip to content

Feature Request: Add ExpectNoPrimary flag to PlannedReparentShard and EmergencyReparentShard #19650

@mhamza15

Description

@mhamza15

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.

Metadata

Metadata

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions