-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[vtctld] Migrate ShardReplicationPositions #7690
[vtctld] Migrate ShardReplicationPositions #7690
Conversation
Signed-off-by: Andrew Mason <[email protected]>
Signed-off-by: Andrew Mason <[email protected]>
Signed-off-by: Andrew Mason <[email protected]>
Signed-off-by: Andrew Mason <[email protected]>
This also copies over `SortReplicatingTablets` over from legacy vtctl Signed-off-by: Andrew Mason <[email protected]>
…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 <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly looks good. A few comments.
go/cmd/vtctldclient/cli/shards.go
Outdated
type ReplicatingTablet struct { | ||
Status *replicationdatapb.Status | ||
Tablet *topodatapb.Tablet | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you consider writing it like this?
type ReplicatingTablet struct {
topodatapb.Tablet
Status *replicationdatapb.Status
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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)) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: remove newline
// 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)) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: unnecessary newline
502bf7f
to
502f0c1
Compare
Signed-off-by: Andrew Mason <[email protected]>
502f0c1
to
6e0edb6
Compare
…cation_positions [vtctld] Migrate ShardReplicationPositions Signed-off-by: Rafael Chacon <[email protected]>
Description
This PR does the following:
ShardReplicationPositions
vtctl command to aVtctldServer
rpcVtctldServer
implementation, to fix the timeout bug in the old server as well as the new.Related Issue(s)
vtctl ShardReplicationPositions
is called (can lead to indefinite hang) #4073Checklist
Deployment Notes
Impacted Areas in Vitess
Components that this PR will affect: