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: report error to all fence requests #6583

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/common/libkvs/kvs_txn_compact.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
*
* append "A"
* write "B"
* append "c"
* append "C"
*
* we cannot combine the appends of "A" and "C". In this scenario, we
* generate an EINVAL error to the caller, indicating that the
Expand Down
12 changes: 11 additions & 1 deletion src/modules/kvs/kvs.c
Original file line number Diff line number Diff line change
Expand Up @@ -2046,7 +2046,7 @@
flux_log_error (h,
"%s: kvstxn_mgr_add_transaction",
__FUNCTION__);
goto error;
goto error_all;

Check warning on line 2049 in src/modules/kvs/kvs.c

View check run for this annotation

Codecov / codecov/patch

src/modules/kvs/kvs.c#L2049

Added line #L2049 was not covered by tests
}

tstat_push (&ctx->txn_fence_stats,
Expand Down Expand Up @@ -2077,6 +2077,16 @@
request_tracking_add (ctx, msg);
return;

error_all:

Check warning on line 2080 in src/modules/kvs/kvs.c

View check run for this annotation

Codecov / codecov/patch

src/modules/kvs/kvs.c#L2080

Added line #L2080 was not covered by tests
/* An error has occurred, so we will return an error similarly to
* how an error would be returned via a transaction error in
* kvstxn_apply().
*/
if (error_event_send_to_name (ctx, ns, name, errno) < 0)
flux_log_error (h, "%s: error_event_send_to_name", __FUNCTION__);
request_tracking_remove (ctx, msg);

Check warning on line 2087 in src/modules/kvs/kvs.c

View check run for this annotation

Codecov / codecov/patch

src/modules/kvs/kvs.c#L2085-L2087

Added lines #L2085 - L2087 were not covered by tests
return;

error:
if (flux_respond_error (h, msg, errno, errmsg) < 0)
flux_log_error (h, "%s: flux_respond_error", __FUNCTION__);
Expand Down
22 changes: 11 additions & 11 deletions t/kvs/fence_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ typedef struct {
int sequence;
} thd_t;

static int count = -1;
static int fencecount = -1;
static char *prefix = NULL;
static char *fence_name;
static bool syncflag = false;
Expand All @@ -58,7 +58,7 @@ static void usage (void)
fprintf (stderr,
"Usage: fence_api "
"[--sync] [--symlink] [--namespace=ns] "
"count prefix\n");
"<fencecount> <prefix>\n");
exit (1);
}

Expand Down Expand Up @@ -104,7 +104,7 @@ void *thread (void *arg)
flags |= FLUX_KVS_SYNC;

if (!(f = flux_kvs_fence (t->h, namespace, flags, fence_name,
count, txn))
fencecount, txn))
|| flux_future_get (f, NULL) < 0)
log_err_exit ("flux_kvs_fence");

Expand Down Expand Up @@ -157,35 +157,35 @@ int main (int argc, char *argv[])
if ((argc - optind) != 2)
usage ();

count = strtoul (argv[optind], NULL, 10);
if (count <= 1)
log_msg_exit ("commit count must be > 1");
fencecount = strtoul (argv[optind], NULL, 10);
if (fencecount <= 1)
log_msg_exit ("thread count must be > 1");
prefix = argv[optind+1];

/* create a fence name for this test that is random-ish */
srand (time (NULL));
num = rand ();
fence_name = xasprintf ("%s-%d", prefix, num);

thd = xzmalloc (sizeof (*thd) * count);
thd = xzmalloc (sizeof (*thd) * fencecount);

for (i = 0; i < count; i++) {
for (i = 0; i < fencecount; i++) {
thd[i].n = i;
if ((rc = pthread_attr_init (&thd[i].attr)))
log_errn (rc, "pthread_attr_init");
if ((rc = pthread_create (&thd[i].t, &thd[i].attr, thread, &thd[i])))
log_errn (rc, "pthread_create");
}

for (i = 0; i < count; i++) {
for (i = 0; i < fencecount; i++) {
if ((rc = pthread_join (thd[i].t, NULL)))
log_errn (rc, "pthread_join");
}

/* compare results from all of the fences, the root ref info
* should all be the same
*/
for (i = 1; i < count; i++) {
for (i = 1; i < fencecount; i++) {
if (!streq (thd[0].treeobj, thd[i].treeobj))
log_msg_exit ("treeobj mismatch: %s != %s\n",
thd[0].treeobj, thd[i].treeobj);
Expand All @@ -197,7 +197,7 @@ int main (int argc, char *argv[])
thd[0].sequence, thd[i].sequence);
}

for (i = 0; i < count; i++) {
for (i = 0; i < fencecount; i++) {
free (thd[i].treeobj);
free (thd[i].rootref);
}
Expand Down
Loading