Skip to content

Commit 7b3516b

Browse files
committed
flux-shutdown: add --skip-gc option
Problem: when garbage collection is enabled by default in systemd, it may be handy to have a way to avoid it, for example if the system has been garbage collected recently, but it is still expected to take a long time. Add a flux shutdown --skip-gc option to avoid garbage collection.
1 parent cb40e07 commit 7b3516b

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/cmd/builtin/shutdown.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,9 @@ static bool gc_threshold_check (flux_t *h, optparse_t *p)
7474
get_gc_threshold (h, &gc_threshold);
7575

7676
if (gc_threshold > 0 && version > gc_threshold) {
77-
if (optparse_hasopt (p, "yes") || optparse_hasopt (p, "no")) {
77+
if (optparse_hasopt (p, "yes")
78+
|| optparse_hasopt (p, "no")
79+
|| optparse_hasopt (p, "skip-gc")) {
7880
if (optparse_hasopt (p, "yes"))
7981
rc = true;
8082
else
@@ -143,6 +145,11 @@ static int subcmd (optparse_t *p, int ac, char *av[])
143145
if (optparse_hasopt (p, "background"))
144146
flags &= ~FLUX_RPC_STREAMING;
145147

148+
if (optparse_hasopt (p, "skip-gc")) {
149+
if (flux_attr_set (h, "content.dump", "") < 0)
150+
log_err_exit ("error clearing content.dump attribute");
151+
}
152+
146153
if (optparse_hasopt (p, "gc")
147154
|| optparse_hasopt (p, "dump")
148155
|| gc_threshold_check (h, p)) {
@@ -176,6 +183,9 @@ static int subcmd (optparse_t *p, int ac, char *av[])
176183
}
177184

178185
static struct optparse_option opts[] = {
186+
{ .name = "skip-gc", .has_arg = 0,
187+
.usage = "Skip KVS garbage collection this time, if already enabled",
188+
},
179189
{ .name = "gc", .has_arg = 0,
180190
.usage = "Garbage collect KVS (short for --dump=auto)",
181191
},

0 commit comments

Comments
 (0)