Skip to content

Commit e0445d0

Browse files
authored
fix: improve GC error when manifest is out of sync with server.conf (#4115)
At the weekend I ran GC on lhcb.cern.ch which normally has `CVMFS_GARBAGE_COLLECTION=false`. While I figured it out, I think the error messages could be clearer about what is wrong so I'm making this PR to suggest an improvement. Feel free to close if you'd leave things as-is or handle it a different way. See also: cvmfs/doc-cvmfs#258
1 parent 0a6dc90 commit e0445d0

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

cvmfs/server/cvmfs_server_gc.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,12 @@ cvmfs_server_gc() {
164164
if [ $reconstruct_reflog -eq 1 ]; then reflog_reconstruct_msg="yes"; fi
165165

166166
echo "Affected Repositories: $names"
167+
for _gc_name in $names; do
168+
load_repo_config $_gc_name
169+
if [ x"$CVMFS_GARBAGE_COLLECTION" != x"true" ]; then
170+
echo " WARNING: CVMFS_GARBAGE_COLLECTION is not enabled for $_gc_name"
171+
fi
172+
done
167173
echo "Dry Run (no actual deletion): $dry_run_msg"
168174
echo "Needs Reflog reconstruction: $reflog_reconstruct_msg"
169175
if [ $preserve_revisions -ge 0 ]; then
@@ -318,6 +324,11 @@ __do_gc_cmd()
318324
return 0
319325
fi
320326
is_garbage_collectable $name || die "Garbage Collection is not enabled for $name"
327+
if is_stratum0 $name; then
328+
if [ x"$(get_repo_info_from_url $CVMFS_STRATUM0 -g)" != x"yes" ]; then
329+
die "Garbage collection is enabled in server.conf but not yet in the repository manifest. Run 'cvmfs_server transaction $name && cvmfs_server publish $name' to update the manifest, then retry."
330+
fi
331+
fi
321332
is_owner_or_root $name || die "Permission denied: Repository $name is owned by $user"
322333

323334
# figure out the URL of the repository

cvmfs/swissknife_gc.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,10 @@ int CommandGc::Main(const ArgumentList &args) {
121121

122122
if (!manifest->garbage_collectable()) {
123123
LogCvmfs(kLogCvmfs, kLogStderr,
124-
"repository does not allow garbage collection");
124+
"repository does not allow garbage collection "
125+
"(manifest does not have the garbage collection flag set; "
126+
"ensure CVMFS_GARBAGE_COLLECTION=true in server.conf and "
127+
"run a transaction + publish to update the manifest)");
125128
return 1;
126129
}
127130

0 commit comments

Comments
 (0)