[ 
https://issues.apache.org/jira/browse/HDDS-15593?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

ASF GitHub Bot updated HDDS-15593:
----------------------------------
    Labels: pull-request-available  (was: )

> Fix recursive Ratis protobuf import rewriting
> ---------------------------------------------
>
>                 Key: HDDS-15593
>                 URL: https://issues.apache.org/jira/browse/HDDS-15593
>             Project: Apache Ozone
>          Issue Type: Bug
>            Reporter: Chu Cheng Li
>            Assignee: Chu Cheng Li
>            Priority: Major
>              Labels: pull-request-available
>
> `hdds-interface-client` and `hdds-interface-server` generate protobuf/gRPC 
> Java sources that are expected to use Ratis-shaded dependencies:
>  - `org.apache.ratis.thirdparty.io.grpc`
>  - `org.apache.ratis.thirdparty.com.google.protobuf`
>  - `org.apache.ratis.thirdparty.com.google.common`
> The existing `maven-antrun-plugin` replacement used `<replace dir="...">`, 
> which did not reliably apply to generated Java files under nested package 
> directories such as:
> ```text
> target/generated-sources/proto-java-for-ratis/org/apache/hadoop/...
> ```
> As a result, clean builds could leave generated gRPC sources importing 
> unshaded packages like `io.grpc`, causing interface module compilation 
> failures and downstream missing-proto-class errors.
> This patch changes the replacement rules to use explicit recursive Ant 
> `<fileset>` entries over `*{*}/{*}.java`.
> No protobuf definitions or generated sources are checked in by this change.
> Why
> A clean build can fail in `hdds-interface-client` or `hdds-interface-server` 
> because generated Ratis protobuf/gRPC sources still reference unshaded 
> packages.
> This can also surface downstream as missing generated classes such as:
>  - `ContainerProtos`
>  - `HddsProtos`
>  - `XceiverClientProtocolServiceGrpc`
> Reproduction before the fix
> On a clean checkout without this patch:
> ```bash
> mvn -pl :hdds-interface-client clean compile \
> -DskipTests -DskipShade -DskipRecon -DskipDocs
> ```
> Example failure:
> ```text
> target/generated-sources/proto-java-for-ratis/.../XceiverClientProtocolServiceGrpc.java:[3,22]
>  package io.grpc does not exist
> target/generated-sources/proto-java-for-ratis/.../IntraDatanodeProtocolServiceGrpc.java:[7,26]
>  package io.grpc.stub.annotations does not exist
> ```
> A downstream build can also fail during test compilation, for example:
> ```bash
> mvn clean test-compile -pl hadoop-ozone/s3gateway -am
> ```
> with errors like:
> ```text
> package org.apache.hadoop.hdds.protocol.datanode.proto does not exist
> cannot find symbol: class HddsProtos
> cannot find symbol: class ContainerCommandRequestProto
> ```
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to