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

Adding deprecate message to backup hooks #11491

Merged
merged 7 commits into from
Oct 14, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions doc/releasenotes/15_0_0_release_notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ The following VTTablet flags were deprecated in 7.0. They have now been deleted
- --enable_semi_sync is now deprecated. It will be removed in v16. Instead, set the correct durability policy using `SetKeyspaceDurabilityPolicy`
- --queryserver-config-pool-prefill-parallelism, --queryserver-config-stream-pool-prefill-parallelism and --queryserver-config-transaction-prefill-parallelism have all been deprecated. They will be removed in v16.

#### vtbackup flag deprecations
- - --backup_storage_hook is deprecated; Consider using ExternalCompressorCmd/ExternalDecompressorCmd instead.

### New command line flags and behavior

#### vtgate --mysql-server-pool-conn-read-buffers
Expand Down
3 changes: 3 additions & 0 deletions doc/releasenotes/15_0_0_summary.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ The following VTTablet flags were deprecated in 7.0. They have now been deleted
- --enable_semi_sync is now deprecated. It will be removed in v16. Instead, set the correct durability policy using `SetKeyspaceDurabilityPolicy`
- --queryserver-config-pool-prefill-parallelism, --queryserver-config-stream-pool-prefill-parallelism and --queryserver-config-transaction-prefill-parallelism have all been deprecated. They will be removed in v16.

#### vtbackup flag deprecations
- --backup_storage_hook is deprecated; Consider using ExternalCompressorCmd/ExternalDecompressorCmd instead.
rsajwani marked this conversation as resolved.
Show resolved Hide resolved

### New command line flags and behavior

