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
libczmqcontainers: introduce new internal library of czmq zhashx
library
#3596
libczmqcontainers: introduce new internal library of czmq zhashx
library
#3596
Conversation
adcde20
to
eb7c4bb
Compare
This pull request introduces 1 alert when merging eb7c4bb into e2034e2 - view on LGTM.com new alerts:
|
Thanks for this and for the upstream work! One problem with renaming everything in the copied czmq source is that it's hard to diff later. Could we instead leave the source mostly pristine and just include the header with the rename defines? It might also be clearer to someone down the line if we left the source file names as they were, which I don't think will affect anything. Finally, would it be possible to avoid all the include additions to our source by using something like AH_BOTTOM to add our local include to config.h and then have the ability to turn it off in one place later? |
Er, I'm not sure how great of an idea that would be since it kind of hides everything. It might be better to just change the name of the new include to something more generic that could include multiple container classes, like |
This is what I had been thinking when I suggested using preprocessor to redefine symbol names. At first I was thinking of modifying just the czmq header files to include the preprocessor defines. You could presumably add |
Another thought would be to add stuff we need to detach the classes from czmq to a separate include like Then instead of defining stuff directly in zhashx.c, it could just include standalone.h (bonus: reducing the size of the diff). |
eb7c4bb
to
1dac3f0
Compare
re-pushed. Now we have these files:
with callers to load The diff is pretty tiny now with it mostly being my comments on what the file is.
|
6473bdc
to
00a39ad
Compare
This pull request introduces 1 alert when merging 00a39ad into 7aaea06 - view on LGTM.com new alerts:
|
As an side, the LGTM failure is b/c there is a "FIXME" in the zhashx implementation. So it was copied in. Won't be fixing that one so the code/comments will stay the same. |
Nice! Any reason not to just leave the source files The multi-include protection in Our commit that adds the copy of the czmq source should probably reference the foreign commit and a czmq release so we can quickly check if we're behind. Might also be good to include a note on the czmq license and a reference to the MPL in (L)GPL discussion you referenced earlier. |
Problem: A bug in the czmq zhashx library would incorrectly resize the hash. See: zeromq/czmq#2173 This would lead to significant performance issues as the hash would take up far more memory than it should and iteration of the hash would take an excess amount of time. A solution to this problem was fixed in: zeromq/czmq#2174 however the fix will not exist in most OS distributions for some time. Solution: We have copied in the zhashx implementation into a new convenience library libczmqcontainers. Code was copied from the master branch at commit d4b1a1d884532e43e82b9055ceb0b84d1db5915c. The library is copied in verbatim with only minor changes to headers and header guards. To avoid excess copying in from czmq, add a file czmq_internal.h that copies in macros, headers, and typdefs needed by the localized zhashx. To avoid symbol collisions, add a file zhashx_map.h that will convert all internal uses of "zhashx" to "fzhashx". Add a generic czmq_containers.h, that callers can include to use the internal zhashx over the shared library version. All files containing copied in code maintain their czmq license (Mozilla Public License Version 2.0). All modifications to czmq files and code were isolated to those files, no code from other parts of flux-core were copied in. See: https://www.mozilla.org/en-US/MPL/2.0/combining-mpl-and-gpl/
Problem: To avoid bugs in most OS distro's versions of czmq, we want internal flux callers to use the internal "fzhashx" library instead of the czmq "zhashx" library whenever a "zhashx" is used. Solution: Include the file "czmq_containers.h" whereever zhashx data structures are used. Update Makefile.am files to add libczmqcontainers.la when appropriate. Fixes flux-framework#3591
00a39ad
to
6771b05
Compare
Codecov Report
@@ Coverage Diff @@
## master #3596 +/- ##
==========================================
- Coverage 82.56% 82.07% -0.50%
==========================================
Files 324 325 +1
Lines 48888 49482 +594
==========================================
+ Hits 40366 40611 +245
- Misses 8522 8871 +349
|
re-pushed with tweaks per @garlick comment above |
This pull request introduces 1 alert when merging 6771b05 into 7aaea06 - view on LGTM.com new alerts:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me! Thanks!
Per discussion in #3591, bring in a new internal copy of
zhashx
into flux-core to deal with CZMQ issue zeromq/czmq#2173.zhashx
tofzhashx
in the local copyzhashx_int.h
which does pre-processor macros to changezhashx
tofzhashx
everywhere.@garlick mentioned we may want to do tweaks later as well, to perhaps not assert on malloc errors, etc. But I will leave those fixes for another day. Perhaps we will want to create an issue to remember.