Skip to content

Conversation

@Loaki07
Copy link
Contributor

@Loaki07 Loaki07 commented Nov 28, 2025

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 configuration bug where result_max_size and aggregation_max_size were not being divided by bucket_num, causing each bucket to use the full configured cache size instead of a proportional share.

  • Added division by bucket_num for result_max_size (line 2914)
  • Added division by bucket_num for aggregation_max_size (line 2915)
  • This matches the existing pattern used for max_size, release_size, and gc_size
  • Each of the multiple disk cache buckets now correctly honors the per-bucket size limits for result and aggregation caches
  • Without this fix, total cache usage could exceed configured limits by a factor of bucket_num (typically equal to CPU thread count)

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk - it's a straightforward bug fix that aligns cache configuration behavior.
  • The change is a simple two-line addition that follows the exact same pattern already established for other cache size parameters (max_size, release_size, gc_size). The fix is necessary to prevent cache size limits from being exceeded when multiple buckets are used. The code is protected against division by zero since bucket_num is guaranteed to be non-zero before these divisions occur.
  • No files require special attention

Important Files Changed

File Analysis

Filename Score Overview
src/config/src/config.rs 5/5 Added division by bucket_num for result_max_size and aggregation_max_size to properly distribute cache limits across multiple buckets, matching the existing pattern for other cache size parameters.

Sequence Diagram

sequenceDiagram
    participant Config as Config Initialization
    participant CDC as check_disk_cache_config()
    participant BucketCalc as Bucket Calculation
    participant SizeDistribution as Size Distribution
    participant DiskCache as Disk Cache Buckets

    Config->>CDC: Initialize disk cache config
    CDC->>CDC: Set bucket_num based on CPU threads
    CDC->>BucketCalc: Calculate bucket_num (threads-based logic)
    BucketCalc->>BucketCalc: Adjust for multi_dir count
    BucketCalc-->>CDC: Final bucket_num
    
    Note over SizeDistribution: Before this PR: Only max_size, release_size, gc_size divided
    Note over SizeDistribution: After this PR: Also divide result_max_size & aggregation_max_size
    
    CDC->>SizeDistribution: Divide max_size by bucket_num
    CDC->>SizeDistribution: Divide result_max_size by bucket_num (NEW)
    CDC->>SizeDistribution: Divide aggregation_max_size by bucket_num (NEW)
    CDC->>SizeDistribution: Divide release_size by bucket_num
    CDC->>SizeDistribution: Divide gc_size by bucket_num
    
    SizeDistribution-->>DiskCache: Per-bucket size limits applied
    Note over DiskCache: Each bucket now has correct result & aggregation limits
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

@Loaki07 Loaki07 changed the title fix: result cache & aggs cache max size needs to honor for entire fix: result cache & aggs cache max size needs to honor for entire dir Nov 28, 2025
@Loaki07 Loaki07 merged commit 3a690bd into main Nov 28, 2025
35 checks passed
@Loaki07 Loaki07 deleted the fix/cache_disk_utilizatio branch November 28, 2025 07:39
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.

The Result cache disk size exceeds the max size given

3 participants