#### vtgate --mysql-server-pool-conn-read-buffers
Expand Down
1 change: 0 additions & 1 deletion go/flags/endtoend/mysqlctl.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ Global flags:
--backup_engine_implementation string Specifies which implementation to use for creating new backups (builtin or xtrabackup). Restores will always be done with whichever engine created a given backup. (default "builtin")
--backup_storage_block_size int if backup_storage_compress is true, backup_storage_block_size sets the byte size for each block while compressing (default is 250000). (default 250000)
--backup_storage_compress if set, the backup files will be compressed (default is true). Set to false for instance if a backup_storage_hook is specified and it compresses the data. (default true)
--backup_storage_hook string if set, we send the contents of the backup files through this hook (deprecated: hooks will be disabled in v16.0. Please use ExternalCompressorCmd/ExternalDecompressorCmd instead).
--backup_storage_number_blocks int if backup_storage_compress is true, backup_storage_number_blocks sets the number of blocks that can be processed, at once, before the writer blocks, during compression (default is 2). It should be equal to the number of CPUs available for compression. (default 2)
--builtinbackup_mysqld_timeout duration how long to wait for mysqld to shutdown at the start of the backup. (default 10m0s)
--builtinbackup_progress duration how often to send progress updates when backing up large files. (default 5s)
Expand Down
1 change: 0 additions & 1 deletion go/flags/endtoend/mysqlctld.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ Usage of mysqlctld:
--backup_engine_implementation string Specifies which implementation to use for creating new backups (builtin or xtrabackup). Restores will always be done with whichever engine created a given backup. (default "builtin")
--backup_storage_block_size int if backup_storage_compress is true, backup_storage_block_size sets the byte size for each block while compressing (default is 250000). (default 250000)
--backup_storage_compress if set, the backup files will be compressed (default is true). Set to false for instance if a backup_storage_hook is specified and it compresses the data. (default true)
--backup_storage_hook string if set, we send the contents of the backup files through this hook (deprecated: hooks will be disabled in v16.0. Please use ExternalCompressorCmd/ExternalDecompressorCmd instead).
--backup_storage_number_blocks int if backup_storage_compress is true, backup_storage_number_blocks sets the number of blocks that can be processed, at once, before the writer blocks, during compression (default is 2). It should be equal to the number of CPUs available for compression. (default 2)
--builtinbackup_mysqld_timeout duration how long to wait for mysqld to shutdown at the start of the backup. (default 10m0s)
--builtinbackup_progress duration how often to send progress updates when backing up large files. (default 5s)
Expand Down
1 change: 0 additions & 1 deletion go/flags/endtoend/vtbackup.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ Usage of vtbackup:
--backup_engine_implementation string Specifies which implementation to use for creating new backups (builtin or xtrabackup). Restores will always be done with whichever engine created a given backup. (default "builtin")
--backup_storage_block_size int if backup_storage_compress is true, backup_storage_block_size sets the byte size for each block while compressing (default is 250000). (default 250000)
--backup_storage_compress if set, the backup files will be compressed (default is true). Set to false for instance if a backup_storage_hook is specified and it compresses the data. (default true)
--backup_storage_hook string if set, we send the contents of the backup files through this hook (deprecated: hooks will be disabled in v16.0. Please use ExternalCompressorCmd/ExternalDecompressorCmd instead).
--backup_storage_implementation string Which backup storage implementation to use for creating and restoring backups.
--backup_storage_number_blocks int if backup_storage_compress is true, backup_storage_number_blocks sets the number of blocks that can be processed, at once, before the writer blocks, during compression (default is 2). It should be equal to the number of CPUs available for compression. (default 2)
--ceph_backup_storage_config string Path to JSON config file for ceph backup storage. (default "ceph_backup_config.json")
Expand Down
1 change: 0 additions & 1 deletion go/flags/endtoend/vtctld.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ Usage of vtctld:
--backup_engine_implementation string Specifies which implementation to use for creating new backups (builtin or xtrabackup). Restores will always be done with whichever engine created a given backup. (default "builtin")
--backup_storage_block_size int if backup_storage_compress is true, backup_storage_block_size sets the byte size for each block while compressing (default is 250000). (default 250000)
--backup_storage_compress if set, the backup files will be compressed (default is true). Set to false for instance if a backup_storage_hook is specified and it compresses the data. (default true)
--backup_storage_hook string if set, we send the contents of the backup files through this hook (deprecated: hooks will be disabled in v16.0. Please use ExternalCompressorCmd/ExternalDecompressorCmd instead).
--backup_storage_implementation string Which backup storage implementation to use for creating and restoring backups.
--backup_storage_number_blocks int if backup_storage_compress is true, backup_storage_number_blocks sets the number of blocks that can be processed, at once, before the writer blocks, during compression (default is 2). It should be equal to the number of CPUs available for compression. (default 2)
--builtinbackup_mysqld_timeout duration how long to wait for mysqld to shutdown at the start of the backup. (default 10m0s)
Expand Down
1 change: 0 additions & 1 deletion go/flags/endtoend/vtexplain.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ Usage of vtexplain:
--backup_engine_implementation string Specifies which implementation to use for creating new backups (builtin or xtrabackup). Restores will always be done with whichever engine created a given backup. (default "builtin")
--backup_storage_block_size int if backup_storage_compress is true, backup_storage_block_size sets the byte size for each block while compressing (default is 250000). (default 250000)
--backup_storage_compress if set, the backup files will be compressed (default is true). Set to false for instance if a backup_storage_hook is specified and it compresses the data. (default true)
--backup_storage_hook string if set, we send the contents of the backup files through this hook (deprecated: hooks will be disabled in v16.0. Please use ExternalCompressorCmd/ExternalDecompressorCmd instead).
--backup_storage_number_blocks int if backup_storage_compress is true, backup_storage_number_blocks sets the number of blocks that can be processed, at once, before the writer blocks, during compression (default is 2). It should be equal to the number of CPUs available for compression. (default 2)
--batch-interval duration Interval between logical time slots. (default 10ms)
--builtinbackup_mysqld_timeout duration how long to wait for mysqld to shutdown at the start of the backup. (default 10m0s)
Expand Down
1 change: 0 additions & 1 deletion go/flags/endtoend/vttablet.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ Usage of vttablet:
--backup_engine_implementation string Specifies which implementation to use for creating new backups (builtin or xtrabackup). Restores will always be done with whichever engine created a given backup. (default "builtin")
--backup_storage_block_size int if backup_storage_compress is true, backup_storage_block_size sets the byte size for each block while compressing (default is 250000). (default 250000)
--backup_storage_compress if set, the backup files will be compressed (default is true). Set to false for instance if a backup_storage_hook is specified and it compresses the data. (default true)
--backup_storage_hook string if set, we send the contents of the backup files through this hook (deprecated: hooks will be disabled in v16.0. Please use ExternalCompressorCmd/ExternalDecompressorCmd instead).
--backup_storage_implementation string Which backup storage implementation to use for creating and restoring backups.
--backup_storage_number_blocks int if backup_storage_compress is true, backup_storage_number_blocks sets the number of blocks that can be processed, at once, before the writer blocks, during compression (default is 2). It should be equal to the number of CPUs available for compression. (default 2)
--binlog_host string PITR restore parameter: hostname/IP of binlog server.
Expand Down
1 change: 0 additions & 1 deletion go/flags/endtoend/vttestserver.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ Usage of vttestserver:
--backup_engine_implementation string Specifies which implementation to use for creating new backups (builtin or xtrabackup). Restores will always be done with whichever engine created a given backup. (default "builtin")
--backup_storage_block_size int if backup_storage_compress is true, backup_storage_block_size sets the byte size for each block while compressing (default is 250000). (default 250000)
--backup_storage_compress if set, the backup files will be compressed (default is true). Set to false for instance if a backup_storage_hook is specified and it compresses the data. (default true)
--backup_storage_hook string if set, we send the contents of the backup files through this hook (deprecated: hooks will be disabled in v16.0. Please use ExternalCompressorCmd/ExternalDecompressorCmd instead).
--backup_storage_number_blocks int if backup_storage_compress is true, backup_storage_number_blocks sets the number of blocks that can be processed, at once, before the writer blocks, during compression (default is 2). It should be equal to the number of CPUs available for compression. (default 2)
--builtinbackup_mysqld_timeout duration how long to wait for mysqld to shutdown at the start of the backup. (default 10m0s)
--builtinbackup_progress duration how often to send progress updates when backing up large files. (default 5s)
Expand Down
3 changes: 2 additions & 1 deletion go/vt/mysqlctl/backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ func init() {
}

