Skip to content

Migrate stream non-gRPC protos to LightProto#4781

Merged
lhotari merged 3 commits intoapache:masterfrom
merlimat:lightproto-stream
May 8, 2026
Merged

Migrate stream non-gRPC protos to LightProto#4781
lhotari merged 3 commits intoapache:masterfrom
merlimat:lightproto-stream

Conversation

@merlimat
Copy link
Copy Markdown
Contributor

@merlimat merlimat commented May 7, 2026

Summary

Migrates the stream module's non-gRPC proto definitions from protobuf-java to LightProto:

  • stream/statelib/src/main/proto/kv.proto — KV state-store commands (uses proto3 oneof)
  • stream/proto/src/main/proto/cluster.proto — cluster metadata / server assignment (uses proto3 map)

Both proto files are proto3; LightProto handles oneof and map directly.

Approach

Branched off apache/master and does not stack on top of #4779 / #4780 (the in-flight bookkeeper-proto migrations). The pom changes are minimal and contained to stream:

  • pom.xml — adds <lightproto-maven-plugin.version> property.
  • stream/statelib/pom.xml — replaces protobuf-maven-plugin with lightproto-maven-plugin (statelib has only kv.proto).
  • stream/proto/pom.xml — keeps protobuf-maven-plugin for the gRPC-bearing protos and adds lightproto-maven-plugin for cluster.proto. To avoid both plugins generating the same types, cluster.proto is moved to a parallel src/main/proto-lightproto/ directory.

Java sources that referenced the migrated types are updated to use the LightProto mutable-instance API (no Builder pattern, fields populated by chained setters or via the nested-message setX() returning the inner message to mutate).

Out of scope (follow-ups)

  • gRPC service protos (storage.proto, kv_rpc.proto, tests-common/rpc.proto) and the messages they import (common.proto, kv.proto, kv_store.proto, stream.proto) — these still need a custom gRPC marshaller story for LightProto types.
  • tests-common/proto2_coder_test_messages.proto — uses proto2 extensions, not supported by LightProto, and is dead code.

Test plan

  • stream/statelib: TestKVUtils, TestRocksdbKVStore (35 tests pass)
  • stream/storage/impl: InMemClusterMetadataStoreTest, ZkClusterMetadataStoreTest, DefaultStorageContainerControllerTest, ClusterControllerImplTest, ClusterControllerLeaderImplTest, ZkStorageContainerManagerTest (28 tests pass)

merlimat added 2 commits May 7, 2026 16:27
The batchReadUnconfirmedAsync method added in apache#4739 calls LOG.error(...),
but LedgerHandle was migrated to slog and only has a lowercase `log`
field. Master fails to compile.

Convert the call to the slog builder style used elsewhere in the file.
Migrates the stream module's non-gRPC proto definitions to LightProto:
- stream/statelib/src/main/proto/kv.proto (KV state-store commands)
- stream/proto/src/main/proto/cluster.proto (cluster metadata/assignment)

Both files use proto3, including oneof (kv.proto) and map (cluster.proto),
which LightProto handles directly.

For stream/proto, cluster.proto is moved to a parallel proto-lightproto/
directory so the existing protobuf-maven-plugin keeps generating the rest
of the protos (which still depend on the gRPC service stubs). Java sources
that touched the migrated types are updated to use the LightProto
mutable-instance API instead of the protobuf-java builder pattern.

This change is independent of the other in-flight LightProto work in
bookkeeper-proto and bookkeeper-server. gRPC service migration is left
for a follow-up.
@merlimat merlimat force-pushed the lightproto-stream branch from b0914bb to 5f41b36 Compare May 7, 2026 23:36
Copy link
Copy Markdown
Member

@lhotari lhotari left a comment

Choose a reason for hiding this comment

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

LGTM

@lhotari lhotari merged commit c286628 into apache:master May 8, 2026
22 checks passed
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.

2 participants