Skip to content

Commit 27f4390

Browse files
authored
Merge pull request #6611 from chu11/issue6607_kvs_stats_clear_remove
kvs: remove stats clearing
2 parents 779a41d + df1c9b8 commit 27f4390

File tree

6 files changed

+1
-109
lines changed

6 files changed

+1
-109
lines changed

src/modules/kvs/kvs.c

Lines changed: 1 addition & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -221,17 +221,12 @@ static int event_subscribe (struct kvs_ctx *ctx, const char *ns)
221221
* See issue #2779 for more information.
222222
*/
223223

224-
/* do not want to subscribe to events that are not within our
225-
* namespace, so we subscribe to only specific ones.
226-
*/
227-
228224
if (!(ctx->events_init)) {
229225

230226
/* These belong to all namespaces, subscribe once the first
231227
* time we init a namespace */
232228

233-
if (flux_event_subscribe (ctx->h, "kvs.stats.clear") < 0
234-
|| flux_event_subscribe (ctx->h, "kvs.dropcache") < 0) {
229+
if (flux_event_subscribe (ctx->h, "kvs.dropcache") < 0) {
235230
flux_log_error (ctx->h, "flux_event_subscribe");
236231
goto cleanup;
237232
}
@@ -2180,44 +2175,6 @@ static void stats_get_cb (flux_t *h,
21802175
json_decref (nsstats);
21812176
}
21822177

2183-
static int stats_clear_root_cb (struct kvsroot *root, void *arg)
2184-
{
2185-
kvstxn_mgr_clear_noop_stores (root->ktm);
2186-
return 0;
2187-
}
2188-
2189-
static void stats_clear (struct kvs_ctx *ctx)
2190-
{
2191-
ctx->faults = 0;
2192-
memset (&ctx->txn_commit_stats, '\0', sizeof (ctx->txn_commit_stats));
2193-
2194-
if (kvsroot_mgr_iter_roots (ctx->krm, stats_clear_root_cb, NULL) < 0)
2195-
flux_log_error (ctx->h, "%s: kvsroot_mgr_iter_roots", __FUNCTION__);
2196-
}
2197-
2198-
static void stats_clear_event_cb (flux_t *h,
2199-
flux_msg_handler_t *mh,
2200-
const flux_msg_t *msg,
2201-
void *arg)
2202-
{
2203-
struct kvs_ctx *ctx = arg;
2204-
2205-
stats_clear (ctx);
2206-
}
2207-
2208-
static void stats_clear_request_cb (flux_t *h,
2209-
flux_msg_handler_t *mh,
2210-
const flux_msg_t *msg,
2211-
void *arg)
2212-
{
2213-
struct kvs_ctx *ctx = arg;
2214-
2215-
stats_clear (ctx);
2216-
2217-
if (flux_respond (h, msg, NULL) < 0)
2218-
flux_log_error (h, "%s: flux_respond", __FUNCTION__);
2219-
}
2220-
22212178
static int namespace_create (struct kvs_ctx *ctx,
22222179
const char *ns,
22232180
const char *rootref,
@@ -2625,18 +2582,6 @@ static const struct flux_msg_handler_spec htab[] = {
26252582
stats_get_cb,
26262583
FLUX_ROLE_USER
26272584
},
2628-
{
2629-
FLUX_MSGTYPE_REQUEST,
2630-
"kvs.stats-clear",
2631-
stats_clear_request_cb,
2632-
0
2633-
},
2634-
{
2635-
FLUX_MSGTYPE_EVENT,
2636-
"kvs.stats-clear",
2637-
stats_clear_event_cb,
2638-
0
2639-
},
26402585
{
26412586
FLUX_MSGTYPE_EVENT,
26422587
"kvs.namespace-*-setroot",

src/modules/kvs/kvstxn.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1343,11 +1343,6 @@ int kvstxn_mgr_get_noop_stores (kvstxn_mgr_t *ktm)
13431343
return ktm->noop_stores;
13441344
}
13451345

1346-
void kvstxn_mgr_clear_noop_stores (kvstxn_mgr_t *ktm)
1347-
{
1348-
ktm->noop_stores = 0;
1349-
}
1350-
13511346
int kvstxn_mgr_ready_transaction_count (kvstxn_mgr_t *ktm)
13521347
{
13531348
return zlist_size (ktm->ready);

src/modules/kvs/kvstxn.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,6 @@ void kvstxn_mgr_remove_transaction (kvstxn_mgr_t *ktm,
201201
bool fallback);
202202

203203
int kvstxn_mgr_get_noop_stores (kvstxn_mgr_t *ktm);
204-
void kvstxn_mgr_clear_noop_stores (kvstxn_mgr_t *ktm);
205204

206205
/* return count of ready transactions */
207206
int kvstxn_mgr_ready_transaction_count (kvstxn_mgr_t *ktm);

src/modules/kvs/test/kvstxn.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,8 +228,6 @@ void kvstxn_mgr_basic_tests (void)
228228
ok (kvstxn_mgr_get_noop_stores (ktm) == 0,
229229
"kvstxn_mgr_get_noop_stores works");
230230

231-
kvstxn_mgr_clear_noop_stores (ktm);
232-
233231
ok (kvstxn_mgr_ready_transaction_count (ktm) == 0,
234232
"kvstxn_mgr_ready_transaction_count is initially 0");
235233

t/t1001-kvs-internals.t

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -494,45 +494,6 @@ test_expect_success 'kvs: module stats returns reasonable transaction stats' '
494494
echo $commitdata | jq -e ".stddev >= 0.0"
495495
'
496496

497-
#
498-
# test clear of stats
499-
#
500-
501-
# each store of largeval will increase the noop store count, b/c we
502-
# know that the identical large value will be cached as raw data
503-
504-
test_expect_success 'kvs: clear stats locally' '
505-
flux kvs unlink -Rf $DIR &&
506-
flux module stats -c kvs &&
507-
flux module stats --parse "namespace.primary.#no-op stores" kvs | grep -q 0 &&
508-
flux kvs put $DIR.largeval1=$largeval &&
509-
flux kvs put $DIR.largeval2=$largeval &&
510-
! flux module stats --parse "namespace.primary.#no-op stores" kvs | grep -q 0 &&
511-
flux module stats -c kvs &&
512-
flux module stats --parse "namespace.primary.#no-op stores" kvs | grep -q 0
513-
'
514-
515-
test_expect_success 'kvs: clear of transaction stats works' '
516-
commitdata=$(flux module stats -p transaction-opcount.commit kvs) &&
517-
echo $commitdata | jq -e ".count == 0" &&
518-
echo $commitdata | jq -e ".min == 0" &&
519-
echo $commitdata | jq -e ".max == 0" &&
520-
echo $commitdata | jq -e ".mean == 0.0" &&
521-
echo $commitdata | jq -e ".stddev == 0.0"
522-
'
523-
524-
test_expect_success NO_ASAN 'kvs: clear stats globally' '
525-
flux kvs unlink -Rf $DIR &&
526-
flux module stats -C kvs &&
527-
flux exec -n sh -c "flux module stats --parse \"namespace.primary.#no-op stores\" kvs | grep -q 0" &&
528-
for i in `seq 0 $((${SIZE} - 1))`; do
529-
flux exec -n -r $i sh -c "flux kvs put $DIR.$i.largeval1=$largeval $DIR.$i.largeval2=$largeval"
530-
done &&
531-
! flux exec -n sh -c "flux module stats --parse \"namespace.primary.#no-op stores\" kvs | grep -q 0" &&
532-
flux module stats -C kvs &&
533-
flux exec -n sh -c "flux module stats --parse \"namespace.primary.#no-op stores\" kvs | grep -q 0"
534-
'
535-
536497
#
537498
# test ENOSYS on unfinished requests when unloading the KVS module
538499
#

t/t1005-kvs-security.t

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -397,12 +397,6 @@ test_expect_success 'kvs-watch: stats works (user)' '
397397
unset_userid
398398
'
399399

400-
test_expect_success 'kvs: stats clear fails (user)' '
401-
set_userid 9999 &&
402-
! flux module stats -c kvs &&
403-
unset_userid
404-
'
405-
406400
#
407401
# ensure no lingering pending requests
408402
#

0 commit comments

Comments
 (0)