Skip to content

db_purge: remove --retired_wus option#6932

Merged
AenBleidd merged 1 commit into
masterfrom
dpa_purge2
Mar 26, 2026
Merged

db_purge: remove --retired_wus option#6932
AenBleidd merged 1 commit into
masterfrom
dpa_purge2

Conversation

@davidpanderson

@davidpanderson davidpanderson commented Mar 26, 2026

Copy link
Copy Markdown
Contributor

Never purge WUs/results of a non-retired batch.


Summary by cubic

Removed the --retired_wus option from db_purge and made purging always limited to WUs with FILE_DELETE_DONE in retired batches or with no batch. This prevents purging from active batches.

  • Refactors

    • db_purge: removed --retired_wus; queries now restrict to batch in (0,<retired_ids>); updated usage text and flow.
    • Docs/comments: clarified behavior in file_deleter, process_input_template, submit_util.inc; small copy tweak in submit.php; marked assimilator.py as not supported.
  • Migration

    • Remove --retired_wus from any scripts.
    • To purge batched WUs, retire the batch first.

Written for commit 1423143. Summary will update on new commits.

Never purge WUs/results of a non-retired batch.
Copilot AI review requested due to automatic review settings March 26, 2026 20:23

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 6 files

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Removes the --retired_wus option from db_purge and changes purge eligibility so that workunits/results are purged only when they’re either in a retired batch or not in any batch.

Changes:

  • Updated db_purge to always restrict purging to retired batches plus non-batch WUs/results (batch=0), and removed the --retired_wus CLI option.
  • Clarified/upgraded module comments across scheduler/tools, including an “NOT SUPPORTED” note in the legacy Python assimilator.
  • Minor HTML/text touch-ups around batch retirement UI and utilities.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tools/process_input_template.cpp Adds clarifying comments about staging and md5 handling.
sched/file_deleter.cpp Improves header comment to more accurately describe behavior.
sched/db_purge.cpp Removes --retired_wus and enforces “retired batch or no batch” purge restriction.
sched/assimilator.py Adds a notice that this assimilator is not supported.
html/user/submit.php Adjusts markup in the retire-batch confirmation message.
html/inc/submit_util.inc Clarifies retire-batch comments and reorders/clarifies related inline comments.

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

Comment thread html/user/submit.php
Comment on lines 1040 to 1044
echo "
<p>
Retiring a batch will remove all of its output files.
Are you sure you want to do this?
<p>

Copilot AI Mar 26, 2026

Copy link

Choose a reason for hiding this comment

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

This emits two opening <p> tags and no explicit closing </p>, producing invalid HTML (nested/implicit paragraph termination). Prefer a single well-formed paragraph, e.g. wrap the message in <p>...</p> (or remove the newly added <p> if the trailing one is the intended separator).

Copilot uses AI. Check for mistakes.
Comment thread sched/db_purge.cpp
Comment on lines +948 to +955
string retired_batch_ids;
retval = get_retired_batch_ids(retired_batch_ids);
if (retval) {
log_messages.printf(MSG_CRITICAL, "Can't get retired batch IDs");
exit(1);
}

bool did_something = do_pass();
bool did_something = do_pass(retired_batch_ids);

Copilot AI Mar 26, 2026

Copy link

Choose a reason for hiding this comment

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

The main loop now queries retired batch IDs on every iteration, even when there may be nothing to purge. This adds avoidable DB load and can become costly if the loop runs frequently. Consider replacing the “ID list building + IN (...)” approach with a single SQL predicate (e.g., batch=0 OR batch IN (SELECT id FROM batch WHERE state=RETIRED)) or caching the retired batch IDs and refreshing them on a timer (e.g., hourly) to reduce repeated queries.

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

Copilot AI Mar 26, 2026

Copy link

Choose a reason for hiding this comment

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

This error message loses useful diagnostics (no newline and no DB/MySQL error details). Include the underlying error code/message (e.g., mysql_error(boinc_db.mysql) / mysql_errno(...)) and a newline so operators can identify the root cause from logs.

Suggested change
log_messages.printf(MSG_CRITICAL, "Can't get retired batch IDs");
log_messages.printf(MSG_CRITICAL,
"Can't get retired batch IDs: %d: %s\n",
mysql_errno(boinc_db.mysql),
mysql_error(boinc_db.mysql)
);

Copilot uses AI. Check for mistakes.
Comment thread sched/db_purge.cpp
}

// get list of IDs of retired batches
// get list of IDs of retired batches (and 0, = no batch)

Copilot AI Mar 26, 2026

Copy link

Choose a reason for hiding this comment

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

The parenthetical is hard to parse (“and 0, = no batch”). Reword to something clearer like “including 0 (meaning ‘no batch’)” to avoid ambiguity for future maintainers.

Suggested change
// get list of IDs of retired batches (and 0, = no batch)
// get list of IDs of retired batches, including 0 (meaning "no batch")

Copilot uses AI. Check for mistakes.
@AenBleidd AenBleidd added this to Server Mar 26, 2026
@github-project-automation github-project-automation Bot moved this to Backlog in Server Mar 26, 2026
@AenBleidd AenBleidd added this to the Server Release 1.6.2 milestone Mar 26, 2026
@AenBleidd AenBleidd merged commit 9eeee53 into master Mar 26, 2026
434 checks passed
@AenBleidd AenBleidd deleted the dpa_purge2 branch March 26, 2026 22:14
@github-project-automation github-project-automation Bot moved this from Backlog to Done in Server Mar 26, 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