Skip to content

Whole DBTest to skip fsync#1

Open
siying wants to merge 1 commit intosiying:disable_sync_reenablefrom
pdillinger:reinstate_7049
Open

Whole DBTest to skip fsync#1
siying wants to merge 1 commit intosiying:disable_sync_reenablefrom
pdillinger:reinstate_7049

Conversation

@siying
Copy link
Owner

@siying siying commented Aug 17, 2020

Summary:
After facebook#7036, we still see extra DBTest that can timeout when running 10 or 20 in parallel. Expand skip-fsync mode in whole DBTest. Still preserve other tests from doing this mode to be conservative.

This commit reinstates facebook#7049, whose un-revert was lost in an automatic
infrastructure mis-merge.

Test Plan: Run all existing files.

Reviewed By: pdillinger

Summary:
After facebook#7036, we still see extra DBTest that can timeout when running 10 or 20 in parallel. Expand skip-fsync mode in whole DBTest. Still preserve other tests from doing this mode to be conservative.

This commit reinstates facebook#7049, whose un-revert was lost in an automatic
infrastructure mis-merge.

Test Plan: Run all existing files.

Reviewed By: pdillinger
siying added a commit that referenced this pull request Jan 24, 2022
Summary:
Right now, Env can be destroyed before SST File manager in DBTest's destructor, causing failure during test cleaning up. Remove SST File manager first instead.
One failure I observed is a CI failure:

[ RUN      ] DBSSTTest.DBWithMaxSpaceAllowedWithBlobFiles
==================
WARNING: ThreadSanitizer: data race on vptr (ctor/dtor vs virtual call) (pid=1196842)
  Write of size 8 at 0x7b5800000000 by main thread:
    #0 rocksdb::EnvWrapper::~EnvWrapper() env/env.cc:1120 (db_sst_test+0x8a9df9)
    #1 rocksdb::SpecialEnv::~SpecialEnv() db/db_test_util.h:114 (db_sst_test+0x52cdfd)
    facebook#2 rocksdb::SpecialEnv::~SpecialEnv() db/db_test_util.h:114 (db_sst_test+0x52cdfd)
    facebook#3 rocksdb::DBTestBase::~DBTestBase() db/db_test_util.cc:120 (db_sst_test+0x51906c)
    facebook#4 rocksdb::DBSSTTest::~DBSSTTest() db/db_sst_test.cc:19 (db_sst_test+0x4e54b5)
    facebook#5 rocksdb::DBSSTTest_DBWithMaxSpaceAllowedWithBlobFiles_Test::~DBSSTTest_DBWithMaxSpaceAllowedWithBlobFiles_Test() db/db_sst_test.cc:1074 (db_sst_test+0x4e54b5)
    facebook#6 rocksdb::DBSSTTest_DBWithMaxSpaceAllowedWithBlobFiles_Test::~DBSSTTest_DBWithMaxSpaceAllowedWithBlobFiles_Test() db/db_sst_test.cc:1074 (db_sst_test+0x4e54b5)
......

  Previous read of size 8 at 0x7b5800000000 by thread T4 (mutexes: write M1359):
    #0 GetFreeSpace env/env.cc:598 (db_sst_test+0x8a29ee)
    #1 rocksdb::SstFileManagerImpl::ClearError() file/sst_file_manager_impl.cc:264 (db_sst_test+0x92cd57)
......

Test Plan: Run all tests.
siying pushed a commit that referenced this pull request Mar 30, 2022
…n opening Posix WritableFile (facebook#9685)

Summary:
Pull Request resolved: facebook#9685

Our TSAN reports a race condition as follows when running test
```
gtest-parallel -r 100 ./external_sst_file_test --gtest_filter=ExternalSSTFileTest.MultiThreaded
```
leads to the following

```
WARNING: ThreadSanitizer: data race (pid=2683148)
  Write of size 1 at 0x556fede63340 by thread T7:
    #0 rocksdb::(anonymous namespace)::PosixFileSystem::OpenWritableFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, rocksdb::FileOptions const&, bool, std::unique_ptr<rocksdb::FSWritableFile, std::default_delete<rocksdb::FSWritableFile> >*, rocksdb::IODebugContext*) internal_repo_rocksdb/repo/env/fs_posix.cc:334 (external_sst_file_test+0xb61ac4)
    #1 rocksdb::(anonymous namespace)::PosixFileSystem::ReopenWritableFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, rocksdb::FileOptions const&, std::unique_ptr<rocksdb::FSWritableFile, std::default_delete<rocksdb::FSWritableFile> >*, rocksdb::IODebugContext*) internal_repo_rocksdb/repo/env/fs_posix.cc:382 (external_sst_file_test+0xb5ba96)
    facebook#2 rocksdb::CompositeEnv::ReopenWritableFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::unique_ptr<rocksdb::WritableFile, std::default_delete<rocksdb::WritableFile> >*, rocksdb::EnvOptions const&) internal_repo_rocksdb/repo/env/composite_env.cc:334 (external_sst_file_test+0xa6ab7f)
    facebook#3 rocksdb::EnvWrapper::ReopenWritableFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::unique_ptr<rocksdb::WritableFile, std::default_delete<rocksdb::WritableFile> >*, rocksdb::EnvOptions const&) internal_repo_rocksdb/repo/include/rocksdb/env.h:1428 (external_sst_file_test+0x561f3e)
Previous read of size 1 at 0x556fede63340 by thread T4:
    #0 rocksdb::(anonymous namespace)::PosixFileSystem::OpenWritableFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, rocksdb::FileOptions const&, bool, std::unique_ptr<rocksdb::FSWritableFile, std::default_delete<rocksdb::FSWritableFile> >*, rocksdb::IODebugContext*) internal_repo_rocksdb/repo/env/fs_posix.cc:328 (external_sst_file_test+0xb61a70)
    #1 rocksdb::(anonymous namespace)::PosixFileSystem::ReopenWritableFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator
...
```

Fix by making sure the following block gets executed only once:
```
      if (!checkedDiskForMmap_) {
        // this will be executed once in the program's lifetime.
        // do not use mmapWrite on non ext-3/xfs/tmpfs systems.
        if (!SupportsFastAllocate(fname)) {
          forceMmapOff_ = true;
        }
        checkedDiskForMmap_ = true;
      }
```

Reviewed By: pdillinger

Differential Revision: D34780308

fbshipit-source-id: b761f66b24c8b5b8389d86ea371c8542b8d869d5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant