Skip to content

refactor: update PutChunk interface to return compressed_size#861

Merged
kalbasit merged 2 commits intomainfrom
02-11-refactor_update_putchunk_interface_to_return_compressed_size
Feb 12, 2026
Merged

refactor: update PutChunk interface to return compressed_size#861
kalbasit merged 2 commits intomainfrom
02-11-refactor_update_putchunk_interface_to_return_compressed_size

Conversation

@kalbasit
Copy link
Owner

Updated the PutChunk interface in the storage layer to return the compressed
size of the chunk. This metric is necessary for the cache implementation
to accurately manage storage limits and track disk usage.

Changes:

  • Modified PutChunk signature in Store interface to return (bool, int64, error).
  • Updated filesystem storage implementation to return the length of the data.
  • Updated S3 storage implementation to return 0 (to be updated later or as placeholder).
  • Updated all callers in tests and distributed cache to handle the new return value.

@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Feb 12, 2026
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @kalbasit, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request refactors the core chunk storage mechanism to provide crucial metadata for cache management. By introducing the compressed size as a return value from the PutChunk operation, the system gains the ability to accurately track storage limits and disk usage, which is essential for optimizing cache performance and resource allocation. This change primarily involves updating function signatures and their respective calls across the codebase.

Highlights

  • Interface Update: The PutChunk interface in the storage layer has been updated to return an additional int64 value representing the compressed size of the chunk.
  • Storage Implementations: Both the localStore (filesystem) and s3Store implementations of PutChunk have been modified to conform to the new interface. The localStore now returns the actual length of the data, while s3Store currently returns 0 as a placeholder.
  • Caller Updates: All existing callers of PutChunk, including those in the distributed cache and various test files, have been updated to handle the new return signature.
Changelog
  • pkg/cache/cache.go
    • Updated the call to chunkStore.PutChunk to accommodate the new return signature, now destructuring three return values instead of two.
  • pkg/storage/chunk/local.go
    • Modified the PutChunk function signature to include int64 for compressed size as a third return value.
    • Adjusted all return statements within PutChunk to include 0 as the placeholder for the new compressed size value.
  • pkg/storage/chunk/local_test.go
    • Updated PutChunk calls in various test cases to destructure the new int64 return value, typically ignoring it with _.
  • pkg/storage/chunk/s3.go
    • Modified the PutChunk function signature to include int64 for compressed size as a third return value.
    • Adjusted all return statements within PutChunk to include 0 as the placeholder for the new compressed size value.
  • pkg/storage/chunk/s3_test.go
    • Updated PutChunk calls in various test cases to destructure the new int64 return value, typically ignoring it with _.
  • pkg/storage/chunk/store.go
    • Updated the PutChunk interface definition to include int64 for compressed size in its return signature.
    • Updated the comment for PutChunk to explicitly mention the new compressed size return value.
Activity
  • No human activity (comments, reviews, etc.) has been recorded on this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@dosubot
Copy link

dosubot bot commented Feb 12, 2026

Related Documentation

Checked 7 published document(s) in 1 knowledge base(s). No updates required.

How did I do? Any feedback?  Join Discord

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the PutChunk interface to return the size of the stored chunk, which is a good step towards better storage management. However, the implementations in local.go and s3.go don't correctly return the size. I've added comments with suggestions to fix these issues.

@kalbasit kalbasit changed the base branch from 02-11-feat_add_compressed_size_column_to_chunks_table_for_cdc_compression_tracking to graphite-base/861 February 12, 2026 05:32
@kalbasit kalbasit force-pushed the 02-11-refactor_update_putchunk_interface_to_return_compressed_size branch from 51a8b70 to 9c79f8c Compare February 12, 2026 05:37
@kalbasit kalbasit changed the base branch from graphite-base/861 to 02-11-feat_add_compressed_size_column_to_chunks_table_for_cdc_compression_tracking February 12, 2026 05:37
Base automatically changed from 02-11-feat_add_compressed_size_column_to_chunks_table_for_cdc_compression_tracking to main February 12, 2026 06:12
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels Feb 12, 2026
Updated the PutChunk interface in the storage layer to return the compressed
size of the chunk. This metric is necessary for the cache implementation
to accurately manage storage limits and track disk usage.

Changes:
- Modified PutChunk signature in Store interface to return (bool, int64, error).
- Updated filesystem storage implementation to return the length of the data.
- Updated S3 storage implementation to return 0 (to be updated later or as placeholder).
- Updated all callers in tests and distributed cache to handle the new return value.
@kalbasit kalbasit force-pushed the 02-11-refactor_update_putchunk_interface_to_return_compressed_size branch from 9c79f8c to 49755ec Compare February 12, 2026 06:15
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:L This PR changes 100-499 lines, ignoring generated files. labels Feb 12, 2026
@codecov
Copy link

codecov bot commented Feb 12, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 3.96%. Comparing base (012dba9) to head (264177b).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@          Coverage Diff          @@
##            main    #861   +/-   ##
=====================================
  Coverage   3.96%   3.96%           
=====================================
  Files          6       6           
  Lines        429     429           
=====================================
  Hits          17      17           
  Misses       409     409           
  Partials       3       3           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

- Implement correct behavior for PutChunk in localStore and s3Store by returning the actual data length instead of a placeholder 0.
- Update tests to assert that PutChunk returns the correct size, following TDD.
- Address PR comments regarding placeholder return values.
@kalbasit kalbasit enabled auto-merge (squash) February 12, 2026 06:38
@kalbasit kalbasit merged commit 152eeb6 into main Feb 12, 2026
16 checks passed
@kalbasit kalbasit deleted the 02-11-refactor_update_putchunk_interface_to_return_compressed_size branch February 12, 2026 06:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request go Pull requests that update go code size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant