Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated API for compatibility with latest rocksdb #13

Merged
merged 5 commits into from
Mar 28, 2022

Conversation

alexreg
Copy link

@alexreg alexreg commented Mar 5, 2022

Made API compatible with rocksdb v6.29.3.

Removed following properties of ColumnFamilyOptions, which have been deprecated for some time. (They cause issues with Cython right now, and will be obsolete in v7 anyway.)

  • soft_rate_limit
  • hard_rate_limit
  • rate_limit_delay_max_milliseconds
  • purge_redundant_kvs_while_flush
  • skip_log_error_on_recovery

Resolves #11.

@NightTsarina
Copy link
Owner

Hi @alexreg, thanks for the PR!

I have created a branch and PR to make the github CI test buiilding the library against the newer versions of librocksdb. Could you rebase this branch over it so we can verify all works?

Independently of that, I see that there is a breaking change that is already making the build fail against the older versions of librocksdb, which we might need to support for a while. Do you think it would be possible to make this change backwards compatible?

@NightTsarina
Copy link
Owner

One further comment: after making the changes for the CI, I see that the builds are succeeding with v6.29.3, without applying your change.. Is the CI doing something wrong, or we don't actually need this change?

@alexreg
Copy link
Author

alexreg commented Mar 7, 2022

@NightTsarina The CI must be doing something wrong, because the API for 6.29.3 removed a few bits of the API that Python was trying to bind against. Let me check...

@alexreg
Copy link
Author

alexreg commented Mar 7, 2022

One of the notable differences is that rocksdb/utilities/backupable_db.h got renamed to rocksdb/utilities/backup_engine.h in a recent version of rocksdb (not sure which).

