Skip to content

fix: support building against rocksdb-11#8

Open
jansegre wants to merge 1 commit intomasterfrom
fix/rocksdb-11-support
Open

fix: support building against rocksdb-11#8
jansegre wants to merge 1 commit intomasterfrom
fix/rocksdb-11-support

Conversation

@jansegre
Copy link
Copy Markdown
Member

Build broke on macOS after rocksdb was updated to v11 on homebrew. This PR introduces a small shim to to fix support and restore compatibility.

@jansegre jansegre self-assigned this Apr 30, 2026
@jansegre jansegre requested review from glevco and luislhl April 30, 2026 16:36
@jansegre jansegre moved this from Todo to In Progress (Done) in Hathor Network Apr 30, 2026
@jansegre jansegre force-pushed the fix/rocksdb-11-support branch 2 times, most recently from 9022202 to 9091659 Compare April 30, 2026 17:44
@github-project-automation github-project-automation Bot moved this from In Progress (Done) to In Review (WIP) in Hathor Network Apr 30, 2026
@luislhl luislhl requested a review from Copilot May 5, 2026 18:56
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR restores build compatibility with RocksDB v11 by introducing a C++ shim layer that normalizes the rocksdb::DB::Open* APIs across RocksDB versions, and updating the Cython bindings to call through that shim.

Changes:

  • Added rocksdb/cpp/db_helpers.hpp to provide py_rocks::DBOpen* wrappers that adapt RocksDB’s newer std::unique_ptr-based Open* APIs to the existing DB** shape used by the Cython bindings.
  • Updated rocksdb/db.pxd to bind DB_Open* symbols to the new shim functions.
  • Updated DB.close() to explicitly destroy the native rocksdb::DB* after Close().
  • Bumped package version to 0.10.1.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
rocksdb/db.pxd Redirects DB open bindings to shim functions in cpp/db_helpers.hpp, and exposes DB_Destroy.
rocksdb/cpp/db_helpers.hpp New compatibility wrappers for RocksDB DB::Open* / OpenAsSecondary* / OpenForReadOnly* across versions.
rocksdb/_rocksdb.pyx Ensures the native rocksdb::DB* is deleted during DB.close() to avoid leaks and match new open behavior.
pyproject.toml Version bump to 0.10.1.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread rocksdb/cpp/db_helpers.hpp
Comment thread rocksdb/_rocksdb.pyx
Comment on lines 1569 to 1572
with nogil:
st = self.db.Close()
db.DB_Destroy(self.db)
self.db = NULL
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this is important to be able to avoid corrupting the DB in certain situations?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On rocksdb, a close cannot fail, if anything errors it's left on the filesystem, not on the DB struct.

@jansegre jansegre force-pushed the fix/rocksdb-11-support branch from 9091659 to 1fd7272 Compare May 5, 2026 21:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Review (WIP)

Development

Successfully merging this pull request may close these issues.

4 participants