1. 18 7月, 2019 5 次提交
    • A
      Fix LITE mode build failure · ec2b996b
      anand76 提交于
      Summary: Pull Request resolved: https://github.com/facebook/rocksdb/pull/5588
      
      Test Plan: make LITE=1 all check
      
      Differential Revision: D16354543
      
      Pulled By: anand1976
      
      fbshipit-source-id: 327a171439e183ac3a5e5057c511d6bca445e97d
      ec2b996b
    • E
      Fix for ReadaheadSequentialFile crash in ldb_cmd_test (#5586) · 9f5cfb8e
      Eli Pozniansky 提交于
      Summary:
      Fixing a corner case crash when there was no data read from file, but status is still OK
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/5586
      
      Differential Revision: D16348117
      
      Pulled By: elipoz
      
      fbshipit-source-id: f97973308024f020d8be79ca3c56466b84d80656
      9f5cfb8e
    • H
      Block access tracing: Trace referenced key for Get on non-data blocks. (#5548) · 8a008d41
      haoyuhuang 提交于
      Summary:
      This PR traces the referenced key for Get for all types of blocks. This is useful when evaluating hybrid row-block caches.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/5548
      
      Test Plan: make clean && USE_CLANG=1 make check -j32
      
      Differential Revision: D16157979
      
      Pulled By: HaoyuHuang
      
      fbshipit-source-id: f6327411c9deb74e35e22a35f66cdbae09ab9d87
      8a008d41
    • V
      Export Import sst files (#5495) · 22ce4624
      Venki Pallipadi 提交于
      Summary:
      Refresh of the earlier change here - https://github.com/facebook/rocksdb/issues/5135
      
      This is a review request for code change needed for - https://github.com/facebook/rocksdb/issues/3469
      "Add support for taking snapshot of a column family and creating column family from a given CF snapshot"
      
      We have an implementation for this that we have been testing internally. We have two new APIs that together provide this functionality.
      
      (1) ExportColumnFamily() - This API is modelled after CreateCheckpoint() as below.
      // Exports all live SST files of a specified Column Family onto export_dir,
      // returning SST files information in metadata.
      // - SST files will be created as hard links when the directory specified
      //   is in the same partition as the db directory, copied otherwise.
      // - export_dir should not already exist and will be created by this API.
      // - Always triggers a flush.
      virtual Status ExportColumnFamily(ColumnFamilyHandle* handle,
                                        const std::string& export_dir,
                                        ExportImportFilesMetaData** metadata);
      
      Internally, the API will DisableFileDeletions(), GetColumnFamilyMetaData(), Parse through
      metadata, creating links/copies of all the sst files, EnableFileDeletions() and complete the call by
      returning the list of file metadata.
      
      (2) CreateColumnFamilyWithImport() - This API is modeled after IngestExternalFile(), but invoked only during a CF creation as below.
      // CreateColumnFamilyWithImport() will create a new column family with
      // column_family_name and import external SST files specified in metadata into
      // this column family.
      // (1) External SST files can be created using SstFileWriter.
      // (2) External SST files can be exported from a particular column family in
      //     an existing DB.
      // Option in import_options specifies whether the external files are copied or
      // moved (default is copy). When option specifies copy, managing files at
      // external_file_path is caller's responsibility. When option specifies a
      // move, the call ensures that the specified files at external_file_path are
      // deleted on successful return and files are not modified on any error
      // return.
      // On error return, column family handle returned will be nullptr.
      // ColumnFamily will be present on successful return and will not be present
      // on error return. ColumnFamily may be present on any crash during this call.
      virtual Status CreateColumnFamilyWithImport(
          const ColumnFamilyOptions& options, const std::string& column_family_name,
          const ImportColumnFamilyOptions& import_options,
          const ExportImportFilesMetaData& metadata,
          ColumnFamilyHandle** handle);
      
      Internally, this API creates a new CF, parses all the sst files and adds it to the specified column family, at the same level and with same sequence number as in the metadata. Also performs safety checks with respect to overlaps between the sst files being imported.
      
      If incoming sequence number is higher than current local sequence number, local sequence
      number is updated to reflect this.
      
      Note, as the sst files is are being moved across Column Families, Column Family name in sst file
      will no longer match the actual column family on destination DB. The API does not modify Column
      Family name or id in the sst files being imported.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/5495
      
      Differential Revision: D16018881
      
      fbshipit-source-id: 9ae2251025d5916d35a9fc4ea4d6707f6be16ff9
      22ce4624
    • Y
      Arm64 CRC32 parallel computation optimization for RocksDB (#5494) · a3c1832e
      Yuqi Gu 提交于
      Summary:
      Crc32c Parallel computation optimization:
      Algorithm comes from Intel whitepaper: [crc-iscsi-polynomial-crc32-instruction-paper](https://www.intel.com/content/dam/www/public/us/en/documents/white-papers/crc-iscsi-polynomial-crc32-instruction-paper.pdf)
       Input data is divided into three equal-sized blocks
      Three parallel blocks (crc0, crc1, crc2) for 1024 Bytes
      One Block: 42(BLK_LENGTH) * 8(step length: crc32c_u64) bytes
      
      1. crc32c_test:
      ```
      [==========] Running 4 tests from 1 test case.
      [----------] Global test environment set-up.
      [----------] 4 tests from CRC
      [ RUN      ] CRC.StandardResults
      [       OK ] CRC.StandardResults (1 ms)
      [ RUN      ] CRC.Values
      [       OK ] CRC.Values (0 ms)
      [ RUN      ] CRC.Extend
      [       OK ] CRC.Extend (0 ms)
      [ RUN      ] CRC.Mask
      [       OK ] CRC.Mask (0 ms)
      [----------] 4 tests from CRC (1 ms total)
      
      [----------] Global test environment tear-down
      [==========] 4 tests from 1 test case ran. (1 ms total)
      [  PASSED  ] 4 tests.
      ```
      
      2. RocksDB benchmark: db_bench --benchmarks="crc32c"
      
      ```
      Linear Arm crc32c:
        crc32c: 1.005 micros/op 995133 ops/sec; 3887.2 MB/s (4096 per op)
      ```
      
      ```
      Parallel optimization with Armv8 crypto extension:
        crc32c: 0.419 micros/op 2385078 ops/sec; 9316.7 MB/s (4096 per op)
      ```
      
      It gets ~2.4x speedup compared to linear Arm crc32c instructions.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/5494
      
      Differential Revision: D16340806
      
      fbshipit-source-id: 95dae9a5b646fd20a8303671d82f17b2e162e945
      a3c1832e
  2. 17 7月, 2019 5 次提交
    • E
      Cleaned up and simplified LRU cache implementation (#5579) · 74fb7f0b
      Eli Pozniansky 提交于
      Summary:
      The 'refs' field in LRUHandle now counts only external references, since anyway we already have the IN_CACHE flag. This simplifies reference accounting logic a bit. Also cleaned up few asserts code as well as the comments - to be more readable.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/5579
      
      Differential Revision: D16286747
      
      Pulled By: elipoz
      
      fbshipit-source-id: 7186d88f80f512ce584d0a303437494b5cbefd7f
      74fb7f0b
    • E
      Added support for sequential read-ahead file (#5580) · 0f4d90e6
      Eli Pozniansky 提交于
      Summary:
      Added support for sequential read-ahead file that can prefetch the read data and later serve it from internal cache buffer.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/5580
      
      Differential Revision: D16287082
      
      Pulled By: elipoz
      
      fbshipit-source-id: a3e7ad9643d377d39352ff63058ce050ec31dcf3
      0f4d90e6
    • S
      Remove RandomAccessFileReader.for_compaction_ (#5572) · 699a569c
      sdong 提交于
      Summary:
      RandomAccessFileReader.for_compaction_ doesn't seem to be used anymore. Remove it.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/5572
      
      Test Plan: USE_CLANG=1 make all check -j
      
      Differential Revision: D16286178
      
      fbshipit-source-id: aa338049761033dfbe5e8b1707bbb0be2df5be7e
      699a569c
    • M
      WriteUnPrepared: use tracked_keys_ to track keys needed for rollback (#5562) · 0acaa1a8
      Manuel Ung 提交于
      Summary:
      Currently, we are tracking keys we need to rollback via a separate structure specific to WriteUnprepared in write_set_keys_.
      
      We already have a data structure called tracked_keys_ used to track which keys to unlock on transaction termination. This is exactly what we want, since we should only rollback keys that we have locked anyway.
      
      Save some memory by reusing that data structure instead of making our own.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/5562
      
      Differential Revision: D16206484
      
      Pulled By: lth
      
      fbshipit-source-id: 5894d2b824a4b19062d84adbd6e6e86f00047488
      0acaa1a8
    • L
      Move the filter readers out of the block cache (#5504) · 3bde41b5
      Levi Tamasi 提交于
      Summary:
      Currently, when the block cache is used for the filter block, it is not
      really the block itself that is stored in the cache but a FilterBlockReader
      object. Since this object is not pure data (it has, for instance, pointers that
      might dangle, including in one case a back pointer to the TableReader), it's not
      really sharable. To avoid the issues around this, the current code erases the
      cache entries when the TableReader is closed (which, BTW, is not sufficient
      since a concurrent TableReader might have picked up the object in the meantime).
      Instead of doing this, the patch moves the FilterBlockReader out of the cache
      altogether, and decouples the filter reader object from the filter block.
      In particular, instead of the TableReader owning, or caching/pinning the
      FilterBlockReader (based on the customer's settings), with the change the
      TableReader unconditionally owns the FilterBlockReader, which in turn
      owns/caches/pins the filter block. This change also enables us to reuse the code
      paths historically used for data blocks for filters as well.
      
      Note:
      Eviction statistics for filter blocks are temporarily broken. We plan to fix this in a
      separate phase.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/5504
      
      Test Plan: make asan_check
      
      Differential Revision: D16036974
      
      Pulled By: ltamasi
      
      fbshipit-source-id: 770f543c5fb4ed126fd1e04bfd3809cf4ff9c091
      3bde41b5
  3. 16 7月, 2019 4 次提交
    • J
      Fix memorty leak in `rocksdb_wal_iter_get_batch` function (#5515) · cd252036
      Jim Lin 提交于
      Summary:
      `wal_batch.writeBatchPtr.release()` gives up the ownership of the original `WriteBatch`, but there is no new owner, which causes memory leak.
      
      The patch is simple. Removing `release()` prevent ownership change. `std::move` is for speed.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/5515
      
      Differential Revision: D16264281
      
      Pulled By: riversand963
      
      fbshipit-source-id: 51c556b7a1c977325c3aa24acb636303847151fa
      cd252036
    • T
      Fix regression - 100% CPU - Regression for Windows 7 (#5557) · 6e8a1354
      Tomas Kolda 提交于
      Summary:
      Fixes https://github.com/facebook/rocksdb/issues/5552
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/5557
      
      Differential Revision: D16266329
      
      fbshipit-source-id: a8f6b50298a6f7c8d6c7e172bb26dd7eb6bd8a4d
      6e8a1354
    • Z
      add more tracing for stats history (#5566) · b0259e45
      Zhongyi Xie 提交于
      Summary:
      Sample info log output from db_bench:
      In-memory:
      ```
      2019/07/12-21:39:19.478490 7fa01b3f5700 [_impl/db_impl.cc:702] ------- PERSISTING STATS -------
      2019/07/12-21:39:19.478633 7fa01b3f5700 [_impl/db_impl.cc:753] Storing 145 stats with timestamp 1562992759 to in-memory stats history
      2019/07/12-21:39:19.478670 7fa01b3f5700 [_impl/db_impl.cc:766] [Pre-GC] In-memory stats history size: 1051218 bytes, slice count: 103
      2019/07/12-21:39:19.478704 7fa01b3f5700 [_impl/db_impl.cc:775] [Post-GC] In-memory stats history size: 1051218 bytes, slice count: 102
      ```
      On-disk:
      ```
      2019/07/12-21:48:53.862548 7f24943f5700 [_impl/db_impl.cc:702] ------- PERSISTING STATS -------
      2019/07/12-21:48:53.862553 7f24943f5700 [_impl/db_impl.cc:709] Reading 145 stats from statistics
      2019/07/12-21:48:53.862852 7f24943f5700 [_impl/db_impl.cc:737] Writing 145 stats with timestamp 1562993333 to persistent stats CF succeeded
      ```
      ```
      2019/07/12-21:48:51.861711 7f24943f5700 [_impl/db_impl.cc:702] ------- PERSISTING STATS -------
      2019/07/12-21:48:51.861729 7f24943f5700 [_impl/db_impl.cc:709] Reading 145 stats from statistics
      2019/07/12-21:48:51.861921 7f24943f5700 [_impl/db_impl.cc:732] Writing to persistent stats CF failed -- Result incomplete: Write stall
      ...
      2019/07/12-21:48:51.873032 7f2494bf6700 [WARN] [lumn_family.cc:749] [default] Stopping writes because we have 2 immutable memtables (waiting for flush), max_write_buffer_number is set to 2
      ```
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/5566
      
      Differential Revision: D16258187
      
      Pulled By: miasantreble
      
      fbshipit-source-id: 292497099b941418590ed4312411bee36e244dc5
      b0259e45
    • Y
      Cleanup the Arm64 CRC32 unused warning (#5565) · f064d74e
      Yikun Jiang 提交于
      Summary:
      When 'HAVE_ARM64_CRC' is set, the blew methods:
      
      - bool rocksdb::crc32c::isSSE42()
      - bool rocksdb::crc32c::isPCLMULQDQ()
      
      are defined but not used, the unused-function is raised
      when do rocksdb build.
      
      This patch try to cleanup these warnings by add ifndef,
      if it build under the HAVE_ARM64_CRC, we will not define
      `isSSE42` and `isPCLMULQDQ`.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/5565
      
      Differential Revision: D16233654
      
      fbshipit-source-id: c32a9dda7465dbf65f9ccafef159124db92cdffd
      f064d74e
  4. 13 7月, 2019 3 次提交
  5. 12 7月, 2019 1 次提交
  6. 11 7月, 2019 1 次提交
  7. 10 7月, 2019 5 次提交
    • G
      Implemented a file logger that uses WritableFileWriter (#5491) · 60d8b198
      ggaurav28 提交于
      Summary:
      Current PosixLogger performs IO operations using posix calls. Thus the
      current implementation will not work for non-posix env. Created a new
      logger class EnvLogger that uses env specific WritableFileWriter for IO operations.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/5491
      
      Test Plan: make check
      
      Differential Revision: D15909002
      
      Pulled By: ggaurav28
      
      fbshipit-source-id: 13a8105176e8e42db0c59798d48cb6a0dbccc965
      60d8b198
    • Y
      Improve result print on atomic flush stress test failure (#5549) · f786b4a5
      Yanqin Jin 提交于
      Summary:
      When atomic flush stress test fails, we print internal keys within the range with mismatched key/values for all column families.
      
      Test plan (on devserver)
      Manually hack the code to randomly insert wrong data. Run the test.
      ```
      $make clean && COMPILE_WITH_TSAN=1 make -j32 db_stress
      $./db_stress -test_atomic_flush=true -ops_per_thread=10000
      ```
      Check that proper error messages are printed, as follows:
      ```
      2019/07/08-17:40:14  Starting verification
      Verification failed
      Latest Sequence Number: 190903
      [default] 000000000000050B => 56290000525350515E5F5C5D5A5B5859
      [3] 0000000000000533 => EE100000EAEBE8E9E6E7E4E5E2E3E0E1FEFFFCFDFAFBF8F9
      Internal keys in CF 'default', [000000000000050B, 0000000000000533] (max 8)
        key 000000000000050B seq 139920 type 1
        key 0000000000000533 seq 0 type 1
      Internal keys in CF '3', [000000000000050B, 0000000000000533] (max 8)
        key 0000000000000533 seq 0 type 1
      ```
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/5549
      
      Differential Revision: D16158709
      
      Pulled By: riversand963
      
      fbshipit-source-id: f07fa87763f87b3bd908da03c956709c6456bcab
      f786b4a5
    • S
      Allow ldb to open DB as secondary (#5537) · aa0367aa
      sdong 提交于
      Summary:
      Right now ldb can open running DB through read-only DB. However, it might leave info logs files to the read-only DB directory. Add an option to open the DB as secondary to avoid it.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/5537
      
      Test Plan:
      Run
      ./ldb scan  --max_keys=10 --db=/tmp/rocksdbtest-2491/dbbench --secondary_path=/tmp --no_value --hex
      and
      ./ldb get 0x00000000000000103030303030303030 --hex --db=/tmp/rocksdbtest-2491/dbbench --secondary_path=/tmp
      against a normal db_bench run and observe the output changes. Also observe that no new info logs files are created under /tmp/rocksdbtest-2491/dbbench.
      Run without --secondary_path and observe that new info logs created under /tmp/rocksdbtest-2491/dbbench.
      
      Differential Revision: D16113886
      
      fbshipit-source-id: 4e09dec47c2528f6ca08a9e7a7894ba2d9daebbb
      aa0367aa
    • S
      Fix bugs in DBWALTest.kTolerateCorruptedTailRecords triggered by #5520 (#5550) · cb19e741
      sdong 提交于
      Summary:
      https://github.com/facebook/rocksdb/pull/5520 caused a buffer overflow bug in DBWALTest.kTolerateCorruptedTailRecords. Fix it.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/5550
      
      Test Plan: Run the test in UBSAN. It used to fail. Not it succeeds.
      
      Differential Revision: D16165516
      
      fbshipit-source-id: 42c56a6bc64eb091f054b87757fcbef60da825f7
      cb19e741
    • T
      Fix interpreter lines for files with python2-only syntax. · a6a9213a
      Tim Hatch 提交于
      Reviewed By: lisroach
      
      Differential Revision: D15362271
      
      fbshipit-source-id: 48fab12ab6e55a8537b19b4623d2545ca9950ec5
      a6a9213a
  8. 09 7月, 2019 1 次提交
    • S
      db_stress to print some internal keys after verification failure (#5543) · 872a261f
      sdong 提交于
      Summary:
      Print out some more information when db_tress fails with verification failures to help debugging problems.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/5543
      
      Test Plan:
      Manually ingest some failures and observe the outputs are like this:
      
      Verification failed
      [default] 0000000000199A5A => 7C3D000078797A7B74757677707172736C6D6E6F68696A6B
      [6] 000000000019C8BD => 65380000616063626D6C6F6E69686B6A
      internal keys in default CF [0000000000199A5A, 000000000019C8BD] (max 8)
        key 0000000000199A5A seq 179246 type 1
        key 000000000019C8BD seq 163970 type 1
      Lastest Sequence Number: 292234
      
      Differential Revision: D16153717
      
      fbshipit-source-id: b33fa50a828c190cbf8249a37955432044f92daf
      872a261f
  9. 08 7月, 2019 3 次提交
    • H
      Fix -Werror=shadow (#5546) · 6ca3feed
      haoyuhuang 提交于
      Summary:
      This PR fixes shadow errors.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/5546
      
      Test Plan: make clean && make check -j32 && make clean && USE_CLANG=1 make check -j32 && make clean && COMPILE_WITH_ASAN=1 make check -j32
      
      Differential Revision: D16147841
      
      Pulled By: HaoyuHuang
      
      fbshipit-source-id: 1043500d70c134185f537ab4c3900452752f1534
      6ca3feed
    • Y
      Support GetAllKeyVersions() for non-default cf (#5544) · 7c76a7fb
      Yanqin Jin 提交于
      Summary:
      Previously `GetAllKeyVersions()` supports default column family only. This PR add support for other column families.
      
      Test plan (devserver):
      ```
      $make clean && COMPILE_WITH_ASAN=1 make -j32 db_basic_test
      $./db_basic_test --gtest_filter=DBBasicTest.GetAllKeyVersions
      ```
      All other unit tests must pass.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/5544
      
      Differential Revision: D16147551
      
      Pulled By: riversand963
      
      fbshipit-source-id: 5a61aece2a32d789e150226a9b8d53f4a5760168
      7c76a7fb
    • Z
      setup wal_in_db_path_ for secondary instance (#5545) · 8d348069
      Zhongyi Xie 提交于
      Summary:
      PR https://github.com/facebook/rocksdb/pull/5520 adds DBImpl:: wal_in_db_path_ and initializes it in DBImpl::Open, this PR fixes the valgrind error for secondary instance:
      ```
      ==236417== Conditional jump or move depends on uninitialised value(s)
      ==236417==    at 0x62242A: rocksdb::DeleteDBFile(rocksdb::ImmutableDBOptions const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool, bool) (file_util.cc:96)
      ==236417==    by 0x512432: rocksdb::DBImpl::DeleteObsoleteFileImpl(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, rocksdb::FileType, unsigned long) (db_impl_files.cc:261)
      ==236417==    by 0x515A7A: rocksdb::DBImpl::PurgeObsoleteFiles(rocksdb::JobContext&, bool) (db_impl_files.cc:492)
      ==236417==    by 0x499153: rocksdb::ColumnFamilyHandleImpl::~ColumnFamilyHandleImpl() (column_family.cc:75)
      ==236417==    by 0x499880: rocksdb::ColumnFamilyHandleImpl::~ColumnFamilyHandleImpl() (column_family.cc:84)
      ==236417==    by 0x4C9AF9: rocksdb::DB::DestroyColumnFamilyHandle(rocksdb::ColumnFamilyHandle*) (db_impl.cc:3105)
      ==236417==    by 0x44E853: CloseSecondary (db_secondary_test.cc:53)
      ==236417==    by 0x44E853: rocksdb::DBSecondaryTest::~DBSecondaryTest() (db_secondary_test.cc:31)
      ==236417==    by 0x44EC77: ~DBSecondaryTest_PrimaryDropColumnFamily_Test (db_secondary_test.cc:443)
      ==236417==    by 0x44EC77: rocksdb::DBSecondaryTest_PrimaryDropColumnFamily_Test::~DBSecondaryTest_PrimaryDropColumnFamily_Test() (db_secondary_test.cc:443)
      ==236417==    by 0x83D1D7: HandleSehExceptionsInMethodIfSupported<testing::Test, void> (gtest-all.cc:3824)
      ==236417==    by 0x83D1D7: void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (gtest-all.cc:3860)
      ==236417==    by 0x8346DB: testing::TestInfo::Run() [clone .part.486] (gtest-all.cc:4078)
      ==236417==    by 0x8348D4: Run (gtest-all.cc:4047)
      ==236417==    by 0x8348D4: testing::TestCase::Run() [clone .part.487] (gtest-all.cc:4190)
      ==236417==    by 0x834D14: Run (gtest-all.cc:6100)
      ==236417==    by 0x834D14: testing::internal::UnitTestImpl::RunAllTests() (gtest-all.cc:6062)
      ```
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/5545
      
      Differential Revision: D16146224
      
      Pulled By: miasantreble
      
      fbshipit-source-id: 184c90e451352951da4e955f054d4b1a1f29ea29
      8d348069
  10. 07 7月, 2019 1 次提交
  11. 06 7月, 2019 1 次提交
    • S
      Assert get_context not null in BlockBasedTable::Get() (#5542) · 2de61d91
      sdong 提交于
      Summary:
      clang analyze fails after https://github.com/facebook/rocksdb/pull/5514 for this failure:
      table/block_based/block_based_table_reader.cc:3450:16: warning: Called C++ object pointer is null
                if (!get_context->SaveValue(
                     ^~~~~~~~~~~~~~~~~~~~~~~
      1 warning generated.
      
      The reaon is that a branching is added earlier in the function on get_context is null or not, CLANG analyze thinks that it can be null and we make the function call withou the null checking.
      Fix the issue by removing the branch and add an assert.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/5542
      
      Test Plan: "make all check" passes and CLANG analyze failure goes away.
      
      Differential Revision: D16133988
      
      fbshipit-source-id: d4627d03c4746254cc11926c523931086ccebcda
      2de61d91
  12. 05 7月, 2019 1 次提交
  13. 04 7月, 2019 3 次提交
  14. 03 7月, 2019 3 次提交
    • A
      Fix clang build with jemalloc (#5522) · 09ea5d89
      Andrew Kryczka 提交于
      Summary:
      Fixes the below build failure for clang compiler using glibc and jemalloc.
      
      Platform: linux x86-64
      Compiler: clang version 6.0.0-1ubuntu2
      Build failure:
      ```
      $ CXX=clang++ CC=clang USE_CLANG=1 WITH_JEMALLOC_FLAG=1 JEMALLOC=1 EXTRA_LDFLAGS="-L/home/andrew/jemalloc/lib/" EXTRA_CXXFLAGS="-I/home/andrew/jemalloc/include/" make check -j12
      ...
        CC       memory/jemalloc_nodump_allocator.o
      In file included from memory/jemalloc_nodump_allocator.cc:6:
      In file included from ./memory/jemalloc_nodump_allocator.h:11:
      In file included from ./port/jemalloc_helper.h:16:
      /usr/include/clang/6.0.0/include/mm_malloc.h:39:16: error: 'posix_memalign' is missing exception specification 'throw()'
      extern "C" int posix_memalign(void **__memptr, size_t __alignment, size_t __size);
                     ^
      /home/andrew/jemalloc/include/jemalloc/jemalloc.h:388:26: note: expanded from macro 'posix_memalign'
      #  define posix_memalign je_posix_memalign
                               ^
      /home/andrew/jemalloc/include/jemalloc/jemalloc.h:77:29: note: expanded from macro 'je_posix_memalign'
      #  define je_posix_memalign posix_memalign
                                  ^
      /home/andrew/jemalloc/include/jemalloc/jemalloc.h:232:38: note: previous declaration is here
      JEMALLOC_EXPORT int JEMALLOC_NOTHROW    je_posix_memalign(void **memptr,
                                              ^
      /home/andrew/jemalloc/include/jemalloc/jemalloc.h:77:29: note: expanded from macro 'je_posix_memalign'
      #  define je_posix_memalign posix_memalign
                                  ^
      1 error generated.
      Makefile:1972: recipe for target 'memory/jemalloc_nodump_allocator.o' failed
      make: *** [memory/jemalloc_nodump_allocator.o] Error 1
      ```
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/5522
      
      Differential Revision: D16069869
      
      Pulled By: miasantreble
      
      fbshipit-source-id: c489bbc993adee194b9a550134c6237a264bc443
      09ea5d89
    • A
      Support jemalloc compiled with `--with-jemalloc-prefix` (#5521) · 0d57d93a
      Andrew Kryczka 提交于
      Summary:
      Previously, if the jemalloc was built with nonempty string for
      `--with-jemalloc-prefix`, then `HasJemalloc()` would return false on
      Linux, so jemalloc would not be used at runtime. On Mac, it would cause
      a linker failure due to no definitions found for the weak functions
      declared in "port/jemalloc_helper.h". This should be a rare problem
      because (1) on Linux the default `--with-jemalloc-prefix` value is the
      empty string, and (2) Homebrew's build explicitly sets
      `--with-jemalloc-prefix` to the empty string.
      
      However, there are cases where `--with-jemalloc-prefix` is nonempty.
      For example, when building jemalloc from source on Mac, the default
      setting is `--with-jemalloc-prefix=je_`. Such jemalloc builds should be
      usable by RocksDB.
      
      The fix is simple. Defining `JEMALLOC_MANGLE` before including
      "jemalloc.h" causes it to define unprefixed symbols that are aliases for
      each of the prefixed symbols. Thanks to benesch for figuring this out
      and explaining it to me.
      
      Fixes https://github.com/facebook/rocksdb/issues/1462.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/5521
      
      Test Plan:
      build jemalloc with prefixed symbols:
      
      ```
      $ ./configure --with-jemalloc-prefix=lol
      $ make
      ```
      
      compile rocksdb against it:
      
      ```
      $ WITH_JEMALLOC_FLAG=1 JEMALLOC=1 EXTRA_LDFLAGS="-L/home/andrew/jemalloc/lib/" EXTRA_CXXFLAGS="-I/home/andrew/jemalloc/include/" make -j12 ./db_bench
      ```
      
      run db_bench and verify jemalloc actually used:
      
      ```
      $ ./db_bench -benchmarks=fillrandom -statistics=true -dump_malloc_stats=true -stats_dump_period_sec=1
      $ grep jemalloc /tmp/rocksdbtest-1000/dbbench/LOG
      2019/06/29-12:20:52.088658 7fc5fb7f6700 [_impl/db_impl.cc:837] ___ Begin jemalloc statistics ___
      ...
      ```
      
      Differential Revision: D16092758
      
      fbshipit-source-id: c2c358346190ed62ceb2a3547a6c4c180b12f7c4
      0d57d93a
    • Y
      Reduce iterator key comparison for upper/lower bound check (2nd attempt) (#5468) · 662ce620
      Yi Wu 提交于
      Summary:
      This is a second attempt for https://github.com/facebook/rocksdb/issues/5111, with the fix to redo iterate bounds check after `SeekXXX()`. This is because MyRocks may change iterate bounds between seek.
      
      See https://github.com/facebook/rocksdb/issues/5111 for original benchmark result and discussion.
      
      Closes https://github.com/facebook/rocksdb/issues/5463.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/5468
      
      Test Plan: Existing rocksdb tests, plus myrocks test `rocksdb.optimizer_loose_index_scans` and `rocksdb.group_min_max`.
      
      Differential Revision: D15863332
      
      fbshipit-source-id: ab4aba5899838591806b8673899bd465f3f53e18
      662ce620
  15. 02 7月, 2019 3 次提交