Skip to content

Conversation

@superhx
Copy link
Collaborator

@superhx superhx commented Nov 3, 2025

No description provided.

Signed-off-by: Robin Han <hanxvdovehx@gmail.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors the LogCache class to introduce block count tracking and improve the eviction mechanism for cache blocks. The changes split the previous combined free and merge logic into separate methods, add a maximum block count limit, and remove an unused forceFree method.

  • Introduces block count tracking with MAX_BLOCKS_COUNT constant and blockCount field
  • Refactors tryRealFree() to consider both capacity and block count limits
  • Extracts merge logic into a separate tryMerge() method
  • Removes the unused forceFree() method
Comments suppressed due to low confidence (1)

s3stream/src/main/java/com/automq/stream/s3/cache/LogCache.java:312

  • When a block is removed during merge in tryMerge(), the blockCount should be decremented to maintain consistency with the blocks list. Add blockCount.decrementAndGet(); after iter.remove();.
                iter.remove();

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@superhx superhx merged commit 63e6eb8 into main Nov 3, 2025
11 of 12 checks passed
@superhx superhx deleted the chore_limit branch November 3, 2025 04:18
superhx added a commit that referenced this pull request Nov 3, 2025
Signed-off-by: Robin Han <hanxvdovehx@gmail.com>
superhx added a commit that referenced this pull request Nov 3, 2025
Signed-off-by: Robin Han <hanxvdovehx@gmail.com>
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.

3 participants