1. 16 12月, 2017 4 次提交
    • A
      Add a histogram stat for memtable flush · fccc12f3
      Anand Ananthabhotla 提交于
      Summary:
      Add a new histogram stat called rocksdb.db.flush.micros for memtable
      flush
      Closes https://github.com/facebook/rocksdb/pull/3269
      
      Differential Revision: D6559496
      
      Pulled By: anand1976
      
      fbshipit-source-id: f5c771ba2568630458751795e8c37a493ff9b14d
      fccc12f3
    • M
      db_stress: skip snapshot check if cf is dropped · 95583e15
      Maysam Yabandeh 提交于
      Summary:
      We added a new verification that ensures a value that snapshot reads when is released is the same as when it was created. This test however fails when the cf is dropped in between. The patch skips the tests if that was the case.
      Closes https://github.com/facebook/rocksdb/pull/3279
      
      Differential Revision: D6581584
      
      Pulled By: maysamyabandeh
      
      fbshipit-source-id: afe37d371c0f91818d2e279b3949b810e112e8eb
      95583e15
    • Y
      BlobDB: Remove the need to get sequence number per write · 237b2925
      Yi Wu 提交于
      Summary:
      Previously we store sequence number range of each blob files, and use the sequence number range to check if the file can be possibly visible by a snapshot. But it adds complexity to the code, since the sequence number is only available after a write. (The current implementation get sequence number by calling GetLatestSequenceNumber(), which is wrong.) With the patch, we are not storing sequence number range, and check if snapshot_sequence < obsolete_sequence to decide if the file is visible by a snapshot (previously we check if first_sequence <= snapshot_sequence < obsolete_sequence).
      Closes https://github.com/facebook/rocksdb/pull/3274
      
      Differential Revision: D6571497
      
      Pulled By: yiwu-arbug
      
      fbshipit-source-id: ca06479dc1fcd8782f6525b62b7762cd47d61909
      237b2925
    • A
      fix backup meta-file buffer overrun · a79c7c05
      Andrew Kryczka 提交于
      Summary:
      - check most times after calling snprintf that the buffer didn't fill up. Previously we'd proceed and use `buf_size - len` as the length in subsequent calls, which underflowed as those are unsigned size_t.
      - replace some memcpys with snprintf for consistency
      Closes https://github.com/facebook/rocksdb/pull/3255
      
      Differential Revision: D6541464
      
      Pulled By: ajkr
      
      fbshipit-source-id: 8610ea6a24f38e0a37c6d17bc65b7c712da6d932
      a79c7c05
  2. 15 12月, 2017 4 次提交
  3. 14 12月, 2017 1 次提交
    • M
      WritePrepared Txn: make db_stress transactional · cd2e5cae
      Maysam Yabandeh 提交于
      Summary:
      Add "--use_txn" option to use transactional API in db_stress, default being WRITE_PREPARED policy, which is the main intention of modifying db_stress. It also extend the existing snapshots to verify that before releasing a snapshot a read from it returns the same value as before.
      Closes https://github.com/facebook/rocksdb/pull/3243
      
      Differential Revision: D6556912
      
      Pulled By: maysamyabandeh
      
      fbshipit-source-id: 1ae31465be362d44bd06e635e2e9e49a1da11268
      cd2e5cae
  4. 13 12月, 2017 7 次提交
    • M
      disableWAL with WriteImplWALOnly · 546a6327
      Maysam Yabandeh 提交于
      Summary:
      Currently WriteImplWALOnly simply returns when disableWAL is set. This is an incorrect behavior since it does not allocated the sequence number, which is a side-effect of writing to the WAL. This patch fixes the issue.
      Closes https://github.com/facebook/rocksdb/pull/3262
      
      Differential Revision: D6550974
      
      Pulled By: maysamyabandeh
      
      fbshipit-source-id: 745a83ae8f04e7ca6c8ffb247d6ef16c287c52e7
      546a6327
    • M
      WritePrepared Txn: GC old_commit_map_ · 35dfbd58
      Maysam Yabandeh 提交于
      Summary:
      Garbage collect entries from old_commit_map_ when the corresponding snapshots are released.
      Closes https://github.com/facebook/rocksdb/pull/3247
      
      Differential Revision: D6528478
      
      Pulled By: maysamyabandeh
      
      fbshipit-source-id: 15d1566d85d4ac07036bc0dc47418f6c3228d4bf
      35dfbd58
    • Z
      Reduce heavy hitter for Get operation · 51c2ea0f
      Zhongyi Xie 提交于
      Summary:
      This PR addresses the following heavy hitters in `Get` operation by moving calls to `StatisticsImpl::recordTick` from `BlockBasedTable` to `Version::Get`
      
      - rocksdb.block.cache.bytes.write
      - rocksdb.block.cache.add
      - rocksdb.block.cache.data.miss
      - rocksdb.block.cache.data.bytes.insert
      - rocksdb.block.cache.data.add
      - rocksdb.block.cache.hit
      - rocksdb.block.cache.data.hit
      - rocksdb.block.cache.bytes.read
      
      The db_bench statistics before and after the change are:
      
      |1GB block read|Children      |Self  |Command          |Shared Object        |Symbol|
      |---|---|---|---|---|---|
      |master:     |4.22%     |1.31%  |db_bench  |db_bench  |[.] rocksdb::StatisticsImpl::recordTick|
      |updated:    |0.51%     |0.21%  |db_bench  |db_bench  |[.] rocksdb::StatisticsImpl::recordTick|
      |     	     |0.14%     |0.14%  |db_bench  |db_bench  |[.] rocksdb::GetContext::record_counters|
      
      |1MB block read|Children      |Self  |Command          |Shared Object        |Symbol|
      |---|---|---|---|---|---|
      |master:    |3.48%     |1.08%  |db_bench  |db_bench  |[.] rocksdb::StatisticsImpl::recordTick|
      |updated:    |0.80%     |0.31%  |db_bench  |db_bench  |[.] rocksdb::StatisticsImpl::recordTick|
      |    	     |0.35%     |0.35%  |db_bench  |db_bench  |[.] rocksdb::GetContext::record_counters|
      Closes https://github.com/facebook/rocksdb/pull/3172
      
      Differential Revision: D6330532
      
      Pulled By: miasantreble
      
      fbshipit-source-id: 2b492959e00a3db29e9437ecdcc5e48ca4ec5741
      51c2ea0f
    • I
      Fix DeleteScheduler::MarkAsTrash() handling existing trash · 9089373a
      Islam AbdelRahman 提交于
      Summary:
      DeleteScheduler::MarkAsTrash() don't handle existing .trash files correctly
      This cause rocksdb to not being able to delete existing .trash files on restart
      Closes https://github.com/facebook/rocksdb/pull/3261
      
      Differential Revision: D6548003
      
      Pulled By: IslamAbdelRahman
      
      fbshipit-source-id: c3800639412e587a690062c63076a5a08881e0e6
      9089373a
    • Y
      Fix BlockFetcher ASAN error · 7393ef77
      Yi Wu 提交于
      Summary:
      Some call sites of BlockFetcher create temporary ReadOptions and pass to BlockFetcher. The temporary object will be gone after BlockFetcher construction but BlockFetcher keep its reference, causing stack-use-after-scope. Fixing it.
      Closes https://github.com/facebook/rocksdb/pull/3258
      
      Differential Revision: D6547152
      
      Pulled By: yiwu-arbug
      
      fbshipit-source-id: 6b49e9dd46bb72307f5d8f88ea15faacff35b9bc
      7393ef77
    • S
      Update transaction_test_util.cc · 4bcb7fb1
      Souvik Banerjee 提交于
      Summary:
      Fixes a compile error on gcc 7.2.1 (-Werror=format-truncation=).
      Closes https://github.com/facebook/rocksdb/pull/3248
      
      Differential Revision: D6546515
      
      Pulled By: yiwu-arbug
      
      fbshipit-source-id: bd78cca63f2af376faceccb1838d2d4cc9208fef
      4bcb7fb1
    • Y
      WritePrepared Txn: fix compaction filter snapshot checks · e3a06f12
      Yi Wu 提交于
      Summary:
      Add snapshot_checker check whenever we need to check sequence against snapshots and decide what to do with an input key. The changes are related to one of:
      * compaction filter
      * single delete
      * delete at bottom level
      * merge
      Closes https://github.com/facebook/rocksdb/pull/3251
      
      Differential Revision: D6537850
      
      Pulled By: yiwu-arbug
      
      fbshipit-source-id: 3faba40ed5e37779f4a0cb7ae78af9546659c7f2
      e3a06f12
  5. 12 12月, 2017 8 次提交
    • S
      Fix memory issue introduced by 2f1a3a4d · a9c8d4ef
      Siying Dong 提交于
      Summary: Closes https://github.com/facebook/rocksdb/pull/3256
      
      Differential Revision: D6541714
      
      Pulled By: siying
      
      fbshipit-source-id: 40efd89b68587a9d58cfe6f4eebd771c2d9f1542
      a9c8d4ef
    • Z
      exclude DynamicUniversalCompactionOptions from ROCKSDB_LITE · bb5ed4b1
      Zhongyi Xie 提交于
      Summary:
      since [SetOptions](https://github.com/facebook/rocksdb/blob/master/db/db_impl.cc#L494) is not supported in ROCKSDB_LITE
      Right now unit test under lite is broken
      Closes https://github.com/facebook/rocksdb/pull/3253
      
      Differential Revision: D6539428
      
      Pulled By: miasantreble
      
      fbshipit-source-id: 13172b8ecbd75682330726498ea198969bc3e637
      bb5ed4b1
    • S
      Switch version to 5.10 · 0d5692e0
      Siying Dong 提交于
      Summary: Closes https://github.com/facebook/rocksdb/pull/3252
      
      Differential Revision: D6539373
      
      Pulled By: siying
      
      fbshipit-source-id: ce7c3d3fe625852179055295da9cf7bc80755025
      0d5692e0
    • S
      Refactor ReadBlockContents() · 2f1a3a4d
      Siying Dong 提交于
      Summary:
      Divide ReadBlockContents() to multiple sub-functions. Maintaining the input and intermediate data in a new class BlockFetcher.
      I hope in general it makes the code easier to maintain.
      Another motivation to do it is to clearly divide the logic before file reading and after file reading. The refactor will help us evaluate how can we make I/O async in the future.
      Closes https://github.com/facebook/rocksdb/pull/3244
      
      Differential Revision: D6520983
      
      Pulled By: siying
      
      fbshipit-source-id: 338d90bc0338472d46be7a7682028dc9114b12e9
      2f1a3a4d
    • Y
      Fix drop column family data race · 9a27ac5d
      Yi Wu 提交于
      Summary:
      A data race is caught by tsan_crash test between compaction and DropColumnFamily:
      https://gist.github.com/yiwu-arbug/5a2b4baae05eeb99ae1719b650f30a44 Compaction checks if the column family has been dropped on each key input, while user can issue DropColumnFamily which updates cfd->dropped_, causing the data race. Fixing it by making cfd->dropped_ an atomic.
      Closes https://github.com/facebook/rocksdb/pull/3250
      
      Differential Revision: D6535991
      
      Pulled By: yiwu-arbug
      
      fbshipit-source-id: 5571df020beae7fa7db6fff5ad0d598f49962895
      9a27ac5d
    • Z
      Make Universal compaction options dynamic · fcc8a657
      Zhongyi Xie 提交于
      Summary:
      Let me know if more test coverage is needed
      Closes https://github.com/facebook/rocksdb/pull/3213
      
      Differential Revision: D6457165
      
      Pulled By: miasantreble
      
      fbshipit-source-id: 3f944abff28aa7775237f1c4f61c64ccbad4eea9
      fcc8a657
    • Y
      BlobDB: refactor DB open logic · 250a51a3
      Yi Wu 提交于
      Summary:
      Refactor BlobDB open logic. List of changes:
      
      Major:
      * On reopen, mark blob files found as immutable, do not use them for writing new keys.
      * Not to scan the whole file to find file footer. Instead just seek to the end of the file and try to read footer.
      
      Minor:
      * Move most of the real logic from blob_db.cc to blob_db_impl.cc.
      * Not to hold shared_ptr of event listeners in global maps in blob_db.cc
      * Some changes to BlobFile interface.
      * Improve logging and error handling.
      Closes https://github.com/facebook/rocksdb/pull/3246
      
      Differential Revision: D6526147
      
      Pulled By: yiwu-arbug
      
      fbshipit-source-id: 9dc4cdd63359a2f9b696af817086949da8d06952
      250a51a3
    • P
      Fix coverity issues compaction_job, compaction_picker · 6a183d1a
      Prashant D 提交于
      Summary:
      db/compaction_job.cc:
        ReportStartedCompaction(compaction);
      
      CID 1419863 (#1 of 1): Uninitialized scalar field (UNINIT_CTOR)
      2. uninit_member: Non-static class member bottommost_level_ is not initialized in this constructor nor in any functions that it calls.
      
      db/compaction_picker_universal.cc:
      7struct InputFileInfo {
         	2. uninit_member: Non-static class member level is not initialized in this constructor nor in any functions that it calls.
      
      CID 1405355 (#1 of 1): Uninitialized scalar field (UNINIT_CTOR)
      4. uninit_member: Non-static class member index is not initialized in this constructor nor in any functions that it calls.
       38  InputFileInfo() : f(nullptr) {}
      
      db/dbformat.h:
       ParsedInternalKey()
       84      : sequence(kMaxSequenceNumber)  // Make code analyzer happy
      
      CID 1168095 (#1 of 1): Uninitialized scalar field (UNINIT_CTOR)
      2. uninit_member: Non-static class member type is not initialized in this constructor nor in any functions that it calls.
       85  {}  // Intentionally left uninitialized (for speed)
      Closes https://github.com/facebook/rocksdb/pull/3091
      
      Differential Revision: D6534558
      
      Pulled By: yiwu-arbug
      
      fbshipit-source-id: 5ada975956196d267b3f149386842af71eda7553
      6a183d1a
  6. 08 12月, 2017 5 次提交
    • A
      revert fbcode build behavior · e3814a86
      Andrew Kryczka 提交于
      Summary: Closes https://github.com/facebook/rocksdb/pull/3242
      
      Differential Revision: D6514255
      
      Pulled By: ajkr
      
      fbshipit-source-id: c39fa8e745866b052649d02bf339e794d77e96a3
      e3814a86
    • D
      Fix a race condition in WindowsThread (port::Thread) · fe608e32
      Dmitri Smirnov 提交于
      Summary:
      Fix a race condition when we create a thread and immediately destroy
       This case should be supported.
        What happens is that the thread function needs the Data instance
        to actually run but has no shared ownership and must rely on the
        WindowsThread instance to continue existing.
        To address this we change unique_ptr to shared_ptr and then
        acquire an additional refcount for the threadproc which destroys it
        just before the thread exit.
        We choose to allocate shared_ptr instance on the heap as this allows
        the original thread to continue w/o waiting for the new thread to start
        running.
      Closes https://github.com/facebook/rocksdb/pull/3240
      
      Differential Revision: D6511324
      
      Pulled By: yiwu-arbug
      
      fbshipit-source-id: 4633ff7996daf4d287a9fe34f60c1dd28cf4ff36
      fe608e32
    • P
      Fix coverity issues version, write_batch · 34aa245d
      Prashant D 提交于
      Summary:
      db/version_builder.cc:
      117        base_vstorage_->InternalComparator();
      
      CID 1351713 (#1 of 1): Uninitialized pointer field (UNINIT_CTOR)
      2. uninit_member: Non-static class member field level_zero_cmp_.internal_comparator is not initialized in this constructor nor in any functions that it calls.
      
      db/version_edit.h:
      145  FdWithKeyRange()
      146      : fd(),
      147        smallest_key(),
      148        largest_key() {
      
      CID 1418254 (#1 of 1): Uninitialized pointer field (UNINIT_CTOR)
      2. uninit_member: Non-static class member file_metadata is not initialized in this constructor nor in any functions that it calls.
      149  }
      
      db/version_set.cc:
      120    }
      
      CID 1322789 (#1 of 1): Uninitialized pointer field (UNINIT_CTOR)
      4. uninit_member: Non-static class member curr_file_level_ is not initialized in this constructor nor in any functions that it calls.
      121  }
      
      db/write_batch.cc:
       939    assert(cf_mems_);
      
      CID 1419862 (#1 of 1): Uninitialized scalar field (UNINIT_CTOR)
      3. uninit_member: Non-static class member rebuilding_trx_seq_ is not initialized in this constructor nor in any functions that it calls.
       940  }
      Closes https://github.com/facebook/rocksdb/pull/3092
      
      Differential Revision: D6505666
      
      Pulled By: yiwu-arbug
      
      fbshipit-source-id: fd2c68948a0280772691a419d72ac7e190951d86
      34aa245d
    • P
      table: Fix coverity issues · baff91c1
      Prashant D 提交于
      Summary:
      table/block.cc:
      420  }
      
      CID 1396127 (#1 of 1): Uninitialized scalar field (UNINIT_CTOR)
      7. uninit_member: Non-static class member restart_offset_ is not initialized in this constructor nor in any functions that it calls.
      421}
      
      table/block_based_table_builder.cc:
      
      CID 1418259 (#1 of 1): Uninitialized scalar field (UNINIT_CTOR)
      7. uninit_member: Non-static class member compressed_cache_key_prefix_size is not initialized in this constructor nor in any functions that it calls.
      
      table/block_based_table_reader.h:
         	3. uninit_member: Non-static class member index_type is not initialized in this constructor nor in any functions that it calls.
      
      CID 1396147 (#1 of 1): Uninitialized scalar field (UNINIT_CTOR)
      5. uninit_member: Non-static class member hash_index_allow_collision is not initialized in this constructor nor in any functions that it calls.
      413        global_seqno(kDisableGlobalSequenceNumber) {}
      414
      
      table/cuckoo_table_reader.cc:
       55  if (hash_funs == user_props.end()) {
       56    status_ = Status::Corruption("Number of hash functions not found");
         	5. uninit_member: Non-static class member is_last_level_ is not initialized in this constructor nor in any functions that it calls.
         	7. uninit_member: Non-static class member identity_as_first_hash_ is not initialized in this constructor nor in any functions that it calls.
         	9. uninit_member: Non-static class member use_module_hash_ is not initialized in this constructor nor in any functions that it calls.
         	11. uninit_member: Non-static class member num_hash_func_ is not initialized in this constructor nor in any functions that it calls.
         	13. uninit_member: Non-static class member key_length_ is not initialized in this constructor nor in any functions that it calls.
         	15. uninit_member: Non-static class member user_key_length_ is not initialized in this constructor nor in any functions that it calls.
         	17. uninit_member: Non-static class member value_length_ is not initialized in this constructor nor in any functions that it calls.
         	19. uninit_member: Non-static class member bucket_length_ is not initialized in this constructor nor in any functions that it calls.
         	21. uninit_member: Non-static class member cuckoo_block_size_ is not initialized in this constructor nor in any functions that it calls.
         	23. uninit_member: Non-static class member cuckoo_block_bytes_minus_one_ is not initialized in this constructor nor in any functions that it calls.
      
      CID 1322785 (#2 of 2): Uninitialized scalar field (UNINIT_CTOR)
      25. uninit_member: Non-static class member table_size_ is not initialized in this constructor nor in any functions that it calls.
       57    return;
      
      table/plain_table_index.h:
         	2. uninit_member: Non-static class member index_size_ is not initialized in this constructor nor in any functions that it calls.
      
      CID 1322801 (#1 of 1): Uninitialized scalar field (UNINIT_CTOR)
      4. uninit_member: Non-static class member sub_index_size_ is not initialized in this constructor nor in any functions that it calls.
      128        huge_page_tlb_size_(huge_page_tlb_size) {}
      129
      Closes https://github.com/facebook/rocksdb/pull/3113
      
      Differential Revision: D6505719
      
      Pulled By: yiwu-arbug
      
      fbshipit-source-id: 38f44d8f9dfefb4c2e25d83b8df25a5201c75618
      baff91c1
    • A
      fix ASAN for DeleteFilesInRange test case · 2e3a0098
      Andrew Kryczka 提交于
      Summary:
      error message was
      
      ```
      ==3095==ERROR: AddressSanitizer: stack-use-after-scope on address 0x7ffd18216c40 at pc 0x0000005edda1 bp 0x7ffd18215550 sp 0x7ffd18214d00
      ...
      Address 0x7ffd18216c40 is located in stack of thread T0 at offset 1952 in frame
           #0 internal_repo_rocksdb/db_compaction_test.cc:1520 rocksdb::DBCompactionTest_DeleteFileRangeFileEndpointsOverlapBug_Test::TestBody()
      ```
      
      It was unsafe to have slices referring to the temporary string objects' buffers, as those strings were destroyed before the slices were used. Fixed it by assigning the strings returned by `Key()` to local variables.
      Closes https://github.com/facebook/rocksdb/pull/3238
      
      Differential Revision: D6507864
      
      Pulled By: ajkr
      
      fbshipit-source-id: dd07de1a0070c6748c1ab4f3d7bd31f9a81889d0
      2e3a0098
  7. 07 12月, 2017 10 次提交
  8. 06 12月, 2017 1 次提交