Skip to content

Commit df1c9b8

Browse files
committed
kvs: remove stats clearing
Problem: KVS stats clearing code was added very early on in KVS prototyping for testing. It is basically not used anymore. If we want to test something that requires a "clean" slate for the KVS, we can just start a new instance and test with that. Solution: Remove all KVS stats clearing code. Remove all associated tests. Fixes #6607
1 parent eb9376c commit df1c9b8

File tree

6 files changed

+1
-105
lines changed

6 files changed

+1
-105
lines changed

src/modules/kvs/kvs.c

Lines changed: 1 addition & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,7 @@ static int event_subscribe (struct kvs_ctx *ctx, const char *ns)
226226
/* These belong to all namespaces, subscribe once the first
227227
* time we init a namespace */
228228

229-
if (flux_event_subscribe (ctx->h, "kvs.stats.clear") < 0
230-
|| flux_event_subscribe (ctx->h, "kvs.dropcache") < 0) {
229+
if (flux_event_subscribe (ctx->h, "kvs.dropcache") < 0) {
231230
flux_log_error (ctx->h, "flux_event_subscribe");
232231
goto cleanup;
233232
}
@@ -2176,44 +2175,6 @@ static void stats_get_cb (flux_t *h,
21762175
json_decref (nsstats);
21772176
}
21782177

2179-
static int stats_clear_root_cb (struct kvsroot *root, void *arg)
2180-
{
2181-
kvstxn_mgr_clear_noop_stores (root->ktm);
2182-
return 0;
2183-
}
2184-
2185-
static void stats_clear (struct kvs_ctx *ctx)
2186-
{
2187-
ctx->faults = 0;
2188-
memset (&ctx->txn_commit_stats, '\0', sizeof (ctx->txn_commit_stats));
2189-
2190-
if (kvsroot_mgr_iter_roots (ctx->krm, stats_clear_root_cb, NULL) < 0)
2191-
flux_log_error (ctx->h, "%s: kvsroot_mgr_iter_roots", __FUNCTION__);
2192-
}
2193-
2194-
static void stats_clear_event_cb (flux_t *h,
2195-
flux_msg_handler_t *mh,
2196-
const flux_msg_t *msg,
2197-
void *arg)
2198-
{
2199-
struct kvs_ctx *ctx = arg;
2200-
2201-
stats_clear (ctx);
2202-
}
2203-
2204-
static void stats_clear_request_cb (flux_t *h,
2205-
flux_msg_handler_t *mh,
2206-
const flux_msg_t *msg,
2207-
void *arg)
2208-
{
2209-
struct kvs_ctx *ctx = arg;
2210-
2211-
stats_clear (ctx);
2212-
2213-
if (flux_respond (h, msg, NULL) < 0)
2214-
flux_log_error (h, "%s: flux_respond", __FUNCTION__);
2215-
}
2216-
22172178
static int namespace_create (struct kvs_ctx *ctx,
22182179
const char *ns,
22192180
const char *rootref,
@@ -2621,18 +2582,6 @@ static const struct flux_msg_handler_spec htab[] = {
26212582
stats_get_cb,
26222583
FLUX_ROLE_USER
26232584
},
2624-
{
2625-
FLUX_MSGTYPE_REQUEST,
2626-
"kvs.stats-clear",
2627-
stats_clear_request_cb,
2628-
0
2629-
},
2630-
{
2631-
FLUX_MSGTYPE_EVENT,
2632-
"kvs.stats-clear",
2633-
stats_clear_event_cb,
2634-
0
2635-
},
26362585
{
26372586
FLUX_MSGTYPE_EVENT,
26382587
"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)