1. 23 4月, 2021 2 次提交
    • H
      Add ZenFS to plugin list (#8218) · e85d8a65
      Hans Holmberg 提交于
      Summary:
      Add ZenFS, a file system for zoned block devices, to PLUGINS.md
      
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/8218
      
      Reviewed By: jay-zhuang
      
      Differential Revision: D27944376
      
      Pulled By: ajkr
      
      fbshipit-source-id: c9ea2e9814001ccd7c56d7ef4d38e20dfeb48d1e
      e85d8a65
    • Z
      Fix the false positive alert of CF consistency check in WAL recovery (#8207) · 09a9ec3a
      Zhichao Cao 提交于
      Summary:
      In current RocksDB, in recover the information form WAL, we do the consistency check for each column family when one WAL file is corrupted and PointInTimeRecovery is set. However, it will report a false positive alert on "SST file is ahead of WALs" when one of the CF current log number is greater than the corrupted WAL number (CF contains the data beyond the corrupted WAl) due to a new column family creation during flush. In this case, a new WAL is created (it is empty) during a flush. Also, due to some reason (e.g., storage issue or crash happens before SyncCloseLog is called), the old WAL is corrupted. The new CF has no data, therefore, it does not have the consistency issue.
      
      Fix: when checking cfd->GetLogNumber() > corrupted_wal_number also check cfd->GetLiveSstFilesSize() > 0. So the CFs with no SST file data will skip the check here.
      
      Note potential ignored inconsistency caused due to fix: empty CF can also be caused by write+delete. In this case, after flush, there is no SST files being generated. However, this CF still have the log in the WAL. When the WAL is corrupted, the DB might be inconsistent.
      
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/8207
      
      Test Plan: added unit test, make crash_test
      
      Reviewed By: riversand963
      
      Differential Revision: D27898839
      
      Pulled By: zhichao-cao
      
      fbshipit-source-id: 931fc2d8b92dd00b4169bf84b94e712fd688a83e
      09a9ec3a
  2. 22 4月, 2021 4 次提交
    • M
      Add check to cmake to see if we need to link against -latomic (#8183) · 47b424f4
      mrambacher 提交于
      Summary:
      For some compilers/environments (e.g. Clang, riscv64), we need to link against -latomic.  Check if this is a requirement and add the library to the third-party libs if it is.
      
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/8183
      
      Reviewed By: pdillinger
      
      Differential Revision: D27773564
      
      Pulled By: mrambacher
      
      fbshipit-source-id: 68e15d823144f83fb02221c7bf5b1e43323419bf
      47b424f4
    • Y
      Ignore comparator name mismatch in ldb manifest dump (#8216) · 31435276
      Yanqin Jin 提交于
      Summary:
      RocksDB allows user-specified custom comparators which may not be known to `ldb`,
      a built-in tool for checking/mutating the database. Therefore, column family comparator
      names mismatch encountered during manifest dump should not prevent the dumping from
      proceeding.
      
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/8216
      
      Test Plan:
      ```
      make check
      ```
      
      Also manually do the following
      ```
      KEEP_DB=1 ./db_with_timestamp_basic_test
      ./ldb --db=<db> manifest_dump --verbose
      ```
      The ldb should succeed and print something like:
      ```
      ...
      --------------- Column family "default"  (ID 0) --------------
      log number: 6
      comparator: <TestComparator>, but the comparator object is not available.
      ...
      ```
      
      Reviewed By: ltamasi
      
      Differential Revision: D27927581
      
      Pulled By: riversand963
      
      fbshipit-source-id: f610b2c842187d17f575362070209ee6b74ec6d4
      31435276
    • S
      Add comment to DisableManualCompaction() (#8186) · 4985cea1
      sdong 提交于
      Summary:
      Add comment to DisableManualCompaction() which was missing.
      Also explictly return from DBImpl::CompactRange() to avoid memtable flush when manual compaction is disabled.
      
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/8186
      
      Test Plan: Run existing unit tests.
      
      Reviewed By: jay-zhuang
      
      Differential Revision: D27744517
      
      fbshipit-source-id: 449548a48905903b888dc9612bd17480f6596a71
      4985cea1
    • A
      Stall writes in WriteBufferManager when memory_usage exceeds buffer_size (#7898) · 596e9008
      Akanksha Mahajan 提交于
      Summary:
      When WriteBufferManager is shared across DBs and column families
      to maintain memory usage under a limit, OOMs have been observed when flush cannot
      finish but writes continuously insert to memtables.
      In order to avoid OOMs, when memory usage goes beyond buffer_limit_ and DBs tries to write,
      this change will stall incoming writers until flush is completed and memory_usage
      drops.
      
      Design: Stall condition: When total memory usage exceeds WriteBufferManager::buffer_size_
      (memory_usage() >= buffer_size_) WriterBufferManager::ShouldStall() returns true.
      
      DBImpl first block incoming/future writers by calling write_thread_.BeginWriteStall()
      (which adds dummy stall object to the writer's queue).
      Then DB is blocked on a state State::Blocked (current write doesn't go
      through). WBStallInterface object maintained by every DB instance is added to the queue of
      WriteBufferManager.
      
      If multiple DBs tries to write during this stall, they will also be
      blocked when check WriteBufferManager::ShouldStall() returns true.
      
      End Stall condition: When flush is finished and memory usage goes down, stall will end only if memory
      waiting to be flushed is less than buffer_size/2. This lower limit will give time for flush
      to complete and avoid continous stalling if memory usage remains close to buffer_size.
      
      WriterBufferManager::EndWriteStall() is called,
      which removes all instances from its queue and signal them to continue.
      Their state is changed to State::Running and they are unblocked. DBImpl
      then signal all incoming writers of that DB to continue by calling
      write_thread_.EndWriteStall() (which removes dummy stall object from the
      queue).
      
      DB instance creates WBMStallInterface which is an interface to block and
      signal DBs during stall.
      When DB needs to be blocked or signalled by WriteBufferManager,
      state_for_wbm_ state is changed accordingly (RUNNING or BLOCKED).
      
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/7898
      
      Test Plan: Added a new test db/db_write_buffer_manager_test.cc
      
      Reviewed By: anand1976
      
      Differential Revision: D26093227
      
      Pulled By: akankshamahajan15
      
      fbshipit-source-id: 2bbd982a3fb7033f6de6153aa92a221249861aae
      596e9008
  3. 21 4月, 2021 4 次提交
  4. 20 4月, 2021 5 次提交
    • J
      Fix unittest no space issue (#8204) · a89740fb
      Jay Zhuang 提交于
      Summary:
      Unittest reports no space from time to time, which can be reproduced on a small memory machine with SHM. It's caused by large WAL files generated during the test, which is preallocated, but didn't truncate during close(). Adding the missing APIs to set preallocation.
      It added arm test as nightly build, as the test runs more than 1 hour.
      
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/8204
      
      Test Plan: test on small memory arm machine
      
      Reviewed By: mrambacher
      
      Differential Revision: D27873145
      
      Pulled By: jay-zhuang
      
      fbshipit-source-id: f797c429d6bc13cbcc673bc03fcc72adda55f506
      a89740fb
    • J
      Move arm build from travis to circleci (#8203) · a345b4d6
      Jay Zhuang 提交于
      Summary:
      Moving ARM build from travis to CircleCI.
      
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/8203
      
      Test Plan: CI
      
      Reviewed By: ajkr
      
      Differential Revision: D27861753
      
      Pulled By: jay-zhuang
      
      fbshipit-source-id: 5e36a67f6fbb921c2ed80b284ba2de485411937b
      a345b4d6
    • Y
      Handle rename() failure in non-local FS (#8192) · a376c220
      Yanqin Jin 提交于
      Summary:
      In a distributed environment, a file `rename()` operation can succeed on server (remote)
      side, but the client can somehow return non-ok status to RocksDB. Possible reasons include
      network partition, connection issue, etc. This happens in `rocksdb::SetCurrentFile()`, which
      can be called in `LogAndApply() -> ProcessManifestWrites()` if RocksDB tries to switch to a
      new MANIFEST. We currently always delete the new MANIFEST if an error occurs.
      
      This is problematic in distributed world. If the server-side successfully updates the CURRENT
      file via renaming, then a subsequent `DB::Open()` will try to look for the new MANIFEST and fail.
      
      As a fix, we can track the execution result of IO operations on the new MANIFEST.
      - If IO operations on the new MANIFEST fail, then we know the CURRENT must point to the original
        MANIFEST. Therefore, it is safe to remove the new MANIFEST.
      - If IO operations on the new MANIFEST all succeed, but somehow we end up in the clean up
        code block, then we do not know whether CURRENT points to the new or old MANIFEST. (For local
        POSIX-compliant FS, it should still point to old MANIFEST, but it does not matter if we keep the
        new MANIFEST.) Therefore, we keep the new MANIFEST.
          - Any future `LogAndApply()` will switch to a new MANIFEST and update CURRENT.
          - If process reopens the db immediately after the failure, then the CURRENT file can point
            to either the new MANIFEST or the old one, both of which exist. Therefore, recovery can
            succeed and ignore the other.
      
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/8192
      
      Test Plan: make check
      
      Reviewed By: zhichao-cao
      
      Differential Revision: D27804648
      
      Pulled By: riversand963
      
      fbshipit-source-id: 9c16f2a5ce41bc6aadf085e48449b19ede8423e4
      a376c220
    • L
      Fix a data race related to DB properties (#8206) · 0c6e4674
      Levi Tamasi 提交于
      Summary:
      Historically, the DB properties `rocksdb.cur-size-active-mem-table`,
      `rocksdb.cur-size-all-mem-tables`, and `rocksdb.size-all-mem-tables` called
      the method `MemTable::ApproximateMemoryUsage` for mutable memtables,
      which is not safe without synchronization. This resulted in data races with
      memtable inserts. The patch changes the code handling these properties
      to use `MemTable::ApproximateMemoryUsageFast` instead, which returns a
      cached value backed by an atomic variable. Two test cases had to be updated
      for this change. `MemoryTest.MemTableAndTableReadersTotal` was fixed by
      increasing the value size used so each value ends up in its own memtable,
      which was the original intention (note: the test has been broken in the sense
      that the test code didn't consider that memtable sizes below 64 KB get
      increased to 64 KB by `SanitizeOptions`, and has been passing only by
      accident). `DBTest.MemoryUsageWithMaxWriteBufferSizeToMaintain` relies on
      completely up-to-date values and thus was changed to use `ApproximateMemoryUsage`
      directly instead of going through the DB properties. Note: this should be safe in this case
      since there's only a single thread involved.
      
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/8206
      
      Test Plan: `make check`
      
      Reviewed By: riversand963
      
      Differential Revision: D27866811
      
      Pulled By: ltamasi
      
      fbshipit-source-id: 7bd754d0565e0a65f1f7f0e78ffc093beef79394
      0c6e4674
    • Y
      Handle blob files when options.best_efforts_recovery is true (#8180) · b0e20194
      Yanqin Jin 提交于
      Summary:
      If `options.best_efforts_recovery == true`, RocksDB currently tolerates missing table files and recovers to the latest version without missing table files (not considering WAL). It is necessary to handle blob files as well to make the feature more complete.
      
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/8180
      
      Test Plan: make check
      
      Reviewed By: ltamasi
      
      Differential Revision: D27840556
      
      Pulled By: riversand963
      
      fbshipit-source-id: 041685d0dc2e7779ac4f0374c07a8a327704aa5e
      b0e20194
  5. 19 4月, 2021 1 次提交
  6. 17 4月, 2021 3 次提交
    • A
      Update release version to 6.20 (#8199) · 531a5f88
      Akanksha Mahajan 提交于
      Summary:
      Update release version to 6.20
      
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/8199
      
      Test Plan: No code change
      
      Reviewed By: ajkr
      
      Differential Revision: D27838750
      
      Pulled By: akankshamahajan15
      
      fbshipit-source-id: f02f722fc6bdd37d626d47a0e932bbecea3507a8
      531a5f88
    • P
      Ribbon long-term support, starting level support (#8198) · 10196d7e
      Peter Dillinger 提交于
      Summary:
      Since the Ribbon filter schema seems good (compatible back to
      6.15.0), this change commits to long term support of the SST schema,
      even though we expect the API for enabling Ribbon to change (still
      called NewExperimentalRibbonFilterPolicy).
      
      This also adds support for "hybrid" configuration in which some levels
      use Bloom (higher levels, lower numbered) for speed and the rest use
      Ribbon (lower levels, higher numbered) for memory space efficiency.
      
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/8198
      
      Test Plan: unit test added, crash test support
      
      Reviewed By: jay-zhuang
      
      Differential Revision: D27831232
      
      Pulled By: pdillinger
      
      fbshipit-source-id: 90e528677689474d293ed6710b42ba89fbd5b5ab
      10196d7e
    • A
      Fix Windows strcmp for Unicode (#8190) · 90e24569
      Adam Retter 提交于
      Summary:
      The code for strcmp that was present does work when compiled for Windows unicode file paths.
      
      Needs backporting to:
      * 6.17.fb
      * 6.18.fb
      * 6.19.fb
      
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/8190
      
      Reviewed By: akankshamahajan15
      
      Differential Revision: D27765588
      
      Pulled By: jay-zhuang
      
      fbshipit-source-id: 89f8a5ac61fd7edc758340dfd335b0a5f96dae6e
      90e24569
  7. 16 4月, 2021 5 次提交
  8. 15 4月, 2021 2 次提交
  9. 14 4月, 2021 1 次提交
  10. 13 4月, 2021 3 次提交
    • Y
      Disable IOStatsContext/PerfContext if no thread local (#8117) · fd00f39f
      Yanqin Jin 提交于
      Summary:
      Before this PR, `get_iostats_context()` will silently return a nullptr if no thread_local support is detected.
      This can be the result of build_detect_platform's failure to compile the simple code snippet on certain platforms, as
      reported in https://github.com/facebook/mysql-5.6/issues/904.
      To be safe, we should fail the compilation if user does not opt out IOStatsContext and
      ROCKSDB_SUPPORT_THREAD_LOCAL is not defined.
      
      If RocksDB relies on c++11, can we just always use thread_local? It turns out there might be
      performance concerns (https://github.com/facebook/rocksdb/issues/5774),
      which is beyond the scope of this PR. We can revisit this later. Here, we stick to the original impl.
      
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/8117
      
      Reviewed By: ajkr
      
      Differential Revision: D27356847
      
      Pulled By: riversand963
      
      fbshipit-source-id: f7d5776842277598d8341b955febb601946801ae
      fd00f39f
    • P
      Misc Backup API enhancements (#8170) · bb750925
      Peter Dillinger 提交于
      Summary:
      * CreateNewBackup(WithMetadata) returning the BackupID of new backup
      through optional new output param. This is especially useful with the
      new mutithreading support, so that you can transactionally determine the
      ID of a backup you create.
      * GetBackupInfo / GetLatestBackupInfo for individual backups, so that
      you don't have to comb through a vector of backups if you don't want to.
      
      Updated HISTORY.md (including re: BlobDB support as new feature)
      
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/8170
      
      Test Plan:
      Added test logic to existing tests, to minimize increase in
      cost of running tests
      
      Reviewed By: zhichao-cao
      
      Differential Revision: D27680410
      
      Pulled By: pdillinger
      
      fbshipit-source-id: 1fc45b73d81aae293ccd4a43d9583d7fd915d3eb
      bb750925
    • X
      Add util/crc32c_arm64.cc to TARGETS (#8168) · 8972dd1f
      Xavier Deguillard 提交于
      Summary:
      When compiling RocksDB with Buck for ARM64, the linker complains about missing crc32 symbols that are defined in the crc32c_arm64.cc file. Since this file wasn't included in the build this is totally expected
      
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/8168
      
      Test Plan:
      The following no longer fails to link rocksdb:
        buck build mode/mac-xcode //eden/fs/service:edenfs#macosx-arm64
      
      Reviewed By: zhichao-cao
      
      Differential Revision: D27664627
      
      Pulled By: xavierd
      
      fbshipit-source-id: fb9d7a538599ee7a08882f87628731de6e641f8d
      8972dd1f
  11. 10 4月, 2021 2 次提交
  12. 08 4月, 2021 4 次提交
    • G
      Fix flush reason attribution (#8150) · 48cd7a3a
      Giuseppe Ottaviano 提交于
      Summary:
      Current flush reason attribution is misleading or incorrect (depending on what the original intention was):
      
      - Flush due to WAL reaching its maximum size is attributed to `kWriteBufferManager`
      - Flushes due to full write buffer and write buffer manager are not distinguishable, both are attributed to `kWriteBufferFull`
      
      This changes the first to a new flush reason `kWALFull`, and splits the second between `kWriteBufferManager` and `kWriteBufferFull`.
      
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/8150
      
      Reviewed By: zhichao-cao
      
      Differential Revision: D27569645
      
      Pulled By: ot
      
      fbshipit-source-id: 7e3c8ca186a6e71976e6b8e937297eebd4b769cc
      48cd7a3a
    • A
      Enable backup/restore for Integrated BlobDB in stress and crash tests (#8165) · 0be89e87
      Akanksha Mahajan 提交于
      Summary:
      Enable backup/restore functionality with Integrated BlobDB in
      db_stress and crash test.
      
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/8165
      
      Test Plan:
      Ran python3 -u tools/db_crashtest.py --simple whitebox along
      with :
        1. decreased "backup_in_one" value for backups to be more frequent and
        2. manually changed code for "enable_blob_file" to be always true and
           apply blobdb params 100% for testing purpose.
      
      Reviewed By: ltamasi
      
      Differential Revision: D27636025
      
      Pulled By: akankshamahajan15
      
      fbshipit-source-id: 0d0e0d1479ced163f992872dc998e79c581bfc99
      0be89e87
    • A
      Integrated BlobDB for backup/restore support (#8129) · d52b520d
      Akanksha Mahajan 提交于
      Summary:
      Add support for blob files for backup/restore like table files.
          Since DB session ID is currently not supported for blob files (there is no place to store it in
          the header), so for blob files uses the
          kLegacyCrc32cAndFileSize naming scheme even if
          share_files_with_checksum_naming is set to kUseDbSessionId.
      
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/8129
      
      Test Plan: Add new test units
      
      Reviewed By: ltamasi
      
      Differential Revision: D27408510
      
      Pulled By: akankshamahajan15
      
      fbshipit-source-id: b27434d189a639ef3e6ad165c61a143a2daaf06e
      d52b520d
    • P
      Fix read-only DB writing to filesystem with write_dbid_to_manifest (#8164) · a4e82a3c
      Peter Dillinger 提交于
      Summary:
      Fixing another crash test failure in the case of
      write_dbid_to_manifest=true and reading a backup as read-only DB.
      
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/8164
      
      Test Plan:
      enhanced unit test for backup as read-only DB, ran
      blackbox_crash_test more with elevated backup_one_in
      
      Reviewed By: zhichao-cao
      
      Differential Revision: D27622237
      
      Pulled By: pdillinger
      
      fbshipit-source-id: 680d0f99ddb465a601737f2e3f2c80efd47384fb
      a4e82a3c
  13. 07 4月, 2021 4 次提交
    • P
      Fix crash test with backup as read-only DB (#8161) · 35af0433
      Peter Dillinger 提交于
      Summary:
      Forgot to re-test crash test after adding read-only filesystem
      enforcement to https://github.com/facebook/rocksdb/issues/8142. The problem is ReadOnlyFileSystem would reject
      CreateDirIfMissing whenever DBOptions::create_if_missing=true. The fix
      that is better for users is to allow CreateDirIfMissing in
      ReadOnlyFileSystem if the directory exists, so that they don't cause a
      failure on using create_if_missing with opening backups as read-only
      DBs. Added this option test to the unit test (in addition to being in the
      crash test).
      
      Also fixed a couple of lints.
      
      And some better messaging from 'make format' so that when you run it
      with uncommitted changes, it's clear that it's only checking the
      uncommitted changes.
      
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/8161
      
      Test Plan: local blackbox_crash_test with amplified backup_one_in
      
      Reviewed By: ajkr
      
      Differential Revision: D27614409
      
      Pulled By: pdillinger
      
      fbshipit-source-id: 63ccb626c7e34c200d61c6bca2a8f60da9015179
      35af0433
    • S
      Update installation instructions (#8158) · 6db3af11
      Sahir Hoda 提交于
      Summary:
      Updated instructions for installing zstd on CentOS and note about clang-format dependency
      
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/8158
      
      Reviewed By: riversand963
      
      Differential Revision: D27598665
      
      Pulled By: ajkr
      
      fbshipit-source-id: e349eeb91147f3163e170cc29c8460b06d739b5b
      6db3af11
    • P
      Make backups openable as read-only DBs (#8142) · 879357fd
      Peter Dillinger 提交于
      Summary:
      A current limitation of backups is that you don't know the
      exact database state of when the backup was taken. With this new
      feature, you can at least inspect the backup's DB state without
      restoring it by opening it as a read-only DB.
      
      Rather than add something like OpenAsReadOnlyDB to the BackupEngine API,
      which would inhibit opening stackable DB implementations read-only
      (if/when their APIs support it), we instead provide a DB name and Env
      that can be used to open as a read-only DB.
      
      Possible follow-up work:
      
      * Add a version of GetBackupInfo for a single backup.
      * Let CreateNewBackup return the BackupID of the newly-created backup.
      
      Implementation details:
      
      Refactored ChrootFileSystem to split off new base class RemapFileSystem,
      which allows more general remapping of files. We use this base class to
      implement BackupEngineImpl::RemapSharedFileSystem.
      
      To minimize API impact, I decided to just add these fields `name_for_open`
      and `env_for_open` to those set by GetBackupInfo when
      include_file_details=true. Creating the RemapSharedFileSystem adds a bit
      to the memory consumption, perhaps unnecessarily in some cases, but this
      has been mitigated by (a) only initialize the RemapSharedFileSystem
      lazily when GetBackupInfo with include_file_details=true is called, and
      (b) using the existing `shared_ptr<FileInfo>` objects to hold most of the
      mapping data.
      
      To enhance API safety, RemapSharedFileSystem is wrapped by new
      ReadOnlyFileSystem which rejects any attempts to write. This uncovered a
      couple of places in which DB::OpenForReadOnly would write to the
      filesystem, so I fixed these. Added a release note because this affects
      logging.
      
      Additional minor refactoring in backupable_db.cc to support the new
      functionality.
      
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/8142
      
      Test Plan:
      new test (run with ASAN and UBSAN), added to stress test and
      ran it for a while with amplified backup_one_in
      
      Reviewed By: ajkr
      
      Differential Revision: D27535408
      
      Pulled By: pdillinger
      
      fbshipit-source-id: 04666d310aa0261ef6b2385c43ca793ce1dfd148
      879357fd
    • Y
      Fix a bug for SeekForPrev with partitioned filter and prefix (#8137) · 09528f9f
      Yanqin Jin 提交于
      Summary:
      According to https://github.com/facebook/rocksdb/issues/5907, each filter partition "should include the bloom of the prefix of the last
      key in the previous partition" so that SeekForPrev() in prefix mode can return correct result.
      The prefix of the last key in the previous partition does not necessarily have the same prefix
      as the first key in the current partition. Regardless of the first key in current partition, the
      prefix of the last key in the previous partition should be added. The existing code, however,
      does not follow this. Furthermore, there is another issue: when finishing current filter partition,
      `FullFilterBlockBuilder::AddPrefix()` is called for the first key in next filter partition, which effectively
      overwrites `last_prefix_str_` prematurely. Consequently, when the filter block builder proceeds
      to the next partition, `last_prefix_str_` will be the prefix of its first key, leaving no way of adding
      the bloom of the prefix of the last key of the previous partition.
      
      Prefix extractor is FixedLength.2.
      ```
      [  filter part 1   ]    [  filter part 2    ]
                        abc    d
      ```
      When SeekForPrev("abcd"), checking the filter partition will land on filter part 2 because "abcd" > "abc"
      but smaller than "d".
      If the filter in filter part 2 happens to return false for the test for "ab", then SeekForPrev("abcd") will build
      incorrect iterator tree in non-total-order mode.
      
      Also fix a unit test which starts to fail following this PR. `InDomain` should not fail due to assertion
      error when checking on an arbitrary key.
      
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/8137
      
      Test Plan:
      ```
      make check
      ```
      
      Without this fix, the following command will fail pretty soon.
      ```
      ./db_stress --acquire_snapshot_one_in=10000 --avoid_flush_during_recovery=0 \
      --avoid_unnecessary_blocking_io=0 --backup_max_size=104857600 --backup_one_in=0 \
      --batch_protection_bytes_per_key=0 --block_size=16384 --bloom_bits=17 \
      --bottommost_compression_type=disable --cache_index_and_filter_blocks=1 --cache_size=1048576 \
      --checkpoint_one_in=0 --checksum_type=kxxHash64 --clear_column_family_one_in=0 \
      --compact_files_one_in=1000000 --compact_range_one_in=1000000 --compaction_ttl=0 \
      --compression_max_dict_buffer_bytes=0 --compression_max_dict_bytes=0 \
      --compression_parallel_threads=1 --compression_type=zstd --compression_zstd_max_train_bytes=0 \
      --continuous_verification_interval=0 --db=/dev/shm/rocksdb/rocksdb_crashtest_whitebox \
      --db_write_buffer_size=8388608 --delpercent=5 --delrangepercent=0 --destroy_db_initially=0 --enable_blob_files=0 \
      --enable_compaction_filter=0 --enable_pipelined_write=1 --file_checksum_impl=big --flush_one_in=1000000 \
      --format_version=5 --get_current_wal_file_one_in=0 --get_live_files_one_in=1000000 --get_property_one_in=1000000 \
      --get_sorted_wal_files_one_in=0 --index_block_restart_interval=4 --index_type=2 --ingest_external_file_one_in=0 \
      --iterpercent=10 --key_len_percent_dist=1,30,69 --level_compaction_dynamic_level_bytes=True \
      --log2_keys_per_lock=10 --long_running_snapshots=1 --mark_for_compaction_one_file_in=0 \
      --max_background_compactions=20 --max_bytes_for_level_base=10485760 --max_key=100000000 --max_key_len=3 \
      --max_manifest_file_size=1073741824 --max_write_batch_group_size_bytes=16777216 --max_write_buffer_number=3 \
      --max_write_buffer_size_to_maintain=8388608 --memtablerep=skip_list --mmap_read=1 --mock_direct_io=False \
      --nooverwritepercent=0 --open_files=500000 --ops_per_thread=20000000 --optimize_filters_for_memory=0 --paranoid_file_checks=1 --partition_filters=1 --partition_pinning=0 --pause_background_one_in=1000000 \
      --periodic_compaction_seconds=0 --prefixpercent=5 --progress_reports=0 --read_fault_one_in=0 --read_only=0 \
      --readpercent=45 --recycle_log_file_num=0 --reopen=20 --secondary_catch_up_one_in=0 \
      --snapshot_hold_ops=100000 --sst_file_manager_bytes_per_sec=104857600 \
      --sst_file_manager_bytes_per_truncate=0 --subcompactions=2 --sync=0 --sync_fault_injection=False \
      --target_file_size_base=2097152 --target_file_size_multiplier=2 --test_batches_snapshots=0 --test_cf_consistency=0 \
      --top_level_index_pinning=0 --unpartitioned_pinning=1 --use_blob_db=0 --use_block_based_filter=0 \
      --use_direct_io_for_flush_and_compaction=0 --use_direct_reads=0 --use_full_merge_v1=0 --use_merge=0 \
      --use_multiget=0 --use_ribbon_filter=0 --use_txn=0 --user_timestamp_size=8 --verify_checksum=1 \
      --verify_checksum_one_in=1000000 --verify_db_one_in=100000 --write_buffer_size=4194304 \
      --write_dbid_to_manifest=1 --writepercent=35
      ```
      
      Reviewed By: pdillinger
      
      Differential Revision: D27553054
      
      Pulled By: riversand963
      
      fbshipit-source-id: 60e391e4a2d8d98a9a3172ec5d6176b90ec3de98
      09528f9f