An interesting approach (given you don't want to compile a fixed version of rocksdb along with python-rocksdb) would be to actually query which version of rocksdb is available on the system, and adjust the Python bindings accordingly. I believe Cython can do that!

P.S. Did you already remove the branch you created for testing/CI? The link is stale now.

@alexreg alexreg force-pushed the update-api branch 5 times, most recently from bb5ea22 to 272d3b6 Compare March 8, 2022 16:58
@alexreg
Copy link
Author

alexreg commented Mar 8, 2022

So, I've been doing some investigating, and come to a few realisations:

  • The deprecated rocksdb/utilities/backupable_db.h still exists as a proxy for rocksdb/utilities/backup_engine.h, so we can still use that for now, though going forwards you'll want to change to backup_engine.h. (The old header file is removed in rocksdb 7.0).
  • Various members of ColumnFamilyOptions have been deprecated for some time, and those are the ones I've removed. They're removed completely from the underlying rocksdb in 7.0.
  • We can use pkgconfig (specifically the Python package for it) to try to auto-configure compiling & linking against rocksdb when possible. If not, we fall back and use the previous manual configuration, though I added a bit of functionality so you can specify the include and lib paths to search. This is necessary in particular on macOS with Homebrew, where rocksdb is installed in /opt/homebrew and without a pkg-config file.

I also put in a few comments in the backup.pxd file about how to update it in the near future.

Hopefully all tests should pass now.

@alexreg
Copy link
Author

alexreg commented Mar 9, 2022

Seems like just some tests are failing now, which use the old ColumnFamilyOptions members.

Copy link
Owner

@NightTsarina NightTsarina left a comment

Choose a reason for hiding this comment

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

Great work, thanks!

There are a couple of pending issues, but I think we can merge this soon.

CC: @dato and @FdelMazo to see what they think.

pyproject.toml Show resolved Hide resolved
rocksdb/_rocksdb.pyx Show resolved Hide resolved
rocksdb/backup.pxd Show resolved Hide resolved
@NightTsarina NightTsarina requested review from dato and FdelMazo March 9, 2022 23:48
@alexreg
Copy link
Author

alexreg commented Mar 10, 2022

Thanks for the review. I just fixed the issues with the tests and CI, so hopefully everything will pass now!

.github/workflows/debian.yml Outdated Show resolved Hide resolved
.github/workflows/dist.yml Outdated Show resolved Hide resolved
rocksdb/backup.pxd Outdated Show resolved Hide resolved
@alexreg alexreg force-pushed the update-api branch 6 times, most recently from 7b9e345 to 3f070e1 Compare March 10, 2022 17:32
@alexreg
Copy link
Author

alexreg commented Mar 10, 2022

Note: Cython seems to insist on using the first signature for BackupEngine::Open, so we do in fact need to flip the order of the first two parameters to the current one.

@alexreg
Copy link
Author

alexreg commented Mar 11, 2022

Almost all passing now... It seems the Ubuntu package for python-pkgconfig is old, and missing a bit of the API that setup.py uses. Can we install using pip instead, maybe?

@dato
Copy link
Collaborator

dato commented Mar 14, 2022

LGTM.

It would be great if the commit,
or the merged PR description, would enumerate the properties that where deleted.

@alexreg
Copy link
Author

alexreg commented Mar 14, 2022

@dato Sure, I'll do that now.

alexreg added 3 commits March 14, 2022 20:04
Removed following properties of ColumnFamilyOptions, which have been deprecated for some time. (They cause issues with Cython right now, and will be obsolete in v7 anyway.)

* `soft_rate_limit`
* `hard_rate_limit`
* `rate_limit_delay_max_milliseconds`
* `purge_redundant_kvs_while_flush`
* `skip_log_error_on_recovery`
@rollue
Copy link

rollue commented Mar 24, 2022

Looking forward to this PR merge so much

@NightTsarina
Copy link
Owner

@alexreg In case you missed it, last week I've sent you a PR (alexreg#1) to fix the last remaining issues.

@alexreg
Copy link
Author

alexreg commented Mar 28, 2022

@NightTsarina Thank you. I didn't get notified about it for some strange reason. I added your commit now!

@alexreg
Copy link
Author

alexreg commented Mar 28, 2022

It's up to you of course, but maybe we could also add a brief note in the README about manually setting INCLUDE_PATH and LIBRARY_PATH? That is, it is needed if a) rocksdb lib & headers are not in the default C compiler path, and b) either pkgconfig is not installed or the rocksdb pkgconfig definition is not present. This is notably the case with macOS and Homebrew, and possibly other situations too.

@alexreg
Copy link
Author

alexreg commented Mar 28, 2022

Ugh, the situation is complicated now by the latest rocksdb release being 7.0.3, which Homebrew uses. This has dropped the rocksdb/utilities/backupable_db.h file altogether (no longer just deprecated).

@NightTsarina
Copy link
Owner

It's up to you of course, but maybe we could also add a brief note in the README about manually setting INCLUDE_PATH and LIBRARY_PATH? That is, it is needed if a) rocksdb lib & headers are not in the default C compiler path, and b) either pkgconfig is not installed or the rocksdb pkgconfig definition is not present. This is notably the case with macOS and Homebrew, and possibly other situations too.

Oh yes, definitely, I missed that!

The tests are finally passing (yayy!!!), so let's merge this now. Could you send a follow-up PR with the documentation patch?

Ugh, the situation is complicated now by the latest rocksdb release being 7.0.3, which Homebrew uses. This has dropped the rocksdb/utilities/backupable_db.h file altogether (no longer just deprecated).

That is a different major version, I don't think it would be a good idea to switch right away, considering we still have quite some unfinished work in 6.x. Does homebrew not allow you to stay with an older version?

I think it might make sense to just compile it from source, like we do here for actions, and it is quite straightforward.. We could add it to the README too, with detailed instructions for macOS users.

@NightTsarina NightTsarina merged commit be185cc into NightTsarina:main Mar 28, 2022
@alexreg
Copy link
Author

alexreg commented Mar 28, 2022

Ugh, the situation is complicated now by the latest rocksdb release being 7.0.3, which Homebrew uses. This has dropped the rocksdb/utilities/backupable_db.h file altogether (no longer just deprecated).

@rollue FYI This is probably the source of your issue.

@alexreg
Copy link
Author

alexreg commented Mar 28, 2022

@NightTsarina Great, thanks for merging.

I agree... I'll just compile from source for now. (Homebrew only has the latest version for most software.)

I actually started porting to v7, but didn't get too far.

@alexreg alexreg deleted the update-api branch March 30, 2022 02:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Build issue on macOS
4 participants