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

MultiCfIterator - Handle case of invalid key from child iter manual prefix iteration #12773

Closed jaykorean closed 3 months ago

jaykorean commented 3 months ago

Summary

Instead of completely disallowing MultiCfIterator when one or more child iterators will do manual prefix iteration (as suggested in #12770 ), just let MultiCfIterator operate as is even when there's a possibility of undefined result from child iterators. If one or more child iterators cause the heap to be empty, just return early and Valid() will return false.

It is still possible that heap is not empty when one or more child iterators are returning wrong keys. Basically, MultiCfIterator behaves the same as what we described in https://github.com/facebook/rocksdb/wiki/Prefix-Seek#manual-prefix-iterating - "RocksDB will not return error when it is misused and the iterating result will be undefined."

Test Plan

MultiCfIterator added back to the stress test

python3 tools/db_crashtest.py blackbox --simple --max_key=25000000 --write_buffer_size=4194304 --use_attribute_group=0 --use_put_entity_one_in=1 --use_multi_get=1 --use_multi_cf_iterator=1 --verify_iterator_with_expected_state_one_in=2
facebook-github-bot commented 3 months ago

@jaykorean has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

facebook-github-bot commented 3 months ago

@jaykorean merged this pull request in facebook/rocksdb@0ab60b8a8c9a162f30eeb163548003e6e702eb1a.