facebook / rocksdb

A library that provides an embeddable, persistent key-value store for fast storage.
http://rocksdb.org
GNU General Public License v2.0
28.38k stars 6.29k forks source link

RoksDB#multiGetAsList() silently ignores fetching values for keys if db file is corrupt. #12741

Open praste opened 3 months ago

praste commented 3 months ago

Note: Please use Issues only for bug reports. For questions, discussions, feature requests, etc. post to dev group: https://groups.google.com/forum/#!forum/rocksdb or https://www.facebook.com/groups/rocksdb.dev

Expected behavior

RoksDB#multiGetAsList() should throw error with code Status.Code.Corruption if db file is corrupt.

Actual behavior

We use rocksdb JNI and have a test that corrupts db files and issues a read using RocksDB#get(), it except throws error with status code Status.Code.Corruption (due to checksum mismatch). However, if a read issued using RoksDB#multiGetAsList() , simply returns a list of size 1 with a null value in it.

Steps to reproduce the behavior

  1. Open RocksDB with paranoid checks
  2. Issue a few writes
  3. Corrupt the db file (you can do it manually)
  4. Issue a read for a key (added in Step 2) using RocksDB#get() and verify it fails with exception with error code Status.Code.Corruption
  5. Now issue a read for a key (added in Step 2) using RocksDB#multiGetAsList(), it doesn't fail with exception with error code Status.Code.Corruption but returns a list with a null element in it