From 82a288ca49558874f9c9163f5fb58c02d495a4dc Mon Sep 17 00:00:00 2001 From: Renan Rangel Date: Wed, 21 Aug 2024 08:03:14 -0700 Subject: [PATCH] use dumpInstances() instead Signed-off-by: Renan Rangel --- .../backup/vtctlbackup/backup_utils.go | 24 +++++++++---------- go/vt/mysqlctl/mysqlshellbackupengine.go | 4 +--- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/go/test/endtoend/backup/vtctlbackup/backup_utils.go b/go/test/endtoend/backup/vtctlbackup/backup_utils.go index a278e25e2e6..a658fb04d20 100644 --- a/go/test/endtoend/backup/vtctlbackup/backup_utils.go +++ b/go/test/endtoend/backup/vtctlbackup/backup_utils.go @@ -1362,8 +1362,7 @@ func TestReplicaRestoreToTimestamp(t *testing.T, restoreToTimestamp time.Time, e func verifyTabletBackupStats(t *testing.T, vars map[string]any) { switch currentSetupType { // Currently only the builtin backup engine instruments bytes-processed counts. - case XtraBackup, MySQLShell: - default: + case BuiltinBackup: require.Contains(t, vars, "BackupBytes") bb := vars["BackupBytes"].(map[string]any) require.Contains(t, bb, "BackupEngine.Builtin.Compressor:Write") @@ -1372,6 +1371,7 @@ func verifyTabletBackupStats(t *testing.T, vars map[string]any) { if backupstorage.BackupStorageImplementation == "file" { require.Contains(t, bb, "BackupStorage.File.File:Write") } + case XtraBackup, MySQLShell: } require.Contains(t, vars, "BackupCount") @@ -1380,13 +1380,13 @@ func verifyTabletBackupStats(t *testing.T, vars map[string]any) { switch currentSetupType { // Currently only the builtin backup engine instruments bytes-processed counts. - case XtraBackup, MySQLShell: - default: + case BuiltinBackup: require.Contains(t, bc, "BackupEngine.Builtin.Compressor:Close") require.Contains(t, bc, "BackupEngine.Builtin.Destination:Close") require.Contains(t, bc, "BackupEngine.Builtin.Destination:Open") require.Contains(t, bc, "BackupEngine.Builtin.Source:Close") require.Contains(t, bc, "BackupEngine.Builtin.Source:Open") + case XtraBackup, MySQLShell: } require.Contains(t, vars, "BackupDurationNanoseconds") @@ -1395,8 +1395,7 @@ func verifyTabletBackupStats(t *testing.T, vars map[string]any) { switch currentSetupType { // Currently only the builtin backup engine emits timings. - case XtraBackup, MySQLShell: - default: + case BuiltinBackup: require.Contains(t, bd, "BackupEngine.Builtin.Compressor:Close") require.Contains(t, bd, "BackupEngine.Builtin.Compressor:Write") require.Contains(t, bd, "BackupEngine.Builtin.Destination:Close") @@ -1405,6 +1404,7 @@ func verifyTabletBackupStats(t *testing.T, vars map[string]any) { require.Contains(t, bd, "BackupEngine.Builtin.Source:Close") require.Contains(t, bd, "BackupEngine.Builtin.Source:Open") require.Contains(t, bd, "BackupEngine.Builtin.Source:Read") + case XtraBackup, MySQLShell: } if backupstorage.BackupStorageImplementation == "file" { @@ -1432,14 +1432,14 @@ func verifyTabletRestoreStats(t *testing.T, vars map[string]any) { verifyRestorePositionAndTimeStats(t, vars) switch currentSetupType { - case XtraBackup, MySQLShell: - default: + case BuiltinBackup: require.Contains(t, vars, "RestoreBytes") bb := vars["RestoreBytes"].(map[string]any) require.Contains(t, bb, "BackupEngine.Builtin.Decompressor:Read") require.Contains(t, bb, "BackupEngine.Builtin.Destination:Write") require.Contains(t, bb, "BackupEngine.Builtin.Source:Read") require.Contains(t, bb, "BackupStorage.File.File:Read") + case XtraBackup, MySQLShell: } require.Contains(t, vars, "RestoreCount") @@ -1448,13 +1448,13 @@ func verifyTabletRestoreStats(t *testing.T, vars map[string]any) { switch currentSetupType { // Currently only the builtin backup engine emits operation counts. - case XtraBackup, MySQLShell: - default: + case BuiltinBackup: require.Contains(t, bc, "BackupEngine.Builtin.Decompressor:Close") require.Contains(t, bc, "BackupEngine.Builtin.Destination:Close") require.Contains(t, bc, "BackupEngine.Builtin.Destination:Open") require.Contains(t, bc, "BackupEngine.Builtin.Source:Close") require.Contains(t, bc, "BackupEngine.Builtin.Source:Open") + case XtraBackup, MySQLShell: } require.Contains(t, vars, "RestoreDurationNanoseconds") @@ -1463,8 +1463,7 @@ func verifyTabletRestoreStats(t *testing.T, vars map[string]any) { switch currentSetupType { // Currently only the builtin backup engine emits timings. - case XtraBackup, MySQLShell: - default: + case BuiltinBackup: require.Contains(t, bd, "BackupEngine.Builtin.Decompressor:Close") require.Contains(t, bd, "BackupEngine.Builtin.Decompressor:Read") require.Contains(t, bd, "BackupEngine.Builtin.Destination:Close") @@ -1473,6 +1472,7 @@ func verifyTabletRestoreStats(t *testing.T, vars map[string]any) { require.Contains(t, bd, "BackupEngine.Builtin.Source:Close") require.Contains(t, bd, "BackupEngine.Builtin.Source:Open") require.Contains(t, bd, "BackupEngine.Builtin.Source:Read") + case XtraBackup, MySQLShell: } require.Contains(t, bd, "BackupStorage.File.File:Read") diff --git a/go/vt/mysqlctl/mysqlshellbackupengine.go b/go/vt/mysqlctl/mysqlshellbackupengine.go index 624aba138aa..7b80f221406 100644 --- a/go/vt/mysqlctl/mysqlshellbackupengine.go +++ b/go/vt/mysqlctl/mysqlshellbackupengine.go @@ -124,9 +124,7 @@ func (be *MySQLShellBackupEngine) ExecuteBackup(ctx context.Context, params Back args = append(args, strings.Fields(mysqlShellFlags)...) } - args = append(args, "-e", fmt.Sprintf("util.dumpSchemas([\"%s\", \"vt_%s\"], %q, %s)", - sidecar.GetName(), - params.Keyspace, + args = append(args, "-e", fmt.Sprintf("util.dumpInstance(%q, %s)", location, mysqlShellDumpFlags, ))