Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move autoremove builds logic to a scheduled job #2468

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

zackgalbreath
Copy link
Contributor

Decouple the cleanup of old builds from the submission parsing step

@zackgalbreath
Copy link
Contributor Author

it would be good to verify that this doesn't cause any performance degradations on a "production sized" database

Copy link
Collaborator

@williamjallen williamjallen left a comment

Choose a reason for hiding this comment

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

I'll have more code comments later once we agree on the big-picture design.

.env.example Outdated Show resolved Hide resolved
app/Console/Commands/CleanupDatabase.php Show resolved Hide resolved
app/Console/Commands/CleanupDatabase.php Outdated Show resolved Hide resolved
app/Console/Kernel.php Outdated Show resolved Hide resolved
app/Http/Controllers/AdminController.php Show resolved Hide resolved
.env.example Outdated Show resolved Hide resolved
@zackgalbreath zackgalbreath force-pushed the remove_builds_revamp branch 2 times, most recently from be7f3ef to 173e373 Compare September 30, 2024 21:45
@zackgalbreath zackgalbreath force-pushed the remove_builds_revamp branch 3 times, most recently from 29a9574 to d14b1f1 Compare October 8, 2024 20:07
Copy link
Collaborator

@williamjallen williamjallen left a comment

Choose a reason for hiding this comment

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

Looks good to me once the two comments I left are resolved.

docs/submissions.md Outdated Show resolved Hide resolved
app/Http/Controllers/AdminController.php Outdated Show resolved Hide resolved
williamjallen
williamjallen previously approved these changes Oct 11, 2024
Copy link
Collaborator

@williamjallen williamjallen left a comment

Choose a reason for hiding this comment

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

Looks good to me. @zackgalbreath feel free to merge once you've taken a look at the changes I pushed.

@williamjallen williamjallen added this to the v3.6 milestone Oct 11, 2024
@williamjallen williamjallen added this pull request to the merge queue Oct 15, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 15, 2024
@williamjallen williamjallen modified the milestones: v3.6, v3.7 Oct 16, 2024
@williamjallen
Copy link
Collaborator

Moving this to 3.7 as per our in-person discussion today

@williamjallen williamjallen marked this pull request as draft November 6, 2024 16:28
@zackgalbreath zackgalbreath force-pushed the remove_builds_revamp branch 3 times, most recently from 1e6422f to c0ed119 Compare November 15, 2024 19:38
Separate the automatic removal of old builds from CDash's submission parsing
logic. Instead, old builds will now be periodically cleaned up as a scheduled
job. We use a new, lower priority queue to schedule these pruning jobs so they
don't interfere with asychronous submission parsing.

This commit moves the remove_builds function (and related helper functions)
from common.php to DatabaseCleanupUtils.

It also removes the "Cleanup database" from upgrade.php and moves this
functionality to a new Artisan command instead: db:cleanup. We use this new
db:cleanup command to remove shared records, such as testoutput. This allows
us to remove a big chunk of custom logic from our removeBuilds funcion.

While writing this commit, the following tables were already handled by db:cleanup:
  - buildfailuredetails
  - configure
  - configureerror
  - coveragefile
  - test2image

The following tables represent potentially shared data that wasn't already handled
by db:cleanup:
  - note
  - buildupdate
  - testoutput
  - updatefile
  - image
  - uploadfile

The following tables were found to already have cascade-on-delete foreign keys,
and thus their explicit DELETE logic was deemed safe to remove:
  - build2uploadfile
  - dynamicanalysisdefect
  - label2dynamicanalysis
  - label2buildfailure
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants