-
Notifications
You must be signed in to change notification settings - Fork 51
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 Jansson Updates #1108
KVS Jansson Updates #1108
Conversation
Nice! Do we need the proto.[ch] after this at all? I guess this won't |
Not sure if we can remove proto.[ch] yet, wanted to see how much you did in #1107. But it's minimally close. I think there's one test that still uses it, so perhaps we'd have to convert that. Also need to figure out where the |
#1107 removes the client API users of proto.[ch]. Ah right, As I needed each of the KVS_PROTO_* flags, I defined new ones (same values, different names) in API header files. Since the KVS module includes <flux/core.h> it can pick them up and use the new names. |
something I just thought about w/ Now under jansson, this might be what we want. Hmmm, minimally should probably just add a comment about this. |
Just peeked at The watch handling really needs a redesign, but let's not do that here. |
@garlick I think I protect against this in
when unpacking the msg, I think a "null" will be converted to a json null.
So I think val & oval will always be non-NULL. As a test I added an |
That seems reasonable then. I double-checked my changes to the |
Just ran some soak tests, and the numbers were a tad better than master. So looks like jansson is having a nice positive effect :-) |
Codecov Report
@@ Coverage Diff @@
## master #1108 +/- ##
==========================================
- Coverage 78.06% 77.98% -0.08%
==========================================
Files 159 157 -2
Lines 26220 25988 -232
==========================================
- Hits 20469 20268 -201
+ Misses 5751 5720 -31
|
Just pushed a branch rebased on current master (which includes #1107). Mostly cleanup patches, adjusting for new enums in master, added more commit API unit tests, fix corner case in t1002-kvs-cmd.t tests b/c of potential ordering issues with kvs output. Now that I've rebased, I'm sure there is some additional cleanup can be done, which I'll look into now. Perhaps |
hmmmm, I'm not really sure why travis doesn't like my unit tests. No unit tests themselves fail, but it does give up after awhile with a missing test plan error.
It's around where I put a new function in in cff8b1f dunno if it's some subtle-bash-ism or something. Maybe they want my helper function to return 0? |
That error usually happens when the test script exits before |
Hmmm, having issues passing travis. I'm sort of at a loss for the moment. This relatively simple change:
seems to be confusing the test and giving me
Which as @grondo says above, is usually indication that the test has exited early without calling I'm also regularly getting build failures on one of the travis clang builds w/ cppcheck, but I'm at a bit of a loss.
But my code seems correct.
minimally for the latter Oh well, will mull over it, maybe will have an epiphany in my sleep. |
Hmm, under the assumption that cppcheck was confused I just cleared the s1 values before re-using and that worked. index 729b4d0..2d81387 100644
--- a/src/modules/kvs/test/json_util.c
+++ b/src/modules/kvs/test/json_util.c
@@ -89,6 +89,7 @@ int main (int argc, char *argv[])
free (s1);
json_decref (obj);
+ s1 = NULL;
obj = json_null ();
@@ -102,6 +103,7 @@ int main (int argc, char *argv[])
free (s1);
json_decref (obj);
+ s1 = NULL;
ok ((s1 = json_strdump (NULL)) != NULL,
"json_strdump works on NULL pointer");
@@ -112,6 +114,7 @@ int main (int argc, char *argv[])
"json_strdump works on NULL pointer");
free (s1);
+ s1 = NULL;
done_testing ();
return (0); |
Only build tests with the object files they require, instead of using all object files in the directory. This will make it easier for testing as unit tests are updated one at a time. Eliminate unnecessary header inclusion in unit tests.
Add comments and unit tests to indicate json_compare() logic when a NULL pointer may be passed into it.
Conversion also requires elimination of use of proto.h. Convert KVS_PROTO_READDIR, KVS_PROTO_READLINK, and KVS_PROTO_TREEOBJ to FLUX_KVS_READDIR, FLUX_KVS_READLINK, and FLUX_KVS_TREEOBJ respectively.
Conversion also requires elimination of use of proto.h. Convert KVS_PROTO_READDIR, KVS_PROTO_READLINK, and KVS_PROTO_TREEOBJ to FLUX_KVS_READDIR, FLUX_KVS_READLINK, and FLUX_KVS_TREEOBJ respectively.
Add tests checking for deletes of invalid keys. Add tests for multiple fences and merged/unmerged multiple fences. Add test for giant directory.
Add util function so different parts of KVS that need to call json_dumps() call it consistently.
Convert kvs to use jansson. Use pack/unpack functions appropriately as needed to remove dependency on json-c functions. Conversion also requires elimination of use of proto.h. Convert KVS_PROTO_FIRST and KVS_PROTO_ONCE to KVS_WATCH_FIRST and KVS_WATCH_ONE appropriately.
In some watch tests, the output can be in unsorted order, leading to a mismatch with "expected" output. Add a small tweak to sort fields from the output before comparison.
With modules/kvs conversion to jansson, proto.[ch] files and functions are no longer used anywhere in flux-core. Also remove lingering build dependency on proto.o in t/Makefile.am.
With modules/kvs conversion to jansson, json_dirent.[ch] files and functions are no longer used anywhere in flux-core.
cppcheck detects "Memory pointed to by 's1' is freed twice". This is believed to be false positive. Set s1 to NULL after free to workaround it.
With jansson conversion, json_compare() is now simply a call to json_equal(). Remove json_compare() everywhere and replace with direct call to json_equal().
Create own convenience function for unit tests instead of using j_dirent_append().
The flux_kvs_txn_t object now abstracts the "op array" passed in a commit/fence request. Drop j_dirent_append() which operates on these arrays. Remove it from the jansson_dirent unit test as well.
With jansson conversions in modules/kvs and common/libkvs, j_dirent_match() was no longer used except in jansson_dirent unit tests. Remove function globally and use json_equal() in unit tests instead.
With use of jansson, some of the json_util function names may appear to be part of the jansson library. To differentiate the functions, adjust names and have all of them prefixed with "kvs_util". Rename files appropriately, use appropriate new header file, and use new functions where appropriate.
I'm going to press the button! Nice work. |
This PR converts all the code in the kvs to use jansson instead of json-c. This PR should be done AFTER @garlick's #1107 PR, but wanted to throw this up here for the time being.
Still need to valgrind check and soak test too. Maybe will add 1-2 unit tests for a code path I think should be tested.