Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

backup: add raw backup command #101

Merged
merged 4 commits into from
Mar 4, 2020
Merged

backup: add raw backup command #101

merged 4 commits into from
Mar 4, 2020

Conversation

3pointer
Copy link
Collaborator

@3pointer 3pointer commented Dec 11, 2019

support backup raw kv according to #86

@codecov
Copy link

codecov bot commented Dec 11, 2019

Codecov Report

Merging #101 into master will decrease coverage by 0.79%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #101      +/-   ##
==========================================
- Coverage   71.54%   70.75%   -0.80%     
==========================================
  Files          41       43       +2     
  Lines        3838     3942     +104     
==========================================
+ Hits         2746     2789      +43     
- Misses        759      805      +46     
- Partials      333      348      +15     
Impacted Files Coverage Δ
pkg/restore/import.go 63.44% <0.00%> (-8.61%) ⬇️
pkg/restore/split_client.go 34.46% <0.00%> (-2.92%) ⬇️
pkg/backup/client.go 70.61% <0.00%> (-0.19%) ⬇️
pkg/task/backup.go 60.00% <0.00%> (+1.02%) ⬆️
pkg/utils/key.go 63.41% <0.00%> (ø)
pkg/task/backup_raw.go 55.22% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e462f80...1ae55bf. Read the comment docs.

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.

Rest LGTM, but I'd like to see if it can backup raw kv cluster.

go.mod Outdated
@@ -16,7 +16,7 @@ require (
github.com/onsi/gomega v1.7.1 // indirect
github.com/pingcap/check v0.0.0-20190102082844-67f458068fc8
github.com/pingcap/errors v0.11.4
github.com/pingcap/kvproto v0.0.0-20191210040729-c23886becb54
github.com/pingcap/kvproto v0.0.0-20191211032946-5dbce7e7b868
Copy link
Member

Choose a reason for hiding this comment

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

Please use kvproto@release-3.1, @MyonKeminta is working on cherry-pick.

Copy link
Contributor

Choose a reason for hiding this comment

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

Cherry-pick is here: pingcap/kvproto#520

Copy link
Contributor

@MyonKeminta MyonKeminta 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. By the way, do you think it's necessary to do some test before merging, which means, wait for TiKV's raw backup to be done?

Copy link
Contributor

@MyonKeminta MyonKeminta left a comment

Choose a reason for hiding this comment

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

Sorry. Dropped a comment.

@@ -357,6 +359,7 @@ func (bc *Client) backupRange(
StorageBackend: bc.backend,
RateLimit: rateLimit,
Concurrency: concurrency,
IsRawKv: isRawKv,
}
push := newPushDown(ctx, bc.mgr, len(allStores))

Copy link
Contributor

Choose a reason for hiding this comment

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

It seems you need to set the IsRawKv field of backupMeta below here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

cmd/backup.go Outdated
Comment on lines 400 to 401
command.Flags().StringP("start", "s", "", "backup raw kv start key")
command.Flags().StringP("end", "e", "", "backup raw kv end key")
Copy link
Collaborator

@kennytm kennytm Dec 11, 2019

Choose a reason for hiding this comment

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

  1. -s of --start conflicts with --storage
  2. If I write --start 1234 is the actual start key x"1234" or x"31323334"?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

add function ParseKey like pd

@3pointer 3pointer force-pushed the raw_backup branch 2 times, most recently from bdb47e6 to 9d5d610 Compare December 11, 2019 10:27
@3pointer
Copy link
Collaborator Author

Rest LGTM. By the way, do you think it's necessary to do some test before merging, which means, wait for TiKV's raw backup to be done?

sure, we can wait until test tikv raw kv backup succeed

cmd/backup.go Outdated
return errors.New("at least one thread required")
}

ranges := []backup.Range{{StartKey: []byte(start), EndKey: []byte(end)}}
Copy link
Contributor

@MyonKeminta MyonKeminta Dec 11, 2019

Choose a reason for hiding this comment

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

Oh, looks like it's not proper to parse keys like this. Maybe you can use command.Flags().GetBytesHex(...)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yes, add function ParseKey, it can parse hex string

Copy link
Contributor

Choose a reason for hiding this comment

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

Please also consider check the correctness of user's input, return an error if endKey < startKey.

@@ -377,6 +380,7 @@ func (bc *Client) backupRange(

bc.backupMeta.StartVersion = backupTS
bc.backupMeta.EndVersion = backupTS
bc.backupMeta.IsRawKv = isRawKv
Copy link
Contributor

Choose a reason for hiding this comment

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

I've updated kvproto and added backed up range in backupMeta. Maybe you need also set the range then.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

cmd/backup.go Outdated
return errors.New("at least one thread required")
}

ranges := []backup.Range{{StartKey: []byte(start), EndKey: []byte(end)}}
Copy link
Contributor

Choose a reason for hiding this comment

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

Please also consider check the correctness of user's input, return an error if endKey < startKey.

pkg/utils/key.go Outdated
Comment on lines 19 to 20
case "encode":
return decodeKey(key)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this format is better to be called "escaped", and the decodeKey is actually unescapeKey.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sure, I found this function in PD, but seems escaped is meaningful

pkg/utils/key.go Outdated
)

// ParseKey parse key by given format
func ParseKey(flags *pflag.FlagSet, key string) (string, error) {
Copy link
Contributor

@MyonKeminta MyonKeminta Dec 12, 2019

Choose a reason for hiding this comment

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

A key is better to be represented by []byte rather than a string. After parsing a string, you'd better return a []byte here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sure, update it

@MyonKeminta MyonKeminta mentioned this pull request Dec 12, 2019
2 tasks
@3pointer 3pointer force-pushed the raw_backup branch 3 times, most recently from 24a828b to 2820b4b Compare December 13, 2019 11:33
@zyxbest
Copy link

zyxbest commented Dec 13, 2019

/run-all-tests

Copy link
Contributor

@MyonKeminta MyonKeminta 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.

cmd/backup.go Outdated
return runBackup(command.Flags(), "Raw Backup", bc)
},
}
command.Flags().StringP("format", "", "raw", "raw key format")
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider using 'hex' as the default format?

Copy link
Contributor

Choose a reason for hiding this comment

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

Also I think it's better to add more details in the help message. For example, supported formats, what exactly these formats are, and that start key is inclusive and end key is exclusive, etc.

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, I'll do it

Copy link
Contributor

@MyonKeminta MyonKeminta left a comment

Choose a reason for hiding this comment

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

LGTM

@3pointer 3pointer added the status/LGT1 LGTM1 label Feb 5, 2020
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.

Could you add a raw kv test?

@3pointer
Copy link
Collaborator Author

3pointer commented Feb 5, 2020

Could you add a raw kv test?

Sure, I'll add one into integration test

@3pointer
Copy link
Collaborator Author

/run-integration-test tidb=release-4.0 tikv=release-4.0 pd=release-4.0

1 similar comment
@3pointer
Copy link
Collaborator Author

/run-integration-test tidb=release-4.0 tikv=release-4.0 pd=release-4.0

@3pointer 3pointer removed the WIP label Feb 10, 2020
@3pointer 3pointer added the type/feature-request New feature or request label Feb 10, 2020
Comment on lines 18 to 24
// * Rand Gen
// * Scan checksum
// * Scan print
// * Scan diff
//
// Ref TIDB: https://github.com/pingcap/tidb/commit/7a7b2d82a70858544d7b711c9cb8499bda5d6eb7

Copy link
Contributor

Choose a reason for hiding this comment

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

Remove these lines please

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

}

