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
main
Deepak Ojha 4 years ago committed by Facebook GitHub Bot
parent 3feee6db17
commit cbf38af705
  1. 11
      env/env_encryption.cc

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

Loading…
Cancel
Save