Skip to content

Commit

Permalink
Merge pull request #4492 from chu11/issue4267_content_backing_module_…
Browse files Browse the repository at this point in the history
…none

etc: support content.backing-module=none
  • Loading branch information
mergify[bot] authored Aug 27, 2022
2 parents ba4c510 + f3c2437 commit 7deb4f3
Show file tree
Hide file tree
Showing 12 changed files with 538 additions and 39 deletions.
28 changes: 20 additions & 8 deletions etc/rc1
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,15 @@ modload() {
fi
}

backing_module() {
local backingmod=$(flux getattr content.backing-module 2>/dev/null) || :
echo ${backingmod:-content-sqlite}
}

modload all barrier

if test $RANK -eq 0; then
backingmod=$(flux getattr content.backing-module 2>/dev/null) || :
backingmod=${backingmod:-content-sqlite}
backingmod=$(backing_module)
dumpfile=$(flux getattr content.restore 2>/dev/null) || :
if test -n "${dumpfile}"; then
if test "${dumpfile}" = "auto"; then
Expand All @@ -30,13 +34,15 @@ if test $RANK -eq 0; then
fi
fi
if test -n "${dumpfile}"; then
flux module load ${backingmod} truncate
if test "${backingmod}" != "none"; then
flux module load ${backingmod} truncate
fi
echo "restoring content from ${dumpfile}"
flux restore --quiet --checkpoint ${dumpfile}
if test -n "${dumplink}"; then
rm -f ${dumplink}
fi
else
elif test "${backingmod}" != "none"; then
flux module load ${backingmod}
fi
fi
Expand All @@ -45,7 +51,9 @@ modload all kvs
modload all kvs-watch

if test $RANK -eq 0; then
flux startlog --post-start-event
if test "$(backing_module)" != "none"; then
flux startlog --post-start-event
fi
fi

modload all resource
Expand All @@ -58,9 +66,13 @@ if test $RANK -eq 0 -a -n "${period}"; then
flux module load job-archive
fi

if test $RANK -eq 0 && ! flux startlog --check --quiet; then
flux queue stop
flux queue disable "Flux is in safe mode due to an incomplete shutdown."
if test $RANK -eq 0; then
if test "$(backing_module)" != "none"; then
if ! flux startlog --check --quiet; then
flux queue stop
flux queue disable "Flux is in safe mode due to an incomplete shutdown."
fi
fi
fi

modload all job-ingest
Expand Down
20 changes: 15 additions & 5 deletions etc/rc3
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ modrm() {
fi
}

backing_module() {
local backingmod=$(flux getattr content.backing-module 2>/dev/null) || :
echo ${backingmod:-content-sqlite}
}

core_dir=$(cd ${0%/*} && pwd -P)
all_dirs=$core_dir${FLUX_RC_EXTRA:+":$FLUX_RC_EXTRA"}
IFS=:
Expand All @@ -37,17 +42,20 @@ modrm 0 cron
modrm all barrier

if test $RANK -eq 0; then
flux startlog --post-finish-event || exit_rc=1
if test "$(backing_module)" != "none"; then
flux startlog --post-finish-event || exit_rc=1
fi
fi

modrm all kvs-watch
modrm all kvs

flux content flush || exit_rc=1
if test "$(backing_module)" != "none"; then
flux content flush || exit_rc=1
fi

if test $RANK -eq 0; then
backingmod=$(flux getattr content.backing-module 2>/dev/null)
backingmod=${backingmod:-content-sqlite}
backingmod=$(backing_module)
dumpfile=$(flux getattr content.dump 2>/dev/null)
if test $exit_rc -eq 0 -a -n "${dumpfile}"; then
if test "${dumpfile}" = "auto"; then
Expand All @@ -63,7 +71,9 @@ if test $RANK -eq 0; then
exit_rc=1
fi
fi
flux module remove ${backingmod} || exit_rc=1
if test "${backingmod}" != "none"; then
flux module remove ${backingmod} || exit_rc=1
fi
fi

exit $exit_rc
1 change: 1 addition & 0 deletions src/broker/content-cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -692,6 +692,7 @@ static void content_register_backing_request (flux_t *h,
if (flux_respond (h, msg, NULL) < 0)
flux_log_error (h, "error responding to register-backing request");
(void)cache_flush (cache);
(void)checkpoints_flush (cache->checkpoint);
return;
error:
if (flux_respond_error (h, msg, errno, errstr) < 0)
Expand Down
Loading

0 comments on commit 7deb4f3

Please sign in to comment.