func registerBackupFlags(fs *pflag.FlagSet) {
fs.StringVar(&backupStorageHook, "backup_storage_hook", backupStorageHook, "if set, we send the contents of the backup files through this hook (deprecated: hooks will be disabled in v16.0. Please use ExternalCompressorCmd/ExternalDecompressorCmd instead).")
fs.StringVar(&backupStorageHook, "backup_storage_hook", backupStorageHook, "if set, we send the contents of the backup files through this hook.")
_ = fs.MarkDeprecated("backup_storage_hook", "--backup_storage_hook is deprecated; Consider using ExternalCompressorCmd/ExternalDecompressorCmd instead.")
Copy link
Contributor

Choose a reason for hiding this comment

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

For this, pflag is going to do roughly {{f.Name}} is deprecated.{{ if .Message ne "" }} {{ .Message }}{{ endif }}, so you should try this out and adjust accordingly.

Copy link
Contributor Author

@rsajwani rsajwani Oct 14, 2022

Choose a reason for hiding this comment

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

fixed it...

Flag --backup_storage_hook has been deprecated, consider using ExternalCompressorCmd/ExternalDecompressorCmd instead.
W1014 10:26:31.712856 67759 backup.go:211] checkNoDB failed, found active db vt_ks
W1014 10:26:32.067150 67759 builtinbackupengine.go:165] --backup_storage_hook is deprecated; Consider using ExternalCompressorCmd/ExternalDecompressorCmd instead.

fs.BoolVar(&backupStorageCompress, "backup_storage_compress", backupStorageCompress, "if set, the backup files will be compressed (default is true). Set to false for instance if a backup_storage_hook is specified and it compresses the data.")
fs.IntVar(&backupCompressBlockSize, "backup_storage_block_size", backupCompressBlockSize, "if backup_storage_compress is true, backup_storage_block_size sets the byte size for each block while compressing (default is 250000).")
fs.IntVar(&backupCompressBlocks, "backup_storage_number_blocks", backupCompressBlocks, "if backup_storage_compress is true, backup_storage_number_blocks sets the number of blocks that can be processed, at once, before the writer blocks, during compression (default is 2). It should be equal to the number of CPUs available for compression.")
Expand Down
9 changes: 6 additions & 3 deletions go/vt/mysqlctl/builtinbackupengine.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,10 @@ func (fe *FileEntry) open(cnf *Mycnf, readOnly bool) (*os.File, error) {
// ExecuteBackup returns a boolean that indicates if the backup is usable,
// and an overall error.
func (be *BuiltinBackupEngine) ExecuteBackup(ctx context.Context, params BackupParams, bh backupstorage.BackupHandle) (bool, error) {

params.Logger.Infof("Hook: %v, Compress: %v", backupStorageHook, backupStorageCompress)

if backupStorageHook != "" {
log.Warning("--backup_storage_hook is deprecated; Consider using ExternalCompressorCmd/ExternalDecompressorCmd instead.")
}
Copy link
Contributor

Choose a reason for hiding this comment

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

this is redundant

Copy link
Member

Choose a reason for hiding this comment

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

We debated this a bit. The flag deprecation warning shows up only at tablet startup, whereas this will show up on every backup/restore, so it does have some additional value.

// Save initial state so we can restore.
replicaStartRequired := false
sourceIsPrimary := false
Expand Down Expand Up @@ -300,7 +301,6 @@ func (be *BuiltinBackupEngine) ExecuteBackup(ctx context.Context, params BackupP

// backupFiles finds the list of files to backup, and creates the backup.
func (be *BuiltinBackupEngine) backupFiles(ctx context.Context, params BackupParams, bh backupstorage.BackupHandle, replicationPosition mysql.Position) (finalErr error) {

// Get the files to backup.
// We don't care about totalSize because we add each file separately.
fes, _, err := findFilesToBackup(params.Cnf)
Expand Down Expand Up @@ -591,6 +591,9 @@ func (be *BuiltinBackupEngine) ExecuteRestore(ctx context.Context, params Restor
if err := prepareToRestore(ctx, params.Cnf, params.Mysqld, params.Logger); err != nil {
return nil, err
}
if bm.TransformHook != "" {
log.Warning("--backup_storage_hook is deprecated; Consider using ExternalCompressorCmd/ExternalDecompressorCmd instead.")
Copy link
Contributor

Choose a reason for hiding this comment

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

this is redundant

}

params.Logger.Infof("Restore: copying %v files", len(bm.FileEntries))

Expand Down