1. 15 10月, 2020 7 次提交
    • 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
  2. 14 10月, 2020 5 次提交
  3. 13 10月, 2020 4 次提交
  4. 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
  5. 10 10月, 2020 2 次提交
  6. 09 10月, 2020 4 次提交
  7. 08 10月, 2020 7 次提交
    • Z
      Add ldb_cmd_test to ASSERT_STATUS_CHECKED list (#7499) · 41462768
      Zhichao Cao 提交于
      Summary:
      Add ldb_cmd_test to ASSERT_STATUS_CHECKED list
      
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/7499
      
      Test Plan: pass ASSERT_STATUS_CHECKED=1 make -j48 ldb_cmd_test
      
      Reviewed By: cheng-chang
      
      Differential Revision: D24086203
      
      Pulled By: zhichao-cao
      
      fbshipit-source-id: 29592202b1d4335e566de15e7937269d98d57841
      41462768
    • Y
      Fix clang analyzer (#7518) · 002b30c9
      Yanqin Jin 提交于
      Summary: Pull Request resolved: https://github.com/facebook/rocksdb/pull/7518
      
      Test Plan:
      ```
      $USE_CLANG=1 make analyze
      ```
      
      Reviewed By: zhichao-cao
      
      Differential Revision: D24175390
      
      Pulled By: riversand963
      
      fbshipit-source-id: c70121652908cf5d450120c38ab65cc595332ca7
      002b30c9
    • L
      Clean up BlobLogReader and rename it to BlobLogSequentialReader (#7517) · 1f84611e
      Levi Tamasi 提交于
      Summary:
      The patch does some cleanup in and around the legacy `BlobLogReader` class:
      * It renames the class to `BlobLogSequentialReader` to emphasize that it is for
      sequentially iterating through blobs in a blob file, as opposed to doing random
      point reads using `BlobIndex`es (which is `BlobFileReader`'s jurisdiction).
      * It removes some dead code from the old BlobDB implementation that references
      `BlobLogReader` (namely the method `BlobFile::OpenRandomAccessReader`).
      * It cleans up some `#include`s and forward declarations.
      * It fixes some incorrect/outdated comments related to the reader class.
      * It adds a few assertions to the `Read` methods of the class.
      
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/7517
      
      Test Plan: `make check`
      
      Reviewed By: riversand963
      
      Differential Revision: D24172611
      
      Pulled By: ltamasi
      
      fbshipit-source-id: 43e2ae1eba5c3dd30c1070cb00f217edc45bd64f
      1f84611e
    • L
      Introduce a blob file reader class (#7461) · 22655a39
      Levi Tamasi 提交于
      Summary:
      The patch adds a class called `BlobFileReader` that can be used to retrieve blobs
      using the information available in blob references (e.g. blob file number, offset, and
      size). This will come in handy when implementing blob support for `Get`, `MultiGet`,
      and iterators, and also for compaction/garbage collection.
      
      When a `BlobFileReader` object is created (using the factory method `Create`),
      it first checks whether the specified file is potentially valid by comparing the file
      size against the combined size of the blob file header and footer (files smaller than
      the threshold are considered malformed). Then, it opens the file, and reads and verifies
      the header and footer. The verification involves magic number/CRC checks
      as well as checking for unexpected header/footer fields, e.g. incorrect column family ID
      or TTL blob files.
      
      Blobs can be retrieved using `GetBlob`. `GetBlob` validates the offset and compression
      type passed by the caller (because of the presence of the header and footer, the
      specified offset cannot be too close to the start/end of the file; also, the compression type
      has to match the one in the blob file header), and retrieves and potentially verifies and
      uncompresses the blob. In particular, when `ReadOptions::verify_checksums` is set,
      `BlobFileReader` reads the blob record header as well (as opposed to just the blob itself)
      and verifies the key/value size, the key itself, as well as the CRC of the blob record header
      and the key/value pair.
      
      In addition, the patch exposes the compression type from `BlobIndex` (both using an
      accessor and via `DebugString`), and adds a blob file read latency histogram to
      `InternalStats` that can be used with `BlobFileReader`.
      
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/7461
      
      Test Plan: `make check`
      
      Reviewed By: riversand963
      
      Differential Revision: D23999219
      
      Pulled By: ltamasi
      
      fbshipit-source-id: deb6b1160d251258b308d5156e2ec063c3e12e5e
      22655a39
    • A
      Add Stats for MultiGet (#7366) · 38d0a365
      Akanksha Mahajan 提交于
      Summary:
      Add following stats for MultiGet in Histogram to get more insight on MultiGet.
          1. Number of index and filter blocks read from file as part of MultiGet
          request per level.
          2. Number of data blocks read from file per level.
          3. Number of SST files loaded from file system per level.
      
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/7366
      
      Reviewed By: anand1976
      
      Differential Revision: D24127040
      
      Pulled By: akankshamahajan15
      
      fbshipit-source-id: e63a003056b833729b277edc0639c08fb432756b
      38d0a365
    • J
      Disallow trivial move if BottommostLevelCompaction is kForce* (#7368) · 8891e9a0
      Jay Zhuang 提交于
      Summary:
      If `BottommostLevelCompaction.kForce*` is set, compaction should avoid
      trivial move and always compact the sst to the target size.
      
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/7368
      
      Reviewed By: ajkr
      
      Differential Revision: D23629525
      
      Pulled By: jay-zhuang
      
      fbshipit-source-id: 79f23c79ecb31587e0593b28cce43131107bbcd0
      8891e9a0
    • P
      Fix wrong comments about function TruncateToPageBoundary. (#6975) · 60649aa0
      peterpaule 提交于
      Summary: Pull Request resolved: https://github.com/facebook/rocksdb/pull/6975
      
      Reviewed By: ajkr
      
      Differential Revision: D22914797
      
      Pulled By: riversand963
      
      fbshipit-source-id: 5be2cd322d41447f638dba1336e96dcdc090f9dd
      60649aa0
  8. 07 10月, 2020 3 次提交
  9. 06 10月, 2020 1 次提交
  10. 04 10月, 2020 1 次提交
  11. 03 10月, 2020 5 次提交