Skip to content

Conversation

@Loaki07
Copy link
Contributor

@Loaki07 Loaki07 commented Nov 28, 2025

… (#9376)

fixes: #9344

@github-actions github-actions bot added the ☢️ Bug Something isn't working label Nov 28, 2025
@github-actions
Copy link
Contributor

Failed to generate code suggestions for PR

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Nov 28, 2025

Greptile Overview

Greptile Summary

Fixed cache size overflow bug by dividing result_max_size and aggregation_max_size by bucket_num, matching the existing pattern for max_size, release_size, and gc_size.

Key changes:

  • Added division by bucket_num for result_max_size and aggregation_max_size in check_disk_cache_config
  • This ensures each cache bucket respects the configured max size limits, preventing total cache from exceeding configured limits
  • Follows established pattern already used for other cache size fields

Root cause: The system creates multiple cache buckets (bucket_num), each with its own FileData instance. Previously, result_max_size and aggregation_max_size weren't divided per bucket, causing the total cache size across all buckets to exceed the configured maximum by a factor of bucket_num.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The fix is straightforward, follows the existing established pattern for other cache size fields in the same function, and directly addresses the reported issue where cache size exceeded configured limits. The change is minimal (2 lines), logically sound, and consistent with how max_size, release_size, and gc_size are already handled.
  • No files require special attention

Important Files Changed

File Analysis

Filename Score Overview
src/config/src/config.rs 5/5 Added per-bucket division for result_max_size and aggregation_max_size to match existing max_size behavior, fixing cache size overflow issue

Sequence Diagram

sequenceDiagram
    participant Config as Config Initialization
    participant CheckDiskCache as check_disk_cache_config()
    participant DiskCache as DiskCache Struct
    participant FileData as FileData Buckets

    Config->>CheckDiskCache: Initialize disk cache config
    CheckDiskCache->>CheckDiskCache: Calculate bucket_num<br/>(based on CPU threads)
    CheckDiskCache->>DiskCache: Divide max_size /= bucket_num
    CheckDiskCache->>DiskCache: Divide result_max_size /= bucket_num (NEW)
    CheckDiskCache->>DiskCache: Divide aggregation_max_size /= bucket_num (NEW)
    CheckDiskCache->>DiskCache: Divide release_size /= bucket_num
    CheckDiskCache->>DiskCache: Divide gc_size /= bucket_num
    
    Note over CheckDiskCache,DiskCache: Each bucket gets 1/bucket_num<br/>of total configured size
    
    DiskCache->>FileData: Create bucket_num instances<br/>of FileData::new(FileType::Result)
    DiskCache->>FileData: Create bucket_num instances<br/>of FileData::new(FileType::Aggregation)
    
    Note over FileData: Each FileData uses<br/>result_max_size or<br/>aggregation_max_size<br/>per bucket
    
    Note over Config,FileData: Total cache size across all buckets<br/>now equals configured max size
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

1 file reviewed, no comments

Edit Code Review Agent Settings | Greptile

@hengfeiyang hengfeiyang merged commit 49e1459 into branch-v0.20.0 Nov 28, 2025
34 checks passed
@hengfeiyang hengfeiyang deleted the fix/cache_disk_utilizatio_v0.20.0 branch November 28, 2025 08:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

☢️ Bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants