Skip to content

[vtctld] Migrate ShardReplicationPositions#7690

Merged
deepthi merged 7 commits intovitessio:masterfrom
tinyspeck:am_vtctld_shard_replication_positions
Mar 18, 2021
Merged

[vtctld] Migrate ShardReplicationPositions#7690
deepthi merged 7 commits intovitessio:masterfrom
tinyspeck:am_vtctld_shard_replication_positions

Conversation

@ajm188
Copy link
Contributor

@ajm188 ajm188 commented Mar 15, 2021

Description

This PR does the following:

  • Migrate the ShardReplicationPositions vtctl command to a VtctldServer rpc
  • Modify the behavior to do per-tablet timeouts, and show partial results if those time out.
  • Reimplement the vtctl command using the VtctldServer implementation, to fix the timeout bug in the old server as well as the new.

Related Issue(s)

Checklist

  • Should this PR be backported? no (maybe?)
  • Tests were added or are not required
  • Documentation was added or is not required

Deployment Notes

Impacted Areas in Vitess

Components that this PR will affect:

  • Query Serving
  • VReplication
  • Cluster Management
  • Build/CI
  • VTAdmin

Andrew Mason added 6 commits March 15, 2021 18:45
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>
Copy link
Contributor

@doeg doeg left a 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.

Copy link
Collaborator

@deepthi deepthi left a 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.

Comment on lines +52 to +55
type ReplicatingTablet struct {
Status *replicationdatapb.Status
Tablet *topodatapb.Tablet
}
Copy link
Collaborator

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
}

Copy link
Contributor Author

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!

// 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 {
Copy link
Collaborator

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))

Copy link
Collaborator

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))

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: unnecessary newline

@ajm188 ajm188 force-pushed the am_vtctld_shard_replication_positions branch from 502bf7f to 502f0c1 Compare March 18, 2021 00:28
Signed-off-by: Andrew Mason <amason@slack-corp.com>
@ajm188 ajm188 force-pushed the am_vtctld_shard_replication_positions branch from 502f0c1 to 6e0edb6 Compare March 18, 2021 00:30
@deepthi deepthi merged commit f8d0d0a into vitessio:master Mar 18, 2021
@askdba askdba added this to the v10.0 milestone Mar 18, 2021
rafael pushed a commit to tinyspeck/vitess that referenced this pull request Apr 6, 2021
…cation_positions

[vtctld] Migrate ShardReplicationPositions

Signed-off-by: Rafael Chacon <rafael@slack-corp.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate ShardReplicationPositions to VtctldServer No [grpc] timeouts when vtctl ShardReplicationPositions is called (can lead to indefinite hang)

4 participants