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

vrepl: CreateLookupVindex command with backfill #5692

Merged
merged 10 commits into from
Jan 15, 2020

Conversation

sougou
Copy link
Contributor

@sougou sougou commented Jan 13, 2020

This command comes very close to a DDL that can create a lookup vindex on an existing table that already has rows. It will:

  • Create a lookup vindex in the vschema in "write_only" mode.
  • Change the main table to use it.
  • Create the lookup table.
  • Create a vschema entry for the lookup table.
  • Setup vreplication from main table to lookup for the backfill.

If the table is the "owner", then the vreplication streams are created with "stop_after_copy" option. Otherwise, we assume that it's a "best effort" vindex where the lookup table is continuously populated by the vreplication stream.

The final step of this workflow will come in the next PR as ExternalizeVindex, which would remove the "write_only" mode and/or delete the vreplication streams.

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.

LGTM except for a couple of nits.

@@ -314,6 +314,9 @@ var commands = []commandGroup{
{"Migrate", commandMigrate,
"[-cell=<cell>] [-tablet_types=<tablet_types>] -workflow=<workflow> <source_keyspace> <target_keyspace> <table_specs>",
`Start a table(s) migration, table_specs is a list of tables or the tables section of the vschema for the target keyspace. Example: '{"t1":{"column_vindexes": [{""column": "id1", "name": "hash"}]}, "t2":{"column_vindexes": [{""column": "id2", "name": "hash"}]}}`},
{"CreateLookupVindex", commandCreateLookupVindex,
"[-cell=<cell>] [-tablet_types=<tablet_types>] <keyspace> <json_spec>",
Copy link
Member

Choose a reason for hiding this comment

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

Can you explain tablet_types with more detail?

return err
}
if subFlags.NArg() != 2 {
return fmt.Errorf("two arguments are required: keyspace and specs")
Copy link
Member

Choose a reason for hiding this comment

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

specs -> json_spec

Convenience function to automatically choose a good vindex for
a type. Will be used for upcoming CreateLookupVindex functionality.

Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
@sougou sougou merged commit 1e10d2e into vitessio:master Jan 15, 2020
@sougou sougou deleted the ss-create-lookup branch January 15, 2020 02:29
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.

2 participants