C API: add rocksdb_delete_range_cf_with_ts for user-defined timestamps

Open Beginner friendly
#14,870 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Quiet
Tech stack
c, cpp
Domain
api, database

Research direction

Start with include/rocksdb/c.h and compare the existing rocksdb_delete_range_cf and rocksdb_delete_cf_with_ts declarations. Then inspect db/c.cc and db/c_test.c for their corresponding implementation and timestamped-delete test patterns. Done means the new entry point forwards the timestamped range deletion, the C test covers it, and the unreleased_history note is updated.

Written by the indexing model from the issue text.

Description

Summary

The C API has no way to issue a range deletion with a user-defined timestamp. DB::DeleteRange has had a UDT overload (DeleteRange(const WriteOptions&, ColumnFamilyHandle*, const Slice& begin, const Slice& end, const Slice& ts)) on the C++ side for years, but the C API only exposes the non-timestamped rocksdb_delete_range_cf. There is no rocksdb_delete_range_cf_with_ts.

This leaves a gap for C and FFI consumers (e.g. the rust-rocksdb bindings): on a column family that enables user-defined timestamps, you can issue timestamped point deletes (rocksdb_delete_cf_with_ts, rocksdb_singledelete_cf_with_ts) but you cannot issue a timestamped range delete at all.

Background

The original UDT C-API work (#9889 / #9914) added timestamped Get, MultiGet, Delete, and SingleDelete, but did not include range deletes. This issue tracks completing that surface with the one missing entry point.

Proposed API

extern ROCKSDB_LIBRARY_API void rocksdb_delete_range_cf_with_ts(
    rocksdb_t* db, const rocksdb_writeoptions_t* options,
    rocksdb_column_family_handle_t* column_family, const char* start_key,
    size_t start_key_len, const char* end_key, size_t end_key_len,
    const char* ts, size_t tslen, char** errptr);

A thin forwarder to the existing C++ overload, modeled exactly on rocksdb_delete_cf_with_ts (for the Slice(ts, tslen) + SaveError pattern) and rocksdb_delete_range_cf (for the begin/end key plumbing).

Environment

  • RocksDB: main (also reproduces on the 11.x releases)
  • C API header: include/rocksdb/c.h

I have a patch ready (header declaration, db/c.cc implementation, a db/c_test.c case covering write-at-ts then delete-range-at-later-ts then read-at-later-ts, and an unreleased_history note) and am happy to open a PR.

Dominant language
C++
Stars
32.1k
Forks
6.9k
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from facebook/rocksdb

All issues in facebook/rocksdb

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.