Skip to content

HADOOP-13363. Upgrade protobuf from 2.5.0 to something newer #1408

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dev-support/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ ENV PATH "${PATH}:/opt/cmake/bin"
# hadolint ignore=DL3003
RUN mkdir -p /opt/protobuf-src \
&& curl -L -s -S \
https://github.com/google/protobuf/releases/download/v2.5.0/protobuf-2.5.0.tar.gz \
https://github.com/protocolbuffers/protobuf/releases/download/v3.7.1/protobuf-java-3.7.1.tar.gz \
-o /opt/protobuf.tar.gz \
&& tar xzf /opt/protobuf.tar.gz --strip-components 1 -C /opt/protobuf-src \
&& cd /opt/protobuf-src \
Expand Down
7 changes: 7 additions & 0 deletions hadoop-client-modules/hadoop-client-runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,13 @@
<exclude>update*</exclude>
</excludes>
</filter>
<filter>
<artifact>com.google.protobuf:protobuf-java</artifact>
<excludes>
<exclude>google/protobuf/*.proto</exclude>
<exclude>google/protobuf/**/*.proto</exclude>
</excludes>
</filter>
</filters>
<relocations>
<relocation>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

import org.apache.commons.codec.binary.Base64;

import com.google.protobuf.GeneratedMessage;
import com.google.protobuf.GeneratedMessageV3;
import com.google.protobuf.Message;
import com.google.protobuf.Message.Builder;
import com.google.protobuf.MessageOrBuilder;
Expand All @@ -31,7 +31,7 @@
* Helper class for setting/getting data elements in an object backed by a
* protobuf implementation.
*/
public class FederationProtocolPBTranslator<P extends GeneratedMessage,
public class FederationProtocolPBTranslator<P extends GeneratedMessageV3,
B extends Builder, T extends MessageOrBuilder> {

/** Optional proto byte stream used to create this object. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1015,7 +1015,7 @@ private SectionName(String name) {
}
}

private static int getOndiskTrunkSize(com.google.protobuf.GeneratedMessage s) {
private static int getOndiskTrunkSize(com.google.protobuf.GeneratedMessageV3 s) {
return CodedOutputStream.computeRawVarint32Size(s.getSerializedSize())
+ s.getSerializedSize();
}
Expand Down
2 changes: 1 addition & 1 deletion hadoop-project/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@

<!-- ProtocolBuffer version, used to verify the protoc version and -->
<!-- define the protobuf JAR version -->
<protobuf.version>2.5.0</protobuf.version>
<protobuf.version>3.7.1</protobuf.version>
<protoc.path>${env.HADOOP_PROTOC_PATH}</protoc.path>

<zookeeper.version>3.4.13</zookeeper.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ synchronized void writeDirEntry(DirEntry e) throws IOException {
e.writeDelimitedTo(dirs);
}

private static int getOndiskSize(com.google.protobuf.GeneratedMessage s) {
private static int getOndiskSize(com.google.protobuf.GeneratedMessageV3 s) {
return CodedOutputStream.computeRawVarint32Size(s.getSerializedSize())
+ s.getSerializedSize();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import org.apache.hadoop.yarn.proto.YarnProtos.TimedPlacementConstraintProto;

import com.google.protobuf.GeneratedMessage;
import com.google.protobuf.GeneratedMessageV3;

/**
* {@code PlacementConstraintToProtoConverter} generates a
Expand All @@ -50,7 +51,7 @@
*/
@Private
public class PlacementConstraintToProtoConverter
implements PlacementConstraint.Visitor<GeneratedMessage> {
implements PlacementConstraint.Visitor<GeneratedMessageV3> {

private PlacementConstraint placementConstraint;

Expand All @@ -65,7 +66,7 @@ public PlacementConstraintProto convert() {
}

@Override
public GeneratedMessage visit(SingleConstraint constraint) {
public GeneratedMessageV3 visit(SingleConstraint constraint) {
SimplePlacementConstraintProto.Builder sb =
SimplePlacementConstraintProto.newBuilder();

Expand Down Expand Up @@ -94,7 +95,7 @@ public GeneratedMessage visit(SingleConstraint constraint) {
}

@Override
public GeneratedMessage visit(TargetExpression target) {
public GeneratedMessageV3 visit(TargetExpression target) {
PlacementConstraintTargetProto.Builder tb =
PlacementConstraintTargetProto.newBuilder();

Expand All @@ -109,16 +110,16 @@ public GeneratedMessage visit(TargetExpression target) {
}

@Override
public GeneratedMessage visit(TargetConstraint constraint) {
public GeneratedMessageV3 visit(TargetConstraint constraint) {
throw new YarnRuntimeException("Unexpected TargetConstraint found.");
}

@Override
public GeneratedMessage visit(CardinalityConstraint constraint) {
public GeneratedMessageV3 visit(CardinalityConstraint constraint) {
throw new YarnRuntimeException("Unexpected CardinalityConstraint found.");
}

private GeneratedMessage visitAndOr(
private GeneratedMessageV3 visitAndOr(
CompositeConstraint<AbstractConstraint> composite, CompositeType type) {
CompositePlacementConstraintProto.Builder cb =
CompositePlacementConstraintProto.newBuilder();
Expand All @@ -137,17 +138,17 @@ private GeneratedMessage visitAndOr(
}

@Override
public GeneratedMessage visit(And constraint) {
public GeneratedMessageV3 visit(And constraint) {
return visitAndOr(constraint, CompositeType.AND);
}

@Override
public GeneratedMessage visit(Or constraint) {
public GeneratedMessageV3 visit(Or constraint) {
return visitAndOr(constraint, CompositeType.OR);
}

@Override
public GeneratedMessage visit(DelayedOr constraint) {
public GeneratedMessageV3 visit(DelayedOr constraint) {
CompositePlacementConstraintProto.Builder cb =
CompositePlacementConstraintProto.newBuilder();

Expand All @@ -166,7 +167,7 @@ public GeneratedMessage visit(DelayedOr constraint) {
}

@Override
public GeneratedMessage visit(TimedPlacementConstraint constraint) {
public GeneratedMessageV3 visit(TimedPlacementConstraint constraint) {
TimedPlacementConstraintProto.Builder tb =
TimedPlacementConstraintProto.newBuilder();

Expand Down