1
0
mirror of https://github.com/facebook/rocksdb.git synced 2026-10-23 08:09:02 +03:00
Files
rocksdb/tools
zaidoon 4b35e9966c Add batch-owned pinned MultiGet C API (#14988)
Summary:
- add `rocksdb_batched_multi_get_pinned_cf` for batched reads using `rocksdb_slice_t` keys
- return one `rocksdb_pinnable_multi_get_t` owner for all values and per-key errors
- preserve input ordering, duplicates, misses, and sorted-input behavior
- expose indexed borrowed results plus count and destroy functions

## Why

`rocksdb_batched_multi_get_cf_slice` returns one separately allocated `rocksdb_pinnableslice_t` wrapper for every found key. Language bindings that want to retain a full batch have to manage and destroy each wrapper independently.

The new API keeps successful `PinnableSlice` values in one owner. It stores only compact value and error payloads, while a result index maps them back to the original key order. Found values and error messages remain borrowed until the batch is destroyed.

The batch must be destroyed before closing the DB that created it because pinned values can retain DB-owned cache state.

## Compatibility

This is additive. Existing MultiGet APIs and ownership rules are unchanged.

## Testing

`c_test` covers:

- found and missing keys
- duplicate keys and input ordering
- empty values
- per-key merge errors
- sorted and unsorted input
- empty batches
- out-of-bounds access
- borrowed value and error lifetimes

Validation run locally:

- `make -j8 check-c-api-c_test`
- `CXX=clang++ make check-c-api-gen CHECK_C_API_GEN_STRICT=1 CLANG_FORMAT_BINARY=clang-format`
- C API link-completeness and backward-compatibility checks

This API is intended to replace a temporary compatibility extension in `rust-rocksdb` once it is available in a RocksDB release.

Pull Request resolved: https://github.com/facebook/rocksdb/pull/14988

Reviewed By: jaykorean

Differential Revision: D114357453

Pulled By: xingbowang

fbshipit-source-id: a35785f7bb4d097b391932e2b9f96fc177d1ba1c
2026-08-02 14:13:23 -07:00
..
2024-10-14 03:01:20 -07:00
2022-10-13 09:00:37 -07:00
2024-10-14 03:01:20 -07:00
2017-08-03 15:56:46 -07:00
2026-07-01 19:04:40 -07:00
2017-08-03 15:56:46 -07:00
2023-01-27 13:14:19 -08:00
2023-01-27 13:14:19 -08:00
2024-10-14 03:01:20 -07:00