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: hash backup file name #6177
Conversation
components/backup/src/endpoint.rs
Outdated
"{}_{}_{}_{:?}", | ||
store_id, | ||
region.get_id(), | ||
region.get_region_epoch().get_version(), |
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.
Should use "{}", hex::encode(k)
.
Here is an example of {:?}, vec![1, 2, 3]
=> [1, 2, 3]
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.
hex::encode
is used in sha256, I think use String::from_utf8
is enough
components/backup/src/endpoint.rs
Outdated
@@ -382,7 +382,7 @@ impl<E: Engine, R: RegionInfoProvider> Endpoint<E, R> { | |||
let key = brange | |||
.start_key | |||
.clone() | |||
.map(|k| hex::encode(k.into_raw().unwrap())); | |||
.and_then(|k| tikv_util::file::sha256(&k.into_raw().unwrap()).ok()); |
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.
Could you add some comments about why we need it?
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.
sure, add comment
4906ac6
to
6250fc5
Compare
Signed-off-by: luancheng <luancheng@pingcap.com>
6250fc5
to
4601b61
Compare
Signed-off-by: luancheng <luancheng@pingcap.com>
e512fc3
to
7ac5ef6
Compare
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
/run-unit-test |
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
/run-all-tests |
cherry pick to release-3.1 failed |
Signed-off-by: luancheng <luancheng@pingcap.com>
Signed-off-by: luancheng <luancheng@pingcap.com>
Signed-off-by: luancheng <luancheng@pingcap.com>
Signed-off-by: luancheng <luancheng@pingcap.com>
Signed-off-by: luancheng luancheng@pingcap.com
What have you changed?
use start key sha256 to replace raw start key, if we use start key as file name we could meet
"file name too long" error because some index key are longer than 255 bytes
What is the type of the changes?
How is the PR tested?
Please select the tests that you ran to verify your changes:
Does this PR affect documentation (docs) or should it be mentioned in the release notes?
N/A
Does this PR affect
tidb-ansible
?N/A
Refer to a related PR or issue link (optional)
Benchmark result if necessary (optional)
Any examples? (optional)