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

Add support for loading dynamic libraries into the RocksDB environment #5281

Closed
wants to merge 43 commits into from

Conversation

mrambacher
Copy link
Contributor

This change adds a Dynamic Library class to the RocksDB Env. Dynamic libraries are populated via the Env::LoadLibrary method.

The addition of dynamic library support allows for a few different features to be developed:

  1. The compression code can be changed to use dynamic library support. This would allow RocksDB to determine at run-time what compression packages were installed. This change would eliminate the need to make sure the build-time and run-time environment had the same library set. It would also simplify some of the Java build issues (where it attempts to build and include various packages inside the RocksDB jars).

  2. Along with other features (to be provided in a subsequent PR), this change would allow code/configurations to be added to RocksDB at run-time. For example, the build system includes code for building an "rados" environment and adding "Cassandra" features. Instead of these extensions being built into the base RocksDB code, these extensions could be loaded at run-time as required/appropriate, either by configuration or explicitly.

We intend to push out other changes in support of the extending RocksDB at run-time via configurations.

mrambacher and others added 30 commits October 24, 2018 13:43
EC2 builds need it
EC2 builds need it
This reverts commit 68c839b.
@mrambacher
Copy link
Contributor Author

Can you rebase the changes, please? Thanks! There are conflicts and the change set is unnecessarily large.

I think it has been rebased. Somehow I seem to have pulled something from master accidentally.

@riversand963
Copy link
Contributor

riversand963 commented May 22, 2019

Hi @mrambacher. Please excuse my pushing commits directly to your branch, but I feel sometimes this can be more efficient and clearer.
The second and third commits are not interesting. One of them removes virtual keyword in subclasses and specifies override instead. The other is the result of running make format on my dev machine, a routine step to make the format conform to guidelines.
The interesting part is my first commit, which checks whether we should add -ldl to EXEC_LDFLAGS in build_tools/build_detect_platform. I can see two benefits in here. First, make static_lib && cd examples && make will no longer complain 'dlopen' undefined reference so that Travis can all pass. Second, we try to consolidate flag evaluation in a single place so that we do not have to check multiple files in the future.
What do you think?

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

@riversand963 has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@riversand963
Copy link
Contributor

I still see some linking errors in our internal test, will look into it.

@facebook-github-bot
Copy link
Contributor

@mrambacher has updated the pull request. Re-import the pull request

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

@riversand963 has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@mrambacher has updated the pull request. Re-import the pull request

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

@riversand963 has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@mrambacher
Copy link
Contributor Author

I am fine with the changes you have made/suggested.

Is there any documentation on the "things to do" before generating a PR to merge anywhere? I did builds on two platforms (MacOS, RedHat) and made sure all of the tests passed. I have no idea what "buckifier" is or how to make that work, but am willing to do more to make the process faster/smoother/easier.

@riversand963
Copy link
Contributor

I think making sure the local tests pass is a good start. After generating the PR, any test failure on Travis or Appveyor is also good candidate for investigation.
Regarding this PR, I can import the PR to test it with our internal tools, including buck (for which buckifier is used).

Instead use a macro to exclude dynamic library loading support from buck build.
@facebook-github-bot
Copy link
Contributor

@mrambacher has updated the pull request. Re-import the pull request

@riversand963
Copy link
Contributor

Chatted with team offline, and we decided not to add glibc as a dependency for our internal build. Instead, we use a macro to exclude this feature when building internally.

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

@riversand963 has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@mrambacher
Copy link
Contributor Author

mrambacher commented May 24, 2019 via email

@riversand963
Copy link
Contributor

riversand963 commented May 24, 2019

What platform are you using that requires libgc? The man pages say to use libdl. I am confused as to what you need.

On Fri, May 24, 2019, 18:15 Facebook Community Bot @.> wrote: @.* commented on this pull request. @riversand963 https://github.com/riversand963 has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator https://phabricator.internmc.facebook.com/D15447613. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#5281?email_source=notifications&email_token=AABCTBAORXLGHDN2FI4WAN3PXBSGZA5CNFSM4HLCH7JKYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOBZWA2FA#pullrequestreview-241962260>, or mute the thread https://github.com/notifications/unsubscribe-auth/AABCTBDJDDMUSFWPFZJWY6LPXBSGZANCNFSM4HLCH7JA .

In buck build, we have to specify ("glibc", None, "dl") as a dependency. It's a linux-based system. I did not dig very deep into why this is the case, though.

Copy link
Contributor

@riversand963 riversand963 left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks @mrambacher for the contribution.

@facebook-github-bot
Copy link
Contributor

@riversand963 merged this pull request in c826712.

vagogte pushed a commit to vagogte/rocksdb that referenced this pull request Jun 18, 2019
facebook#5281)

Summary:
This change adds a Dynamic Library class to the RocksDB Env.  Dynamic libraries are populated via the  Env::LoadLibrary method.

The addition of dynamic library support allows for a few different features to be developed:
1.  The compression code can be changed to use dynamic library support.  This would allow RocksDB to determine at run-time what compression packages were installed.  This change would eliminate the need to make sure the build-time and run-time environment had the same library set.  It would also simplify some of the Java build issues (where it attempts to build and include various packages inside the RocksDB jars).

2.  Along with other features (to be provided in a subsequent PR), this change would allow code/configurations to be added to RocksDB at run-time.  For example, the build system includes code for building an "rados" environment and adding "Cassandra" features.  Instead of these extensions being built into the base RocksDB code, these extensions could be loaded at run-time as required/appropriate, either by configuration or explicitly.

We intend to push out other changes in support of the extending RocksDB at run-time via configurations.
Pull Request resolved: facebook#5281

Differential Revision: D15447613

Pulled By: riversand963

fbshipit-source-id: 452cd4f54511c0bceee18f6d9d919aae9fd25fef
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants