Skip to content

Conversation

@dotnwat
Copy link
Member

@dotnwat dotnwat commented Jan 31, 2026

Track the size of partitions in L1, and expose that through our internal admin interface.

This is part of a bigger project to support DescribeLogDirs Kafka API for cloud topics, which will require fusing together the metadata tracked in this PR with metadata from L0.

Backports Required

  • none - not a bug fix
  • none - this is a backport
  • none - issue does not exist in previous branches
  • none - papercut/not impactful enough to backport
  • v25.3.x
  • v25.2.x
  • v25.1.x

Release Notes

  • none

Adds an interface to compute the summation of extent sizes for a
partition that is managed by the simple metastore.

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
@dotnwat dotnwat force-pushed the track-l1-partition-size branch 3 times, most recently from 578bf5a to ded128e Compare February 3, 2026 21:42
The size is tracked in the metadata_row_value, and the serde version is
not incremented because we have not yet released this feature.

Updates partition metadata for:

  * set_start_offset_db_update
  * add_objects_db_update
  * replace_objects_db_update

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
This relies on abstractions introduced at the metastore level in the
previous commit which wired everything up, so this can't be squashed
into the commit which altered the simple metastore itself.

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
@dotnwat dotnwat force-pushed the track-l1-partition-size branch from ded128e to 7406981 Compare February 3, 2026 23:19
Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
@dotnwat dotnwat marked this pull request as ready for review February 4, 2026 00:53
Copilot AI review requested due to automatic review settings February 4, 2026 00:53
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 implements partition size tracking for cloud topics in the L1 metastore, enabling clients to query the total byte size of a partition through a new GetSize RPC endpoint.

Changes:

  • Adds a new GetSize RPC to the metastore service that returns the total byte size of a partition
  • Implements size tracking by maintaining a cumulative size field in partition metadata that's updated incrementally during add, replace, and set_start_offset operations
  • Includes comprehensive test coverage for size calculations across various operations

Reviewed changes

Copilot reviewed 31 out of 31 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
proto/redpanda/core/admin/internal/cloud_topics/v1/metastore.proto Defines the new GetSize RPC service and request/response messages
tests/rptest/clients/admin/proto/redpanda/core/admin/internal/cloud_topics/v1/metastore_pb2*.py* Generated Python protobuf bindings for the GetSize RPC
tests/rptest/tests/cloud_topics/e2e_test.py Adds end-to-end test verifying GetSize returns correct partition size
src/v/redpanda/admin/services/internal/metastore.{h,cc} Implements admin API handler for GetSize RPC
src/v/cloud_topics/level_one/metastore/metastore.h Adds GetSize method to the metastore interface
src/v/cloud_topics/level_one/metastore/simple_metastore.{h,cc} Implements GetSize for the simple (in-memory) metastore
src/v/cloud_topics/level_one/metastore/replicated_metastore.{h,cc} Implements GetSize for the replicated (production) metastore
src/v/cloud_topics/level_one/metastore/state.h Adds calculate_size helper method for partition state
src/v/cloud_topics/level_one/metastore/lsm/values.h Adds size field to metadata_row_value for persistent size tracking
src/v/cloud_topics/level_one/metastore/lsm/state_update.cc Updates all state update operations to maintain the size field
src/v/cloud_topics/level_one/metastore/rpc_types.h Defines internal RPC types for get_size requests and replies
src/v/cloud_topics/level_one/metastore/rpc.json Registers the get_size RPC method
src/v/cloud_topics/level_one/metastore/service.{h,cc} Implements RPC service handler for get_size
src/v/cloud_topics/level_one/metastore/leader_router.{h,cc} Adds routing logic for get_size requests to the correct leader
src/v/cloud_topics/level_one/domain/domain_manager.h Adds GetSize method to domain manager interface
src/v/cloud_topics/level_one/domain/simple_domain_manager.{h,cc} Implements GetSize for simple domain manager
src/v/cloud_topics/level_one/domain/db_domain_manager.{h,cc} Implements GetSize for database-backed domain manager
src/v/cloud_topics/level_one/metastore/tests/simple_metastore_test.cc Unit tests for GetSize with various scenarios
src/v/cloud_topics/level_one/metastore/lsm/tests/state_update_test.cc Unit tests verifying size tracking during state updates
src/v/cloud_topics/level_one/domain/tests/db_domain_manager_test.cc Integration tests for GetSize at the domain manager level
tests/rptest/clients/admin/proto/redpanda/core/admin/internal/cloud_topics/v1/level_zero_gc_pb2*.py* Updates to GC service protobuf bindings (documentation changes)

@dotnwat dotnwat requested a review from andrwng February 4, 2026 00:55
Copy link
Contributor

@rockwotj rockwotj left a comment

Choose a reason for hiding this comment

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

lgtm, just one comment on the test could be improved

return False

wait_until(
condition=size_is_positive,
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe better to fold this into the retention tests and you can ensure retention book keeps this back to zero properly

Copy link
Member Author

Choose a reason for hiding this comment

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

ahh good idea. will do

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants