Garbage collector ignores the per-invocation file limit when deletions fail
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 85/100
Research direction
Start with GarbageCollector.deleteInBatches, TableFilesDeleted, and the property description for sleeper.gc.files.maximum. In GarbageCollectorTest, add the described case alongside shouldDeleteFilesUpToLimitWithinSingleInvocation: use five ready-for-GC files and a delete fake that fails every file, with the limit set to two. Done means the invocation attempts at most the limit plus any files in the current batch, and the property description explains that failed files count.
Written by the indexing model from the issue text.
Description
Description / Background
The property sleeper.gc.files.maximum limits how many files the garbage collector deletes per table in one invocation. Its description says the limit exists to avoid reaching the lambda timeout.
GarbageCollector.deleteInBatches keeps reading ready-for-GC files while deleted.getDeletedFileCount() < maxFiles. Only files that were successfully deleted from S3 increase that count. Files that fail to delete are recorded with TableFilesDeleted.failed and don't count.
If S3 deletes fail for every file, e.g. because of a permissions or bucket policy problem, the count stays at zero. One invocation then sends a delete request for every ready-for-GC file in the table, however many there are. A large table can run until the lambda times out. Failed files stay ready for GC, so every later invocation does the same.
Steps to reproduce
- In
GarbageCollectorTest, setsleeper.gc.files.maximumto 2 andsleeper.gc.batch.sizeto 1. - Create 5 files that are ready for GC, and use a
DeleteFilesfake that fails every file. - Run the garbage collector. All 5 files are attempted, not 2.
Expected behaviour
Every file the garbage collector attempts counts towards sleeper.gc.files.maximum, whether it was deleted or not. An invocation stops after attempting that many files, apart from finishing the current batch, as the property description says.
Technical Notes / Implementation Details
- Add a count of attempted files to
TableFilesDeleted, or count files asdeleteInBatchesreads them, and use that in the loop condition. KeepgetDeletedFileCountfor the return value and the logs. - Update the property description to say failed files count towards the limit.
- Add a test to
GarbageCollectorTestfor the steps above, alongsideshouldDeleteFilesUpToLimitWithinSingleInvocation.
- Dominant language
- Java
- Stars
- 107
- Forks
- 29
- Avg merge
- 1d 33m
- Merged PRs (30d)
- 115
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from gchq/sleeper
-
enhancement scripts
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Maintainers usually reply within 1 day
-
EMR executor market type is not validated and any value other than ON_DEMAND is treated as SPOTOpenbug bulk-import-module
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
bug needs-refinement under-discussion
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
gchq/sleeper#8632 · 1 comment ·
Maintainers usually reply within 1 day
-
Transaction log follower logs an error for every transaction deleted from the files logPossibly taken @ca61688 claimed this 1 day ago. Openbug size:small
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
gchq/sleeper#8624 · 2 comments · 1 assignee ·
Maintainers usually reply within 1 day
-
bug size:medium
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
Similar issues
-
面渣逆袭Spring事务传播机制勘误Open
Difficulty 1/5 Under an hour Newbie friendliness 80/100
itwanger/toBeBetterJavaer#218 ·
-
Markdown and Astro language servers do not start when the project path contains a non-ASCII character or a spacePossibly taken @RoiSoleil claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
eclipse-wildwebdeveloper/wildwebdeveloper#2277 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
johanhaleby/occurrent#1462 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
SasanLabs/VulnerableApp#912 ·
Maintainers usually reply within 1 day
-
area/build area/events area/storage area/storage/kafkasql area/storage/sql
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Apicurio/apicurio-registry#11079 ·
Maintainers usually reply within 1 day