Conversation
- keyspace_type: NORMAL/SNAPSHOT - snapshot_time: for SNAPSHOT keyspaces, the time for which it is being recovered - also when creating a keyspace, create an empty vschema * Vttablet recovery mode - recovery_keyspace: which keyspace to recover - init_keyspace: this should be a SNAPSHOT keyspace - snapshot_time will be used as a starting point to find a backup to restore (most recent backup from snapshot_time) * Vtgate changes - tables and vindexes of SNAPSHOT keyspaces are not added to the uniqueTables and uniqueVindexes maps when building vschema * integration test to test recovery of vttablet Signed-off-by: deepthi <deepthi@planetscale.com>
Signed-off-by: deepthi <deepthi@planetscale.com>
…ime is not set Signed-off-by: deepthi <deepthi@planetscale.com>
…ion for CreateKeyspace call RebuildVSchemaGraph after copying vschema for snapshot keyspace Signed-off-by: deepthi <deepthi@planetscale.com>
Signed-off-by: deepthi <deepthi@planetscale.com>
Signed-off-by: deepthi <deepthi@planetscale.com>
Signed-off-by: deepthi <deepthi@planetscale.com>
Signed-off-by: deepthi <deepthi@planetscale.com>
…nd which gtid we restored to Signed-off-by: deepthi <deepthi@planetscale.com>
sougou
left a comment
There was a problem hiding this comment.
Still need to do a deeper dive. Have one high level comment so far.
| dir := fmt.Sprintf("%v/%v", tablet.Keyspace, tablet.Shard) | ||
| name := fmt.Sprintf("%v.%v", time.Now().UTC().Format("2006-01-02.150405"), topoproto.TabletAliasString(tablet.Alias)) | ||
| returnErr := mysqlctl.Backup(ctx, agent.Cnf, agent.MysqlDaemon, l, dir, name, concurrency, agent.hookExtraEnv()) | ||
| backupTime := time.Now().UTC() |
There was a problem hiding this comment.
I think the backup time should be pulled from the server's timestamp. Ideally, as of the snapshot time. But I can see someone make an argument for the current time as seen by vttablet. @rafael: thoughts?
There was a problem hiding this comment.
that is a good point. until now this time was only used to make the backup directory, so it didn't matter, but for purposes of knowing where to replay binlogs from, it should be server time.
Signed-off-by: deepthi <deepthi@planetscale.com>
distribute backup tests among jobs Signed-off-by: deepthi <deepthi@planetscale.com>
Signed-off-by: deepthi <deepthi@planetscale.com>
Signed-off-by: deepthi <deepthi@planetscale.com>
Signed-off-by: deepthi <deepthi@planetscale.com>
Signed-off-by: deepthi <deepthi@planetscale.com>
go/cmd/vtbackup/vtbackup.go
Outdated
|
|
||
| log.Infof("Restoring latest backup from directory %v", backupDir) | ||
| restorePos, err := mysqlctl.Restore(ctx, mycnf, mysqld, backupDir, *concurrency, extraEnv, map[string]string{}, logutil.NewConsoleLogger(), true, dbName) | ||
| restorePos, _, err := mysqlctl.Restore(ctx, mycnf, mysqld, backupDir, *concurrency, extraEnv, map[string]string{}, logutil.NewConsoleLogger(), true, dbName, time.Unix(0, 0).UTC()) |
There was a problem hiding this comment.
Traditionally we use the zero value time.Time{} to represent "unspecified". Is there any reason we can't make Restore() accept that?
There was a problem hiding this comment.
no reason, I just didn't know there was a convention. I will change it.
There was a problem hiding this comment.
Still need to change this to time.Time{} (and a few more places below). Also, I noticed that you were calling .UTC() in a few places. That should not be necessary because time.Unix() will return the correct value whether it's UTC or not.
| // to convert times. | ||
| message Time { | ||
| int64 seconds = 1; | ||
| int32 nanoseconds = 2; |
There was a problem hiding this comment.
I'd say go with int64. There's no great benefit to using int32.
There was a problem hiding this comment.
this is an existing message that I moved into a new file. Is it safe to change the data type?
There was a problem hiding this comment.
we'll keep this as int32 because changing the type will not be backwards-compatible
go/cmd/vtbackup/vtbackup.go
Outdated
|
|
||
| log.Infof("Restoring latest backup from directory %v", backupDir) | ||
| restorePos, err := mysqlctl.Restore(ctx, mycnf, mysqld, backupDir, *concurrency, extraEnv, map[string]string{}, logutil.NewConsoleLogger(), true, dbName) | ||
| restorePos, _, err := mysqlctl.Restore(ctx, mycnf, mysqld, backupDir, *concurrency, extraEnv, map[string]string{}, logutil.NewConsoleLogger(), true, dbName, time.Unix(0, 0).UTC()) |
There was a problem hiding this comment.
Still need to change this to time.Time{} (and a few more places below). Also, I noticed that you were calling .UTC() in a few places. That should not be necessary because time.Unix() will return the correct value whether it's UTC or not.
Signed-off-by: deepthi <deepthi@planetscale.com>
Signed-off-by: deepthi <deepthi@planetscale.com>
Partial fix for #4886
TabletExternallyReparented, notInitShardMasterorPlannedReparentShard.use @replicafollowed byselect ... from ks.tableuse ks@replicaoruse ks:shard@replicafollowed byselect .. from tableSigned-off-by: deepthi deepthi@planetscale.com