From 1ab95c06cf638b31db373824b933c7f3cf1d7fff Mon Sep 17 00:00:00 2001 From: Jim Garlick Date: Tue, 15 Sep 2020 05:55:16 -0700 Subject: [PATCH] broker/state_machine: rename quorum-monitor to quorum-get Problem: now that the quorum-monitor RPC does not support streaming, the name doesn't fit. Rename 'quorum-monitor' to 'quorum-get'. Update tests. --- src/broker/state_machine.c | 21 +++++++++------------ t/t0025-broker-state-machine.t | 10 +++++----- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/src/broker/state_machine.c b/src/broker/state_machine.c index dfc52dfe34ad..cda68cbd6ace 100644 --- a/src/broker/state_machine.c +++ b/src/broker/state_machine.c @@ -688,10 +688,10 @@ static flux_watcher_t *quorum_create_batch_timer (struct state_machine *s) s); } -static void quorum_monitor_cb (flux_t *h, - flux_msg_handler_t *mh, - const flux_msg_t *msg, - void *arg) +static void quorum_get_cb (flux_t *h, + flux_msg_handler_t *mh, + const flux_msg_t *msg, + void *arg) { struct state_machine *s = arg; const char *errstr = NULL; @@ -700,7 +700,7 @@ static void quorum_monitor_cb (flux_t *h, if (flux_request_decode (msg, NULL, NULL) < 0) goto error; if (s->ctx->rank != 0) { - errstr = "quorum-monitor RPC is only available on rank 0"; + errstr = "quorum-get RPC is only available on rank 0"; errno = EPROTO; goto error; } @@ -713,7 +713,7 @@ static void quorum_monitor_cb (flux_t *h, return; error: if (flux_respond_error (h, msg, errno, errstr) < 0) - flux_log_error (h, "error responding to quorum-monitor request"); + flux_log_error (h, "error responding to quorum-get request"); free (tmp); } @@ -851,10 +851,8 @@ static bool msglist_drop_sender (zlist_t *l, const char *sender) return false; } -/* If a disconnect is received for streaming monitor or quorum-monitor - * requests, drop the request. Example use cases: - * - monitor module unloads while still watching quorum-monitor - * - tests (potentially) +/* If a disconnect is received for streaming monitor request, + * drop the request. */ static void disconnect_cb (flux_t *h, flux_msg_handler_t *mh, @@ -881,8 +879,7 @@ static void disconnect_cb (flux_t *h, static const struct flux_msg_handler_spec htab[] = { { FLUX_MSGTYPE_REQUEST, "state-machine.monitor", monitor_cb, 0 }, { FLUX_MSGTYPE_REQUEST, "state-machine.quorum", quorum_cb, 0 }, - { FLUX_MSGTYPE_REQUEST, "state-machine.quorum-monitor", - quorum_monitor_cb, 0 }, + { FLUX_MSGTYPE_REQUEST, "state-machine.quorum-get", quorum_get_cb, 0 }, { FLUX_MSGTYPE_REQUEST, "state-machine.disconnect", disconnect_cb, 0 }, FLUX_MSGHANDLER_TABLE_END, }; diff --git a/t/t0025-broker-state-machine.t b/t/t0025-broker-state-machine.t index 146d48eb0147..b6268c873d31 100755 --- a/t/t0025-broker-state-machine.t +++ b/t/t0025-broker-state-machine.t @@ -13,7 +13,7 @@ ARGS="-o,-Sbroker.rc1_path=,-Sbroker.rc3_path=" test_expect_success 'create qget.sh script to query quorum' ' cat >qget.sh <<-EOT && - $RPC state-machine.quorum-monitor | jq -r .idset + $RPC state-machine.quorum-get | jq -r .idset EOT chmod +x qget.sh ' @@ -88,16 +88,16 @@ test_expect_success HAVE_JQ 'instance functions with late-joiner' ' test_cmp late.exp late.out ' -test_expect_success HAVE_JQ 'quorum-monitor singleton RPC works' ' +test_expect_success HAVE_JQ 'quorum-get RPC works' ' flux start ${ARGS} \ - $RPC state-machine.quorum-monitor \ + $RPC state-machine.quorum-get \ qm0.out && jq -cea .idset qm0.out ' -test_expect_success 'quorum-monitor RPC fails on rank > 0' ' +test_expect_success 'quorum-get RPC fails on rank > 0' ' test_must_fail flux start -s2 ${ARGS} \ - flux exec -r1 $RPC state-machine.quorum-monitor \ + flux exec -r1 $RPC state-machine.quorum-get \ qm1.err && grep "only available on rank 0" qm1.err '