Skip to content

Commit

Permalink
kvs: call content.flush before checkpoint
Browse files Browse the repository at this point in the history
Problem: When the KVS module is unloaded, a checkpoint of the root
reference is attempted.  However, a content.flush is not done
beforehand.  This could result in an invalid checkpoint reference
as data is not guaranteed to be flushed to the backing store.

Solution: Call content.flush before checkpointing.

Fixes #6237
  • Loading branch information
chu11 committed Dec 18, 2024
1 parent 59841ca commit 50be094
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/modules/kvs/kvs.c
Original file line number Diff line number Diff line change
Expand Up @@ -3142,15 +3142,22 @@ static int checkpoint_get (flux_t *h, char *buf, size_t len, int *seq)
*/
static int checkpoint_put (flux_t *h, const char *rootref, int rootseq)
{
flux_future_t *f = NULL;
flux_future_t *f1 = NULL;
flux_future_t *f2 = NULL;
int rv = -1;

if (!(f = kvs_checkpoint_commit (h, NULL, rootref, rootseq, 0, 0))
|| flux_rpc_get (f, NULL) < 0)
/* first must ensure all content is flushed */
if (!(f1 = flux_rpc (h, "content.flush", NULL, 0, 0))
|| flux_rpc_get (f1, NULL) < 0)
goto error;

if (!(f2 = kvs_checkpoint_commit (h, NULL, rootref, rootseq, 0, 0))
|| flux_rpc_get (f2, NULL) < 0)
goto error;
rv = 0;
error:
flux_future_destroy (f);
flux_future_destroy (f1);
flux_future_destroy (f2);
return rv;
}

Expand Down

0 comments on commit 50be094

Please sign in to comment.