-
Notifications
You must be signed in to change notification settings - Fork 92
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
Atomize RenameFile in KeyManagedEncryptedEnv #222
Atomize RenameFile in KeyManagedEncryptedEnv #222
Conversation
Signed-off-by: Xintao <hunterlxt@live.com>
b286c61
to
51fdfa9
Compare
@tabokie @Connor1996 PTAL |
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.
Looks good, but I want to make sure future implementation won't embed critical logic inside Rename
method, e.g. file-specific state transfer. Maybe add a comment or simply deprecate the function in KeyManager
?
encryption/encryption.cc
Outdated
// Ignore error | ||
key_manager_->RenameFile(dst_fname, src_fname); | ||
key_manager_->DeleteFile(dst_fname); |
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.
do me a favor, update the code like this. also update the same logic for ::LinkFile()
Status delete_status __attribute__((__unused__)) = key_manager_->DeleteFile(dst_name);
assert(delete_stauts.ok());
Great suggestion. Let's remove |
revert redundant formatter change? |
3da8411
to
6cdcaa9
Compare
Signed-off-by: Xintao <hunterlxt@live.com>
eb6dd19
to
0da0b57
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
* adjust logic in KeyManagedEncryptedEnv::RenameFile to avoid poweroff Signed-off-by: Xintao <hunterlxt@live.com>
* adjust logic in KeyManagedEncryptedEnv::RenameFile to avoid poweroff Signed-off-by: Xintao <hunterlxt@live.com> Signed-off-by: tabokie <xy.tao@outlook.com>
* adjust logic in KeyManagedEncryptedEnv::RenameFile to avoid poweroff Signed-off-by: Xintao <hunterlxt@live.com> Signed-off-by: tabokie <xy.tao@outlook.com>
* adjust logic in KeyManagedEncryptedEnv::RenameFile to avoid poweroff Signed-off-by: Xintao <hunterlxt@live.com> Signed-off-by: tabokie <xy.tao@outlook.com>
fix bug: tikv/tikv#9115
Summary: we need to update encryption metadata via
encryption::DataKeyManager
, which cannot combine with the actual file operation into one atomic operation. InRenameFile
, when the src_file has been removed, power is off, then we may lost the file info of src_file next restart.Signed-off-by: Xintao hunterlxt@live.com