-
Notifications
You must be signed in to change notification settings - Fork 101
backup: support explicitly set sst compression type #404
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rest LGTM
pkg/task/backup.go
Outdated
@@ -60,6 +62,7 @@ func DefineBackupFlags(flags *pflag.FlagSet) { | |||
flags.String(flagBackupTS, "", "the backup ts support TSO or datetime,"+ | |||
" e.g. '400036290571534337', '2018-05-11 01:42:23'") | |||
flags.Int64(flagGCTTL, backup.DefaultBRGCSafePointTTL, "the TTL (in seconds) that PD holds for BR's GC safepoint") | |||
flags.String(flagCompressionType, "", "backup sst file compression algorithm, value can be one of 'lz4|zstd|snappy'") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
provide a default value?
flags.String(flagCompressionType, "", "backup sst file compression algorithm, value can be one of 'lz4|zstd|snappy'") | |
flags.String(flagCompressionType, "zstd", "backup sst file compression algorithm, value can be one of 'lz4|zstd|snappy'") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the default value should be default, which means the compression type will be determined by tikv. In currently logic, tikv will choose the fastest algorithm and in most case it will be 'lz4'.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the default is called "unknown" though
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
e, so we should change the name in kv-proto to default?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should provide a validate default value, "zstd" looks good to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. Then I think we can set default to lz4
because it's the current compression type tikv uses. So if user don't set this flag, the behavior is same with previous version, so it's compatible will old version
pkg/task/backup.go
Outdated
case "": | ||
ct = kvproto.CompressionType_UNKNOWN |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
case "": | |
ct = kvproto.CompressionType_UNKNOWN |
pkg/task/backup.go
Outdated
flagBackupTimeago = "timeago" | ||
flagBackupTS = "backupts" | ||
flagLastBackupTS = "lastbackupts" | ||
flagCompressionType = "compression-type" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
flagCompressionType = "compression-type" | |
flagCompressionType = "compression" |
pkg/task/backup.go
Outdated
@@ -60,6 +62,7 @@ func DefineBackupFlags(flags *pflag.FlagSet) { | |||
flags.String(flagBackupTS, "", "the backup ts support TSO or datetime,"+ | |||
" e.g. '400036290571534337', '2018-05-11 01:42:23'") | |||
flags.Int64(flagGCTTL, backup.DefaultBRGCSafePointTTL, "the TTL (in seconds) that PD holds for BR's GC safepoint") | |||
flags.String(flagCompressionType, "", "backup sst file compression algorithm, value can be one of 'lz4|zstd|snappy'") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should provide a validate default value, "zstd" looks good to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@kennytm,Thanks for your review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@overvenus,Thanks for your review. |
maybe we should add a integration test for "zstd" |
cherry pick to release-4.0 failed |
* add compression type * fix * apply compresssion * fix lint * fix restore flag * provide default value for flag compression * change default backup compression type from 'lz4' to 'zstd' in favor of better performance * fix a log bug
* backup: support explicitly set sst compression type (#404) * add compression type * fix * apply compresssion * fix lint * fix restore flag * provide default value for flag compression * change default backup compression type from 'lz4' to 'zstd' in favor of better performance * fix a log bug * Fix the problem that backup time may be negative (#405) * backup: make sure backup time greater than 0 * backup: rename some variables * backup: make CI happy * glue: set no register itself to dashboard (#421) * glue: set no register itself to dashboard * glue: set no register when initlizating gluetidb * go.mod: update tidb to latest release-4.0 * *: update TiDB version * *: update tidb to 4.0 confirmed hash * glue: add a todo in a place that inconsistant to master * glue: set query DDL when executing DDLs (#406) * glue: set query DDL when executing DDLs * glue: fix some linting * *: update TiDB version * *: run go mod tidy * Update tests/br_db/run.sh Co-authored-by: kennytm <[email protected]> * glue: use double quote in comment * tests: use leaser DDL grep regex * tests: use from(br) as comment Co-authored-by: kennytm <[email protected]> * *: run go mod tidy Co-authored-by: glorv <[email protected]> Co-authored-by: kennytm <[email protected]>
What problem does this PR solve?
Add command line parameter for sst file compression type
What is changed and how it works?
Check List
Tests
Code changes
Side effects
Related changes
Release Note