1. 24 10月, 2020 2 次提交
    • C
      Track WAL in MANIFEST: persist WALs to and recover WALs from MANIFEST (#7256) · 1b224324
      Cheng Chang 提交于
      Summary:
      This PR makes it able to `LogAndApply` `VersionEdit`s related to WALs, and also be able to `Recover` from MANIFEST with WAL related `VersionEdit`s.
      
      The `VersionEdit`s related to WAL are treated similarly as those related to column family operations, they are not applied to versions, but can be in a commit group. Mixing WAL related `VersionEdit`s with other types of edits will make logic in `ProcessManifestWrite` more complicated, so `VersionEdit`s related to WAL can either be WAL additions or deletions, like column family add and drop.
      
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/7256
      
      Test Plan: a set of unit tests are added in `version_set_test.cc`
      
      Reviewed By: riversand963
      
      Differential Revision: D23123238
      
      Pulled By: cheng-chang
      
      fbshipit-source-id: 246be2ed4744fd03fa2738aba408aaa611d0379c
      1b224324
    • P
      Add Encode/DecodeFixedGeneric, coding_lean.h (#7587) · a16d1b2f
      Peter Dillinger 提交于
      Summary:
      To minimize dependencies for Ribbon filter code in progress,
      core part of coding.h for fixed sizes has been moved to coding_lean.h.
      Also, generic versions of these functions have been added to math128.h
      (since the generic versions are likely only to be used along with
      Unsigned128).
      
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/7587
      
      Test Plan: Unit tests added for new functions
      
      Reviewed By: jay-zhuang
      
      Differential Revision: D24486718
      
      Pulled By: pdillinger
      
      fbshipit-source-id: a69768f742379689442135fa52237c01dfe2647e
      a16d1b2f
  2. 23 10月, 2020 3 次提交
    • J
      add StartTrace and EndTrace to stackable_db (#7585) · b1cdb8cc
      jmn 提交于
      Summary:
      In addition to trace block cache access, we want to support trace queries on MySQL. To achieve that StartTrace and EndTrace need to be added to the stackable_db.h
      
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/7585
      
      Reviewed By: zhichao-cao
      
      Differential Revision: D24482306
      
      Pulled By: nmjnmjnmj
      
      fbshipit-source-id: de641b4837c64cd33b44b5bebaeae5d1527c8c31
      b1cdb8cc
    • Z
      Make FileType Public and Replace kLogFile with kWalFile (#7580) · d8ec0a76
      Zhichao Cao 提交于
      Summary:
      As suggested by pdillinger ,The name of kLogFile is misleading, in some tests, kLogFile is defined as info log. Replace it with kWalFile and move it to public, which will be used in https://github.com/facebook/rocksdb/issues/7523
      
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/7580
      
      Test Plan: make check
      
      Reviewed By: riversand963
      
      Differential Revision: D24485420
      
      Pulled By: zhichao-cao
      
      fbshipit-source-id: 955e3dacc1021bb590fde93b0a568ffe9ad80799
      d8ec0a76
    • Z
      Make parallel compression optimization code tidier (#6888) · 1c78e4b2
      Ziyue Yang 提交于
      Summary:
      This commit makes https://github.com/facebook/rocksdb/issues/6262's code change tidier and easier to understand by:
      
      1. Wrapping parallel compression initialization and termination into
         common methods;
      2. Wrapping BlockRep initialization, push/pop into common methods;
      3. Wrapping file size estimation into common methods;
      4. Fixing function declarations that use non-const reference;
      5. Fixing some uninitialized variables;
      6. Fixing first_block data race;
      7. Making BlockRep::status check in BlockBasedTableBuilder::Finish only present
      if ok();
      8. Making assert(ok()) in BlockBasedTableBuilder::CompressAndVerifyBlock only
      present in non-parallel compression mode. In parallel compression mode,
      compression will abort if status is not OK;
      9. Eliminating potential data race caused by BlockBasedTableBuilder::GetStatus()
      and BlockBasedTableBuilder::GetIOStatus() by returning status copy instead of
      unprotected reference.
      
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/6888
      
      Reviewed By: ajkr
      
      Differential Revision: D21957110
      
      Pulled By: jay-zhuang
      
      fbshipit-source-id: 3a29892f249209513f030349756cecd7736eae80
      1c78e4b2
  3. 22 10月, 2020 2 次提交
  4. 21 10月, 2020 4 次提交
  5. 20 10月, 2020 2 次提交
    • A
      Add a host location property to TableProperties (#7479) · 00751e42
      anand76 提交于
      Summary:
      This PR adds support for writing a location identifier of the DB host to SST files as a table property. By default, the hostname is used, but can be overridden by the user. There have been some recent corruptions in files written by ```SstFileWriter``` before checksumming, so this property can be used to trace it back to the writing host and checking the host for hardware isues.
      
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/7479
      
      Test Plan: Add new unit tests
      
      Reviewed By: pdillinger
      
      Differential Revision: D24340671
      
      Pulled By: anand1976
      
      fbshipit-source-id: 2038949fd8d160c0633ccb4f9da77740f19fa2a2
      00751e42
    • C
      Abstract out LockManager interface (#7532) · 0ea7db76
      Cheng Chang 提交于
      Summary:
      In order to be able to introduce more locking protocols, we need to abstract out the locking subsystem in TransactionDB into a set of interfaces.
      
      PR https://github.com/facebook/rocksdb/pull/7013 introduces interface `LockTracker`. This PR is a follow up to take the first step to abstract out a `LockManager` interface.
      
      Further modifications to the interface may be needed when introducing the first implementation of range lock. But the idea here is to put the range lock implementation based on range tree under the `utilities/transactions/lock/range/range_tree`.
      
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/7532
      
      Test Plan: point_lock_manager_test
      
      Reviewed By: ajkr
      
      Differential Revision: D24238731
      
      Pulled By: cheng-chang
      
      fbshipit-source-id: 2a9458cd8b3fb008d9529dbc4d3b28c24631f463
      0ea7db76
  6. 17 10月, 2020 2 次提交
  7. 16 10月, 2020 1 次提交
    • L
      Introduce BlobFileCache and add support for blob files to Get() (#7540) · e8cb32ed
      Levi Tamasi 提交于
      Summary:
      The patch adds blob file support to the `Get` API by extending `Version` so that
      whenever a blob reference is read from a file, the blob is retrieved from the corresponding
      blob file and passed back to the caller. (This is assuming the blob reference is valid
      and the blob file is actually part of the given `Version`.) It also introduces a cache
      of `BlobFileReader`s called `BlobFileCache` that enables sharing `BlobFileReader`s
      between callers. `BlobFileCache` uses the same backing cache as `TableCache`, so
      `max_open_files` (if specified) limits the total number of open (table + blob) files.
      
      TODO: proactively open/cache blob files and pin the cache handles of the readers in the
      metadata objects similarly to what `VersionBuilder::LoadTableHandlers` does for
      table files.
      
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/7540
      
      Test Plan: `make check`
      
      Reviewed By: riversand963
      
      Differential Revision: D24260219
      
      Pulled By: ltamasi
      
      fbshipit-source-id: a8a2a4f11d3d04d6082201b52184bc4d7b0857ba
      e8cb32ed
  8. 15 10月, 2020 10 次提交
    • A
      Update zstd dependency to 1.4.5 (#7560) · fa2a8cda
      Adam Retter 提交于
      Summary: Pull Request resolved: https://github.com/facebook/rocksdb/pull/7560
      
      Reviewed By: akankshamahajan15
      
      Differential Revision: D24323048
      
      Pulled By: zhichao-cao
      
      fbshipit-source-id: 2094ef089c37f570d4ea30d28d2f46f9fa1ce0f1
      fa2a8cda
    • M
      Test for LoadLatestOptions (#7554) · a8c89cc9
      mrambacher 提交于
      Summary:
      Make LoadLatestOptions return PathNotFound if the options file does not exist.  Added tests for the LoadOptions related methods.
      
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/7554
      
      Reviewed By: akankshamahajan15
      
      Differential Revision: D24298985
      
      Pulled By: zhichao-cao
      
      fbshipit-source-id: c9ae3cb12fc4a5bbef07743e1c1300f98a2441b3
      a8c89cc9
    • A
      Small JNI improvements (#7371) · ccbf468c
      Adam Retter 提交于
      Summary:
      * Avoid some unnecessary array copy operations on read/write
      * Remove some duplicated code
      * Don't leak arrays on some exceptions
      * Fixed some doc comments
      
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/7371
      
      Reviewed By: jay-zhuang
      
      Differential Revision: D24312932
      
      Pulled By: pdillinger
      
      fbshipit-source-id: 422fe6b98bbdb922a148922ac0d2d965c715176e
      ccbf468c
    • S
      Expose BackupableDBOptions in the C API (#7550) · 1a83f5a8
      Stanislav Tkach 提交于
      Summary: Pull Request resolved: https://github.com/facebook/rocksdb/pull/7550
      
      Reviewed By: jay-zhuang
      
      Differential Revision: D24315343
      
      Pulled By: ajkr
      
      fbshipit-source-id: fc7855b630a50c00dcb940241942295932732f39
      1a83f5a8
    • T
      Make RocksDB instance responsible for closing associated ColumnFamilyHandle instances (#7428) · 05fba969
      Tomasz Posluszny 提交于
      Summary:
      - Takes the burden off developer to close ColumnFamilyHandle instances before closing RocksDB instance
      - The change is backward-compatible
      
      ----
      Previously the pattern for working with Column Families was:
      
      ```java
      try (final ColumnFamilyOptions cfOpts = new ColumnFamilyOptions().optimizeUniversalStyleCompaction()) {
      
        // list of column family descriptors, first entry must always be default column family
        final List<ColumnFamilyDescriptor> cfDescriptors = Arrays.asList(
            new ColumnFamilyDescriptor(RocksDB.DEFAULT_COLUMN_FAMILY, cfOpts),
            new ColumnFamilyDescriptor("my-first-columnfamily".getBytes(), cfOpts)
        );
      
        // a list which will hold the handles for the column families once the db is opened
        final List<ColumnFamilyHandle> columnFamilyHandleList =
            new ArrayList<>();
      
        try (final DBOptions options = new DBOptions()
            .setCreateIfMissing(true)
            .setCreateMissingColumnFamilies(true);
             final RocksDB db = RocksDB.open(options,
                 "path/to/do", cfDescriptors,
                 columnFamilyHandleList)) {
      
          try {
      
            // do something
      
          } finally {
      
            // NOTE user must explicitly frees the column family handles before freeing the db
            for (final ColumnFamilyHandle columnFamilyHandle :
                columnFamilyHandleList) {
              columnFamilyHandle.close();
            }
          } // frees the column family options
        }
      } // frees the db and the db options
      ```
      
      With the changes in this PR, the Java user no longer has to worry about manually closing the Column Families, which allows them to write simpler symmetrical create/free oriented code like this:
      
      ```java
      try (final ColumnFamilyOptions cfOpts = new ColumnFamilyOptions().optimizeUniversalStyleCompaction()) {
      
        // list of column family descriptors, first entry must always be default column family
        final List<ColumnFamilyDescriptor> cfDescriptors = Arrays.asList(
            new ColumnFamilyDescriptor(RocksDB.DEFAULT_COLUMN_FAMILY, cfOpts),
            new ColumnFamilyDescriptor("my-first-columnfamily".getBytes(), cfOpts)
        );
      
        // a list which will hold the handles for the column families once the db is opened
        final List<ColumnFamilyHandle> columnFamilyHandleList =
            new ArrayList<>();
      
        try (final DBOptions options = new DBOptions()
            .setCreateIfMissing(true)
            .setCreateMissingColumnFamilies(true);
             final RocksDB db = RocksDB.open(options,
                 "path/to/do", cfDescriptors,
                 columnFamilyHandleList)) {
      
              // do something
      
          } // frees the column family options, then frees the db and the db options
        }
      }
      ```
      
      **NOTE**: The changes in this PR are backwards API compatible, which means existing code using the original approach will also continue to function correctly.
      
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/7428
      
      Reviewed By: cheng-chang
      
      Differential Revision: D24063348
      
      Pulled By: jay-zhuang
      
      fbshipit-source-id: 648d7526669923128c863ead94516bf4d50ac658
      05fba969
    • A
      Fix for clang_analyzer build failure in table_test (#7553) · 850cc0db
      Akanksha Mahajan 提交于
      Summary:
      fix for clang_analyzer build failure in table_test because of
      potential memory leak of memtable in case of ASSERT failure.
      
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/7553
      
      Test Plan:
      USE_CLANG=1 make analyze;
                 make check -j64
      
      Reviewed By: jay-zhuang
      
      Differential Revision: D24295042
      
      Pulled By: akankshamahajan15
      
      fbshipit-source-id: e9ea184367970fff3b520e33f3ceebf28d66ac8d
      850cc0db
    • T
      Add event listeners to RocksJava (#7425) · 6528ecc8
      Tomasz Posluszny 提交于
      Summary:
      Allows adding event listeners in RocksJava.
      
      * Adds listeners getter and setter in `Options` and `DBOptions` classes.
      * Adds `EventListener` Java interface and base class for implementing custom event listener callbacks - `AbstractEventListener`, which has an underlying native callback class implementing C++ `EventListener` class.
      * `AbstractEventListener` class has mechanism for selectively enabling its callback methods in order to prevent invoking Java method if it is not implemented. This decreases performance cost in case only subset of event listener callback methods is needed - the JNI code for remaining "no-op" callbacks is not executed.
      * The code is covered by unit tests in `EventListenerTest.java`, there are also tests added for setting/getting listeners field in `OptionsTest.java` and `DBOptionsTest.java`.
      
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/7425
      
      Reviewed By: pdillinger
      
      Differential Revision: D24063390
      
      Pulled By: jay-zhuang
      
      fbshipit-source-id: 508c359538983d6b765e70d9989c351794a944ee
      6528ecc8
    • Z
      Remove the status.PermitUncheckedError() from WriteGroup Destructor (#7555) · b99fe1ab
      Zhichao Cao 提交于
      Summary: Pull Request resolved: https://github.com/facebook/rocksdb/pull/7555
      
      Test Plan: ASSERT_STATUS_CHECKED=1 make -j48 error_handler_fs_test
      
      Reviewed By: riversand963
      
      Differential Revision: D24299387
      
      Pulled By: zhichao-cao
      
      fbshipit-source-id: 6c8aa91c4b6e2bc82580b8d2264c177068f5a32c
      b99fe1ab
    • A
      Return error if Get/Multi() fails in Prefetching Filter blocks (#7543) · db87afbc
      Akanksha Mahajan 提交于
      Summary:
      Right now all I/O failures under
      PartitionFilterBlock::CacheDependencies() is swallowed. Return error in
      case prefetch fails.
      
      On returning error in PartitionedFilterBlockReader::CacheDependencies was causing stress test failure because PrefetchBuffer is initialized with enable_ = true, as result when PosixMmapReadableFile::Read is called from Prefetch, scratch is ignored causing buffer to fill with garbage values. Initializing prefetch buffer by CreatePrefetchBuffer that sets enable_ with !ioptions.allow_mmap_reads fixed the problem as it returns without prefetching data if allow_mmap_reads is set.
      
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/7543
      
      Test Plan:
      make check -j64;
      python -u tools/db_crashtest.py --simple blackbox
      
      Reviewed By: anand1976
      
      Differential Revision: D24284596
      
      Pulled By: akankshamahajan15
      
      fbshipit-source-id: f3f0fd44b59dcf60645730436f28564a07884868
      db87afbc
    • A
      Update IOTrace operations in stackable_db.h (#7514) · 7b65666c
      Akanksha Mahajan 提交于
      Summary:
      Update IOTrace operations in stackabledb.h and also trace few
      other IO operations.
      
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/7514
      
      Test Plan: make check -j64
      
      Reviewed By: anand1976
      
      Differential Revision: D24151202
      
      Pulled By: akankshamahajan15
      
      fbshipit-source-id: 112cd3d2041f8c6398b7b0ba1a783b8c93224d4a
      7b65666c
  9. 14 10月, 2020 5 次提交
  10. 13 10月, 2020 4 次提交
  11. 12 10月, 2020 1 次提交
    • A
      Redesign block cache pinning API (#7520) · 75d3b6fd
      Andrew Kryczka 提交于
      Summary:
      The old flag-based APIs (`BlockBasedTableOptions::pin_l0_filter_and_index_blocks_in_cache` and `BlockBasedTableOptions::pin_top_level_index_and_filter`) were insufficient for our needs. For example, it was impossible to pin only unpartitioned meta-blocks, which could prevent block cache contention when turning on dictionary compression or during a migration to partitioned indexes/filters. It was also impossible to pin all meta-blocks in memory while having predictable memory usage via block cache. If we had continued adding flags to address these scenarios, they would have had significant overlap causing confusion. Instead, this PR deprecates the flags and starts a new API with non-overlapping options.
      
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/7520
      
      Test Plan:
      - new unit test
      - added new options to stress/crash test and ran for a while: `$ python tools/db_crashtest.py blackbox --simple --max_key=1000000 -write_buffer_size=1048576 -target_file_size_base=1048576 -max_bytes_for_level_base=4194304 --interval=10 -value_size_mult=33 -column_families=1 -reopen=0`
      
      Reviewed By: pdillinger
      
      Differential Revision: D24200034
      
      Pulled By: ajkr
      
      fbshipit-source-id: 3fa7cfc71e7960f7a867511dd6ae5834dd73b13e
      75d3b6fd
  12. 10 10月, 2020 2 次提交
  13. 09 10月, 2020 2 次提交