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: remove fence support #6592

Merged
merged 5 commits into from
Jan 31, 2025
Merged
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
1 change: 0 additions & 1 deletion doc/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,6 @@ MAN3_FILES_SECONDARY = \
man3/flux_kvs_getroot_get_sequence.3 \
man3/flux_kvs_getroot_get_owner.3 \
man3/flux_kvs_getroot_cancel.3 \
man3/flux_kvs_fence.3 \
man3/flux_kvs_commit_get_treeobj.3 \
man3/flux_kvs_commit_get_rootref.3 \
man3/flux_kvs_commit_get_sequence.3 \
Expand Down
5 changes: 0 additions & 5 deletions doc/man1/flux-shell.rst
Original file line number Diff line number Diff line change
Expand Up @@ -407,11 +407,6 @@ plugins include:
Skip pre-populating the ``flux.taskmap`` and ``PMI_process_mapping`` keys
in the ``simple`` implementation.

.. option:: pmi-simple.kvs=native

Use the native Flux KVS instead of the PMI plugin's built-in key exchange
algorithm in the ``simple`` implementation.

.. option:: pmi-simple.exchange.k=N

Configure the PMI plugin's built-in key exchange algorithm to use a
Expand Down
38 changes: 8 additions & 30 deletions doc/man3/flux_kvs_commit.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,6 @@ SYNOPSIS
int flags,
flux_kvs_txn_t *txn);

flux_future_t *flux_kvs_fence (flux_t *h,
const char *ns,
int flags,
const char *name,
int nprocs,
flux_kvs_txn_t *txn);

int flux_kvs_commit_get_treeobj (flux_future_t *f,
const char **treeobj);

Expand All @@ -47,31 +40,21 @@ namespace, or if set, the namespace from the FLUX_KVS_NAMESPACE
environment variable. Note that all transactions operate on the same
namespace.

:func:`flux_kvs_fence` is a "collective" version of :func:`flux_kvs_commit`
that supports multiple callers. Each caller uses the same :var:`flags`,
:var:`name`, and :var:`nprocs` arguments. Once :var:`nprocs` requests are
received by the KVS service for the named operation, the transactions are
combined and committed together as one transaction. :var:`name` must be unique
across the Flux session and should not be reused, even after the fence is
complete.

:man3:`flux_future_then` may be used to register a reactor callback
(continuation) to be called once the response to the commit/fence
(continuation) to be called once the response to the commit
request has been received. :man3:`flux_future_wait_for` may be used to
block until the response has been received. Both accept an optional timeout.

:man3:`flux_future_get`, :func:`flux_kvs_commit_get_treeobj`,
:func:`flux_kvs_commit_get_rootref`, or :func:`flux_kvs_commit_get_sequence`
can decode the response. A return of 0 indicates success and the
entire transaction was committed. A return of -1 indicates failure,
none of the transaction was committed. All can be used on the
:type:`flux_future_t` returned by :func:`flux_kvs_commit` or
:func:`flux_kvs_fence`.
can decode the response. A return of 0 indicates success and the entire
transaction was committed. A return of -1 indicates failure, none of the
transaction was committed.

In addition to checking for success or failure,
:func:`flux_kvs_commit_get_treeobj`, :func:`flux_kvs_commit_get_rootref()`,
and :func:`flux_kvs_commit_get_sequence` can return information about the
root snapshot that the commit or fence has completed its transaction on.
root snapshot that the commit has completed its transaction on.

:func:`flux_kvs_commit_get_treeobj` obtains the root hash in the form of
an RFC 11 *dirref* treeobj, suitable to be passed to
Expand All @@ -87,7 +70,7 @@ FLAGS
=====

The following are valid bits in a :var:`flags` mask passed as an argument
to :func:`flux_kvs_commit` or :func:`flux_kvs_fence`.
to :func:`flux_kvs_commit`.

FLUX_KVS_NO_MERGE
The KVS service may merge contemporaneous commit transactions as an
Expand All @@ -99,9 +82,8 @@ FLUX_KVS_NO_MERGE
RETURN VALUE
============

:func:`flux_kvs_commit` and :func:`flux_kvs_fence` return a
:type:`flux_future_t` on success, or NULL on failure with :var:`errno` set
appropriately.
:func:`flux_kvs_commit` returns a :type:`flux_future_t` on success, or NULL
on failure with :var:`errno` set appropriately.


ERRORS
Expand All @@ -122,10 +104,6 @@ ENOSYS
ENOTSUP
An unknown namespace was requested.

EOVERFLOW
:func:`flux_kvs_fence` has been called too many times and :var:`nprocs` has
been exceeded.


RESOURCES
=========
Expand Down
8 changes: 4 additions & 4 deletions doc/man3/flux_kvs_txn_create.rst
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ The Flux Key Value Store is a general purpose distributed storage
service used by Flux services.

