Skip to content

rocksdb: add enableLiburing option - #314945

Merged
superherointj merged 3 commits into
NixOS:stagingfrom
olivia-fl:rocksdb-uring-option
Jun 18, 2024
Merged

superherointj merged 3 commits into
NixOS:stagingfrom
olivia-fl:rocksdb-uring-option

Conversation

@olivia-fl

Copy link
Copy Markdown
Contributor

Description of changes

Rocksdb added support for io-uring in v6.7.0. This PR adds an enableLiburing option to the package to enable this.

In the process, I discovered that the liburing package is broken in static stdenv, and outputs both static and dynamic libraries unconditionally. This causes rocksdb to link against the static liburing when built in a dynamic stdenv. In conduwuit, we are using an overlay to add liburing support to rocksdb and fix the static library issues with liburing, but would like to be able to just use upstream nixpkgs.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.11 Release Notes (or backporting 23.11 and 24.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@ofborg
ofborg Bot requested review from NickCao, adevress and thoughtpolice May 26, 2024 22:49
@ofborg ofborg Bot added 10.rebuild-darwin: 11-100 This PR causes between 11 and 100 packages to rebuild on Darwin. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 501-1000 This PR causes many rebuilds on Linux and should normally target the staging branches. labels May 26, 2024
@olivia-fl
olivia-fl force-pushed the rocksdb-uring-option branch from d4ff572 to efbeda2 Compare May 27, 2024 00:59
x86pup pushed a commit to x86pup/conduwuit that referenced this pull request May 27, 2024
The original implementation of this was really weird, so I restructed it
a lot while debugging, and am just gonna leave the restructured version.

Root cause of the segfault seems to be that upstream nixpkgs liburing
derivation is generating both static and dynamic libraries, causing
rocksdb to statically link liburing in a dynamic build, pulling in some
allocator stuff at the same time. I created a PR[1] to fix this upstream,
but it probably won't be available on nixos-unstable for quite a while,
so we can also patch it locally.

[1]: NixOS/nixpkgs#314945
@PedroHLC

Copy link
Copy Markdown
Member

@Benjamin-L can you rebase this branch?

If the static libraries are available, rocksdb will try to link against
them instead of the dynamic libraries.
@olivia-fl
olivia-fl force-pushed the rocksdb-uring-option branch from efbeda2 to 65a6502 Compare June 18, 2024 19:32
@olivia-fl

Copy link
Copy Markdown
Contributor Author

@PedroHLC Rebased onto current staging.

@PedroHLC PedroHLC left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, couldn't test it against staging, but have been seeing this working out perfectly in conduwuit flake.

@superherointj
superherointj merged commit 5d55b71 into NixOS:staging Jun 18, 2024
@vcunat

vcunat commented Jul 6, 2024

Copy link
Copy Markdown
Member

db863ae liburing: don't emit extra static libraries

I'm not opposed in principle, but this breaks ceph build (verified by testing build with that single change reverted). Example log: https://hydra.nixos.org/build/265092568/nixlog/2/tail

@PedroHLC

PedroHLC commented Jul 6, 2024 •

Copy link
Copy Markdown
Member

db863ae liburing: don't emit extra static libraries

I'm not opposed in principle, but this breaks ceph build (verified by testing build with that single change reverted). Example log: https://hydra.nixos.org/build/265092568/nixlog/2/tail

Hummm, that smells like something to be fixed in Ceph and not here. It looks like it's using/expecting either the static with the shared library stdenv's output or the inverse...

@vcunat

vcunat commented Jul 6, 2024

Copy link
Copy Markdown
Member

In principle, static linkage isn't all-or-nothing situation.

@superherointj superherointj mentioned this pull request Jul 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

10.rebuild-darwin: 11-100 This PR causes between 11 and 100 packages to rebuild on Darwin. 10.rebuild-linux: 501-1000 This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants