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

kvs: support non-environment variable mechanism to choose namespace #1328

Merged
merged 10 commits into from
Feb 8, 2018

Conversation

chu11
Copy link
Member

@chu11 chu11 commented Feb 8, 2018

Previously, the only way to set/use a non-default KVS namespace was through the environment variable FLUX_KVS_NAMESPACE. This is inconvenient. This PR adds a flux_kvs_set_namespace() and flux_kvs_get_namespace() set of functions, which allows a namespace to be set for a particular flux handle.

This allows a simple --namespace option to be added to the flux-kvs command.

This is a far more simple way to specify a namespace. The environment variable option is still there, but using the functions/kvs option takes precedence over the environment variable.

This option allows us to clean up the unit tests a ton, as there was no need to constantly set/unset FLUX_KVS_NAMESPACE everywhere.

chu11 added 3 commits February 7, 2018 17:06
To many libkvs functions, add input check for NULL flux handle and
other bad inputs.

Add unit tests appropriately.
Support new functions flux_kvs_set_namespace() and flux_kvs_get_namespace()
functions, which set a namespace for a specific flux_t handle.  This
allows an easier interface for selecting a namespace other than setting
the FLUX_KVS_NAMESPACE environment variable.  The value set in the
handle takes precedence over the value specified in the environment
variable.

Adjust functions to call flux_kvs_get_namespace() instead of private
get_kvs_namespace().

As a side consequence, kvs_private.h is no longer needed as
get_kvs_namespace() is removed, so remove this file.

Add unit tests & manpages for new functions.
@coveralls
Copy link

coveralls commented Feb 8, 2018

Coverage Status

Coverage increased (+0.04%) to 78.564% when pulling cfdc0ce on chu11:kvsnamespaceset into 0f7cadb on flux-framework:master.

@garlick
Copy link
Member

garlick commented Feb 8, 2018

Just had a quick peek and looks good.

The flux-kvs(1) namespace option is missing the usual short,long option formatting, e.g. from flux-start(1):

*-b, --bootstrap*='METHOD'::
Select the flux bootstrap method.  Possible values of 'METHOD' are:

Since the other options are subcommand-specific, should that section be renamed to COMMON OPTIONS maybe?

I'd say the part in the intro about namespace consistency can be dropped, since it follows the same pattern as other KVS operations. If we do need it, maybe it could go in a new section on consistency below the subcommand descriptions? Seems a bit detailed for the intro.

@chu11
Copy link
Member Author

chu11 commented Feb 8, 2018

just pushed changes per your suggestions. Since the changes in the doc for the flux-kvs option was so tiny, I went ahead and squashed it.

@garlick
Copy link
Member

garlick commented Feb 8, 2018

Restarted one builder that seemed hung right after the python tests (assuming that's not related to this PR).

The chainlint build is failing the namespace sharness test in the same way that mine was failing in #1320. Not sure if the same background process issue is in play here as well - I didn't spot it if so, but I didn't look too hard.

chu11 added 2 commits February 8, 2018 13:57
Inform callers that flux_kvs_set_namespace() is an alternate
mechanism to using a different namespace.
@chu11
Copy link
Member Author

chu11 commented Feb 8, 2018

It ends up with my changes, I forgot a && in one of tests. Will re-push shortly.

chu11 added 5 commits February 8, 2018 14:54
Clean up all kvs tests to use --namespace option in flux kvs, instead
of setting the environment variable.  Remove now unnecessary helper
functions throughout.
Add tests to ensure priority ordring of how you specify a namespace
works as expected.
Update test so that fence_namespace_remove binary takes a namespace
as a parameter.
@chu11
Copy link
Member Author

chu11 commented Feb 8, 2018

travis failed a unit test. Ended up I accidentally deleted a line in a test file. just re-pushed,

@codecov-io
Copy link

Codecov Report

Merging #1328 into master will increase coverage by 0.03%.
The diff coverage is 88.57%.

@@            Coverage Diff             @@
##           master    #1328      +/-   ##
==========================================
+ Coverage    78.2%   78.23%   +0.03%     
==========================================
  Files         156      156              
  Lines       28291    28315      +24     
==========================================
+ Hits        22124    22153      +29     
+ Misses       6167     6162       -5
Impacted Files Coverage Δ
src/common/libkvs/kvs_lookup.c 77.69% <100%> (ø) ⬆️
src/common/libkvs/kvs_commit.c 83.33% <100%> (+5.55%) ⬆️
src/common/libkvs/kvs_watch.c 91.41% <100%> (+2.87%) ⬆️
src/cmd/flux-kvs.c 81.01% <66.66%> (-0.16%) ⬇️
src/common/libkvs/kvs.c 96% <88.88%> (-4%) ⬇️
src/modules/kvs/kvs.c 65.61% <0%> (-0.18%) ⬇️
src/bindings/lua/flux-lua.c 81.08% <0%> (-0.09%) ⬇️
src/common/libflux/message.c 81.6% <0%> (+0.23%) ⬆️
src/common/libutil/dirwalk.c 94.28% <0%> (+0.71%) ⬆️
src/common/libflux/response.c 84.55% <0%> (+0.81%) ⬆️
... and 3 more

@garlick
Copy link
Member

garlick commented Feb 8, 2018

Yay! Ready?

@chu11
Copy link
Member Author

chu11 commented Feb 8, 2018

yup

@garlick garlick merged commit 7ce22e2 into flux-framework:master Feb 8, 2018
@chu11 chu11 deleted the kvsnamespaceset branch June 5, 2021 16:02
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.

4 participants