Skip to content

Sharded recovery test migrated in go#5684

Merged
deepthi merged 5 commits intovitessio:masterfrom
planetscale:tal_sharded_recovery_test
Jan 17, 2020
Merged

Sharded recovery test migrated in go#5684
deepthi merged 5 commits intovitessio:masterfrom
planetscale:tal_sharded_recovery_test

Conversation

@saurabh408
Copy link
Copy Markdown
Contributor

@saurabh408 saurabh408 commented Jan 10, 2020

Sharded recovery tests the following :

  • Unsharded recovery after sharding
  • Sharded recovery

Signed-off-by: saurabh <saurabh.408@gmail.com>
Signed-off-by: saurabh <saurabh.408@gmail.com>
@saurabh408 saurabh408 requested a review from sougou as a code owner January 10, 2020 07:03
@saurabh408 saurabh408 changed the title Tal sharded recovery test Sharded recovery test migrated in go Jan 10, 2020
for i := 0; i < tabletsRequired; i++ {
tabletType := "replica"
if i == 0 {
tabletType = "master"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You don't need to do this if you are doing initShard master

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

shard0RdOnly = localCluster.Keyspaces[0].Shards[1].Vttablets[2]
shard1Master = localCluster.Keyspaces[0].Shards[2].Vttablets[0]
shard1Replica = localCluster.Keyspaces[0].Shards[2].Vttablets[1]
shard1RdOnly = localCluster.Keyspaces[0].Shards[2].Vttablets[2]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Maybe a better way to create these objects first and then add them into shard(s) and then loop those shards to create mysql processes. Check resharding_base for example.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

if err = localCluster.VtctlclientProcess.InitTablet(rdOnly, cell, keyspaceName, hostname, shard.Name); err != nil {
return 1, err
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

On same principle, you can loop shard tablets to run InitTablet

Comment on lines +169 to +186
// we need to create the schema, and the worker will do data copying
for _, keyspaceShard := range []string{"test_keyspace/-80", "test_keyspace/80-"} {
err = localCluster.VtctlclientProcess.ExecuteCommand("CopySchemaShard", "test_keyspace/0", keyspaceShard)
assert.Nil(t, err)
}

err = localCluster.VtctlclientProcess.ExecuteCommand("SplitClone", "test_keyspace", "0", "-80,80-")
assert.Nil(t, err)

err = localCluster.VtctlclientProcess.ExecuteCommand("MigrateServedTypes", "test_keyspace/0", "rdonly")
assert.Nil(t, err)

err = localCluster.VtctlclientProcess.ExecuteCommand("MigrateServedTypes", "test_keyspace/0", "replica")
assert.Nil(t, err)

// then serve master from the split shards
err = localCluster.VtctlclientProcess.ExecuteCommand("MigrateServedTypes", "test_keyspace/0", "master")
assert.Nil(t, err)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@sougou should we change this to use the new Reshard, MigrateReads and MigrateWrites?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We should write separate tests for the new workflows. @rohit-nayak-ps is taking this on.

// check that new tablet is accessible with 'use ks'
executeQueriesUsingVtgate(t, session, "use recovery_keyspace@replica")
verifyQueriesUsingVtgate(t, session, "select count(*) from vt_insert_test", "INT64(2)")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We should also test the case that we weren't able to test in python:
https://github.com/vitessio/vitess/blob/master/test/sharded_recovery.py#L382

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

// check that new keyspace is accessible with 'use ks'
executeQueriesUsingVtgate(t, session, "use recovery_keyspace@replica")
verifyQueriesUsingVtgate(t, session, "select count(*) from vt_insert_test", "INT64(2)")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

Signed-off-by: saurabh <saurabh.408@gmail.com>
Signed-off-by: saurabh <saurabh.408@gmail.com>
Signed-off-by: saurabh <saurabh.408@gmail.com>
Copy link
Copy Markdown
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.

LGTM

@deepthi deepthi merged commit 1d60870 into vitessio:master Jan 17, 2020
@saurabh408 saurabh408 deleted the tal_sharded_recovery_test branch January 17, 2020 05:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants