1. 02 6月, 2015 1 次提交
  2. 30 5月, 2015 1 次提交
    • A
      Optimistic Transactions · dc9d70de
      agiardullo 提交于
      Summary: Optimistic transactions supporting begin/commit/rollback semantics.  Currently relies on checking the memtable to determine if there are any collisions at commit time.  Not yet implemented would be a way of enuring the memtable has some minimum amount of history so that we won't fail to commit when the memtable is empty.  You should probably start with transaction.h to get an overview of what is currently supported.
      
      Test Plan: Added a new test, but still need to look into stress testing.
      
      Reviewers: yhchiang, igor, rven, sdong
      
      Reviewed By: sdong
      
      Subscribers: adamretter, MarkCallaghan, leveldb, dhruba
      
      Differential Revision: https://reviews.facebook.net/D33435
      dc9d70de
  3. 29 5月, 2015 1 次提交
    • A
      Support saving history in memtable_list · c8153510
      agiardullo 提交于
      Summary:
      For transactions, we are using the memtables to validate that there are no write conflicts.  But after flushing, we don't have any memtables, and transactions could fail to commit.  So we want to someone keep around some extra history to use for conflict checking.  In addition, we want to provide a way to increase the size of this history if too many transactions fail to commit.
      
      After chatting with people, it seems like everyone prefers just using Memtables to store this history (instead of a separate history structure).  It seems like the best place for this is abstracted inside the memtable_list.  I decide to create a separate list in MemtableListVersion as using the same list complicated the flush/installalflushresults logic too much.
      
      This diff adds a new parameter to control how much memtable history to keep around after flushing.  However, it sounds like people aren't too fond of adding new parameters.  So I am making the default size of flushed+not-flushed memtables be set to max_write_buffers.  This should not change the maximum amount of memory used, but make it more likely we're using closer the the limit.  (We are now postponing deleting flushed memtables until the max_write_buffer limit is reached).  So while we might use more memory on average, we are still obeying the limit set (and you could argue it's better to go ahead and use up memory now instead of waiting for a write stall to happen to test this limit).
      
      However, if people are opposed to this default behavior, we can easily set it to 0 and require this parameter be set in order to use transactions.
      
      Test Plan: Added a xfunc test to play around with setting different values of this parameter in all tests.  Added testing in memtablelist_test and planning on adding more testing here.
      
      Reviewers: sdong, rven, igor
      
      Reviewed By: igor
      
      Subscribers: dhruba, leveldb
      
      Differential Revision: https://reviews.facebook.net/D37443
      c8153510
  4. 22 5月, 2015 1 次提交
  5. 19 5月, 2015 3 次提交
  6. 15 5月, 2015 1 次提交
  7. 14 5月, 2015 1 次提交
  8. 12 5月, 2015 1 次提交
    • A
      API to fetch from both a WriteBatchWithIndex and the db · 711465cc
      agiardullo 提交于
      Summary:
      Added a couple functions to WriteBatchWithIndex to make it easier to query the value of a key including reading pending writes from a batch.  (This is needed for transactions).
      
      I created write_batch_with_index_internal.h to use to store an internal-only helper function since there wasn't a good place in the existing class hierarchy to store this function (and it didn't seem right to stick this function inside WriteBatchInternal::Rep).
      
      Since I needed to access the WriteBatchEntryComparator, I moved some helper classes from write_batch_with_index.cc into write_batch_with_index_internal.h/.cc.  WriteBatchIndexEntry, ReadableWriteBatch, and WriteBatchEntryComparator are all unchanged (just moved to a different file(s)).
      
      Test Plan: Added new unit tests.
      
      Reviewers: rven, yhchiang, sdong, igor
      
      Reviewed By: igor
      
      Subscribers: dhruba, leveldb
      
      Differential Revision: https://reviews.facebook.net/D38037
      711465cc
  9. 10 5月, 2015 1 次提交
  10. 09 5月, 2015 1 次提交
  11. 07 5月, 2015 1 次提交
    • Y
      Allow GetThreadList() to report basic compaction operation properties. · 77a5a543
      Yueh-Hsuan Chiang 提交于
      Summary:
      Now we're able to show more details about a compaction in
      GetThreadList() :)
      
      This patch allows GetThreadList() to report basic compaction
      operation properties.  Basic compaction properties include:
          1. job id
          2. compaction input / output level
          3. compaction property flags (is_manual, is_deletion, .. etc)
          4. total input bytes
          5. the number of bytes has been read currently.
          6. the number of bytes has been written currently.
      
      Flush operation properties will be done in a seperate diff.
      
      Test Plan:
      /db_bench --threads=30 --num=1000000 --benchmarks=fillrandom --thread_status_per_interval=1
      
      Sample output of tracking same job:
      
                ThreadID ThreadType       cfName            Operation   ElapsedTime                                         Stage        State OperationProperties
         140664171987072    Low Pri      default           Compaction     31.357 ms     CompactionJob::FinishCompactionOutputFile              BaseInputLevel 1 | BytesRead 2264663 | BytesWritten 1934241 | IsDeletion 0 | IsManual 0 | IsTrivialMove 0 | JobID 277 | OutputLevel 2 | TotalInputBytes 3964158 |
      
                ThreadID ThreadType       cfName            Operation   ElapsedTime                                         Stage        State OperationProperties
         140664171987072    Low Pri      default           Compaction     59.440 ms     CompactionJob::FinishCompactionOutputFile              BaseInputLevel 1 | BytesRead 2264663 | BytesWritten 1934241 | IsDeletion 0 | IsManual 0 | IsTrivialMove 0 | JobID 277 | OutputLevel 2 | TotalInputBytes 3964158 |
      
                ThreadID ThreadType       cfName            Operation   ElapsedTime                                         Stage        State OperationProperties
         140664171987072    Low Pri      default           Compaction    226.375 ms                        CompactionJob::Install              BaseInputLevel 1 | BytesRead 3958013 | BytesWritten 3621940 | IsDeletion 0 | IsManual 0 | IsTrivialMove 0 | JobID 277 | OutputLevel 2 | TotalInputBytes 3964158 |
      
      Reviewers: sdong, rven, igor
      
      Reviewed By: igor
      
      Subscribers: dhruba, leveldb
      
      Differential Revision: https://reviews.facebook.net/D37653
      77a5a543
  12. 02 5月, 2015 1 次提交
  13. 30 4月, 2015 2 次提交
  14. 25 4月, 2015 1 次提交
  15. 24 4月, 2015 3 次提交
    • S
      Fix CompactRange for universal compaction with num_levels > 1 · d01bbb53
      sdong 提交于
      Summary:
      CompactRange for universal compaction with num_levels > 1 seems to have a bug. The unit test also has a bug so it doesn't capture the problem.
      Fix it. Revert the compact range to the logic equivalent to num_levels=1. Always compact all files together.
      
      It should also fix DBTest.IncreaseUniversalCompactionNumLevels. The issue was that options.write_buffer_size = 100 << 10 and options.write_buffer_size = 100 << 10 are not used in later test scenarios. So write_buffer_size of 4MB was used. The compaction trigger condition is not anymore obvious as expected.
      
      Test Plan: Run the new test and all test suites
      
      Reviewers: yhchiang, rven, kradhakrishnan, anthony, igor
      
      Reviewed By: igor
      
      Subscribers: leveldb, dhruba
      
      Differential Revision: https://reviews.facebook.net/D37551
      d01bbb53
    • G
      Implement DB::PromoteL0 method · 2dc421df
      Giuseppe Ottaviano 提交于
      Summary:
      This diff implements a new `DB` method `PromoteL0` which moves all files in L0
      to a given level skipping compaction, provided that the files have disjoint
      ranges and all levels up to the target level are empty.
      
      This method provides finer-grain control for trivial compactions, and it is
      useful for bulk-loading pre-sorted keys. Compared to D34797, it does not change
      the semantics of an existing operation, which can impact existing code.
      
      PromoteL0 is designed to work well in combination with the proposed
      `GetSstFileWriter`/`AddFile` interface, enabling to "design" the level structure
      by populating one level at a time. Such fine-grained control can be very useful
      for static or mostly-static databases.
      
      Test Plan: `make check`
      
      Reviewers: IslamAbdelRahman, philipp, MarkCallaghan, yhchiang, igor, sdong
      
      Reviewed By: sdong
      
      Subscribers: dhruba
      
      Differential Revision: https://reviews.facebook.net/D37107
      2dc421df
    • S
      options.paranoid_file_checks to read all rows after writing to a file. · 397b6588
      sdong 提交于
      Summary: To further distinguish the corruption cases were caused by storage media or in memory states when writing it, add a paranoid check after writing the file to iterate all the rows.
      
      Test Plan: Add a new unit test for it
      
      Reviewers: rven, igor
      
      Subscribers: leveldb, dhruba
      
      Differential Revision: https://reviews.facebook.net/D37335
      397b6588
  16. 23 4月, 2015 1 次提交
    • V
      Making PreShutdown tests more reliable. · 618d07b0
      Venkatesh Radhakrishnan 提交于
      Summary:
      A couple of times on Travis, we have had the thread status say that there were no compactions done and since we assert for it, the test failed.
      We now fix this by waiting till compaction started.
      
      Test Plan:
      run DBTEST::*PreShutdown*
      
      d=/tmp/j; rm -rf $d; seq 200 | parallel --gnu --eta 'd=/tmp/j/d-{}; mkdir -p $d; TEST_TMPDIR=$d ./db_test --gtest_filter=DBTest.PreShutdown* >& '$d'/log-{}'
      
      Reviewers: sdong, igor
      
      Reviewed By: igor
      
      Subscribers: dhruba
      
      Differential Revision: https://reviews.facebook.net/D37545
      618d07b0
  17. 18 4月, 2015 1 次提交
    • I
      Add experimental API MarkForCompaction() · 6059bdf8
      Igor Canadi 提交于
      Summary:
      Some Mongo+Rocks datasets in Parse's environment are not doing compactions very frequently. During the quiet period (with no IO), we'd like to schedule compactions so that our reads become faster. Also, aggressively compacting during quiet periods helps when write bursts happen. In addition, we also want to compact files that are containing deleted key ranges (like old oplog keys).
      
      All of this is currently not possible with CompactRange() because it's single-threaded and blocks all other compactions from happening. Running CompactRange() risks an issue of blocking writes because we generate too much Level 0 files before the compaction is over. Stopping writes is very dangerous because they hold transaction locks. We tried running manual compaction once on Mongo+Rocks and everything fell apart.
      
      MarkForCompaction() solves all of those problems. This is very light-weight manual compaction. It is lower priority than automatic compactions, which means it shouldn't interfere with background process keeping the LSM tree clean. However, if no automatic compactions need to be run (or we have extra background threads available), we will start compacting files that are marked for compaction.
      
      Test Plan: added a new unit test
      
      Reviewers: yhchiang, rven, MarkCallaghan, sdong
      
      Reviewed By: sdong
      
      Subscribers: yoshinorim, dhruba, leveldb
      
      Differential Revision: https://reviews.facebook.net/D37083
      6059bdf8
  18. 15 4月, 2015 4 次提交
    • S
      Bug of trivial move of dynamic level · debaf85e
      sdong 提交于
      Summary: D36669 introduces a bug that trivial moved data is not going to specific level but the next level, which will incorrectly be level 1 for level 0 compaciton if base level is not level 1. Fixing it by appreciating the output level
      
      Test Plan: Run all tests
      
      Reviewers: MarkCallaghan, rven, yhchiang, igor
      
      Reviewed By: igor
      
      Subscribers: leveldb, dhruba
      
      Differential Revision: https://reviews.facebook.net/D37119
      debaf85e
    • S
      Fix and Improve DBTest.DynamicLevelCompressionPerLevel2 · 12d7d3d2
      sdong 提交于
      Summary:
      Recent change of DBTest.DynamicLevelCompressionPerLevel2 has a bug that the second sync point is not enabled. Fix it. Also add an assert for that.
      Also, flush compression is not tracked in the test. Add it.
      
      Test Plan: Build everything
      
      Subscribers: leveldb, dhruba
      
      Differential Revision: https://reviews.facebook.net/D37101
      12d7d3d2
    • S
      Fix build break introduced by new SyncPoint interface change · a1271c6c
      sdong 提交于
      Summary: When commiting the sync point interface change, didn't resolve the new occurance of the old interface in rebase. Fix it.
      
      Test Plan: Build and see it pass
      
      Reviewers: igor, yhchiang, rven, anthony, kradhakrishnan
      
      Subscribers: leveldb, dhruba
      
      Differential Revision: https://reviews.facebook.net/D37095
      a1271c6c
    • S
      SyncPoint to allow a callback with an argument and use it to get... · fcb206b6
      sdong 提交于
      SyncPoint to allow a callback with an argument and use it to get DBTest.DynamicLevelCompressionPerLevel2 more straight-forward
      
      Summary:
      Allow users to give a callback function with parameter using sync point, so more complicated verification can be done in tests.
      Use it in DBTest.DynamicLevelCompressionPerLevel2 so that failures will be more easy to debug.
      
      Test Plan: Run all tests. Run DBTest.DynamicLevelCompressionPerLevel2 with valgrind check.
      
      Reviewers: rven, yhchiang, anthony, kradhakrishnan, igor
      
      Reviewed By: igor
      
      Subscribers: leveldb, dhruba
      
      Differential Revision: https://reviews.facebook.net/D36999
      fcb206b6
  19. 14 4月, 2015 2 次提交
  20. 11 4月, 2015 1 次提交
    • I
      Make Compaction class easier to use · 47b87439
      Igor Canadi 提交于
      Summary:
      The goal of this diff is to make Compaction class easier to use. This should also make new compaction algorithms easier to write (like CompactFiles from @yhchiang and dynamic leveled and multi-leveled universal from @sdong).
      
      Here are couple of things demonstrating that Compaction class is hard to use:
      1. we have two constructors of Compaction class
      2. there's this thing called grandparents_, but it appears to only be setup for leveled compaction and not compactfiles
      3. it's easy to introduce a subtle and dangerous bug like this: D36225
      4. SetupBottomMostLevel() is hard to understand and it shouldn't be. See this comment: https://github.com/facebook/rocksdb/blob/afbafeaeaebfd27a0f3e992fee8e0c57d07658fa/db/compaction.cc#L236-L241. It also made it harder for @yhchiang to write CompactFiles, as evidenced by this: https://github.com/facebook/rocksdb/blob/afbafeaeaebfd27a0f3e992fee8e0c57d07658fa/db/compaction_picker.cc#L204-L210
      
      The problem is that we create Compaction object, which holds a lot of state, and then pass it around to some functions. After those functions are done mutating, then we call couple of functions on Compaction object, like SetupBottommostLevel() and MarkFilesBeingCompacted(). It is very hard to see what's happening with all that Compaction's state while it's travelling across different functions. If you're writing a new PickCompaction() function you need to try really hard to understand what are all the functions you need to run on Compaction object and what state you need to setup.
      
      My proposed solution is to make important parts of Compaction immutable after construction. PickCompaction() should calculate compaction inputs and then pass them onto Compaction object once they are finalized. That makes it easy to create a new compaction -- just provide all the parameters to the constructor and you're done. No need to call confusing functions after you created your object.
      
      This diff doesn't fully achieve that goal, but it comes pretty close. Here are some of the changes:
      * have one Compaction constructor instead of two.
      * inputs_ is constant after construction
      * MarkFilesBeingCompacted() is now private to Compaction class and automatically called on construction/destruction.
      * SetupBottommostLevel() is gone. Compaction figures it out on its own based on the input.
      * CompactionPicker's functions are not passing around Compaction object anymore. They are only passing around the state that they need.
      
      Test Plan:
      make check
      make asan_check
      make valgrind_check
      
      Reviewers: rven, anthony, sdong, yhchiang
      
      Reviewed By: yhchiang
      
      Subscribers: sdong, yhchiang, dhruba, leveldb
      
      Differential Revision: https://reviews.facebook.net/D36687
      47b87439
  21. 09 4月, 2015 1 次提交
    • S
      Trivial move to cover multiple input levels · b118238a
      sdong 提交于
      Summary: Now trivial move is only triggered when moving from level n to n+1. With dynamic level base, it is possible that file is moved from level 0 to level n, while levels from 1 to n-1 are empty. Extend trivial move to this case.
      
      Test Plan: Add a more unit test of sequential loading. Non-trivial compaction happened without the patch and now doesn't happen.
      
      Reviewers: rven, yhchiang, MarkCallaghan, igor
      
      Reviewed By: igor
      
      Subscribers: leveldb, dhruba, IslamAbdelRahman
      
      Differential Revision: https://reviews.facebook.net/D36669
      b118238a
  22. 07 4月, 2015 2 次提交
    • I
      Clean up compression logging · 5e067a7b
      Igor Canadi 提交于
      Summary: Now we add warnings when user configures compression and the compression is not supported.
      
      Test Plan:
      Configured compression to non-supported values. Observed messages in my log:
      
          2015/03/26-12:17:57.586341 7ffb8a496840 [WARN] Compression type chosen for level 2 is not supported: LZ4. RocksDB will not compress data on level 2.
      
          2015/03/26-12:19:10.768045 7f36f15c5840 [WARN] Compression type chosen is not supported: LZ4. RocksDB will not compress data.
      
      Reviewers: rven, sdong, yhchiang
      
      Reviewed By: sdong
      
      Subscribers: dhruba, leveldb
      
      Differential Revision: https://reviews.facebook.net/D35979
      5e067a7b
    • S
      A new call back to TablePropertiesCollector to allow users know the entry is add, delete or merge · 953a885e
      sdong 提交于
      Summary:
      Currently users have no idea a key is add, delete or merge from TablePropertiesCollector call back. Add a new function to add it.
      
      Also refactor the codes so that
      (1) make table property collector and internal table property collector two separate data structures with the later one now exposed
      (2) table builders only receive internal table properties
      
      Test Plan: Add cases in table_properties_collector_test to cover both of old and new ways of using TablePropertiesCollector.
      
      Reviewers: yhchiang, igor.sugak, rven, igor
      
      Reviewed By: rven, igor
      
      Subscribers: meyering, yoshinorim, maykov, leveldb, dhruba
      
      Differential Revision: https://reviews.facebook.net/D35373
      953a885e
  23. 03 4月, 2015 2 次提交
    • S
      db_test: clean up sync points in test cleaning up · 089509b8
      sdong 提交于
      Summary: In some db_test tests sync points are not cleared which will cause unexpected results in the next tests. Clean them up in test cleaning up.
      
      Test Plan:
      Run the same tests that used to fail:
      
      build using USE_CLANG=1 and run
      ./db_test --gtest_filter="DBTest.CompressLevelCompaction:*DBTestUniversalCompactionParallel*"
      
      Reviewers: rven, yhchiang, igor
      
      Reviewed By: igor
      
      Subscribers: leveldb, dhruba
      
      Differential Revision: https://reviews.facebook.net/D36429
      089509b8
    • V
      Disallow trivial move if compression level is different · afbafeae
      Venkatesh Radhakrishnan 提交于
      Summary:
      Check compression level of start_level with output_compression
      before allowing trivial move
      
      Test Plan: New DBTest CompressLevelCompactionThirdPath added
      
      Reviewers: igor, yhchiang, IslamAbdelRahman, sdong
      
      Reviewed By: sdong
      
      Subscribers: dhruba, leveldb
      
      Differential Revision: https://reviews.facebook.net/D36213
      afbafeae
  24. 02 4月, 2015 1 次提交
  25. 31 3月, 2015 3 次提交
    • S
      Fix one non-determinism of DBTest.DynamicCompactionOptions · 76d63b45
      sdong 提交于
      Summary:
      After recent change of DBTest.DynamicCompactionOptions, occasionally hit another non-deterministic case where L0 showdown is triggered while timeout should not triggered for hard limit.
      Fix it by increasing L0 slowdown trigger at the same time.
      
      Test Plan: Run the failed test.
      
      Reviewers: igor, rven
      
      Reviewed By: rven
      
      Subscribers: leveldb, dhruba
      
      Differential Revision: https://reviews.facebook.net/D36219
      76d63b45
    • S
      Universal Compactions with Small Files · b23bbaa8
      sdong 提交于
      Summary:
      With this change, we use L1 and up to store compaction outputs in universal compaction.
      The compaction pick logic stays the same. Outputs are stored in the largest "level" as possible.
      
      If options.num_levels=1, it behaves all the same as now.
      
      Test Plan:
      1) convert most of existing unit tests for universal comapaction to include the option of one level and multiple levels.
      2) add a unit test to cover parallel compaction in universal compaction and run it in one level and multiple levels
      3) add unit test to migrate from multiple level setting back to one level setting
      4) add a unit test to insert keys to trigger multiple rounds of compactions and verify results.
      
      Reviewers: rven, kradhakrishnan, yhchiang, igor
      
      Reviewed By: igor
      
      Subscribers: meyering, leveldb, MarkCallaghan, dhruba
      
      Differential Revision: https://reviews.facebook.net/D34539
      b23bbaa8
    • I
      Clean up old log files in background threads · fd3dbef2
      Igor Canadi 提交于
      Summary:
      Cleaning up log files can do heavy IO, since we call ftruncate() in the destructor. We don't want to call ftruncate() in user threads.
      
      This diff moves cleaning to background threads (flush and compaction)
      
      Test Plan: make check, will also run valgrind
      
      Reviewers: yhchiang, rven, MarkCallaghan, sdong
      
      Reviewed By: sdong
      
      Subscribers: dhruba, leveldb
      
      Differential Revision: https://reviews.facebook.net/D36177
      fd3dbef2
  26. 25 3月, 2015 1 次提交
    • A
      Adding stats for the merge and filter operation · 3d1a924f
      Anurag Indu 提交于
      Summary:
      We have addded new stats and perf_context for measuring the merge and filter operation time consumption.
      We have bounded all the merge operations within the GUARD statment and collected the total time for these operations in the DB.
      
      Test Plan: WIP
      
      Reviewers: rven, yhchiang, kradhakrishnan, igor, sdong
      
      Reviewed By: sdong
      
      Subscribers: dhruba
      
      Differential Revision: https://reviews.facebook.net/D34377
      3d1a924f
  27. 24 3月, 2015 1 次提交
    • Y
      Improve ThreadStatusSingleCompaction · a057bb2a
      Yueh-Hsuan Chiang 提交于
      Summary:
      Improve ThreadStatusSingleCompaction in two ways:
      1. Use SYNC_POINT to ensure compaction won't happen
         before the test finishes its "Put Phase" instead of
         using sleep.
      2. In Put Phase, it continues until we have sufficient
         number of L0 files.  Note that during the put phase,
         there won't be any compaction that consumes L0 files
         because of item 1.
      
      Test Plan: ./db_test  --gtest_filter="*ThreadStatusSingleCompaction*"
      
      Reviewers: sdong, igor, rven
      
      Subscribers: dhruba, leveldb
      
      Differential Revision: https://reviews.facebook.net/D35727
      a057bb2a