Skip to content

db_purge: ignore wu.batch unless --batch option#6947

Merged
AenBleidd merged 2 commits intomasterfrom
dpa_db_purge2
Mar 31, 2026
Merged

db_purge: ignore wu.batch unless --batch option#6947
AenBleidd merged 2 commits intomasterfrom
dpa_db_purge2

Conversation

@davidpanderson
Copy link
Copy Markdown
Contributor

@davidpanderson davidpanderson commented Mar 31, 2026

fixes a problem for NFS@home, which uses the batch field for its own purposes


Summary by cubic

Make db_purge ignore the workunit batch field by default; only filter by retired batches when --batch is used. This prevents unintended purges for projects like NFS@home that repurpose the batch field.

  • New Features
    • Add --batch flag to purge only WUs in retired batches; otherwise the batch field is ignored.
    • Retired-batch lookup and SQL filter run only with --batch; help text typo fixed and error message now includes the return code.

Written for commit 2c971ac. Summary will update on new commits.

Copilot AI review requested due to automatic review settings March 31, 2026 05:05
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates sched/db_purge.cpp to avoid treating workunit.batch as a BOINC batch ID by default (needed for NFS@home, which repurposes the field), while preserving the prior “purge only retired batches (and non-batch)” behavior behind an explicit flag.

Changes:

  • Add a --batch CLI option and associated help text.
  • Gate the “batch in (retired_batch_ids)” SQL filter behind the --batch flag.
  • Only query retired batch IDs when --batch is enabled.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread sched/db_purge.cpp
"Purge workunit and result records that are no longer needed.\n\n"
"Usage: db_purge [options]\n"
" -d N or --debug_level N Set verbosity level (1-4; 3=normal, 4=debug)\n"
" --batch purge batch jobs only if retired\n"
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new help text for --batch is misleading: the code enables filtering by retired batches (and batch=0), it doesn't mean “purge batch jobs only”. Consider rewording to something like “only purge WUs in retired batches (and non-batch WUs)” or otherwise clearly describe the actual behavior and the default when --batch is omitted.

Suggested change
" --batch purge batch jobs only if retired\n"
" --batch Only purge WUs in retired batches and non-batch WUs (default: all eligible WUs)\n"

Copilot uses AI. Check for mistakes.
Comment thread sched/db_purge.cpp
Comment on lines 26 to 30
// Purge WUs for which file_delete_state == FILE_DELETE_DONE
// and the WU is either
// and if --batch:
// the WU is either
// - in a retired batch
// - not in a batch
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The updated header comment is grammatically awkward and unclear about the default behavior. Consider rewriting to a single sentence like: “If --batch is specified, only purge WUs that are either in a retired batch or not in a batch; otherwise ignore the batch field.”

Copilot uses AI. Check for mistakes.
Comment thread sched/db_purge.cpp Outdated
if (batch) {
retval = get_retired_batch_ids(retired_batch_ids);
if (retval) {
log_messages.printf(MSG_CRITICAL, "Can't get retired batch IDs");
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This critical log message is missing a trailing newline, which can make logs harder to read and inconsistent with surrounding messages. Consider adding \n and including the returned error code for debugging.

Suggested change
log_messages.printf(MSG_CRITICAL, "Can't get retired batch IDs");
log_messages.printf(MSG_CRITICAL,
"Can't get retired batch IDs; retval=%d\n",
retval
);

Copilot uses AI. Check for mistakes.
@AenBleidd AenBleidd added this to Server Mar 31, 2026
@github-project-automation github-project-automation Bot moved this to Backlog in Server Mar 31, 2026
@AenBleidd AenBleidd added this to the Server Release 1.6.2 milestone Mar 31, 2026
@AenBleidd AenBleidd merged commit dbc4ace into master Mar 31, 2026
430 checks passed
@AenBleidd AenBleidd deleted the dpa_db_purge2 branch March 31, 2026 10:00
@github-project-automation github-project-automation Bot moved this from Backlog to Done in Server Mar 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants