[vtctld] Migrate ShardReplicationPositions#7690
Conversation
Signed-off-by: Andrew Mason <amason@slack-corp.com>
Signed-off-by: Andrew Mason <amason@slack-corp.com>
Signed-off-by: Andrew Mason <amason@slack-corp.com>
Signed-off-by: Andrew Mason <amason@slack-corp.com>
This also copies over `SortReplicatingTablets` over from legacy vtctl Signed-off-by: Andrew Mason <amason@slack-corp.com>
…w impl The new implementation contains the bugfix for getting partial results with one (or more) dead/unreachable tablets. Closes vitessio#4073. Signed-off-by: Andrew Mason <amason@slack-corp.com>
doeg
left a comment
There was a problem hiding this comment.
Looks great as always and TIL a little more about go contexts. :)
This seems straightforward to me, but totally up to you if you want to wait for a Vitess-y blessing (a Vitessing?!) from @deepthi / @setassociative.
deepthi
left a comment
There was a problem hiding this comment.
Mostly looks good. A few comments.
| type ReplicatingTablet struct { | ||
| Status *replicationdatapb.Status | ||
| Tablet *topodatapb.Tablet | ||
| } |
There was a problem hiding this comment.
Did you consider writing it like this?
type ReplicatingTablet struct {
topodatapb.Tablet
Status *replicationdatapb.Status
}
There was a problem hiding this comment.
I did, and decided not to for a silly reason. Basically I was worried "what if Tablet and Status each have a field with the same name, you wouldn't be able to tell the difference" but now I remember that Go will just force you to disambiguate so it's actually not a problem at all.
I'll make this change!
go/cmd/vtctldclient/cli/shards.go
Outdated
| // 1. Tablets that do not have a replication Status. | ||
| // 2. Any tablets of type MASTER. | ||
| // 3. Remaining tablets sorted by comparing replication positions. | ||
| func SortReplicatingTablets(tabletMap map[string]*topodatapb.Tablet, replicationStatuses map[string]*replicationdatapb.Status) []*ReplicatingTablet { |
There was a problem hiding this comment.
Maybe call this Sorted...?
| // The RPC was not timed out or canceled. We treat this | ||
| // as a fatal error for the overall request. | ||
| rec.RecordError(fmt.Errorf("MasterPosition(%s) failed: %w", alias, err)) | ||
|
|
| // The RPC was not timed out or canceled. We treat this | ||
| // as a fatal error for the overall request. | ||
| rec.RecordError(fmt.Errorf("ReplicationStatus(%s) failed: %s", alias, err)) | ||
|
|
502bf7f to
502f0c1
Compare
Signed-off-by: Andrew Mason <amason@slack-corp.com>
502f0c1 to
6e0edb6
Compare
…cation_positions [vtctld] Migrate ShardReplicationPositions Signed-off-by: Rafael Chacon <rafael@slack-corp.com>
Description
This PR does the following:
ShardReplicationPositionsvtctl command to aVtctldServerrpcVtctldServerimplementation, to fix the timeout bug in the old server as well as the new.Related Issue(s)
vtctl ShardReplicationPositionsis called (can lead to indefinite hang) #4073Checklist
Deployment Notes
Impacted Areas in Vitess
Components that this PR will affect: