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

backup: support explicitly set sst compression type #404

Merged
merged 10 commits into from
Jul 9, 2020

Conversation

glorv
Copy link
Collaborator

@glorv glorv commented Jul 7, 2020

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

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Code changes

Side effects

Related changes

Release Note

@CLAassistant
Copy link

CLAassistant commented Jul 7, 2020

CLA assistant check
All committers have signed the CLA.

@glorv glorv requested review from 3pointer and kennytm July 7, 2020 11:47
Copy link
Collaborator

@kennytm kennytm left a comment

Choose a reason for hiding this comment

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

rest LGTM

@@ -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'")
Copy link
Collaborator

Choose a reason for hiding this comment

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

provide a default value?

Suggested change
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'")

Copy link
Collaborator Author

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'.

Copy link
Collaborator

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

Copy link
Collaborator Author

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?

Copy link
Member

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.

Copy link
Collaborator Author

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

Comment on lines 322 to 323
case "":
ct = kvproto.CompressionType_UNKNOWN
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
case "":
ct = kvproto.CompressionType_UNKNOWN

flagBackupTimeago = "timeago"
flagBackupTS = "backupts"
flagLastBackupTS = "lastbackupts"
flagCompressionType = "compression-type"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
flagCompressionType = "compression-type"
flagCompressionType = "compression"

@@ -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'")
Copy link
Member

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.

Copy link
Collaborator

@kennytm kennytm left a comment

Choose a reason for hiding this comment

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

LGTM

@ti-srebot ti-srebot added the status/LGT1 LGTM1 label Jul 8, 2020
@ti-srebot
Copy link
Contributor

@kennytm,Thanks for your review.

Copy link
Member

@overvenus overvenus left a comment

Choose a reason for hiding this comment

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

LGTM

@ti-srebot ti-srebot removed the status/LGT1 LGTM1 label Jul 9, 2020
@ti-srebot ti-srebot added the status/LGT2 LGTM2 label Jul 9, 2020
@ti-srebot
Copy link
Contributor

@overvenus,Thanks for your review.

@kennytm kennytm merged commit de452e1 into pingcap:master Jul 9, 2020
@3pointer
Copy link
Collaborator

3pointer commented Jul 9, 2020

maybe we should add a integration test for "zstd"

@ti-srebot
Copy link
Contributor

cherry pick to release-4.0 failed

YuJuncen pushed a commit to YuJuncen/br that referenced this pull request Jul 15, 2020
* 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
YuJuncen added a commit that referenced this pull request Jul 15, 2020
* 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 <kennytm@gmail.com>

* glue: use double quote in comment

* tests: use leaser DDL grep regex

* tests: use from(br) as comment

Co-authored-by: kennytm <kennytm@gmail.com>

* *: run go mod tidy

Co-authored-by: glorv <glorvs@163.com>
Co-authored-by: kennytm <kennytm@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants