Skip to content

Commit

Permalink
Merge pull request #1466 from chu11/issue1462
Browse files Browse the repository at this point in the history
kvs: couple of minor fixes
  • Loading branch information
garlick authored Apr 16, 2018
2 parents 62100bf + c9c2d45 commit c644b7f
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 6 deletions.
4 changes: 0 additions & 4 deletions src/modules/kvs/kvs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1042,10 +1042,6 @@ static void kvstxn_apply (kvstxn_t *kt)
} else {
fallback = kvstxn_fallback_mergeable (kt);

flux_log (ctx->h, LOG_ERR, "kvstxn failed: %s%s",
flux_strerror (errnum),
fallback ? " (is fallbackable)" : "");

/* if merged transaction is fallbackable, ignore the fallback option
* if it's an extreme "death" like error.
*/
Expand Down
42 changes: 40 additions & 2 deletions src/modules/kvs/test/kvstxn.c
Original file line number Diff line number Diff line change
Expand Up @@ -2536,11 +2536,11 @@ void kvstxn_namespace_prefix (void)

kvstxn_mgr_remove_transaction (ktm, kt, false);

/* Third, test if invalid prefix across multiple prefixes fails */
/* Third, test if valid & indentical prefix across multiple operations works */

ops = json_array ();
ops_append (ops, "ns:primary/key3", "3", 0);
ops_append (ops, "ns:foobar/key4", "4", 0);
ops_append (ops, "ns:primary/key4", "4", 0);

ok (kvstxn_mgr_add_transaction (ktm,
"transaction3",
Expand All @@ -2550,6 +2550,44 @@ void kvstxn_namespace_prefix (void)

json_decref (ops);

ok ((kt = kvstxn_mgr_get_ready_transaction (ktm)) != NULL,
"kvstxn_mgr_get_ready_transaction returns ready kvstxn");

ok (kvstxn_process (kt, 1, rootref) == KVSTXN_PROCESS_DIRTY_CACHE_ENTRIES,
"kvstxn_process returns KVSTXN_PROCESS_DIRTY_CACHE_ENTRIES");

count = 0;
ok (kvstxn_iter_dirty_cache_entries (kt, cache_count_dirty_cb, &count) == 0,
"kvstxn_iter_dirty_cache_entries works for dirty cache entries");

ok (count == 1,
"correct number of cache entries were dirty");

ok (kvstxn_process (kt, 1, rootref) == KVSTXN_PROCESS_FINISHED,
"kvstxn_process returns KVSTXN_PROCESS_FINISHED");

ok ((newroot = kvstxn_get_newroot_ref (kt)) != NULL,
"kvstxn_get_newroot_ref returns != NULL when processing complete");

verify_value (cache, krm, KVS_PRIMARY_NAMESPACE, newroot, "key3", "3");
verify_value (cache, krm, KVS_PRIMARY_NAMESPACE, newroot, "key4", "4");

kvstxn_mgr_remove_transaction (ktm, kt, false);

/* Fourth, test if invalid prefix across multiple prefixes fails */

ops = json_array ();
ops_append (ops, "ns:primary/key5", "5", 0);
ops_append (ops, "ns:foobar/key6", "6", 0);

ok (kvstxn_mgr_add_transaction (ktm,
"transaction4",
ops,
0) == 0,
"kvstxn_mgr_add_transaction works");

json_decref (ops);

ok ((kt = kvstxn_mgr_get_ready_transaction (ktm)) != NULL,
"kvstxn_mgr_get_ready_transaction returns ready kvstxn");

Expand Down
4 changes: 4 additions & 0 deletions t/t1004-kvs-namespace.t
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,10 @@ test_expect_success 'kvs: put - fails across multiple namespaces' '
! flux kvs put ns:${NAMESPACEPREFIX}-1/$DIR.puttest.a=1 ns:${NAMESPACEPREFIX}-2/$DIR.puttest.b=2
'

test_expect_success 'kvs: put - success multiple namespace prefixes identical' '
flux kvs put ns:${NAMESPACEPREFIX}-2/$DIR.puttest.a=1 ns:${NAMESPACEPREFIX}-2/$DIR.puttest.b=2
'

test_expect_success 'kvs: namespace prefix works with dir' '
flux kvs dir ns:${NAMESPACEPREFIX}-1/. | sort >output &&
cat >expected <<EOF &&
Expand Down

0 comments on commit c644b7f

Please sign in to comment.