-
Notifications
You must be signed in to change notification settings - Fork 50
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 symlinks with namespaces within them #1949
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1949 +/- ##
==========================================
+ Coverage 80% 80.01% +<.01%
==========================================
Files 195 195
Lines 34913 34987 +74
==========================================
+ Hits 27933 27994 +61
- Misses 6980 6993 +13
|
ENODATA might be a bad choice because it is the RFC 6 end-of-stream indicator. Some code, e.g. see |
Doh! I totally forgot about that. Hmmm I guess |
Or maybe just change const char *treeobj_get_symlink (const json_t *obj); to int treeobj_get_symlink (const json_t *obj, const char **namespace, const char **target); and set |
Oh, that's a good idea. Lets go with that. |
ee1588d
to
69dac65
Compare
re-pushed with new |
This might be slightly confusing:
So if I want
A minor tweak would be to change "Specify link's namespace" with "specify target's namespace". Or, would it be better if
Thoughts? |
It actually might make sense for the tool (not the API) to always take a ns:: prefix whereever there is a key? Then drop the "global" |
Yeah, "target namespace" makes a lot more sense.
I dislike the idea that the user would have to know a special format to specify the namespace. I feel like there should always be an option. As for supporting a
And we get into some of the same trappings we had before. Perhaps the issue is the output of
As an aside, I admittedly dislike the global "--namespace" option b/c it's used somewhat weirdly. i.e.
The
but that would mean every sub-commands would have to handle the namespace option. Perhaps my desire to have cleaner coding got in the way. Perhaps each sub-command should simply parse the namespace option instead. |
OK, that sounds like a reasonable position. I withdraw that suggestion :-) I don't necessarily have a strong opinion on the output format. Since we both don't like the global |
Was noticing vim colorizes the word |
I don't recall agreeing to that, but it does seem like a good idea. I'll adjust code accordingly. |
Was going to try and correct |
69dac65
to
588f5c8
Compare
re-pushed with |
One builder failed in |
Hmmm, it's worrisome since this PR is related to the KVS. But it appears this has shown up a few times before, including recently (#1936, #1931, #1846) where the tests pass, so the error is from the shutdown of the broker. Of the few log entries we have with details (including this one):
it always appears to be these two modules not cleanly being shutdown. @grondo suggests grace timeout issue in #1931. I guess I don't quite know the behavior of the broker in these circumstances. If a module unload takes too long, does it SIGTERM? |
It seems if a runlevel takes too long it gets a SIGTERM ... possible travis is just taking to long to run rc3? |
The "not cleanly shutdown" messages are hints that it was indeed the rc3 timeout. Whether it's travis being slow or one of the module unloads getting stuck (kvs unloads before content-sqlite) so prob kvs), it's hard to tell. So maybe it's worth pondering whether anything in this PR could conceivably cause the kvs module to get stuck, and then move on if not? |
I can't think of anything. And the fact it occurred in several other issues recently suggests it's something outside of these changes. I wasn't too familiar with how an unload of a module works, but it appears that a module unload sends a rpc to I also noticed in rc3:
the fact we only see "not cleanly shutdown" once for the kvs module suggest to me that the first |
The default shutdown handler calls Let's consider that failure unrelated to this PR then. |
588f5c8
to
ca64dd7
Compare
rebased and re-pushed |
7dcc877
to
05f6cac
Compare
oops, rebase bug, repushed |
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.
I made a few minor review comments - see what you think.
Overall this is looking good. Nice work!
doc/man3/flux_kvs_txn_create.adoc
Outdated
`flux_kvs_txn_symlink()` sets _key_ to a symbolic link pointing to a | ||
namespace _ns_ and a _target_ key within that namespace. Neither | ||
_ns_ nor _target_ must exist. The namespace _ns_ is optional, if | ||
set to NULL the _target_'s current namespace is assumed. |
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.
Should it be the key's target namespace is assumed?
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.
ahh, you're right!
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.
what I really meant to say was, "the target is assumed to be in the key's current namespace."
@@ -32,7 +32,8 @@ SYNOPSIS | |||
const char *key); |
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.
Not critical but "common" is not that helpful in the commit title. Maybe go with "libkvs/txn:" for this one?
@@ -171,9 +171,9 @@ void _treeobj_insert_entry_val (json_t *obj, const char *name, | |||
* created symlink can be properly dereferenced |
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.
Just a thought (feel free to ignore) but kvs/lookup test is pretty huge. Should it be split?
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.
It's smaller than when we had ns prefix support :-) But yeah, it is quite big. And the kvstxn.c tests too. I'll take a look in the future to splitting it up. I never split it up before b/c there wasn't an obvious split in the tests.
Update symlink treeobj to have object for data instead of a string. The object has a target and an optional namespace. Add tests and update callers.
Support namespace in symlinks in kvs txn requests. Add unit tests appropriately.
Add namespace parameter to flux_kvs_lookup_get_symlink(). Update callers appropriately.
Support namespaces in symlinks in txns and lookups. Add / update unit tests appropriately.
Add ability for readlink to read symlink tree objects with namespaces. Add options to limit output to only keys or only namespaces if the user desires.
05f6cac
to
bae80e4
Compare
repushed with suggested changes to commit comments and tweak to documentation |
LGTM - thanks! |
This is the third part to issue #1860, implementing namespace symlink support as described by RFC change flux-framework/rfc#147.
Basically, we're changing the treeobj of a symlink to:
where the "namespace" field is optional. Adjustments to all functions that relate to symlinks are done (
treeobj_create_symlink()
,flux_kvs_lookup_get_symlink()
, andflux_kvs_txn_symlink()
are the obvious ones). Subsequently new options to
flux kvs link
andflux kvs readlink
.The one part of this PR I really like is how so little changed in
modules/kvs
and there were no changes inmodules/kvs-watch
. So I think this was a much better choice than the ns prefix we did earlier.The one part of this PR that folks may find weird is in the function
treeobj_get_symlink_namespace()
. If the symlink does not contain a namespace, I elect to return NULL and set errno to ENODATA, instead of EINVAL. So that callers have a way to differentiate between no namespace and an invalid treeobj. I'm not 100% if this is the right errno or the right pattern to use. Thoughts?Also up for discussion may be the "ns::key" output format I use in
flux-kvs
.