:func:`flux_kvs_txn_create` creates a KVS transaction object that may be
passed to :man3:`flux_kvs_commit` or :man3:`flux_kvs_fence`. The transaction
consists of a list of operations that are applied to the KVS together,
in order. The entire transaction either succeeds or fails. After commit
or fence, the object must be destroyed with :func:`flux_kvs_txn_destroy`.
passed to :man3:`flux_kvs_commit`. The transaction consists of a list
of operations that are applied to the KVS together, in order. The
entire transaction either succeeds or fails. After commit, the object
must be destroyed with :func:`flux_kvs_txn_destroy`.

Each function below adds a single operation to :var:`txn`. :var:`key` is a
hierarchical path name with period (".") used as path separator.
Expand Down
1 change: 0 additions & 1 deletion doc/manpages.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@
('man3/flux_idle_watcher_create', 'flux_prepare_watcher_create', 'create prepare/check/idle watchers', [author], 3),
('man3/flux_idle_watcher_create', 'flux_check_watcher_create', 'create prepare/check/idle watchers', [author], 3),
('man3/flux_idle_watcher_create', 'flux_idle_watcher_create', 'create prepare/check/idle watchers', [author], 3),
('man3/flux_kvs_commit', 'flux_kvs_fence', 'commit a KVS transaction', [author], 3),
('man3/flux_kvs_commit', 'flux_kvs_commit_get_treeobj', 'commit a KVS transaction', [author], 3),
('man3/flux_kvs_commit', 'flux_kvs_commit_get_rootref', 'commit a KVS transaction', [author], 3),
('man3/flux_kvs_commit', 'flux_kvs_commit_get_sequence', 'commit a KVS transaction', [author], 3),
Expand Down
69 changes: 1 addition & 68 deletions src/common/libkvs/kvs_commit.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,73 +35,6 @@ static void free_ctx (struct commit_ctx *ctx)
}
}

static struct commit_ctx *alloc_ctx (void)
{
struct commit_ctx *ctx;
if (!(ctx = calloc (1, sizeof (*ctx))))
return NULL;
return ctx;
}

flux_future_t *flux_kvs_fence (flux_t *h,
const char *ns,
int flags,
const char *name,
int nprocs,
flux_kvs_txn_t *txn)
{
flux_future_t *f;
struct commit_ctx *ctx = NULL;
json_t *ops;

if (!name || nprocs <= 0 || !txn) {
errno = EINVAL;
return NULL;
}

if (!ns) {
if (!(ns = kvs_get_namespace ()))
return NULL;
}

if (flags & FLUX_KVS_TXN_COMPACT) {
if (txn_compact (txn) < 0)
return NULL;
flags &= ~FLUX_KVS_TXN_COMPACT;
}

if (!(ops = txn_get_ops (txn))) {
errno = EINVAL;
return NULL;
}

if (!(ctx = alloc_ctx ()))
return NULL;

if (!(f = flux_rpc_pack (h,
"kvs.fence",
FLUX_NODEID_ANY,
0,
"{s:s s:i s:s s:i s:O}",
"name", name,
"nprocs", nprocs,
"namespace", ns,
"flags", flags,
"ops", ops)))
goto error;

if (flux_future_aux_set (f, auxkey, ctx, (flux_free_f)free_ctx) < 0)
goto error_future;

return f;

error_future:
flux_future_destroy (f);
error:
free_ctx (ctx);
return NULL;
}

flux_future_t *flux_kvs_commit (flux_t *h,
const char *ns,
int flags,
Expand Down Expand Up @@ -132,7 +65,7 @@ flux_future_t *flux_kvs_commit (flux_t *h,
return NULL;
}

if (!(ctx = alloc_ctx ()))
if (!(ctx = calloc (1, sizeof (*ctx))))
return NULL;

if (!(f = flux_rpc_pack (h,
Expand Down
9 changes: 1 addition & 8 deletions src/common/libkvs/kvs_commit.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,7 @@ flux_future_t *flux_kvs_commit (flux_t *h,
int flags,
flux_kvs_txn_t *txn);

flux_future_t *flux_kvs_fence (flux_t *h,
const char *ns,
int flags,
const char *name,
int nprocs,
flux_kvs_txn_t *txn);

/* accessors can be used for commit or fence futures */
/* accessors can be used for commit futures */
int flux_kvs_commit_get_treeobj (flux_future_t *f, const char **treeobj);
int flux_kvs_commit_get_rootref (flux_future_t *f, const char **rootref);
int flux_kvs_commit_get_sequence (flux_future_t *f, int *rootseq);
Expand Down
10 changes: 0 additions & 10 deletions src/common/libkvs/test/kvs_commit.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,6 @@ void errors (void)

/* check simple error cases */

errno = 0;
ok (flux_kvs_fence (NULL, NULL, 0, NULL, 0, NULL) == NULL
&& errno == EINVAL,
"flux_kvs_fence fails on bad params");

errno = 0;
ok (flux_kvs_fence (NULL, NULL, 0, "foo", 1, NULL) == NULL
&& errno == EINVAL,
"flux_kvs_fence fails on bad handle");

errno = 0;
ok (flux_kvs_commit (NULL, NULL, 0, NULL) == NULL
&& errno == EINVAL,
Expand Down
Loading
Loading