merlimat opened a new pull request, #4783:
URL: https://github.com/apache/bookkeeper/pull/4783
## Summary
Migrates the remaining stream protos (the gRPC service ones plus everything
they import) from `protobuf-java` to LightProto. After this PR, the entire
bookkeeper repo runs without `com.google.protobuf:protobuf-java` (combined with
#4779 / #4780 / #4781).
The lightproto-maven-plugin produces both messages **and** gRPC service
stubs natively, so `protobuf-maven-plugin` and `protoc-gen-grpc-java` are
removed — same pattern oxia-java and pulsar-functions use.
## Proto changes
- `stream/proto/src/main/proto/`: cluster, common, kv, kv_rpc, kv_store,
storage, stream — all generated by lightproto.
- `stream/tests-common/src/main/proto/rpc.proto`: same.
- `stream/tests-common/src/main/proto/proto2_coder_test_messages.proto`:
deleted (proto2 \`extensions\`, unsupported by lightproto, dead code with zero
Java references).
## API translations
Standard lightproto patterns applied across ~100 Java files in
\`stream/{api, statelib, storage/api, storage/impl, clients/java/{base, kv,
all}, server, common, tests-common}\`, \`tools/stream\`, and
\`tests/integration/cluster\`:
- \`Foo.newBuilder().setX(v).build()\` → \`new Foo().setX(v)\` (no
\`.build()\`)
- \`Foo.newBuilder(other)\` → \`new Foo().copyFrom(other)\`
- nested message setters: \`outer.setInner(inner)\` →
\`outer.setInner().copyFrom(inner)\`
- repeated message setters: \`addRequests(req)\` →
\`addRequest().copyFrom(req)\`
- bytes: \`UnsafeByteOperations.unsafeWrap(b)\` → just \`b\`;
\`getX().toByteArray()\` → just \`getX()\`
- parsing: static \`Foo.parseFrom(byte[])\` → \`Foo f = new Foo();
f.parseFrom(b)\`
- getter renames (\`getRoEndpointCount\` → \`getRoEndpointsCount\`,
\`getRequests(i)\` → \`getRequestAt(i)\`)
- primitive boolean accessors \`getX()\` → \`isX()\`
- \`InvalidProtocolBufferException\` / \`CodedOutputStream\` removed
- enum \`UNRECOGNIZED\` checks dropped
## FutureStub adapters
LightProto's gRPC generator emits async + blocking stubs but **not**
\`*FutureStub\`. Where existing client code used \`ListenableFuture\`-based
APIs, four hand-written adapters were added under
\`stream/clients/java/base/.../clients/grpc/\`:
- \`RootRangeServiceFutureStub\`
- \`MetaRangeServiceFutureStub\`
- \`StorageContainerServiceFutureStub\`
- \`TableServiceFutureStub\`
Each extends \`AbstractStub\` and calls \`ClientCalls.futureUnaryCall\`
against the lightproto-generated \`MethodDescriptor\`s.
## Test plan
- [x] \`mvn install -DskipTests -pl '!native-io'\` succeeds end-to-end.
- [x] \`mvn checkstyle:check\`, \`apache-rat:check\`, \`spotbugs:check\`,
\`spotless:check\` clean for stream + tools modules.
- [x] Unit tests pass for \`stream/proto\`, \`stream/statelib\`,
\`stream/storage/impl\`, \`stream/clients/java/{base,kv,all}\`,
\`stream/server\`.
- [ ] Integration tests (CI).
## Behavioural note
A handful of tests previously relied on protobuf-java's gRPC in-process
transport passing message references by identity (\`assertSame(req,
receivedReq)\` / \`assertTrue(a == b)\`). LightProto's gRPC marshaller always
serializes/deserializes (matching oxia/pulsar), so those checks were switched
to \`.equals()\` / \`assertEquals\`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]