yandrey321 opened a new pull request, #12017:
URL: https://github.com/apache/ozone/pull/12017
## What changes were proposed in this pull request?
**Problem.** The OM gRPC path (`GrpcOzoneManagerServer` on OM,
`GrpcOmTransport` in the S3 Gateway and in clients that
set `ozone.om.transport.class` to `GrpcOmTransportFactory`) was the last
main path on unshaded `io.grpc` / `io.netty`.
Because `ozone-common` carried it, every Ozone filesystem jar bundled a
second, relocated gRPC/Netty stack next to
Ratis's, with its own BoringSSL and transport natives: about 15.8 MB of the
70.4 MB `ozone-filesystem-hadoop3`. OM and
S3 Gateway also ran two Netty/gRPC stacks per JVM. ratis-thirdparty 1.1.1
shades the same gRPC (1.82.4) and Netty
(4.1.139.Final) that Ozone pins.
**Implementation idea.**
- **Binding instead of the generated stub:** `OMRequest` / `OMResponse` are
unshaded protobuf, which the shaded
`ProtoUtils` doesn't accept. So the generated stub is replaced by
`OzoneManagerServiceGrpcBinding`:
- a shaded `MethodDescriptor` with the same full name,
`hadoop.ozone.OzoneManagerService/submitRequest`;
- marshallers that write the same bytes. Messages are drained lazily into
the gRPC frame (`Drainable` + `KnownLength`), as `ProtoUtils` does, with no
extra copy;
- `bindService` for the server and a blocking `submitRequest` for the
client.
- **Error trailer:** `OMGrpcError` uses a hand-written metadata marshaller
with the same bytes as `ProtoUtils.metadataMarshaller`.
- **Client and server:** `GrpcOmTransport`, the two failover proxy
providers, the client-address interceptors,
`OzoneManagerServiceGrpc`, `GrpcOzoneManagerServer` and the `GrpcMetrics*`
interceptors move to shaded classes.
The OM server keeps NIO (epoll is HDDS-16985), and its TLS now uses
`SecurityConfig.getGrpcSslProvider()`, as the
datanode does.
- **Build:**
- `ozone-interface-client` no longer runs `protoc-gen-grpc-java`; the
protobuf messages are generated as before;
- the unshaded gRPC/Netty dependencies leave `ozone-common`,
`ozone-manager`, `hdds-server-framework`, `s3gateway` and
`ozone-interface-client`;
- `ozonefs-shaded` no longer bundles or renames Ozone's own Netty natives;
- a new `ban-unshaded-grpc` enforcer rule in `ozonefs-shaded` fails the
build if `io.grpc` or `io.netty` comes back.
**Key decisions.**
- **A hand-written binding, not shaded OM protos.** Moving `OMRequest` /
`OMResponse` to shaded protobuf would touch
Hadoop RPC and the whole OM request path.
- **Wire compatibility checked against the real old stub.** Before the stub
was removed, a temporary test ran the
old unshaded generated client against the new shaded server, and the new
client against an old unshaded server,
over loopback: plain calls, a 40 MB response, and the NOT_LEADER error
trailer with its suggested leader. It also
checked that the marshalled bytes match `ProtoUtils`. It passed and was
then deleted. The permanent
`TestOzoneManagerServiceGrpcBinding` pins the method name and the bytes.
- **Tests use loopback Netty servers.** Ratis's shaded gRPC has no
in-process transport, so `TestS3GrpcOmTransport`
starts localhost servers on ephemeral ports. Its max-response-length case
now exercises the real limit
(`maxInboundMessageSize`, as `GrpcOmTransport` sets it); with the
in-process transport it relied on a metadata-size quirk.
- **Unchanged:** datanode streaming (`container-service`) still uses
unshaded Netty, so some `netty-*` jars stay in the
dist. Epoll stays out of scope (HDDS-16985).
**Side effects.**
- **Jar size:** `ozone-filesystem-hadoop3` and `ozone-filesystem-hadoop2` go
from 70.36 MB to 54.54 MB (−22%), 5,557
fewer entries.
- **Dist:** `share/ozone/lib` loses 22 jars:
- the 8 `grpc-*` jars;
- `perfmark-api`, `proto-google-common-protos` and
`animal-sniffer-annotations`;
- `netty-codec-http`, `netty-codec-http2`, `netty-codec-socks` and
`netty-handler-proxy`;
- the 7 `netty-tcnative` jars.
`jar-report.txt`, `LICENSE.txt` and `NOTICE.txt` are updated. The Netty
jars that datanode streaming needs stay.
- **Wire, protos, config:** unchanged. Old and new S3 gateways and OMs
interoperate. There are no `.proto` changes;
only the generated Java stub class is gone.
- **Netty and gRPC versions** for this path now follow ratis-thirdparty,
like the datanode path.
- **`-Dio.netty.*` system properties** no longer affect this path. The
shaded Netty reads
`org.apache.ratis.thirdparty.io.netty.*` instead, as on the datanode path.
Co-authored-by: Claude Opus 5.5 <[email protected]>
## What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-14949
## How was this patch tested?
Unit + integration tests.
**One-time interop** (old generated stub ↔ new binding, both directions,
loopback): 3/3 passed before the stub was
removed.
**Jar contents:** the filesystem jars have no
`org/apache/ozone/shaded/io/{grpc,netty}` and no
`liborg_apache_ozone_shaded_netty_*`, and keep Ratis's 11 natives. A smoke test
through the shaded jar makes a loopback call and maps the error trailer.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]