1. 13 Nov, 2018 3 commits
  2. 10 Nov, 2018 4 commits
    • Yi Wu's avatar
      Fix DBTest.SoftLimit flakyness (#4658) · 859dbda6
      Yi Wu authored
      Summary:
      The flakyness can be reproduced with the following patch:
      ```
       --- a/db/db_impl_compaction_flush.cc
      +++ b/db/db_impl_compaction_flush.cc
      @@ -2013,6 +2013,9 @@ void DBImpl::BackgroundCallFlush() {
             if (job_context.HaveSomethingToDelete()) {
               PurgeObsoleteFiles(job_context);
             }
      +      static int f_count = 0;
      +      printf("clean flush job context %d\n", ++f_count);
      +      env_->SleepForMicroseconds(1000000);
             job_context.Clean();
             mutex_.Lock();
           }
      ```
      The issue is that FlushMemtable with opt.wait=true does not wait for `OnStallConditionsChanged` being called. The event listener is triggered on `JobContext::Clean`, which happens after flush result is installed. At the time we check for stall condition after flushing memtable, the job context cleanup may not be finished.
      
      To fix the flaykyness, we use sync point to create a custom WaitForFlush that waits for context cleanup.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/4658
      
      Differential Revision: D13007301
      
      Pulled By: yiwu-arbug
      
      fbshipit-source-id: d98395ee7b0ad4c62e83e8d0e9b6028058c61712
      859dbda6
    • Yi Wu's avatar
      Fix liblua link error when building shared lib under fbcode (#4651) · 7a2f98a0
      Yi Wu authored
      Summary:
      When running `make shared_lib` under fbcode, there's liblua link error: https://gist.github.com/yiwu-arbug/b796bff6b3d46d90c1ed878d983de50d
      This is because we link liblua.a when building shared lib. If we want to link with liblua, we need to link with liblua_pic.a instead. Fixing by simply not link with lua.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/4651
      
      Differential Revision: D12964798
      
      Pulled By: yiwu-arbug
      
      fbshipit-source-id: 18d6cee94afe20748068822b76e29ef255cdb04d
      7a2f98a0
    • Sagar Vemuri's avatar
      Update documentation about dynamic options (#4653) · 0c4678fd
      Sagar Vemuri authored
      Summary:
      Updated the comments around all options which are currently dynamic.
      Without explicitly specifying in the comments around the options, its hard for RocksDB users to know if an option is dynamically changeable or not unless they dig into the implementation details.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/4653
      
      Differential Revision: D12966735
      
      Pulled By: sagar0
      
      fbshipit-source-id: 1a01acbf6fe506b989e71629ce223f9803ebae27
      0c4678fd
    • Sagar Vemuri's avatar
      Update all unique/shared_ptr instances to be qualified with namespace std (#4638) · dc352807
      Sagar Vemuri authored
      Summary:
      Ran the following commands to recursively change all the files under RocksDB:
      ```
      find . -type f -name "*.cc" -exec sed -i 's/ unique_ptr/ std::unique_ptr/g' {} +
      find . -type f -name "*.cc" -exec sed -i 's/<unique_ptr/<std::unique_ptr/g' {} +
      find . -type f -name "*.cc" -exec sed -i 's/ shared_ptr/ std::shared_ptr/g' {} +
      find . -type f -name "*.cc" -exec sed -i 's/<shared_ptr/<std::shared_ptr/g' {} +
      ```
      Running `make format` updated some formatting on the files touched.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/4638
      
      Differential Revision: D12934992
      
      Pulled By: sagar0
      
      fbshipit-source-id: 45a15d23c230cdd64c08f9c0243e5183934338a8
      dc352807
  3. 09 Nov, 2018 1 commit
    • Andrew Kryczka's avatar
      Verify restore from backup in db_stress (#4655) · 8ba17f38
      Andrew Kryczka authored
      Summary:
      We already exercised backup functionality in `db_stress` according to the `-backup_one_in` flag. This PR verifies the backup can be restored/opened and sanity checks a few keys. Changes in this PR:
      
      - Extracted existing backup-related logic to a helper function, `TestBackupRestore`
      - Added restore logic, which targets a hidden directory named "./.restore\<thread number\>", similar to how backups target hidden directories named "./.backup\<thread number\>".
      - After restore, check the existence/non-existence of a few keys.
      - With this PR, backup is no longer compatible with clearing column families.
      - Also included unrelated fixes to set `ReadOptions::total_order_seek=true` when using `-compare_full_db_state_snapshot`
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/4655
      
      Differential Revision: D12972496
      
      Pulled By: ajkr
      
      fbshipit-source-id: 481a40052d9a38d1bd5c5159aa4d7c5a4b546b80
      8ba17f38
  4. 08 Nov, 2018 3 commits
  5. 07 Nov, 2018 4 commits
  6. 06 Nov, 2018 2 commits
    • Maysam Yabandeh's avatar
      WritePrepared: Fix bug in searching in non-cached snapshots (#4639) · 2b5b7bc7
      Maysam Yabandeh authored
      Summary:
      When evicting an entry form the commit_cache, it is verified against the list of old snapshots to see if it overlaps with any. The list of old snapshots is split into two lists: an efficient concurrent cache and an slow vector protected by a lock. The patch fixes a bug that would stop the search in the cache if it finds any and yet would not include the larger snapshots in the slower list.
      An extra info log entry is also removed. The condition to trigger that although very rare is still feasible and should not spam the LOG when that happens.
      Fixes #4621
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/4639
      
      Differential Revision: D12934989
      
      Pulled By: maysamyabandeh
      
      fbshipit-source-id: 4e0fe8147ba292b554ae78e94c21c2ef31e03e2d
      2b5b7bc7
    • Andrew Kryczka's avatar
      Add DB property for SST files kept from deletion (#4618) · fffac43c
      Andrew Kryczka authored
      Summary:
      This property can help debug why SST files aren't being deleted. Previously we only had the property "rocksdb.is-file-deletions-enabled". However, even when that returned true, obsolete SSTs may still not be deleted due to the coarse-grained mechanism we use to prevent newly created SSTs from being accidentally deleted. That coarse-grained mechanism uses a lower bound file number for SSTs that should not be deleted, and this property exposes that lower bound.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/4618
      
      Differential Revision: D12898179
      
      Pulled By: ajkr
      
      fbshipit-source-id: fe68acc041ddbcc9276bbd48976524d95aafc776
      fffac43c
  7. 03 Nov, 2018 5 commits
    • Bo Hou's avatar
      change history.md with new feature · a29053b6
      Bo Hou authored
      Summary: Pull Request resolved: https://github.com/facebook/rocksdb/pull/4626
      
      Differential Revision: D12911848
      
      Pulled By: jsjhoubo
      
      fbshipit-source-id: db6c59665e7cdbda20c6c63b0abd3ce24b473ae9
      a29053b6
    • Siying Dong's avatar
      Try to fix ExternalSSTFileTest.IngestNonExistingFile flakines (#4625) · c3105aa5
      Siying Dong authored
      Summary:
      ExternalSSTFileTest.IngestNonExistingFile occasionally fail for number of SST files after manual compaction doesn't go down as expected. Although I don't find a reason how this can happen, adding an extra waiting to make sure obsolete file purging has finished before we check the files doesn't hurt.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/4625
      
      Differential Revision: D12910586
      
      Pulled By: siying
      
      fbshipit-source-id: 2a5ddec6908c99cf3bcc78431c6f93151c2cab59
      c3105aa5
    • Philip Jameson's avatar
      Change BUCK template files (#4624) · 6c6cb465
      Philip Jameson authored
      Summary:
      Slightly changes the format of generated BUCK files for Facebook consumption. Generated targets end up looking like this:
      ```
      cpp_library(
          name = "rocksdb_tools_lib",
          srcs = [
              "tools/db_bench_tool.cc",
              "tools/trace_analyzer_tool.cc",
              "util/testutil.cc",
          ],
          auto_headers = AutoHeaders.RECURSIVE_GLOB,
          arch_preprocessor_flags = rocksdb_arch_preprocessor_flags,
          compiler_flags = rocksdb_compiler_flags,
          preprocessor_flags = rocksdb_preprocessor_flags,
          deps = [":rocksdb_lib"],
          external_deps = rocksdb_external_deps,
      )
      ```
      Instead of
      ```
      cpp_library(
          name = "rocksdb_tools_lib",
          srcs = [
              "tools/db_bench_tool.cc",
              "tools/trace_analyzer_tool.cc",
              "util/testutil.cc",
          ],
          headers = AutoHeaders.RECURSIVE_GLOB,
          arch_preprocessor_flags = rocksdb_arch_preprocessor_flags,
          compiler_flags = rocksdb_compiler_flags,
          preprocessor_flags = rocksdb_preprocessor_flags,
          deps = [":rocksdb_lib"],
          external_deps = rocksdb_external_deps,
      )
      ```
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/4624
      
      Reviewed By: riversand963
      
      Differential Revision: D12906711
      
      Pulled By: philipjameson
      
      fbshipit-source-id: 32ab64a3390cdcf2c4043ff77517ac1ad58a5e2b
      6c6cb465
    • Zhongyi Xie's avatar
      exclude get db property calls from rocksdb_lite (#4619) · 61311157
      Zhongyi Xie authored
      Summary:
      fix current failing lite test:
      > In file included from ./util/testharness.h:15:0,
                       from ./table/mock_table.h:23,
                       from ./db/db_test_util.h:44,
                       from db/db_flush_test.cc:10:
      db/db_flush_test.cc: In member function ‘virtual void rocksdb::DBFlushTest_ManualFlushFailsInReadOnlyMode_Test::TestBody()’:
      db/db_flush_test.cc:250:35: error: ‘Properties’ is not a member of ‘rocksdb::DB’
         ASSERT_TRUE(db_->GetIntProperty(DB::Properties::kBackgroundErrors,
                                         ^
      make: *** [db/db_flush_test.o] Error 1
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/4619
      
      Differential Revision: D12898319
      
      Pulled By: miasantreble
      
      fbshipit-source-id: 72de603b1f2e972fc8caa88611798c4e98e348c6
      61311157
    • jiachun.fjc's avatar
      Thread.sleep() in StatisticsCollector (#4588) · 55c03492
      jiachun.fjc authored
      Summary:
      In  'StatisticsCollector', the call of Thread.sleep() might be better outside the loop?
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/4588
      
      Differential Revision: D12903406
      
      Pulled By: sagar0
      
      fbshipit-source-id: 1647ed779e9972bc2cea03f4c38e37ab3ad7c361
      55c03492
  8. 02 Nov, 2018 4 commits
    • Yanqin Jin's avatar
      Update test to cover a new case in file ingestion (#4614) · de18a2d8
      Yanqin Jin authored
      Summary:
      The new case is directIO = true, write_global_seqno = false in which we no longer write global_seqno to the external SST file.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/4614
      
      Differential Revision: D12885001
      
      Pulled By: riversand963
      
      fbshipit-source-id: 7541bdc608b3a0c93d3c3c435da1b162b36673d4
      de18a2d8
    • Soli's avatar
      FIX #3820: shorter file name in logs (#4616) · 3f8f81cf
      Soli authored
      Summary:
      Long absolute file names in log make it hard to read the LOG files.
      So we shorter them to relative to the root of RocksDB project path.
      In most cases, they will only have one level directory and one file name.
      
      There was [a talk](#4316) about making "util/logging.h" a public header file.
      But we concern the conflicts that might be introduced in for macros
      named `STRINGIFY`, `TOSTRING`, and `PREPEND_FILE_LINE`.
      
      So I prepend a prefix `ROCKS_LOG_` to them.
      I also remove the line that includes "port.h" which seems unneccessary here.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/4616
      
      Differential Revision: D12892857
      
      Pulled By: siying
      
      fbshipit-source-id: af79aaf82153b8fd66b5966aced39a51fbca9c6c
      3f8f81cf
    • Bo Hou's avatar
      xxhash 64 support · cd9404bb
      Bo Hou authored
      Summary: Pull Request resolved: https://github.com/facebook/rocksdb/pull/4607
      
      Reviewed By: siying
      
      Differential Revision: D12836696
      
      Pulled By: jsjhoubo
      
      fbshipit-source-id: 7122ccb712d0b0f1cd998aa4477e0da1401bd870
      cd9404bb
    • Andrew Kryczka's avatar
      Prevent manual flush hanging in read-only mode (#4615) · 5c794d94
      Andrew Kryczka authored
      Summary:
      The logic to wait for stall conditions to clear before beginning a manual flush didn't take into account whether the DB was in read-only mode. In read-only mode the stall conditions would never clear since no background work is happening, so the wait would be never-ending. It's probably better to return an error to the user.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/4615
      
      Differential Revision: D12888008
      
      Pulled By: ajkr
      
      fbshipit-source-id: 1c474b42a7ac38d9fd0d0e2340ff1d53e684d83c
      5c794d94
  9. 01 Nov, 2018 1 commit
    • Andrew Kryczka's avatar
      Prevent manual compaction hanging in read-only mode (#4611) · b8f68bac
      Andrew Kryczka authored
      Summary:
      A background compaction with pre-picked files (i.e., either a manual compaction or a bottom-pri compaction) fails when the DB is in read-only mode. In the failure handling, we forgot to unregister the compaction and the files it covered. Then subsequent manual compactions could conflict with this zombie compaction (possibly Halloween related) and wait forever for it to finish.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/4611
      
      Differential Revision: D12871217
      
      Pulled By: ajkr
      
      fbshipit-source-id: 9d24e921d5bbd2ee8c2c9536a30abfa42a220c6e
      b8f68bac
  10. 31 Oct, 2018 6 commits
    • Yanqin Jin's avatar
      Update manual flush stress test (#4608) · 50895e5f
      Yanqin Jin authored
      Summary:
      Originally, the manual flush calls in db_stress flushes only a single column
      family, which is not sufficient when atomic flush is enabled.
      With atomic flush, we should call `Flush(flush_opts, cfhs)` to better test this
      new feature. Specifically, we manuall flush all column families so that
      database verification is easier.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/4608
      
      Differential Revision: D12849160
      
      Pulled By: riversand963
      
      fbshipit-source-id: ae1f0dd825247b42c0aba520a5c967335102c876
      50895e5f
    • Yanqin Jin's avatar
      Add test to check if DB can handle atomic group (#4433) · d1118f6f
      Yanqin Jin authored
      Summary:
      Add unit tests to demonstrate that `VersionSet::Recover` is able to detect and handle cases in which the MANIFEST has valid atomic group, incomplete trailing atomic group, atomic group mixed with normal version edits and atomic group with incorrect size.
      With this capability, RocksDB identifies non-valid groups of version edits and do not apply them, thus guaranteeing that the db is restored to a state consistent with the most recent successful atomic flush before applying WAL.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/4433
      
      Differential Revision: D10079202
      
      Pulled By: riversand963
      
      fbshipit-source-id: a0e0b8bf4da1cf68e044d397588c121b66c68876
      d1118f6f
    • Abhishek Madan's avatar
      Promote rocksdb.{deleted.keys,merge.operands} to main table properties (#4594) · eaaf1a6f
      Abhishek Madan authored
      Summary:
      Since the number of range deletions are reported in
      TableProperties, it is confusing to not report the number of merge
      operands and point deletions as top-level properties; they are
      accessible through the public API, but since they are not the "main"
      properties, they do not appear in aggregated table properties, or the
      string representation of table properties.
      
      This change promotes those two property keys to
      `rocksdb/table_properties.h`, adds corresponding uint64 members for
      them, deprecates the old access methods `GetDeletedKeys()` and
      `GetMergeOperands()` (though they are still usable for now), and removes
      `InternalKeyPropertiesCollector`. The property key strings are the same
      as before this change, so this should be able to read DBs written from older
      versions (though I haven't tested this yet).
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/4594
      
      Differential Revision: D12826893
      
      Pulled By: abhimadan
      
      fbshipit-source-id: 9e4e4fbdc5b0da161c89582566d184101ba8eb68
      eaaf1a6f
    • Yanqin Jin's avatar
      Enable crash-recovery stress test for atomic flush (#4605) · 912bbbbc
      Yanqin Jin authored
      Summary:
      This PR adds test of atomic flush to our continuous stress tests.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/4605
      
      Differential Revision: D12840607
      
      Pulled By: riversand963
      
      fbshipit-source-id: 0da187572791a59530065a7952697c05b1197ad9
      912bbbbc
    • Ben Clay's avatar
      RocksJava: Add more flags to BlockBasedTableConfig (#4589) · 72afdf20
      Ben Clay authored
      Summary:
      Punch through more flags for BlockBasedTableConfig, mostly around caching index + filter blocks and partitioned filters.
      
      sagar0 adamretter
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/4589
      
      Differential Revision: D12840626
      
      Pulled By: sagar0
      
      fbshipit-source-id: 3c289d367ceb2a012023aa791b990a437dd1393a
      72afdf20
    • Siying Dong's avatar
      Remove info logging in db mutex inside EnableFileDeletions() (#4604) · 9da88a83
      Siying Dong authored
      Summary:
      EnableFileDeletions() does info logging inside db mutex. This is not recommended in the code base, since there could be I/O involved. Move this outside the DB mutex.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/4604
      
      Differential Revision: D12834432
      
      Pulled By: siying
      
      fbshipit-source-id: ffe5c2626fcfdb4c54a661a3c3b0bc95054816cf
      9da88a83
  11. 30 Oct, 2018 4 commits
    • Andrew Kryczka's avatar
      Fix range tombstones written to more files than necessary (#4592) · cae540eb
      Andrew Kryczka authored
      Summary:
      When there's a gap between files, we do not need to output tombstones starting at the next output file's begin key to the current output file.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/4592
      
      Differential Revision: D12808627
      
      Pulled By: ajkr
      
      fbshipit-source-id: 77c8b2e7523a95b1cd6611194144092c06acb505
      cae540eb
    • Yanqin Jin's avatar
      Disable DBIOFailureTest.NoSpaceCompactRange in LITE (#4596) · 806ff34b
      Yanqin Jin authored
      Summary:
      Since ErrorHandler::RecoverFromNoSpace is no-op in LITE mode, then we should
      not have this test in LITE mode. If we do keep it, it will cause the test
      thread to wait on bg_cv_ that will not be signalled.
      
      How to reproduce
      ```
      $make clean && git checkout a27fce40
      $OPT="-DROCKSDB_LITE -g" make -j20
      $./db_io_failure_test --gtest_filter=DBIOFailureTest.NoSpaceCompactRange
      ```
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/4596
      
      Differential Revision: D12818516
      
      Pulled By: riversand963
      
      fbshipit-source-id: bc83524f40fff1e29506979017f7f4c2b70322f3
      806ff34b
    • Yanqin Jin's avatar
      Fix a warning against implicit type conversion (#4593) · 7fb39f1a
      Yanqin Jin authored
      Summary:
      Test plan
      ```
      $USE_CLANG=1 make -j32 all check
      ```
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/4593
      
      Differential Revision: D12811159
      
      Pulled By: riversand963
      
      fbshipit-source-id: 5e3bbe058c5a8d5a286a19d7643593fc154a2d6d
      7fb39f1a
    • Yanqin Jin's avatar
      Avoid memtable cut when active memtable is empty (#4595) · 92b44015
      Yanqin Jin authored
      Summary:
      For flush triggered by RocksDB due to memory usage approaching certain
      threshold (WriteBufferManager or Memtable full), we should cut the memtable
      only when the current active memtable is not empty, i.e. contains data. This is
      what we do for non-atomic flush. If we always cut memtable even when the active
      memtable is empty, we will generate extra, empty immutable memtable.
      This is not ideal since it may cause write stall. It also causes some
      DBAtomicFlushTest to fail because cfd->imm()->NumNotFlushed() is different from
      expectation.
      
      Test plan
      ```
      $make clean && make J=1 -j32 all check
      $make clean && OPT="-DROCKSDB_LITE -g" make J=1 -j32 all check
      $make clean && TEST_TMPDIR=/dev/shm/rocksdb OPT=-g make J=1 -j32 valgrind_test
      ```
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/4595
      
      Differential Revision: D12818520
      
      Pulled By: riversand963
      
      fbshipit-source-id: d867bdbeacf4199fdd642debb085f94703c41a18
      92b44015
  12. 27 Oct, 2018 3 commits
    • Yi Wu's avatar
      port folly::JemallocNodumpAllocator (#4534) · 5f5fddab
      Yi Wu authored
      Summary:
      Introduce `JemallocNodumpAllocator`, which allow exclusion of block cache usage from core dump. It utilize custom hook of jemalloc arena, and when jemalloc arena request memory from system, the allocator use the hook to set `MADV_DONTDUMP ` to the memory. The implementation is basically the same as `folly::JemallocNodumpAllocator`, except for some minor difference:
      1. It only support jemalloc >= 5.0
      2. When the allocator destruct, it explicitly destruct the corresponding arena via `arena.<i>.destroy` via `mallctl`.
      
      Depending on #4502.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/4534
      
      Differential Revision: D10435474
      
      Pulled By: yiwu-arbug
      
      fbshipit-source-id: e80edea755d3853182485d2be710376384ce0bb4
      5f5fddab
    • Yanqin Jin's avatar
      Enable atomic flush (#4023) · 5b4c709f
      Yanqin Jin authored
      Summary:
      Adds a DB option `atomic_flush` to control whether to enable this feature. This PR is a subset of [PR 3752](https://github.com/facebook/rocksdb/pull/3752).
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/4023
      
      Differential Revision: D8518381
      
      Pulled By: riversand963
      
      fbshipit-source-id: 1e3bb33e99bb102876a31b378d93b0138ff6634f
      5b4c709f
    • Yi Wu's avatar
      s/CacheAllocator/MemoryAllocator/g (#4590) · f560c8f5
      Yi Wu authored
      Summary:
      Rename the interface, as it is mean to be a generic interface for memory allocation.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/4590
      
      Differential Revision: D10866340
      
      Pulled By: yiwu-arbug
      
      fbshipit-source-id: 85cb753351a40cb856c046aeaa3f3b369eef3d16
      f560c8f5