Fix infinite loop from non-positive TABLE_METADATA_CLEANUP_BATCH_SIZE#4970
Merged
dimas-b merged 3 commits intoJul 8, 2026
Merged
Conversation
Clamp TABLE_METADATA_CLEANUP_BATCH_SIZE to at least 1 in TableCleanupTaskHandler to prevent an infinite loop (batchSize = 0) or IllegalArgumentException (batchSize < 0) when the realm config overrides the default. Add a regression test that verifies cleanup still queues subtasks with batchSize = 0.
dimas-b
previously approved these changes
Jul 6, 2026
dimas-b
left a comment
Contributor
There was a problem hiding this comment.
Nice catch! Thanks, @vigneshio !
nandorKollar
previously approved these changes
Jul 7, 2026
ayushtkn
approved these changes
Jul 8, 2026
nandorKollar
approved these changes
Jul 8, 2026
dimas-b
approved these changes
Jul 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix infinite loop from non-positive TABLE_METADATA_CLEANUP_BATCH_SIZE
TABLE_METADATA_CLEANUP_BATCH_SIZEis realm-overridable without bounds. When a realm/catalog override sets the value to0or negative,TableCleanupTaskHandler.getMetadataFileBatches(...)behaves badly:0causes an infinite loop in the batch-splitting logic, and negative values causeIllegalArgumentExceptionfromList.subList(...).This change clamps the configured batch size to at least 1 at the use site with
Math.max(1, batchSize), preventing the availability issue without changing the existing configuration machinery. A regression test with a short@Timeoutverifies that a0override still results in queued cleanup subtasks instead of hanging.Checklist