Skip to content

Commit

Permalink
Fix the creation of new writable file when encryption is never enabled (
Browse files Browse the repository at this point in the history
#1042)

* fix newWritableFile

* fix typo
  • Loading branch information
lidezhu authored Aug 28, 2020
1 parent 8bbd843 commit 4788326
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions dbms/src/Encryption/FileProvider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,7 @@ WritableFilePtr FileProvider::newWritableFile(const String & file_path_, const E
else if (!create_new_encryption_info_)
{
auto encryption_info = key_manager->getFile(encryption_path_.full_path);
if (unlikely(encryption_info.method == EncryptionMethod::Unknown))
{
throw DB::TiFlashException(
"Cannot get encryption info for file: " + encryption_path_.full_path, Errors::Encryption::Internal);
}
if (encryption_info.method != EncryptionMethod::Plaintext)
if (encryption_info.method != EncryptionMethod::Unknown && encryption_info.method != EncryptionMethod::Plaintext)
{
file = std::make_shared<EncryptedWritableFile>(file, AESCTRCipherStream::createCipherStream(encryption_info, encryption_path_));
}
Expand Down

0 comments on commit 4788326

Please sign in to comment.