Wal recovery failure with encryption due to zero bytes WAL size. (#7924)

Summary:
Fixes issue https://github.com/facebook/rocksdb/issues/7410

Pull Request resolved: https://github.com/facebook/rocksdb/pull/7924

Reviewed By: jay-zhuang

Differential Revision: D26216805

Pulled By: ajkr

fbshipit-source-id: 5720635ee06003269bfaf8c8616b3671974b08a8
This commit is contained in:
Deepak Ojha 2021-02-05 12:39:05 -08:00 committed by Facebook GitHub Bot
parent 3feee6db17
commit cbf38af705

11
env/env_encryption.cc vendored
View File

@ -646,6 +646,15 @@ class EncryptedEnvImpl : public EnvWrapper {
if (!status.ok()) {
return status;
}
uint64_t file_size;
status = EnvWrapper::GetFileSize(fname, &file_size);
if (!status.ok()) {
return status;
}
if (!file_size) {
*result = std::move(underlying);
return status;
}
// Create cipher stream
std::unique_ptr<BlockAccessCipherStream> stream;
size_t prefix_length;
@ -830,7 +839,7 @@ class EncryptedEnvImpl : public EnvWrapper {
virtual Status GetFileSize(const std::string& fname,
uint64_t* file_size) override {
auto status = EnvWrapper::GetFileSize(fname, file_size);
if (!status.ok()) {
if (!status.ok() || !(*file_size)) {
return status;
}
EncryptionProvider* provider;