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: do not generate uuid for commit transactions, use fixed algorithm for 'name' #1458

merged 3 commits into from Apr 13, 2018
Changes from 1 commit
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.
+7 −15
Diff settings


Just for now


modules/kvs: Use rank & seq for commit txn name

For commit transactions, instead of generating a name using
an expensive to generate uuid, instead use a simple fixed
name involving a flux rank and a per rank sequence number.

Fixes #1446
  • Loading branch information...
chu11 committed Apr 12, 2018
commit 2e4877b8037f121ec7c65101eeb1f693c48079a7
Copy path View file
@@ -86,6 +86,7 @@ typedef struct {
int transaction_merge;
bool events_init; /* flag */
const char *hash_name;
unsigned int seq; /* for commit transactions */
} kvs_ctx_t;

struct kvs_cb_data {
@@ -1818,8 +1819,6 @@ static void commit_request_cb (flux_t *h, flux_msg_handler_t *mh,
kvs_ctx_t *ctx = arg;
struct kvsroot *root;
const char *namespace;
zuuid_t *uuid = NULL;
const char *name;
int saved_errno, flags;
bool stall = false;
json_t *ops = NULL;
@@ -1847,14 +1846,8 @@ static void commit_request_cb (flux_t *h, flux_msg_handler_t *mh,
goto error;

if (!(uuid = zuuid_new ())) {
flux_log_error (h, "%s: zuuid_new", __FUNCTION__);
goto error;
name = zuuid_str (uuid);

if (!(tr = treq_create (name, 1, flags))) {
flux_log_error (h, "%s: treq_create", __FUNCTION__);
if (!(tr = treq_create_rank (ctx->rank, ctx->seq++, 1, flags))) {
flux_log_error (h, "%s: treq_create_rank", __FUNCTION__);
goto error;
if (treq_mgr_add_transaction (root->trm, tr) < 0) {
@@ -1880,7 +1873,7 @@ static void commit_request_cb (flux_t *h, flux_msg_handler_t *mh,
treq_set_processed (tr, true);

if (kvstxn_mgr_add_transaction (root->ktm,
treq_get_name (tr),
flags) < 0) {
flux_log_error (h, "%s: kvstxn_mgr_add_transaction",
@@ -1895,7 +1888,7 @@ static void commit_request_cb (flux_t *h, flux_msg_handler_t *mh,
if (!(f = flux_rpc_pack (h, "kvs.relaycommit", 0, FLUX_RPC_NORESPONSE,
"{ s:O s:s s:s s:i }",
"ops", ops,
"name", name,
"name", treq_get_name (tr),
"namespace", alt_ns ? alt_ns : namespace,
"flags", flags))) {
flux_log_error (h, "%s: flux_rpc_pack", __FUNCTION__);
@@ -1909,7 +1902,6 @@ static void commit_request_cb (flux_t *h, flux_msg_handler_t *mh,
if (flux_respond (h, msg, errno, NULL) < 0)
flux_log_error (h, "%s: flux_respond", __FUNCTION__);
zuuid_destroy (&uuid);
free (alt_ns);
Copy path View file
@@ -248,7 +248,7 @@ treq_t *treq_create (const char *name, int nprocs, int flags)
return NULL;

treq_t *treq_create_rank (uint32_t rank, uint32_t seq, int nprocs, int flags)
treq_t *treq_create_rank (uint32_t rank, unsigned int seq, int nprocs, int flags)
treq_t *tr = NULL;
int saved_errno;
Copy path View file
@@ -45,7 +45,7 @@ int treq_mgr_transactions_count (treq_mgr_t *trm);
treq_t *treq_create (const char *name, int nprocs, int flags);

/* treq_create_rank - internally will create name based on rank & seq */
treq_t *treq_create_rank (uint32_t rank, uint32_t seq, int nprocs, int flags);
treq_t *treq_create_rank (uint32_t rank, unsigned int seq, int nprocs, int flags);

void treq_destroy (treq_t *tr);

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.