From 36fefd7e22dcf2bd10065ba800f1ce501a9d843d Mon Sep 17 00:00:00 2001 From: Yanqin Jin Date: Wed, 22 Jun 2022 08:50:05 -0700 Subject: [PATCH] Continue to deflake BackupEngineTest.Concurrency (#10228) Summary: Even after https://github.com/facebook/rocksdb/issues/10069, `BackupEngineTest.Concurrency` is still flaky with decreased probability of failure. Repro steps as follows ```bash make backup_engine_test gtest-parallel -r 1000 -w 64 ./backup_engine_test --gtest_filter=BackupEngineTest.Concurrency ``` The first two commits of this PR demonstrate how the test is flaky. https://github.com/facebook/rocksdb/issues/10069 handles the case in which `Rename()` file returns `IOError` with subcode `PathNotFound`, and `CreateLoggerFromOptions()` allows the operation to succeed, as expected by the test. However, `BackupEngineTest` uses `RemapFileSystem` on top of `ChrootFileSystem` which can return `NotFound` instead of `IOError`. This behavior is different from `Env::Default()` which returns PathNotFound if the src of `rename()` does not exist. We should make the behaviors of the test Env/FS match a real Env/FS. Pull Request resolved: https://github.com/facebook/rocksdb/pull/10228 Test Plan: ```bash make check gtest-parallel -r 1000 -w 64 ./backup_engine_test --gtest_filter=BackupEngineTest.Concurrency ``` Reviewed By: pdillinger Differential Revision: D37337241 Pulled By: riversand963 fbshipit-source-id: 07a53115e424467b55a731866e571f0ad4c6635d --- env/fs_remap.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/env/fs_remap.cc b/env/fs_remap.cc index b75121f44..fd9241181 100644 --- a/env/fs_remap.cc +++ b/env/fs_remap.cc @@ -268,6 +268,10 @@ IOStatus RemapFileSystem::RenameFile(const std::string& src, IODebugContext* dbg) { auto status_and_src_enc_path = EncodePath(src); if (!status_and_src_enc_path.first.ok()) { + if (status_and_src_enc_path.first.IsNotFound()) { + const IOStatus& s = status_and_src_enc_path.first; + status_and_src_enc_path.first = IOStatus::PathNotFound(s.ToString()); + } return status_and_src_enc_path.first; } auto status_and_dest_enc_path = EncodePathWithNewBasename(dest);