Skip to content

fix: Reset partCount in StreamObjectCompactor to prevent inefficient grouping#3130

Open
Bablusinghnirwan wants to merge 1 commit intoAutoMQ:mainfrom
Bablusinghnirwan:fix/compaction-grouping-bug
Open

fix: Reset partCount in StreamObjectCompactor to prevent inefficient grouping#3130
Bablusinghnirwan wants to merge 1 commit intoAutoMQ:mainfrom
Bablusinghnirwan:fix/compaction-grouping-bug

Conversation

@Bablusinghnirwan
Copy link
Copy Markdown

  1. What does this PR do?
    This PR fixes a logic bug in StreamObjectCompactor.java where the partCount accumulator was not being reset when creating a new object group.

  2. Why is it needed?
    Currently, partCount keeps increasing indefinitely because it isn't cleared when group and groupSize are reset.

This causes the condition partCount + objectPartCount > Writer.MAX_PART_COUNT to fail prematurely for all subsequent groups after the first one. As a result, valid large groups are split unnecessarily into smaller chunks, leading to inefficient compaction.

  1. How was it fixed?
  • Added partCount = 0; inside the group initialization block in StreamObjectCompactor#group0.
  • This ensures that every new group starts with a fresh part count, just like it starts with a fresh size.
  1. Other Changes
  • Fixed a small grammar error in CONTRIBUTING_GUIDE.md ("follow" -> "must follow").

…mpactor

This fixes a bug where the part count was not reset for new groups, potentially causing inefficient compaction.
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Dec 30, 2025

CLA assistant check
All committers have signed the CLA.

@github-actions
Copy link
Copy Markdown

This PR is being marked as stale since it has not had any activity in 90 days. If you would like to keep this PR alive, please ask a committer for review. If the PR has merge conflicts, please update it with the latest from trunk (or appropriate release branch)

If this PR is no longer valid or desired, please feel free to close it. If no activity occurs in the next 30 days, it will be automatically closed.

@github-actions github-actions Bot added the Stale label Mar 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants