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

Prune one at a time up to the limit #157

Merged
merged 1 commit into from
Jun 7, 2023
Merged

Conversation

mtelvers
Copy link
Member

When a new obuilder job is accepted by ocurrent/ocluster the build function in obuilder_build.ml is called. This checks that there is enough free disk space possibly spawning an asynchronous thread do_prune to prune builds before running Builder.build. do_prune invokes Builder.prune which calls Store.prune from db_store.ml. The prune function queries the database to build a list of items ordered by the least recently used and begins deleting them. The delete operation takes several minutes or longer, however the list of items was evaluated at the start. It is possible that the build job which was started in parallel with do_prune or a subsequent job will use one of the cache steps which is in the list to be pruned.

The workaround proposed here is not perfect. It minimises the chance that this will happen by checking the last used time for each item as it is deleted. We will now have one SQL query per item deleted which is less efficient.

The logging has also been updated to show the start and end of the prune operation:

2023-04-26 13:59.23       obuilder [INFO] Pruning 10 items
...
2023-04-26 14:00.40       obuilder [INFO] Pruned 10 items

@mtelvers mtelvers merged commit bca5bc3 into ocurrent:master Jun 7, 2023
benmandrew added a commit to benmandrew/opam-repository that referenced this pull request Jan 31, 2024
CHANGES:

- Add a Docker backend for Windows and Linux jobs.
  (@MisterDA ocurrent/obuilder#127 ocurrent/obuilder#75, reviewed by @talex5 and @tmcgilchrist)
- Add FreeBSD sandbox backend using jail(8)
  (@dustanddreams ocurrent/obuilder#156 ocurrent/obuilder#174, reviewed by @tmcgilchrist, @MisterDA, and @mtelvers)
- Add Macos ZFS sandbox (@mtelvers ocurrent/obuilder#164, reviewed by @tmcgilchrist)
- Support XFS store (@mtelvers ocurrent/obuilder#170, reviewed by @tmcgilchrist)

- Search for bash rather than assume it lies in /bin (@dustanddreams ocurrent/obuilder#159, reviewed by @tmcgilchrist)
- Prune builds one at a time up to the limit (@mtelvers ocurrent/obuilder#157)
- Specify upper bound on number of items in the store (@mtelvers ocurrent/obuilder#158, reviewed by @MisterDA)
- Fix case where BTRFS is not fully allocated (@mtelvers ocurrent/obuilder#162)
- Avoid pruning parent cache objects (@mtelvers ocurrent/obuilder#176, reviewed by @tmcgilchrist)
nberth pushed a commit to nberth/opam-repository that referenced this pull request Jun 18, 2024
CHANGES:

- Add a Docker backend for Windows and Linux jobs.
  (@MisterDA ocurrent/obuilder#127 ocurrent/obuilder#75, reviewed by @talex5 and @tmcgilchrist)
- Add FreeBSD sandbox backend using jail(8)
  (@dustanddreams ocurrent/obuilder#156 ocurrent/obuilder#174, reviewed by @tmcgilchrist, @MisterDA, and @mtelvers)
- Add Macos ZFS sandbox (@mtelvers ocurrent/obuilder#164, reviewed by @tmcgilchrist)
- Support XFS store (@mtelvers ocurrent/obuilder#170, reviewed by @tmcgilchrist)

- Search for bash rather than assume it lies in /bin (@dustanddreams ocurrent/obuilder#159, reviewed by @tmcgilchrist)
- Prune builds one at a time up to the limit (@mtelvers ocurrent/obuilder#157)
- Specify upper bound on number of items in the store (@mtelvers ocurrent/obuilder#158, reviewed by @MisterDA)
- Fix case where BTRFS is not fully allocated (@mtelvers ocurrent/obuilder#162)
- Avoid pruning parent cache objects (@mtelvers ocurrent/obuilder#176, reviewed by @tmcgilchrist)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant