Skip to content
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

[e2e] vtctld init tablet and some output-based commands #15297

Merged
merged 25 commits into from
Mar 6, 2024

Conversation

ajm188
Copy link
Contributor

@ajm188 ajm188 commented Feb 20, 2024

Description

This PR began as an attempt to remove the deprecated InitTablet with the underlying topo call, and then evolved to also migrate some of the output-based commands from vtctlclient to vtctldclient

Related Issue(s)

#15273

Checklist

  • "Backport to:" labels have been added if this change should be back-ported to release branches
  • If this change is to be back-ported to previous releases, a justification is included in the PR description
  • Tests were added or are not required
  • Did the new or modified tests pass consistently locally and on CI?
  • Documentation was added or is not required

Deployment Notes

Copy link
Contributor

vitess-bot bot commented Feb 20, 2024

Review Checklist

Hello reviewers! 👋 Please follow this checklist when reviewing this Pull Request.

General

  • Ensure that the Pull Request has a descriptive title.
  • Ensure there is a link to an issue (except for internal cleanup and flaky test fixes), new features should have an RFC that documents use cases and test cases.

Tests

  • Bug fixes should have at least one unit or end-to-end test, enhancement and new features should have a sufficient number of tests.

Documentation

  • Apply the release notes (needs details) label if users need to know about this change.
  • New features should be documented.
  • There should be some code comments as to why things are implemented the way they are.
  • There should be a comment at the top of each new or modified test to explain what the test does.

New flags

  • Is this flag really necessary?
  • Flag names must be clear and intuitive, use dashes (-), and have a clear help text.

If a workflow is added or modified:

  • Each item in Jobs should be named in order to mark it as required.
  • If the workflow needs to be marked as required, the maintainer team must be notified.

Backward compatibility

  • Protobuf changes should be wire-compatible.
  • Changes to _vt tables and RPCs need to be backward compatible.
  • RPC changes should be compatible with vitess-operator
  • If a flag is removed, then it should also be removed from vitess-operator and arewefastyet, if used there.
  • vtctl command output order should be stable and awk-able.

@vitess-bot vitess-bot bot added NeedsBackportReason If backport labels have been applied to a PR, a justification is required NeedsDescriptionUpdate The description is not clear or comprehensive enough, and needs work NeedsIssue A linked issue is missing for this Pull Request NeedsWebsiteDocsUpdate What it says labels Feb 20, 2024
@github-actions github-actions bot added this to the v20.0.0 milestone Feb 20, 2024
@ajm188 ajm188 force-pushed the andrew/e2e-vtctld-init-tablet branch from e0e7152 to 551a156 Compare February 20, 2024 14:03
Copy link

codecov bot commented Feb 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 65.45%. Comparing base (696fe0e) to head (f283cf0).
Report is 69 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #15297      +/-   ##
==========================================
- Coverage   67.41%   65.45%   -1.96%     
==========================================
  Files        1560     1562       +2     
  Lines      192752   193911    +1159     
==========================================
- Hits       129952   126933    -3019     
- Misses      62800    66978    +4178     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ajm188 ajm188 force-pushed the andrew/e2e-vtctld-init-tablet branch 5 times, most recently from 7394191 to ef0aa74 Compare February 28, 2024 13:29
@ajm188 ajm188 marked this pull request as ready for review February 28, 2024 14:05
@ajm188 ajm188 requested a review from deepthi as a code owner February 28, 2024 14:05
@frouioui frouioui removed NeedsDescriptionUpdate The description is not clear or comprehensive enough, and needs work NeedsWebsiteDocsUpdate What it says NeedsIssue A linked issue is missing for this Pull Request NeedsBackportReason If backport labels have been applied to a PR, a justification is required labels Feb 28, 2024
Copy link
Member

@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.

Nice! A couple of little things need fixing, rest LGTM.

go/test/endtoend/cluster/cluster_process.go Outdated Show resolved Hide resolved
@@ -246,6 +245,11 @@ func (cluster *LocalProcessCluster) StartTopo() (err error) {
cluster.VtctlProcess.LogDir = cluster.TmpDirectory
}

if err = cluster.TopoProcess.OpenServer(*topoFlavor, cluster.VtctlProcess.TopoGlobalRoot); err != nil {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if err = cluster.TopoProcess.OpenServer(*topoFlavor, cluster.VtctlProcess.TopoGlobalRoot); err != nil {
if err = cluster.TopoProcess.OpenServer(*topoFlavor, cluster.VtctldClientProcess.TopoGlobalRoot); err != nil {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Does not exist (note the original was VtctlProcess not VtctlclientProcess)

Copy link
Contributor

Choose a reason for hiding this comment

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

IMO we should replace the vtctl client usage as well with the new vtctldclient equivalent: https://github.com/vitessio/vitess/pull/14315/files

It offers additional testing of it and moves us away from that client as well so that we could potentially remove it as well (assuming we can use vtctldclient --server internal instead of vtctl when appropriate). Without also removing the vtctl binary as well we can't get rid of any of the vtctlclient related code so I think it's important. Unless you think I'm missing something?

go/test/endtoend/cluster/topo_process.go Outdated Show resolved Hide resolved
Copy link
Contributor

@mattlord mattlord left a comment

Choose a reason for hiding this comment

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

LGTM! I only had some minor comments. Let me know what you think and I'll come back to this quickly.

@@ -167,7 +167,7 @@ func firstBackupTest(t *testing.T, tabletType string) {
mysqlctl.CompressionEngineName = "lz4"
defer func() { mysqlctl.CompressionEngineName = "pgzip" }()
// now bring up the other replica, letting it restore from backup.
err = localCluster.VtctlclientProcess.InitTablet(replica2, cell, keyspaceName, hostname, shardName)
err = localCluster.InitTablet(replica2, keyspaceName, shardName)
Copy link
Contributor

Choose a reason for hiding this comment

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

AFAIK InitTablet is deprecated now for some time and thus not implemented in vtctldclient side. Can we take this opportunity to replace its usage? If not, does that mean InitTablet still has a valid use case and should be migrated to vtctldclient as well? Otherwise we're not actually getting rid of the usage, we're just moving it. It does have the nice benefit, however, of only having one place to change later on.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

as i understand it, InitTablet as a user command is deprecated and (deliberately) not implemented in the new client, but it's still relevant for creating tablet records without actually starting a tablet process which is useful only for tests I wonder if we could use CreateTablet instead like tabletmanager does?

@@ -246,6 +245,11 @@ func (cluster *LocalProcessCluster) StartTopo() (err error) {
cluster.VtctlProcess.LogDir = cluster.TmpDirectory
}

if err = cluster.TopoProcess.OpenServer(*topoFlavor, cluster.VtctlProcess.TopoGlobalRoot); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

IMO we should replace the vtctl client usage as well with the new vtctldclient equivalent: https://github.com/vitessio/vitess/pull/14315/files

It offers additional testing of it and moves us away from that client as well so that we could potentially remove it as well (assuming we can use vtctldclient --server internal instead of vtctl when appropriate). Without also removing the vtctl binary as well we can't get rid of any of the vtctlclient related code so I think it's important. Unless you think I'm missing something?

go/test/endtoend/keyspace/keyspace_test.go Outdated Show resolved Hide resolved
go/test/endtoend/tabletmanager/commands_test.go Outdated Show resolved Hide resolved
@ajm188
Copy link
Contributor Author

ajm188 commented Feb 28, 2024

idk why it's not letting me reply inline to #15297 (comment) but

Without also removing the vtctl binary as well we can't get rid of any of the vtctlclient related code so I think it's important. Unless you think I'm missing something?

That's absolutely correct. Let me rework the GlobalRoot to set it somewhere in addition to VtctlProcess

Andrew Mason added 12 commits February 29, 2024 10:55
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]>
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]>
@ajm188 ajm188 force-pushed the andrew/e2e-vtctld-init-tablet branch from 80178ad to b1375de Compare February 29, 2024 16:01
Andrew Mason added 6 commits February 29, 2024 12:43
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]>
Signed-off-by: Andrew Mason <[email protected]>
@ajm188
Copy link
Contributor Author

ajm188 commented Mar 1, 2024

@mattlord no rush at all, but this is ready for another review whenever you get some time :)

Andrew Mason added 4 commits March 2, 2024 06:43
Signed-off-by: Andrew Mason <[email protected]>
Signed-off-by: Andrew Mason <[email protected]>
@mattlord mattlord self-requested a review March 6, 2024 00:25
Copy link
Contributor

@mattlord mattlord left a comment

Choose a reason for hiding this comment

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

LGTM. Thank you for working on this, @ajm188 !

require.NoError(t, err)
require.GreaterOrEqual(t, len(resp.Workflows), 1, "responce should have at least one workflow")
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure it's even worth a CI run, but response is misspelled.

} else {
assertNodeCount(t, result, int(2))
result, err := clusterInstance.VtctlclientProcess.ExecuteCommandWithOutput("GetShardReplication", cell1, KeyspaceShard)
Copy link
Contributor

Choose a reason for hiding this comment

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

We can't use vtctldclient ShardReplicationPositions instead?

require.NoError(t, err)
require.GreaterOrEqual(t, len(resp.Workflows), 1, "responce should have at least one workflow")
Copy link
Contributor

Choose a reason for hiding this comment

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

responce creeping around again :-)

Comment on lines +123 to +127
err = clusterInstance.VtctldClientProcess.ChangeTabletType(rdOnlyTablet, topodata.TabletType_SPARE)
require.NoError(t, err)
// Change it back to RDONLY afterward as the cluster is re-used.
defer func() {
err = clusterInstance.VtctlclientChangeTabletType(rdOnlyTablet, topodata.TabletType_RDONLY)
err = clusterInstance.VtctldClientProcess.ExecuteCommand("ChangeTabletType", rdOnlyTablet.Alias, "rdonly")
Copy link
Contributor

Choose a reason for hiding this comment

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

Curious why we're using .ChangeTabletType() in one place and .ExecuteCommand() in the other.

@ajm188 ajm188 merged commit c75b784 into vitessio:main Mar 6, 2024
102 checks passed
@ajm188 ajm188 deleted the andrew/e2e-vtctld-init-tablet branch March 6, 2024 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

4 participants