if bytes.Compare(cfg.StartKey, cfg.EndKey) > 0 {
return errors.New("input endKey must greater or equal than startKey")
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return errors.New("input endKey must greater or equal than startKey")
return errors.New("endKey must be greater or equal than startKey")

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually I think it's ok to disallow the case startKey == endKey. It will be an empty range and makes no sense.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yes, updated

return err
}

backupTS, err := client.GetTS(ctx, 0)
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems we don't need this ts in rawkv backup.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

sure, set backupTS

cmd/backup.go Outdated
Use: "raw",
Short: "backup a raw kv range from TiKV cluster",
RunE: func(command *cobra.Command, _ []string) error {
return runBackupRawCommand(command, "Raw Backup")
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return runBackupRawCommand(command, "Raw Backup")
return runBackupRawCommand(command, "Raw backup")

Keep consistent with other commands

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

Comment on lines 19 to 25
type BackupRawConfig struct {
Config

StartKey []byte
EndKey []byte
CF string
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this need to also support json and toml serialization like how BackupConfig does? I'm not sure why its needed. @kennytm PTAL

Copy link
Collaborator

Choose a reason for hiding this comment

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

@MyonKeminta the JSON and TOML tags are for forward compatibility in case we do want to support config file.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Add json and toml serialization support PTAL

@3pointer
Copy link
Collaborator Author

/run-integration-test tidb=release-4.0 tikv=release-4.0 pd=release-4.0

@MyonKeminta
Copy link
Contributor

LGTM

@3pointer 3pointer added the status/LGT1 LGTM1 label Feb 12, 2020
@3pointer
Copy link
Collaborator Author

/run-integration-test tidb=release-4.0 tikv=release-4.0 pd=release-4.0

@kennytm
Copy link
Collaborator

kennytm commented Feb 12, 2020

[2020-02-12T05:46:28.121Z] GC safepoint 0 exceed TS 0
[2020-02-12T05:46:28.121Z] github.com/pingcap/br/pkg/backup.CheckGCSafepoint
[2020-02-12T05:46:28.121Z] 	/home/jenkins/agent/workspace/br_ghpr_unit_and_integration_test/go/src/github.com/pingcap/br/pkg/backup/safe_point.go:32
[2020-02-12T05:46:28.121Z] github.com/pingcap/br/pkg/backup.(*Client).BackupRanges
[2020-02-12T05:46:28.121Z] 	/home/jenkins/agent/workspace/br_ghpr_unit_and_integration_test/go/src/github.com/pingcap/br/pkg/backup/client.go:278
[2020-02-12T05:46:28.121Z] github.com/pingcap/br/pkg/task.RunBackupRaw
[2020-02-12T05:46:28.121Z] 	/home/jenkins/agent/workspace/br_ghpr_unit_and_integration_test/go/src/github.com/pingcap/br/pkg/task/backup_raw.go:117
[2020-02-12T05:46:28.121Z] github.com/pingcap/br/cmd.runBackupRawCommand
[2020-02-12T05:46:28.121Z] 	/home/jenkins/agent/workspace/br_ghpr_unit_and_integration_test/go/src/github.com/pingcap/br/cmd/backup.go:26
[2020-02-12T05:46:28.121Z] github.com/pingcap/br/cmd.newRawBackupCommand.func1
[2020-02-12T05:46:28.121Z] 	/home/jenkins/agent/workspace/br_ghpr_unit_and_integration_test/go/src/github.com/pingcap/br/cmd/backup.go:106

@3pointer
Copy link
Collaborator Author

[2020-02-12T05:46:28.121Z] GC safepoint 0 exceed TS 0
[2020-02-12T05:46:28.121Z] github.com/pingcap/br/pkg/backup.CheckGCSafepoint
[2020-02-12T05:46:28.121Z] 	/home/jenkins/agent/workspace/br_ghpr_unit_and_integration_test/go/src/github.com/pingcap/br/pkg/backup/safe_point.go:32
[2020-02-12T05:46:28.121Z] github.com/pingcap/br/pkg/backup.(*Client).BackupRanges
[2020-02-12T05:46:28.121Z] 	/home/jenkins/agent/workspace/br_ghpr_unit_and_integration_test/go/src/github.com/pingcap/br/pkg/backup/client.go:278
[2020-02-12T05:46:28.121Z] github.com/pingcap/br/pkg/task.RunBackupRaw
[2020-02-12T05:46:28.121Z] 	/home/jenkins/agent/workspace/br_ghpr_unit_and_integration_test/go/src/github.com/pingcap/br/pkg/task/backup_raw.go:117
[2020-02-12T05:46:28.121Z] github.com/pingcap/br/cmd.runBackupRawCommand
[2020-02-12T05:46:28.121Z] 	/home/jenkins/agent/workspace/br_ghpr_unit_and_integration_test/go/src/github.com/pingcap/br/cmd/backup.go:26
[2020-02-12T05:46:28.121Z] github.com/pingcap/br/cmd.newRawBackupCommand.func1
[2020-02-12T05:46:28.121Z] 	/home/jenkins/agent/workspace/br_ghpr_unit_and_integration_test/go/src/github.com/pingcap/br/cmd/backup.go:106

Fixed, Raw backup do not have backupTS and don't need to checkSafePoint

@3pointer
Copy link
Collaborator Author

/run-integration-test tidb=release-4.0 tikv=release-4.0 pd=release-4.0

@3pointer
Copy link
Collaborator Author

Could you add a raw kv test?

Done, PTAL @overvenus

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.

Rest LGTM

return []byte(key), nil
case "escaped":
return unescapedKey(key)
case "hex":
Copy link
Member

Choose a reason for hiding this comment

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

For simplicity, can we just support hex only?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

maybe make hex as default format is enough?

return nil, errors.New("unknown format")
}

func unescapedKey(text string) ([]byte, error) {
Copy link
Member

Choose a reason for hiding this comment

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

Could you add a reference to PD-ctl's implementation?


// DefineRawBackupFlags defines common flags for the backup command.
func DefineRawBackupFlags(command *cobra.Command) {
command.Flags().StringP("format", "", "hex", "start/end key format, support raw|escaped|hex")
Copy link
Member

Choose a reason for hiding this comment

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

Please define a string const for "format", "cf", "start" and "end".

@3pointer
Copy link
Collaborator Author

3pointer commented Mar 4, 2020

/run-all-tests

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

@3pointer 3pointer merged commit 4657932 into master Mar 4, 2020
@3pointer 3pointer deleted the raw_backup branch March 4, 2020 03:21
kennytm added a commit that referenced this pull request Mar 20, 2020
* restore: merge tidb-tools/pkg/restore-util (#146)

* restore-util: Implement split/scatter (#274)

* implement split/scatter

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* init test

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* redesign output/input of the lib

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* update dependency

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* add commments and more tests

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* add ScanRegions interface to Client

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* fix potential data race

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* address comments

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* address comments

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* Apply suggestions from code review

Co-Authored-By: kennytm <kennytm@gmail.com>

* Update pkg/restore-util/client.go

Co-Authored-By: kennytm <kennytm@gmail.com>

* address comments

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* address comments

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* address comments

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* update dependency

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* resolve conflicts

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* fix prefix rewrite

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* add RewriteRule/skip failed scatter region/retry the SplitRegion

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* fix test

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* check if region has peer

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* more logs

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* restore-util: add split retry interval (#277)

* reset dependencies to release-3.1

* add split retry interval

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* fix go.sum

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* restore-util: wait for scatter region sequentially  (#279)

* wait for scatter region sequentially

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* address comments

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* restore-util: add on split hook (#281)

* restore-util: add on split hook

Signed-off-by: Neil Shen <overvenus@gmail.com>

* Nil check onSplit

Co-Authored-By: kennytm <kennytm@gmail.com>

* restore-util: fix returned new region is nil (#283)

* restore-util: fix returned new region is nil

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* more logs

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* *: gofmt

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* Apply suggestions from code review

Co-Authored-By: kennytm <kennytm@gmail.com>

* fix log

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* restore-util: call onSplit on splitByRewriteRules (#285)

Signed-off-by: Neil Shen <overvenus@gmail.com>

* restore-util: fix overlapped error message (#293)

* restore-util: fix overlapped error message

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* fix log message

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* reduce error trace

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* fix test

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* address comments

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* address comments

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* restore-util: log warning when cannot find matched rewrite rule (#299)

* restore-util: add method to set placement rules and store labels (#301)

* restore-util: add method to set placement rules and store labels

Signed-off-by: disksing <i@disksing.com>

* minor fix

Signed-off-by: disksing <i@disksing.com>

* address comment

Signed-off-by: disksing <i@disksing.com>

* add GetPlacementRules

Signed-off-by: disksing <i@disksing.com>

* fix test

Signed-off-by: disksing <i@disksing.com>

* restore-util: support batch split (#300)

* restore-util: support batch split

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* go fmt

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* Apply suggestions from code review

Co-Authored-By: kennytm <kennytm@gmail.com>

* address commits

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* Update pkg/restore-util/split.go

Co-Authored-By: kennytm <kennytm@gmail.com>

* add onSplit callback

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* fix test

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* address comments

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* restore-util: add upper bound time for waiting for scatter (#305)

* restore: fix scatter regions failed

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* add log

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* stop waiting for scatter after 3min

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* address comments

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* restore-util: fix wrong url (#306)

Signed-off-by: disksing <i@disksing.com>

* restore-util: add warning about unmatched table id (#313)

* restore-util: support table partition

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* fix log

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* warn table id does not match

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* add unit tests

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* Apply suggestions from code review

Co-Authored-By: Neil Shen <overvenus@gmail.com>

* fix compile error

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* address comments

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* address comments

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* fix test

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

Co-authored-by: Ian <ArGregoryIan@gmail.com>
Co-authored-by: Neil Shen <overvenus@gmail.com>

* *: prune tidb-tools

Signed-off-by: Neil Shen <overvenus@gmail.com>

* restore: address linters suggestions

Signed-off-by: Neil Shen <overvenus@gmail.com>

* restore: merge restoreutil into restore

Signed-off-by: Neil Shen <overvenus@gmail.com>

* address comment

Signed-off-by: Neil Shen <overvenus@gmail.com>

Co-authored-by: 5kbpers <20279863+5kbpers@users.noreply.github.com>
Co-authored-by: kennytm <kennytm@gmail.com>
Co-authored-by: disksing <i@disksing.com>
Co-authored-by: Ian <ArGregoryIan@gmail.com>

* Fixed handling for a dbName that do not exist in the backup being restored (#148)

* Fixed handling for a dbName that do not exist in the backup being restored

* Fixed handling for a dbName that do not exist in the backup being restored

* validate: fix debug meta test ci (#153)

* validate: fix debug meta test ci

* *: extracts runBackup/runRestore in cmd into pkg/task (#156)

* *: extracts runBackup/runRestore in cmd into pkg/task

Defines a "Config" structure to store the parsed flags.

Use the "black-white-list" structure to define what tables/databases to
backup/restore.

* go.mod: update tidb to v4.0.0-beta

* restore: fix restore summary log (#150)

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

* restore: enhance error handling (#152)

* restore: enhance error handling

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* unit test

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* address comments

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* fix region epoch error

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* address comments

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* remove `Restore*`

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* address lint

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* add debug log

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* Apply suggestions from code review

Co-Authored-By: kennytm <kennytm@gmail.com>

* Update pkg/restore/import.go

Co-Authored-By: kennytm <kennytm@gmail.com>

* fix retry error

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* handle RegionNotFound error

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

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

* Incremental BR: support DDL (#155)

* support backup&restore ddl

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* integration tests

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* update kvproto

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* fix integration tests

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* reduce cyclomatic complexity of `runRestore`

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* fix test

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* add unit test

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* fix tests

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* disable fast checksum in incremental br

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* fix no valid key error

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* address lint

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* address comments

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* Reduce TiDB dependencies (#158)

* utils: exclude mock_cluster outside of unit test

* utils: remove unused ResultSetToStringSlice()

* *: abstract away dependencies of tidb/session into a Glue interface

* *: fix hound lint

* util,mock: move utils.MockCluster to mock.Cluster

* restore: fix test build failure

Co-authored-by: 3pointer <qdlc2010@gmail.com>

* go.mod: update tidb (#168)

Signed-off-by: Neil Shen <overvenus@gmail.com>

* BR support TLS (#161)

* *: support tls

* move tikv.driver to glue

* fix comments

* upgrade golangci and prepare for go 1.14 (#171)

Signed-off-by: Neil Shen <overvenus@gmail.com>

* backup: add raw backup command (#101)

* backup: add raw backup command

* restore: speed up retry on not leader (#179)

* tests: stable cluster start up

Signed-off-by: Neil Shen <overvenus@gmail.com>

* tests: fix unbound var

Signed-off-by: Neil Shen <overvenus@gmail.com>

* restore: speed retry on not leader

Signed-off-by: Neil Shen <overvenus@gmail.com>

* address comments

Signed-off-by: Neil Shen <overvenus@gmail.com>

* tests: add --cacert flag

Signed-off-by: Neil Shen <overvenus@gmail.com>

* make codecov green

Signed-off-by: Neil Shen <overvenus@gmail.com>

* address comments

Signed-off-by: Neil Shen <overvenus@gmail.com>

* conn, restore: paginate scan regions (#165)

* conn, restore: paginate scan regions

Signed-off-by: Neil Shen <overvenus@gmail.com>

* tests: large timeout

Signed-off-by: Neil Shen <overvenus@gmail.com>

* Batch restore (#167)

* *: unify Range and RangeTree

Signed-off-by: Neil Shen <overvenus@gmail.com>

* restore: split restore files into small batch

Signed-off-by: Neil Shen <overvenus@gmail.com>

* task: set default restore concurrency to 128

Signed-off-by: Neil Shen <overvenus@gmail.com>

* restore: unused table worker pool

Signed-off-by: Neil Shen <overvenus@gmail.com>

* summary: sum up repeated duration and int

Signed-off-by: Neil Shen <overvenus@gmail.com>

* rtree: move rtree from utils to pkg

Signed-off-by: Neil Shen <overvenus@gmail.com>

* README, docker: add quick start (#181)

* README, docker: add quick start

Signed-off-by: Neil Shen <overvenus@gmail.com>

* cmd: disable some TiDB log

Signed-off-by: Neil Shen <overvenus@gmail.com>

* docker: build go-ycsb automatically

Signed-off-by: Neil Shen <overvenus@gmail.com>

* cmd: add TODO about TiDB logs

Signed-off-by: Neil Shen <overvenus@gmail.com>

* *: update tidb dependency build with go1.14 (#176)

* *: add license header (#182)

* rtree: move checkFile into backup

Signed-off-by: Neil Shen <overvenus@gmail.com>

* *: add license header

Signed-off-by: Neil Shen <overvenus@gmail.com>

* Update LICENSE.md

Co-Authored-By: kennytm <kennytm@gmail.com>

Co-authored-by: kennytm <kennytm@gmail.com>
Co-authored-by: 3pointer <luancheng@pingcap.com>

* conn: support not shutting down the storage when closing the connection (#185)

Co-authored-by: 3pointer <luancheng@pingcap.com>

* conn: use GetDomain to avoid some TiDB breaking changes (#186)

* conn: use GetDomain to avoid some TiDB breaking changes

Signed-off-by: Neil Shen <overvenus@gmail.com>

* minor usability improvement

Signed-off-by: Neil Shen <overvenus@gmail.com>

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

* fix check safepoint & unhide experimental features (#175)

* backup: check safepoint for last backup ts

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* check lastbackupts > 0

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* unhide experimental features

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* address comment

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* Update tests/br_z_gc_safepoint/run.sh

Co-Authored-By: kennytm <kennytm@gmail.com>

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

* support backupts (#172)

* support backupts

* address comment

* address comment

* fix space

* *: update pd deps to v4 (#184)

Co-authored-by: 3pointer <luancheng@pingcap.com>

* restore: support online restore (#114)

Signed-off-by: disksing <i@disksing.com>

* metrics: add grafana scripts (#140)

* add grafana scripts

* fix

Co-authored-by: 3pointer <luancheng@pingcap.com>
Co-authored-by: glorv <glorvs@163.com>
Co-authored-by: kennytm <kennytm@gmail.com>

* filter out all TiFlash nodes when retrieving lists of stores from PD (#187)

* conn: ignore nodes with label engine=tiflash

* conn: disallow TiFlash on restore, only skip TiFlash on backup

* Create integration test for S3 storage (#174)

* Fix summary log (#191)

* *: fix restore summary log after restore logic changed to files

* fix

* fix

* fix

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

* Implement Raw Restore (#104)

* Update kvproto

* Implement raw restore

* fix build

* Set range for file importer

Signed-off-by: MyonKeminta <MyonKeminta@users.noreply.github.com>

* Remove unnecessary comments

Signed-off-by: MyonKeminta <MyonKeminta@users.noreply.github.com>

* check cf and support multi ranges in BackupMeta

Signed-off-by: MyonKeminta <MyonKeminta@users.noreply.github.com>

* Check files' cf; address comments

* adjust structure to keep consistent with master

* Fix build

Signed-off-by: MyonKeminta <MyonKeminta@users.noreply.github.com>

* Fix build and make check, avoid accessing TiDB in rawkv mode

* Fix test

Signed-off-by: MyonKeminta <MyonKeminta@users.noreply.github.com>

* Fix tests

Signed-off-by: MyonKeminta <MyonKeminta@users.noreply.github.com>

* Fix broken logic after merging master

* Update pkg/task/restore_raw.go

Co-Authored-By: Neil Shen <overvenus@gmail.com>

* Address comments

* Address comments

* Mark raw restore as experimental

* Fix build

* Address comments

* test: Add check for deleting data and partial backup

* Fix build

* Add license header

* fix ci

* fix ci

Co-authored-by: MyonKeminta <MyonKeminta@users.noreply.github.com>
Co-authored-by: 3pointer <luancheng@pingcap.com>
Co-authored-by: Neil Shen <overvenus@gmail.com>
Co-authored-by: pingcap-github-bot <sre-bot@pingcap.com>

* restore: remove tiflash replica before restore (#194)

* restore: remove tiflash replica before restore

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* rename errSplit variable

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* address comments

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* check replica count by region info

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* cleanup

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* save tiflash replica count to backupmeta

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* fix save crcxor

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* fix decode the key of placement rule

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* address lint

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* address comments

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* close domain after restoring tiflash-replica

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* address comments

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* address comments

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* Update pkg/task/restore.go

Co-Authored-By: 3pointer <qdlc2010@gmail.com>

Co-authored-by: 3pointer <qdlc2010@gmail.com>

* summary: put summary log at last (#197)

* summary: put summary log at last

* fix switch sql

Co-authored-by: Neil Shen <overvenus@gmail.com>
Co-authored-by: 5kbpers <20279863+5kbpers@users.noreply.github.com>
Co-authored-by: kennytm <kennytm@gmail.com>
Co-authored-by: disksing <i@disksing.com>
Co-authored-by: Ian <ArGregoryIan@gmail.com>
Co-authored-by: Kolbe Kegel <kolbe@pingcap.com>
Co-authored-by: WangXiangUSTC <wx347249478@gmail.com>
Co-authored-by: glorv <glorvs@163.com>
Co-authored-by: MyonKeminta <9948422+MyonKeminta@users.noreply.github.com>
Co-authored-by: MyonKeminta <MyonKeminta@users.noreply.github.com>
Co-authored-by: pingcap-github-bot <sre-bot@pingcap.com>
3pointer added a commit that referenced this pull request Apr 2, 2020
* restore: fix alter auto increment id for no-primary-key table (#139)

* restore: fix alter auto increment id for no-primary-key table

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* add integration test

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* address comments

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* *: use oracle package to manipulate ts and test gc safe point  (#121)

Signed-off-by: Neil Shen <overvenus@gmail.com>

* cmd: convert version command to flags (#144)

* cmd: convert version command to flags

Signed-off-by: Neil Shen <overvenus@gmail.com>

* address comments

Signed-off-by: Neil Shen <overvenus@gmail.com>

* *: add changelog and github templates (#143)

Signed-off-by: Neil Shen <overvenus@gmail.com>

* restore: merge tidb-tools/pkg/restore-util (#146)

* restore-util: Implement split/scatter (#274)

* implement split/scatter

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* init test

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* redesign output/input of the lib

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* update dependency

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* add commments and more tests

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* add ScanRegions interface to Client

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* fix potential data race

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* address comments

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* address comments

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* Apply suggestions from code review

Co-Authored-By: kennytm <kennytm@gmail.com>

* Update pkg/restore-util/client.go

Co-Authored-By: kennytm <kennytm@gmail.com>

* address comments

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* address comments

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* address comments

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* update dependency

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* resolve conflicts

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* fix prefix rewrite

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* add RewriteRule/skip failed scatter region/retry the SplitRegion

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* fix test

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* check if region has peer

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* more logs

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* restore-util: add split retry interval (#277)

* reset dependencies to release-3.1

* add split retry interval

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* fix go.sum

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* restore-util: wait for scatter region sequentially  (#279)

* wait for scatter region sequentially

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* address comments

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* restore-util: add on split hook (#281)

* restore-util: add on split hook

Signed-off-by: Neil Shen <overvenus@gmail.com>

* Nil check onSplit

Co-Authored-By: kennytm <kennytm@gmail.com>

* restore-util: fix returned new region is nil (#283)

* restore-util: fix returned new region is nil

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* more logs

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* *: gofmt

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* Apply suggestions from code review

Co-Authored-By: kennytm <kennytm@gmail.com>

* fix log

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* restore-util: call onSplit on splitByRewriteRules (#285)

Signed-off-by: Neil Shen <overvenus@gmail.com>

* restore-util: fix overlapped error message (#293)

* restore-util: fix overlapped error message

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* fix log message

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* reduce error trace

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* fix test

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* address comments

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* address comments

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* restore-util: log warning when cannot find matched rewrite rule (#299)

* restore-util: add method to set placement rules and store labels (#301)

* restore-util: add method to set placement rules and store labels

Signed-off-by: disksing <i@disksing.com>

* minor fix

Signed-off-by: disksing <i@disksing.com>

* address comment

Signed-off-by: disksing <i@disksing.com>

* add GetPlacementRules

Signed-off-by: disksing <i@disksing.com>

* fix test

Signed-off-by: disksing <i@disksing.com>

* restore-util: support batch split (#300)

* restore-util: support batch split

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* go fmt

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* Apply suggestions from code review

Co-Authored-By: kennytm <kennytm@gmail.com>

* address commits

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* Update pkg/restore-util/split.go

Co-Authored-By: kennytm <kennytm@gmail.com>

* add onSplit callback

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* fix test

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* address comments

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* restore-util: add upper bound time for waiting for scatter (#305)

* restore: fix scatter regions failed

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* add log

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* stop waiting for scatter after 3min

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* address comments

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* restore-util: fix wrong url (#306)

Signed-off-by: disksing <i@disksing.com>

* restore-util: add warning about unmatched table id (#313)

* restore-util: support table partition

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* fix log

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* warn table id does not match

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* add unit tests

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* Apply suggestions from code review

Co-Authored-By: Neil Shen <overvenus@gmail.com>

* fix compile error

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* address comments

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* address comments

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* fix test

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

Co-authored-by: Ian <ArGregoryIan@gmail.com>
Co-authored-by: Neil Shen <overvenus@gmail.com>

* *: prune tidb-tools

Signed-off-by: Neil Shen <overvenus@gmail.com>

* restore: address linters suggestions

Signed-off-by: Neil Shen <overvenus@gmail.com>

* restore: merge restoreutil into restore

Signed-off-by: Neil Shen <overvenus@gmail.com>

* address comment

Signed-off-by: Neil Shen <overvenus@gmail.com>

Co-authored-by: 5kbpers <20279863+5kbpers@users.noreply.github.com>
Co-authored-by: kennytm <kennytm@gmail.com>
Co-authored-by: disksing <i@disksing.com>
Co-authored-by: Ian <ArGregoryIan@gmail.com>

* Fixed handling for a dbName that do not exist in the backup being restored (#148)

* Fixed handling for a dbName that do not exist in the backup being restored

* Fixed handling for a dbName that do not exist in the backup being restored

* validate: fix debug meta test ci (#153)

* validate: fix debug meta test ci

* *: extracts runBackup/runRestore in cmd into pkg/task (#156)

* *: extracts runBackup/runRestore in cmd into pkg/task

Defines a "Config" structure to store the parsed flags.

Use the "black-white-list" structure to define what tables/databases to
backup/restore.

* go.mod: update tidb to v4.0.0-beta

* restore: fix restore summary log (#150)

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

* restore: enhance error handling (#152)

* restore: enhance error handling

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* unit test

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* address comments

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* fix region epoch error

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* address comments

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* remove `Restore*`

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* address lint

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* add debug log

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* Apply suggestions from code review

Co-Authored-By: kennytm <kennytm@gmail.com>

* Update pkg/restore/import.go

Co-Authored-By: kennytm <kennytm@gmail.com>

* fix retry error

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* handle RegionNotFound error

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

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

* Incremental BR: support DDL (#155)

* support backup&restore ddl

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* integration tests

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* update kvproto

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* fix integration tests

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* reduce cyclomatic complexity of `runRestore`

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* fix test

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* add unit test

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* fix tests

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* disable fast checksum in incremental br

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* fix no valid key error

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* address lint

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* address comments

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* Reduce TiDB dependencies (#158)

* utils: exclude mock_cluster outside of unit test

* utils: remove unused ResultSetToStringSlice()

* *: abstract away dependencies of tidb/session into a Glue interface

* *: fix hound lint

* util,mock: move utils.MockCluster to mock.Cluster

* restore: fix test build failure

Co-authored-by: 3pointer <qdlc2010@gmail.com>

* go.mod: update tidb (#168)

Signed-off-by: Neil Shen <overvenus@gmail.com>

* BR support TLS (#161)

* *: support tls

* move tikv.driver to glue

* fix comments

* upgrade golangci and prepare for go 1.14 (#171)

Signed-off-by: Neil Shen <overvenus@gmail.com>

* backup: add raw backup command (#101)

* backup: add raw backup command

* restore: speed up retry on not leader (#179)

* tests: stable cluster start up

Signed-off-by: Neil Shen <overvenus@gmail.com>

* tests: fix unbound var

Signed-off-by: Neil Shen <overvenus@gmail.com>

* restore: speed retry on not leader

Signed-off-by: Neil Shen <overvenus@gmail.com>

* address comments

Signed-off-by: Neil Shen <overvenus@gmail.com>

* tests: add --cacert flag

Signed-off-by: Neil Shen <overvenus@gmail.com>

* make codecov green

Signed-off-by: Neil Shen <overvenus@gmail.com>

* address comments

Signed-off-by: Neil Shen <overvenus@gmail.com>

* conn, restore: paginate scan regions (#165)

* conn, restore: paginate scan regions

Signed-off-by: Neil Shen <overvenus@gmail.com>

* tests: large timeout

Signed-off-by: Neil Shen <overvenus@gmail.com>

* Batch restore (#167)

* *: unify Range and RangeTree

Signed-off-by: Neil Shen <overvenus@gmail.com>

* restore: split restore files into small batch

Signed-off-by: Neil Shen <overvenus@gmail.com>

* task: set default restore concurrency to 128

Signed-off-by: Neil Shen <overvenus@gmail.com>

* restore: unused table worker pool

Signed-off-by: Neil Shen <overvenus@gmail.com>

* summary: sum up repeated duration and int

Signed-off-by: Neil Shen <overvenus@gmail.com>

* rtree: move rtree from utils to pkg

Signed-off-by: Neil Shen <overvenus@gmail.com>

* README, docker: add quick start (#181)

* README, docker: add quick start

Signed-off-by: Neil Shen <overvenus@gmail.com>

* cmd: disable some TiDB log

Signed-off-by: Neil Shen <overvenus@gmail.com>

* docker: build go-ycsb automatically

Signed-off-by: Neil Shen <overvenus@gmail.com>

* cmd: add TODO about TiDB logs

Signed-off-by: Neil Shen <overvenus@gmail.com>

* *: update tidb dependency build with go1.14 (#176)

* *: add license header (#182)

* rtree: move checkFile into backup

Signed-off-by: Neil Shen <overvenus@gmail.com>

* *: add license header

Signed-off-by: Neil Shen <overvenus@gmail.com>

* Update LICENSE.md

Co-Authored-By: kennytm <kennytm@gmail.com>

Co-authored-by: kennytm <kennytm@gmail.com>
Co-authored-by: 3pointer <luancheng@pingcap.com>

* conn: support not shutting down the storage when closing the connection (#185)

Co-authored-by: 3pointer <luancheng@pingcap.com>

* conn: use GetDomain to avoid some TiDB breaking changes (#186)

* conn: use GetDomain to avoid some TiDB breaking changes

Signed-off-by: Neil Shen <overvenus@gmail.com>

* minor usability improvement

Signed-off-by: Neil Shen <overvenus@gmail.com>

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

* fix check safepoint & unhide experimental features (#175)

* backup: check safepoint for last backup ts

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* check lastbackupts > 0

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* unhide experimental features

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* address comment

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* Update tests/br_z_gc_safepoint/run.sh

Co-Authored-By: kennytm <kennytm@gmail.com>

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

* support backupts (#172)

* support backupts

* address comment

* address comment

* fix space

* *: update pd deps to v4 (#184)

Co-authored-by: 3pointer <luancheng@pingcap.com>

* restore: support online restore (#114)

Signed-off-by: disksing <i@disksing.com>

* metrics: add grafana scripts (#140)

* add grafana scripts

* fix

Co-authored-by: 3pointer <luancheng@pingcap.com>
Co-authored-by: glorv <glorvs@163.com>
Co-authored-by: kennytm <kennytm@gmail.com>

* filter out all TiFlash nodes when retrieving lists of stores from PD (#187)

* conn: ignore nodes with label engine=tiflash

* conn: disallow TiFlash on restore, only skip TiFlash on backup

* Create integration test for S3 storage (#174)

* Fix summary log (#191)

* *: fix restore summary log after restore logic changed to files

* fix

* fix

* fix

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

* Implement Raw Restore (#104)

* Update kvproto

* Implement raw restore

* fix build

* Set range for file importer

Signed-off-by: MyonKeminta <MyonKeminta@users.noreply.github.com>

* Remove unnecessary comments

Signed-off-by: MyonKeminta <MyonKeminta@users.noreply.github.com>

* check cf and support multi ranges in BackupMeta

Signed-off-by: MyonKeminta <MyonKeminta@users.noreply.github.com>

* Check files' cf; address comments

* adjust structure to keep consistent with master

* Fix build

Signed-off-by: MyonKeminta <MyonKeminta@users.noreply.github.com>

* Fix build and make check, avoid accessing TiDB in rawkv mode

* Fix test

Signed-off-by: MyonKeminta <MyonKeminta@users.noreply.github.com>

* Fix tests

Signed-off-by: MyonKeminta <MyonKeminta@users.noreply.github.com>

* Fix broken logic after merging master

* Update pkg/task/restore_raw.go

Co-Authored-By: Neil Shen <overvenus@gmail.com>

* Address comments

* Address comments

* Mark raw restore as experimental

* Fix build

* Address comments

* test: Add check for deleting data and partial backup

* Fix build

* Add license header

* fix ci

* fix ci

Co-authored-by: MyonKeminta <MyonKeminta@users.noreply.github.com>
Co-authored-by: 3pointer <luancheng@pingcap.com>
Co-authored-by: Neil Shen <overvenus@gmail.com>
Co-authored-by: pingcap-github-bot <sre-bot@pingcap.com>

* update dep

* restore: remove tiflash replica before restore (#194)

* restore: remove tiflash replica before restore

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* rename errSplit variable

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* address comments

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* check replica count by region info

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* cleanup

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* save tiflash replica count to backupmeta

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* fix save crcxor

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* fix decode the key of placement rule

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* address lint

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* address comments

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* close domain after restoring tiflash-replica

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* address comments

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* address comments

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* Update pkg/task/restore.go

Co-Authored-By: 3pointer <qdlc2010@gmail.com>

Co-authored-by: 3pointer <qdlc2010@gmail.com>

* summary: put summary log at last (#197)

* summary: put summary log at last

* fix switch sql

* *: abstract the progress channel (updateCh) into the glue package (#196)

* *: abstract the progress channel (updateCh) into the glue package

* restore: fix crash in truncateTS() when the bound is unlimited

* task: fix comment

Co-authored-by: Ian <ArGregoryIan@gmail.com>

* *: refline logs (#189)

* adapt pd/tidb related 3.1 changes

* tests: disable TLS test (#204)

Signed-off-by: Neil Shen <overvenus@gmail.com>

* *: add S3 quick start and few enhancement of log (#202)

* README, docker: add quick start about S3 storage

Signed-off-by: Neil Shen <overvenus@gmail.com>

* pkg/summary: make sure to output correct summary

Signed-off-by: Neil Shen <overvenus@gmail.com>

* cmd, tests: log to terminal if BR_LOG_TO_TERM is set

Signed-off-by: Neil Shen <overvenus@gmail.com>

* Update pkg/task/common.go

Co-Authored-By: kennytm <kennytm@gmail.com>

* address comments

Signed-off-by: Neil Shen <overvenus@gmail.com>

* address comments

Signed-off-by: Neil Shen <overvenus@gmail.com>

* tests: cat log if br fails

Signed-off-by: Neil Shen <overvenus@gmail.com>

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

* restore: add error field to `DownloadResponse` (#195)

* restore: add error field to `DownloadResponse`

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* restore: populate restore cancel error (#207)

Signed-off-by: Neil Shen <overvenus@gmail.com>

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

* enhance usability of br (#208)

* silenceUsage only when parse cmd flags failed

* udpate tidb

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

* task: do not run checksum if restore failed (#209)

* fix incremental bug in llroad test (#199)

* restore: filter same table ddl

* *: do not return error when backup/restore data is empty

* fix create database double during incremental restore

* add tests

* fix ci

* address comment

* add skip create sqls (#211)

* Revert "tests: disable TLS test (#204)" (#218)

This reverts commit e168a60.

* doc: add `minio` to dependence list. (#221)

The README of test omitted `minio` in the dependence list, which is needed for run the integration test.

Co-authored-by: Neil Shen <overvenus@gmail.com>

* move waiting reject stores in import file (#222)

* move wait rejectstores into import files

* restore: use new table id to search placementRules

* Update pkg/restore/import.go

Co-Authored-By: Neil Shen <overvenus@gmail.com>

* Update pkg/restore/import.go

Co-Authored-By: kennytm <kennytm@gmail.com>

* fix ci

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

* Max index length (#220)

* restore: set max-index-length to max

* restore:add max-index-length params

* address comment

* address comment

* glue: create schema/table directly with info (#216)

* glue: create schema/table directly with info

* go.mod: change to use the master version

* gluetidb: fix failure to create schema

* gluetidb: exclude non-public indices when restoring

* go.mod: removed unused replace

Co-authored-by: 3pointer <luancheng@pingcap.com>

* update deps

Co-authored-by: 5kbpers <20279863+5kbpers@users.noreply.github.com>
Co-authored-by: Neil Shen <overvenus@gmail.com>
Co-authored-by: kennytm <kennytm@gmail.com>
Co-authored-by: disksing <i@disksing.com>
Co-authored-by: Ian <ArGregoryIan@gmail.com>
Co-authored-by: Kolbe Kegel <kolbe@pingcap.com>
Co-authored-by: WangXiangUSTC <wx347249478@gmail.com>
Co-authored-by: glorv <glorvs@163.com>
Co-authored-by: MyonKeminta <9948422+MyonKeminta@users.noreply.github.com>
Co-authored-by: MyonKeminta <MyonKeminta@users.noreply.github.com>
Co-authored-by: pingcap-github-bot <sre-bot@pingcap.com>
Co-authored-by: 庄天翼 <zty0826@gmail.com>
Co-authored-by: 山岚 <36239017+YuJuncen@users.noreply.github.com>
3pointer added a commit that referenced this pull request Apr 2, 2020
* restore: merge tidb-tools/pkg/restore-util (#146)

* restore-util: Implement split/scatter (#274)

* implement split/scatter

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* init test

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* redesign output/input of the lib

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* update dependency

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* add commments and more tests

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* add ScanRegions interface to Client

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* fix potential data race

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* address comments

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* address comments

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* Apply suggestions from code review

Co-Authored-By: kennytm <kennytm@gmail.com>

* Update pkg/restore-util/client.go

Co-Authored-By: kennytm <kennytm@gmail.com>

* address comments

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* address comments

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* address comments

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* update dependency

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* resolve conflicts

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* fix prefix rewrite

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* add RewriteRule/skip failed scatter region/retry the SplitRegion

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* fix test

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* check if region has peer

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* more logs

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* restore-util: add split retry interval (#277)

* reset dependencies to release-3.1

* add split retry interval

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* fix go.sum

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* restore-util: wait for scatter region sequentially  (#279)

* wait for scatter region sequentially

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* address comments

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* restore-util: add on split hook (#281)

* restore-util: add on split hook

Signed-off-by: Neil Shen <overvenus@gmail.com>

* Nil check onSplit

Co-Authored-By: kennytm <kennytm@gmail.com>

* restore-util: fix returned new region is nil (#283)

* restore-util: fix returned new region is nil

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* more logs

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* *: gofmt

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* Apply suggestions from code review

Co-Authored-By: kennytm <kennytm@gmail.com>

* fix log

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* restore-util: call onSplit on splitByRewriteRules (#285)

Signed-off-by: Neil Shen <overvenus@gmail.com>

* restore-util: fix overlapped error message (#293)

* restore-util: fix overlapped error message

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* fix log message

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* reduce error trace

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* fix test

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* address comments

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* address comments

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* restore-util: log warning when cannot find matched rewrite rule (#299)

* restore-util: add method to set placement rules and store labels (#301)

* restore-util: add method to set placement rules and store labels

Signed-off-by: disksing <i@disksing.com>

* minor fix

Signed-off-by: disksing <i@disksing.com>

* address comment

Signed-off-by: disksing <i@disksing.com>

* add GetPlacementRules

Signed-off-by: disksing <i@disksing.com>

* fix test

Signed-off-by: disksing <i@disksing.com>

* restore-util: support batch split (#300)

* restore-util: support batch split

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* go fmt

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* Apply suggestions from code review

Co-Authored-By: kennytm <kennytm@gmail.com>

* address commits

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* Update pkg/restore-util/split.go

Co-Authored-By: kennytm <kennytm@gmail.com>

* add onSplit callback

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* fix test

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* address comments

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* restore-util: add upper bound time for waiting for scatter (#305)

* restore: fix scatter regions failed

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* add log

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* stop waiting for scatter after 3min

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* address comments

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* restore-util: fix wrong url (#306)

Signed-off-by: disksing <i@disksing.com>

* restore-util: add warning about unmatched table id (#313)

* restore-util: support table partition

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* fix log

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* warn table id does not match

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* add unit tests

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* Apply suggestions from code review

Co-Authored-By: Neil Shen <overvenus@gmail.com>

* fix compile error

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* address comments

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* address comments

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* fix test

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

Co-authored-by: Ian <ArGregoryIan@gmail.com>
Co-authored-by: Neil Shen <overvenus@gmail.com>

* *: prune tidb-tools

Signed-off-by: Neil Shen <overvenus@gmail.com>

* restore: address linters suggestions

Signed-off-by: Neil Shen <overvenus@gmail.com>

* restore: merge restoreutil into restore

Signed-off-by: Neil Shen <overvenus@gmail.com>

* address comment

Signed-off-by: Neil Shen <overvenus@gmail.com>

Co-authored-by: 5kbpers <20279863+5kbpers@users.noreply.github.com>
Co-authored-by: kennytm <kennytm@gmail.com>
Co-authored-by: disksing <i@disksing.com>
Co-authored-by: Ian <ArGregoryIan@gmail.com>

* Fixed handling for a dbName that do not exist in the backup being restored (#148)

* Fixed handling for a dbName that do not exist in the backup being restored

* Fixed handling for a dbName that do not exist in the backup being restored

* validate: fix debug meta test ci (#153)

* validate: fix debug meta test ci

* *: extracts runBackup/runRestore in cmd into pkg/task (#156)

* *: extracts runBackup/runRestore in cmd into pkg/task

Defines a "Config" structure to store the parsed flags.

Use the "black-white-list" structure to define what tables/databases to
backup/restore.

* go.mod: update tidb to v4.0.0-beta

* restore: fix restore summary log (#150)

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

* restore: enhance error handling (#152)

* restore: enhance error handling

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* unit test

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* address comments

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* fix region epoch error

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* address comments

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* remove `Restore*`

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* address lint

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* add debug log

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* Apply suggestions from code review

Co-Authored-By: kennytm <kennytm@gmail.com>

* Update pkg/restore/import.go

Co-Authored-By: kennytm <kennytm@gmail.com>

* fix retry error

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* handle RegionNotFound error

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

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

* Incremental BR: support DDL (#155)

* support backup&restore ddl

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* integration tests

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* update kvproto

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* fix integration tests

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* reduce cyclomatic complexity of `runRestore`

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* fix test

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* add unit test

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* fix tests

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* disable fast checksum in incremental br

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* fix no valid key error

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* address lint

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* address comments

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* Reduce TiDB dependencies (#158)

* utils: exclude mock_cluster outside of unit test

* utils: remove unused ResultSetToStringSlice()

* *: abstract away dependencies of tidb/session into a Glue interface

* *: fix hound lint

* util,mock: move utils.MockCluster to mock.Cluster

* restore: fix test build failure

Co-authored-by: 3pointer <qdlc2010@gmail.com>

* go.mod: update tidb (#168)

Signed-off-by: Neil Shen <overvenus@gmail.com>

* BR support TLS (#161)

* *: support tls

* move tikv.driver to glue

* fix comments

* upgrade golangci and prepare for go 1.14 (#171)

Signed-off-by: Neil Shen <overvenus@gmail.com>

* backup: add raw backup command (#101)

* backup: add raw backup command

* restore: speed up retry on not leader (#179)

* tests: stable cluster start up

Signed-off-by: Neil Shen <overvenus@gmail.com>

* tests: fix unbound var

Signed-off-by: Neil Shen <overvenus@gmail.com>

* restore: speed retry on not leader

Signed-off-by: Neil Shen <overvenus@gmail.com>

* address comments

Signed-off-by: Neil Shen <overvenus@gmail.com>

* tests: add --cacert flag

Signed-off-by: Neil Shen <overvenus@gmail.com>

* make codecov green

Signed-off-by: Neil Shen <overvenus@gmail.com>

* address comments

Signed-off-by: Neil Shen <overvenus@gmail.com>

* conn, restore: paginate scan regions (#165)

* conn, restore: paginate scan regions

Signed-off-by: Neil Shen <overvenus@gmail.com>

* tests: large timeout

Signed-off-by: Neil Shen <overvenus@gmail.com>

* Batch restore (#167)

* *: unify Range and RangeTree

Signed-off-by: Neil Shen <overvenus@gmail.com>

* restore: split restore files into small batch

Signed-off-by: Neil Shen <overvenus@gmail.com>

* task: set default restore concurrency to 128

Signed-off-by: Neil Shen <overvenus@gmail.com>

* restore: unused table worker pool

Signed-off-by: Neil Shen <overvenus@gmail.com>

* summary: sum up repeated duration and int

Signed-off-by: Neil Shen <overvenus@gmail.com>

* rtree: move rtree from utils to pkg

Signed-off-by: Neil Shen <overvenus@gmail.com>

* README, docker: add quick start (#181)

* README, docker: add quick start

Signed-off-by: Neil Shen <overvenus@gmail.com>

* cmd: disable some TiDB log

Signed-off-by: Neil Shen <overvenus@gmail.com>

* docker: build go-ycsb automatically

Signed-off-by: Neil Shen <overvenus@gmail.com>

* cmd: add TODO about TiDB logs

Signed-off-by: Neil Shen <overvenus@gmail.com>

* *: update tidb dependency build with go1.14 (#176)

* *: add license header (#182)

* rtree: move checkFile into backup

Signed-off-by: Neil Shen <overvenus@gmail.com>

* *: add license header

Signed-off-by: Neil Shen <overvenus@gmail.com>

* Update LICENSE.md

Co-Authored-By: kennytm <kennytm@gmail.com>

Co-authored-by: kennytm <kennytm@gmail.com>
Co-authored-by: 3pointer <luancheng@pingcap.com>

* conn: support not shutting down the storage when closing the connection (#185)

Co-authored-by: 3pointer <luancheng@pingcap.com>

* conn: use GetDomain to avoid some TiDB breaking changes (#186)

* conn: use GetDomain to avoid some TiDB breaking changes

Signed-off-by: Neil Shen <overvenus@gmail.com>

* minor usability improvement

Signed-off-by: Neil Shen <overvenus@gmail.com>

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

* fix check safepoint & unhide experimental features (#175)

* backup: check safepoint for last backup ts

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* check lastbackupts > 0

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* unhide experimental features

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* address comment

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* Update tests/br_z_gc_safepoint/run.sh

Co-Authored-By: kennytm <kennytm@gmail.com>

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

* support backupts (#172)

* support backupts

* address comment

* address comment

* fix space

* *: update pd deps to v4 (#184)

Co-authored-by: 3pointer <luancheng@pingcap.com>

* restore: support online restore (#114)

Signed-off-by: disksing <i@disksing.com>

* metrics: add grafana scripts (#140)

* add grafana scripts

* fix

Co-authored-by: 3pointer <luancheng@pingcap.com>
Co-authored-by: glorv <glorvs@163.com>
Co-authored-by: kennytm <kennytm@gmail.com>

* filter out all TiFlash nodes when retrieving lists of stores from PD (#187)

* conn: ignore nodes with label engine=tiflash

* conn: disallow TiFlash on restore, only skip TiFlash on backup

* Create integration test for S3 storage (#174)

* Fix summary log (#191)

* *: fix restore summary log after restore logic changed to files

* fix

* fix

* fix

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

* Implement Raw Restore (#104)

* Update kvproto

* Implement raw restore

* fix build

* Set range for file importer

Signed-off-by: MyonKeminta <MyonKeminta@users.noreply.github.com>

* Remove unnecessary comments

Signed-off-by: MyonKeminta <MyonKeminta@users.noreply.github.com>

* check cf and support multi ranges in BackupMeta

Signed-off-by: MyonKeminta <MyonKeminta@users.noreply.github.com>

* Check files' cf; address comments

* adjust structure to keep consistent with master

* Fix build

Signed-off-by: MyonKeminta <MyonKeminta@users.noreply.github.com>

* Fix build and make check, avoid accessing TiDB in rawkv mode

* Fix test

Signed-off-by: MyonKeminta <MyonKeminta@users.noreply.github.com>

* Fix tests

Signed-off-by: MyonKeminta <MyonKeminta@users.noreply.github.com>

* Fix broken logic after merging master

* Update pkg/task/restore_raw.go

Co-Authored-By: Neil Shen <overvenus@gmail.com>

* Address comments

* Address comments

* Mark raw restore as experimental

* Fix build

* Address comments

* test: Add check for deleting data and partial backup

* Fix build

* Add license header

* fix ci

* fix ci

Co-authored-by: MyonKeminta <MyonKeminta@users.noreply.github.com>
Co-authored-by: 3pointer <luancheng@pingcap.com>
Co-authored-by: Neil Shen <overvenus@gmail.com>
Co-authored-by: pingcap-github-bot <sre-bot@pingcap.com>

* restore: remove tiflash replica before restore (#194)

* restore: remove tiflash replica before restore

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* rename errSplit variable

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* address comments

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* check replica count by region info

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* cleanup

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* save tiflash replica count to backupmeta

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* fix save crcxor

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* fix decode the key of placement rule

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* address lint

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* address comments

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* close domain after restoring tiflash-replica

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* address comments

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* address comments

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* Update pkg/task/restore.go

Co-Authored-By: 3pointer <qdlc2010@gmail.com>

Co-authored-by: 3pointer <qdlc2010@gmail.com>

* summary: put summary log at last (#197)

* summary: put summary log at last

* fix switch sql

* *: abstract the progress channel (updateCh) into the glue package (#196)

* *: abstract the progress channel (updateCh) into the glue package

* restore: fix crash in truncateTS() when the bound is unlimited

* task: fix comment

Co-authored-by: Ian <ArGregoryIan@gmail.com>

* *: refline logs (#189)

* tests: disable TLS test (#204)

Signed-off-by: Neil Shen <overvenus@gmail.com>

* *: add S3 quick start and few enhancement of log (#202)

* README, docker: add quick start about S3 storage

Signed-off-by: Neil Shen <overvenus@gmail.com>

* pkg/summary: make sure to output correct summary

Signed-off-by: Neil Shen <overvenus@gmail.com>

* cmd, tests: log to terminal if BR_LOG_TO_TERM is set

Signed-off-by: Neil Shen <overvenus@gmail.com>

* Update pkg/task/common.go

Co-Authored-By: kennytm <kennytm@gmail.com>

* address comments

Signed-off-by: Neil Shen <overvenus@gmail.com>

* address comments

Signed-off-by: Neil Shen <overvenus@gmail.com>

* tests: cat log if br fails

Signed-off-by: Neil Shen <overvenus@gmail.com>

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

* restore: add error field to `DownloadResponse` (#195)

* restore: add error field to `DownloadResponse`

Signed-off-by: 5kbpers <tangminghua@pingcap.com>

* restore: populate restore cancel error (#207)

Signed-off-by: Neil Shen <overvenus@gmail.com>

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

* enhance usability of br (#208)

* silenceUsage only when parse cmd flags failed

* udpate tidb

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

* task: do not run checksum if restore failed (#209)

* fix incremental bug in llroad test (#199)

* restore: filter same table ddl

* *: do not return error when backup/restore data is empty

* fix create database double during incremental restore

* add tests

* fix ci

* address comment

* add skip create sqls (#211)

* Revert "tests: disable TLS test (#204)" (#218)

This reverts commit e168a60.

* doc: add `minio` to dependence list. (#221)

The README of test omitted `minio` in the dependence list, which is needed for run the integration test.

Co-authored-by: Neil Shen <overvenus@gmail.com>

* move waiting reject stores in import file (#222)

* move wait rejectstores into import files

* restore: use new table id to search placementRules

* Update pkg/restore/import.go

Co-Authored-By: Neil Shen <overvenus@gmail.com>

* Update pkg/restore/import.go

Co-Authored-By: kennytm <kennytm@gmail.com>

* fix ci

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

* Max index length (#220)

* restore: set max-index-length to max

* restore:add max-index-length params

* address comment

* address comment

* glue: create schema/table directly with info (#216)

* glue: create schema/table directly with info

* go.mod: change to use the master version

* gluetidb: fix failure to create schema

* gluetidb: exclude non-public indices when restoring

* go.mod: removed unused replace

Co-authored-by: 3pointer <luancheng@pingcap.com>

Co-authored-by: Neil Shen <overvenus@gmail.com>
Co-authored-by: 5kbpers <20279863+5kbpers@users.noreply.github.com>
Co-authored-by: kennytm <kennytm@gmail.com>
Co-authored-by: disksing <i@disksing.com>
Co-authored-by: Ian <ArGregoryIan@gmail.com>
Co-authored-by: Kolbe Kegel <kolbe@pingcap.com>
Co-authored-by: WangXiangUSTC <wx347249478@gmail.com>
Co-authored-by: glorv <glorvs@163.com>
Co-authored-by: MyonKeminta <9948422+MyonKeminta@users.noreply.github.com>
Co-authored-by: MyonKeminta <MyonKeminta@users.noreply.github.com>
Co-authored-by: pingcap-github-bot <sre-bot@pingcap.com>
Co-authored-by: 庄天翼 <zty0826@gmail.com>
Co-authored-by: 山岚 <36239017+YuJuncen@users.noreply.github.com>
overvenus pushed a commit to overvenus/br-1 that referenced this pull request Dec 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status/LGT1 LGTM1 type/feature-request New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants