1. 16 12月, 2014 1 次提交
    • V
      RocksDB: Allow Level-Style Compaction to Place Files in Different Paths · 153f4f07
      Venkatesh Radhakrishnan 提交于
      Summary:
      Allow Level-style compaction to place files in different paths
      This diff provides the code for task 4854591. We now support level-compaction
      to place files in different paths by specifying  them in db_paths  along with
      the minimum level for files to store in that path.
      
      Test Plan: ManualLevelCompactionOutputPathId in db_test.cc
      
      Reviewers: yhchiang, MarkCallaghan, dhruba, yoshinorim, sdong
      
      Reviewed By: sdong
      
      Subscribers: yoshinorim, dhruba, leveldb
      
      Differential Revision: https://reviews.facebook.net/D29799
      153f4f07
  2. 12 12月, 2014 1 次提交
    • S
      Improve scalability of DB::GetSnapshot() · d7a48666
      sdong 提交于
      Summary: Now DB::GetSnapshot() doesn't scale to more column families, as it needs to go through all the column families to find whether snapshot is supported. This patch optimizes it.
      
      Test Plan:
      Add unit tests to cover negative cases.
      make all check
      
      Reviewers: yhchiang, rven, igor
      
      Reviewed By: igor
      
      Subscribers: dhruba, leveldb
      
      Differential Revision: https://reviews.facebook.net/D30093
      d7a48666
  3. 09 12月, 2014 1 次提交
  4. 06 12月, 2014 1 次提交
  5. 04 12月, 2014 1 次提交
    • M
      Add Moved(GB) to Compaction IO stats · 32a0a038
      Mark Callaghan 提交于
      Summary:
      Adds counter for bytes moved (files pushed down a level rather than compacted) to compaction
      IO stats as Moved(GB). From the output removed these infrequently used columns: RW-Amp, Rn(cnt), Rnp1(cnt),
      Wnp1(cnt), Wnew(cnt).
      Example old output:
      Level   Files   Size(MB) Score Read(GB)  Rn(GB) Rnp1(GB) Write(GB) Wnew(GB) RW-Amp W-Amp Rd(MB/s) Wr(MB/s)  Rn(cnt) Rnp1(cnt) Wnp1(cnt) Wnew(cnt)  Comp(sec) Comp(cnt) Avg(sec) Stall(sec) Stall(cnt) Avg(ms) RecordIn RecordDrop
      ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        L0     0/0          0   0.0      0.0     0.0      0.0    2130.8   2130.8    0.0   0.0      0.0    109.1        0         0         0         0      20002     25068    0.798      28.75     182059    0.16       0          0
        L1   142/0        509   1.0   4618.5  2036.5   2582.0    4602.1   2020.2    4.5   2.3     88.5     88.1    24220    701246   1215528    514282      53466      4229   12.643       0.00          0    0.002032745988  300688729
      
      Example new output:
      Level   Files   Size(MB) Score Read(GB)  Rn(GB) Rnp1(GB) Write(GB) Wnew(GB) Moved(GB) W-Amp Rd(MB/s) Wr(MB/s) Comp(sec) Comp(cnt) Avg(sec) Stall(sec) Stall(cnt) Avg(ms)     RecordIn   RecordDrop
      --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        L0     7/0         13   1.8      0.0     0.0      0.0       0.6      0.6       0.0   0.0      0.0     14.7        44       353    0.124       0.03        626    0.05            0            0
        L1     9/0         16   1.6      0.0     0.0      0.0       0.0      0.0       0.6   0.0      0.0      0.0         0         0    0.000       0.00          0    0.00            0            0
      
      Task ID: #
      
      Blame Rev:
      
      Test Plan:
      make check, run db_bench --fillseq --stats_per_interval --stats_interval and look at output
      
      Revert Plan:
      
      Database Impact:
      
      Memcache Impact:
      
      Other Notes:
      
      EImportant:
      
      - begin *PUBLIC* platform impact section -
      Bugzilla: #
      - end platform impact -
      
      Reviewers: igor
      
      Reviewed By: igor
      
      Subscribers: dhruba
      
      Differential Revision: https://reviews.facebook.net/D29787
      32a0a038
  6. 03 12月, 2014 1 次提交
    • J
      Enforce write buffer memory limit across column families · a14b7873
      Jonah Cohen 提交于
      Summary:
      Introduces a new class for managing write buffer memory across column
      families.  We supplement ColumnFamilyOptions::write_buffer_size with
      ColumnFamilyOptions::write_buffer, a shared pointer to a WriteBuffer
      instance that enforces memory limits before flushing out to disk.
      
      Test Plan: Added SharedWriteBuffer unit test to db_test.cc
      
      Reviewers: sdong, rven, ljin, igor
      
      Reviewed By: igor
      
      Subscribers: tnovak, yhchiang, dhruba, xjin, MarkCallaghan, yoshinorim
      
      Differential Revision: https://reviews.facebook.net/D22581
      a14b7873
  7. 25 11月, 2014 1 次提交
  8. 22 11月, 2014 1 次提交
    • Y
      Fix leak when create_missing_column_families=true on ThreadStatus · 569853ed
      Yueh-Hsuan Chiang 提交于
      Summary:
      An entry of ConstantColumnFamilyInfo is created when:
      1. DB::Open
      2. CreateColumnFamily.
      
      However, there are cases that DB::Open could also call CreateColumnFamily
      when create_missing_column_families=true.  As a result, it will create
      duplicate ConstantColumnFamilyInfo and one of them would be leaked.
      
      Test Plan: ./deletefile_test
      
      Reviewers: igor, sdong, ljin
      
      Reviewed By: ljin
      
      Subscribers: dhruba, leveldb
      
      Differential Revision: https://reviews.facebook.net/D29307
      569853ed
  9. 21 11月, 2014 2 次提交
    • Y
      Add enable_thread_tracking to DBOptions · 4b63fcbf
      Yueh-Hsuan Chiang 提交于
      Summary:
      Add enable_thread_tracking to DBOptions to allow
      tracking thread status related to the DB.  Default is off.
      
      Test Plan:
      export ROCKSDB_TESTS=ThreadList
      ./db_test
      
      Reviewers: ljin, sdong, igor
      
      Reviewed By: igor
      
      Subscribers: dhruba, leveldb
      
      Differential Revision: https://reviews.facebook.net/D29289
      4b63fcbf
    • Y
      Introduce GetThreadList API · d0c5f28a
      Yueh-Hsuan Chiang 提交于
      Summary:
      Add GetThreadList API, which allows developer to track the
      status of each process.  Currently, calling GetThreadList will
      only get the list of background threads in RocksDB with their
      thread-id and thread-type (priority) set.  Will add more support
      on this in the later diffs.
      
      ThreadStatus currently has the following properties:
      
        // An unique ID for the thread.
        const uint64_t thread_id;
      
        // The type of the thread, it could be ROCKSDB_HIGH_PRIORITY,
        // ROCKSDB_LOW_PRIORITY, and USER_THREAD
        const ThreadType thread_type;
      
        // The name of the DB instance where the thread is currently
        // involved with.  It would be set to empty string if the thread
        // does not involve in any DB operation.
        const std::string db_name;
      
        // The name of the column family where the thread is currently
        // It would be set to empty string if the thread does not involve
        // in any column family.
        const std::string cf_name;
      
        // The event that the current thread is involved.
        // It would be set to empty string if the information about event
        // is not currently available.
      
      Test Plan:
      ./thread_list_test
      export ROCKSDB_TESTS=GetThreadList
      ./db_test
      
      Reviewers: rven, igor, sdong, ljin
      
      Reviewed By: ljin
      
      Subscribers: dhruba, leveldb
      
      Differential Revision: https://reviews.facebook.net/D25047
      d0c5f28a
  10. 19 11月, 2014 1 次提交
  11. 15 11月, 2014 2 次提交
    • I
      Clean job context in DeleteFile · 84af2ff8
      Igor Canadi 提交于
      84af2ff8
    • I
      Explicitly clean JobContext · 5c04acda
      Igor Canadi 提交于
      Summary: This way we can gurantee that old MemTables get destructed before DBImpl gets destructed, which might be useful if we want to make them depend on state from DBImpl.
      
      Test Plan: make check with asserts in JobContext's destructor
      
      Reviewers: ljin, sdong, yhchiang, rven, jonahcohen
      
      Reviewed By: jonahcohen
      
      Subscribers: dhruba, leveldb
      
      Differential Revision: https://reviews.facebook.net/D28959
      5c04acda
  12. 14 11月, 2014 4 次提交
    • Y
      Fix SIGSEGV · 4161de92
      Yueh-Hsuan Chiang 提交于
      Summary: As a short-term fix, let's go back to previous way of calculating NeedsCompaction(). SIGSEGV happens because NeedsCompaction() can happen before super_version (and thus MutableCFOptions) is initialized.
      
      Test Plan: make check
      
      Reviewers: ljin, sdong, rven, yhchiang
      
      Reviewed By: yhchiang
      
      Subscribers: dhruba, leveldb
      
      Differential Revision: https://reviews.facebook.net/D28875
      4161de92
    • I
      No CompactFiles in ROCKSDB_LITE · 772bc97f
      Igor Canadi 提交于
      Summary: It adds lots of code.
      
      Test Plan: compile for iOS, compile for mac. works.
      
      Reviewers: rven, sdong, ljin, yhchiang
      
      Reviewed By: yhchiang
      
      Subscribers: dhruba, leveldb
      
      Differential Revision: https://reviews.facebook.net/D28857
      772bc97f
    • Y
      Move NeedsCompaction() from VersionStorageInfo to CompactionPicker · 1d1a64f5
      Yueh-Hsuan Chiang 提交于
      Summary:
      Move NeedsCompaction() from VersionStorageInfo to CompactionPicker
      to allow different compaction strategy to have their own way to
      determine whether doing compaction is necessary.
      
      When compaction style is set to kCompactionStyleNone, then
      NeedsCompaction() will always return false.
      
      Test Plan:
      export ROCKSDB_TESTS=Compact
      ./db_test
      
      Reviewers: ljin, sdong, igor
      
      Reviewed By: igor
      
      Subscribers: dhruba, leveldb
      
      Differential Revision: https://reviews.facebook.net/D28719
      1d1a64f5
    • I
      Fix iOS compile with -Wshorten-64-to-32 · 25f27302
      Igor Canadi 提交于
      Summary: So iOS size_t is 32-bit, so we need to static_cast<size_t> any uint64_t :(
      
      Test Plan: TARGET_OS=IOS make static_lib
      
      Reviewers: dhruba, ljin, yhchiang, rven, sdong
      
      Reviewed By: sdong
      
      Subscribers: dhruba, leveldb
      
      Differential Revision: https://reviews.facebook.net/D28743
      25f27302
  13. 12 11月, 2014 1 次提交
    • I
      Turn on -Wshorten-64-to-32 and fix all the errors · 767777c2
      Igor Canadi 提交于
      Summary:
      We need to turn on -Wshorten-64-to-32 for mobile. See D1671432 (internal phabricator) for details.
      
      This diff turns on the warning flag and fixes all the errors. There were also some interesting errors that I might call bugs, especially in plain table. Going forward, I think it makes sense to have this flag turned on and be very very careful when converting 64-bit to 32-bit variables.
      
      Test Plan: compiles
      
      Reviewers: ljin, rven, yhchiang, sdong
      
      Reviewed By: yhchiang
      
      Subscribers: bobbaldwin, dhruba, leveldb
      
      Differential Revision: https://reviews.facebook.net/D28689
      767777c2
  14. 11 11月, 2014 2 次提交
  15. 08 11月, 2014 4 次提交
    • I
      Get rid of mutex in CompactionJob's state · e3d3567b
      Igor Canadi 提交于
      Summary: Based on @sdong's feedback in the diff, we shouldn't keep db_mutex in CompactionJob's state. This diff removes db_mutex from CompactionJob state, by making next_file_number_ atomic. That way we only need to pass the lock to InstallCompactionResults() because of LogAndApply()
      
      Test Plan: make check
      
      Reviewers: ljin, yhchiang, rven, sdong
      
      Reviewed By: sdong
      
      Subscribers: sdong, dhruba, leveldb
      
      Differential Revision: https://reviews.facebook.net/D28491
      e3d3567b
    • Y
      Fixed compile error in db/db_impl.cc · b8b39034
      Yueh-Hsuan Chiang 提交于
      Summary:
      Fixed compile error in db/db_impl.cc
      
      Test Plan:
      make
      b8b39034
    • Y
      CompactFiles, EventListener and GetDatabaseMetaData · 28c82ff1
      Yueh-Hsuan Chiang 提交于
      Summary:
      This diff adds three sets of APIs to RocksDB.
      
      = GetColumnFamilyMetaData =
      * This APIs allow users to obtain the current state of a RocksDB instance on one column family.
      * See GetColumnFamilyMetaData in include/rocksdb/db.h
      
      = EventListener =
      * A virtual class that allows users to implement a set of
        call-back functions which will be called when specific
        events of a RocksDB instance happens.
      * To register EventListener, simply insert an EventListener to ColumnFamilyOptions::listeners
      
      = CompactFiles =
      * CompactFiles API inputs a set of file numbers and an output level, and RocksDB
        will try to compact those files into the specified level.
      
      = Example =
      * Example code can be found in example/compact_files_example.cc, which implements
        a simple external compactor using EventListener, GetColumnFamilyMetaData, and
        CompactFiles API.
      
      Test Plan:
      listener_test
      compactor_test
      example/compact_files_example
      export ROCKSDB_TESTS=CompactFiles
      db_test
      export ROCKSDB_TESTS=MetaData
      db_test
      
      Reviewers: ljin, igor, rven, sdong
      
      Reviewed By: sdong
      
      Subscribers: MarkCallaghan, dhruba, leveldb
      
      Differential Revision: https://reviews.facebook.net/D24705
      28c82ff1
    • I
      Redesign pending_outputs_ · 53af5d87
      Igor Canadi 提交于
      Summary:
      Here's a prototype of redesigning pending_outputs_. This way, we don't have to expose pending_outputs_ to other classes (CompactionJob, FlushJob, MemtableList). DBImpl takes care of it.
      
      Still have to write some comments, but should be good enough to start the discussion.
      
      Test Plan: make check, will also run stress test
      
      Reviewers: ljin, sdong, rven, yhchiang
      
      Reviewed By: yhchiang
      
      Subscribers: dhruba, leveldb
      
      Differential Revision: https://reviews.facebook.net/D28353
      53af5d87
  16. 05 11月, 2014 4 次提交
  17. 04 11月, 2014 1 次提交
    • S
      DB::Open() to automatically increase thread pool size if it is smaller than... · 09899f0b
      sdong 提交于
      DB::Open() to automatically increase thread pool size if it is smaller than max number of parallel compactions or flushes
      
      Summary:
      With the patch, thread pool size will be automatically increased if DB's options ask for more parallelism of compactions or flushes.
      
      Too many users have been confused by the API. Change it to make it harder for users to make mistakes
      
      Test Plan: Add two unit tests to cover the function.
      
      Reviewers: yhchiang, rven, igor, MarkCallaghan, ljin
      
      Reviewed By: ljin
      
      Subscribers: dhruba, leveldb
      
      Differential Revision: https://reviews.facebook.net/D27555
      09899f0b
  18. 01 11月, 2014 3 次提交
    • I
      CompactionJob · 74eb4fbe
      Igor Canadi 提交于
      Summary:
      Long awaited CompactionJob class! Move most compaction-related things from DBImpl to CompactionJob, making CompactionJob easier to test and understand.
      
      Currently this is just replicating exactly the same functionality with as little as change as possible. As future work, we should:
      1. Add CompactionJob tests (I think I'll do that tomorrow)
      2. Reduce CompactionJob's state that it inherits from DBImpl
      3. Figure out how to do yielding to flush better. Currently I implemented a callback as we agreed yesterday, but I don't think it's a good long term solution.
      
      This reduces db_impl.cc from 5000+ LOC to 3400!
      
      Test Plan: make check, will add CompactionJob-specific tests, probably also move some tests from db_test to compaction_job_test
      
      Reviewers: rven, yhchiang, sdong, ljin
      
      Reviewed By: ljin
      
      Subscribers: dhruba, leveldb
      
      Differential Revision: https://reviews.facebook.net/D27957
      74eb4fbe
    • I
      Turn on -Wshadow · 9f7fc3ac
      Igor Canadi 提交于
      Summary:
      ...and fix all the errors :)
      
      Jim suggested turning on -Wshadow because it helped him fix number of critical bugs in fbcode. I think it's a good idea to be -Wshadow clean.
      
      Test Plan: compiles
      
      Reviewers: yhchiang, rven, sdong, ljin
      
      Reviewed By: ljin
      
      Subscribers: dhruba, leveldb
      
      Differential Revision: https://reviews.facebook.net/D27711
      9f7fc3ac
    • S
      Make VersionBuilder unit testable · 4d2ba38b
      sdong 提交于
      Summary:
      Rename Version::Builder to VersionBuilder and expose its definition to a header.
      Make VerisonBuilder not reference Version or ColumnFamilyData, only working with VersionStorageInfo.
      Add version_builder_test which has a simple test.
      
      Test Plan: make all check
      
      Reviewers: rven, yhchiang, igor, ljin
      
      Reviewed By: igor
      
      Subscribers: leveldb, dhruba
      
      Differential Revision: https://reviews.facebook.net/D27969
      4d2ba38b
  19. 30 10月, 2014 2 次提交
    • I
      WalManager · 63590548
      Igor Canadi 提交于
      Summary: Decoupling code that deals with archived log files outside of DBImpl. That will make this code easier to reason about and test. It will also make the code easier to improve, because an improver doesn't have to understand DBImpl code in entirety.
      
      Test Plan: added test
      
      Reviewers: ljin, yhchiang, rven, sdong
      
      Reviewed By: sdong
      
      Subscribers: dhruba, leveldb
      
      Differential Revision: https://reviews.facebook.net/D27873
      63590548
    • S
      Make CompactionPicker more easily tested · 76d1c28e
      sdong 提交于
      Summary:
      Make compaction picker easier to test.
      The basic idea is to separate a minimum subcomponent of Version to VersionStorageInfo, which just responsible to LSM tree. A stub VersionStorageInfo can then be easily created and passed into compaction picker so that we can check the outputs.
      
      It now passes most tests. Still two things need to be done:
      (1) deal with the FIFO compaction's file size.
      (2) write an example test to make sure the interface can do the job.
      
      Add a compaction_picker_test to make sure compaction picker codes can be easily unit tested.
      
      Test Plan:
      Pass all unit tests and compaction_picker_test
      
      Reviewers: yhchiang, rven, igor, ljin
      
      Reviewed By: ljin
      
      Subscribers: leveldb, dhruba
      
      Differential Revision: https://reviews.facebook.net/D27639
      76d1c28e
  20. 29 10月, 2014 2 次提交
    • Y
      Fix the bug where compaction does not fail when RocksDB can't create a new file. · 3772a3d0
      Yueh-Hsuan Chiang 提交于
      Summary:
      This diff has two fixes.
      
      1. Fix the bug where compaction does not fail when RocksDB can't create a new file.
      2. When NewWritableFiles() fails in OpenCompactionOutputFiles(), previously such fail-to-created file will be still be included as a compaction output.  This patch also fixes this bug.
      3. Allow VersionEdit::EncodeTo() to return Status and add basic check.
      
      Test Plan:
      ./version_edit_test
      export ROCKSDB_TESTS=FileCreationRandomFailure
      ./db_test
      
      Reviewers: ljin, sdong, nkg-, igor
      
      Reviewed By: igor
      
      Subscribers: dhruba, leveldb
      
      Differential Revision: https://reviews.facebook.net/D25581
      3772a3d0
    • I
      FlushProcess · a39e931e
      Igor Canadi 提交于
      Summary:
      Abstract out FlushProcess and take it out of DBImpl.
      This also includes taking DeletionState outside of DBImpl.
      
      Currently this diff is only doing the refactoring. Future work includes:
      1. Decoupling flush_process.cc, make it depend on less state
      2. Write flush_process_test, which will mock out everything that FlushProcess depends on and test it in isolation
      
      Test Plan: make check
      
      Reviewers: rven, yhchiang, sdong, ljin
      
      Reviewed By: ljin
      
      Subscribers: dhruba, leveldb
      
      Differential Revision: https://reviews.facebook.net/D27561
      a39e931e
  21. 28 10月, 2014 2 次提交
    • I
      Deprecate AtomicPointer · 48842ab3
      Igor Canadi 提交于
      Summary: RocksDB already depends on C++11, so we might as well all the goodness that C++11 provides. This means that we don't need AtomicPointer anymore. The less things in port/, the easier it will be to port to other platforms.
      
      Test Plan: make check + careful visual review verifying that NoBarried got memory_order_relaxed, while Acquire/Release methods got memory_order_acquire and memory_order_release
      
      Reviewers: rven, yhchiang, ljin, sdong
      
      Reviewed By: ljin
      
      Subscribers: leveldb
      
      Differential Revision: https://reviews.facebook.net/D27543
      48842ab3
    • L
      dynamic inplace_update options · f1841985
      Lei Jin 提交于
      Summary:
      Make inplace_update_support and inplace_update_num_locks dynamic.
      inplace_callback becomes immutable
      We are almost free of references to cfd->options() in db_impl
      
      Test Plan: unit test
      
      Reviewers: igor, yhchiang, rven, sdong
      
      Reviewed By: sdong
      
      Subscribers: leveldb
      
      Differential Revision: https://reviews.facebook.net/D25293
      f1841985
  22. 24 10月, 2014 2 次提交