Overview of the Issue
Both PlannedReparentShard and EmergencyReparentShard in grpcvtctldserver silently return empty keyspace and shard fields in their response when reparentShardLocked returns an error before the ev.ShardInfo = *shardInfo assignment.
Both handlers initialise the response with the request values, then overwrite unconditionally from ev.ShardInfo:
resp = &vtctldatapb.PlannedReparentShardResponse{
Keyspace: req.Keyspace,
Shard: req.Shard,
}
if ev != nil {
resp.Keyspace = ev.ShardInfo.Keyspace() // returns "" when ShardInfo is zero-valued
resp.Shard = ev.ShardInfo.ShardName()
...
}
ev is always non-nil, but ev.ShardInfo is zero-valued on any error path that exits reparentShardLocked before reaching ev.ShardInfo = *shardInfo. This overwrites the correct request values with empty strings, producing a response with keyspace: "" and shard: "".
For PRS the affected paths are: GetShard failure, GetKeyspaceDurability failure, GetDurabilityPolicy failure, and ExpectedPrimary mismatch (all before the ev.ShardInfo assignment). For ERS: GetShard failure (the only path before the assignment).
Reproduction Steps
For PlannedReparentShard: call with expected_primary set to a tablet alias that does not match the current primary. The ExpectedPrimary check in reparentShardLocked fires before ev.ShardInfo = *shardInfo, leaving ev.ShardInfo zero-valued. The response comes back with keyspace: "" and shard: "" instead of the request values.
Binary Version
Observed on vitess main.
Operating System and Environment details
N/A
Log Fragments
N/A
Overview of the Issue
Both
PlannedReparentShardandEmergencyReparentShardingrpcvtctldserversilently return emptykeyspaceandshardfields in their response whenreparentShardLockedreturns an error before theev.ShardInfo = *shardInfoassignment.Both handlers initialise the response with the request values, then overwrite unconditionally from
ev.ShardInfo:evis always non-nil, butev.ShardInfois zero-valued on any error path that exitsreparentShardLockedbefore reachingev.ShardInfo = *shardInfo. This overwrites the correct request values with empty strings, producing a response withkeyspace: ""andshard: "".For PRS the affected paths are:
GetShardfailure,GetKeyspaceDurabilityfailure,GetDurabilityPolicyfailure, andExpectedPrimarymismatch (all before theev.ShardInfoassignment). For ERS:GetShardfailure (the only path before the assignment).Reproduction Steps
For
PlannedReparentShard: call withexpected_primaryset to a tablet alias that does not match the current primary. TheExpectedPrimarycheck inreparentShardLockedfires beforeev.ShardInfo = *shardInfo, leavingev.ShardInfozero-valued. The response comes back withkeyspace: ""andshard: ""instead of the request values.Binary Version
Observed on vitess main.
Operating System and Environment details
N/A
Log Fragments
N/A