HADOOP-16557. [pb-upgrade] Upgrade protobuf.version to 3.7.1 (#1432)
HADOOP-16557. [pb-upgrade] Upgrade protobuf.version to 3.7.1. Contributed by Vinayakumar B.
This commit is contained in:
parent
d072d3304c
commit
1654497f98
25
BUILDING.txt
25
BUILDING.txt
@ -6,7 +6,7 @@ Requirements:
|
|||||||
* Unix System
|
* Unix System
|
||||||
* JDK 1.8
|
* JDK 1.8
|
||||||
* Maven 3.3 or later
|
* Maven 3.3 or later
|
||||||
* ProtocolBuffer 2.5.0
|
* ProtocolBuffer 3.7.1
|
||||||
* CMake 3.1 or newer (if compiling native code)
|
* CMake 3.1 or newer (if compiling native code)
|
||||||
* Zlib devel (if compiling native code)
|
* Zlib devel (if compiling native code)
|
||||||
* Cyrus SASL devel (if compiling native code)
|
* Cyrus SASL devel (if compiling native code)
|
||||||
@ -62,8 +62,16 @@ Installing required packages for clean install of Ubuntu 14.04 LTS Desktop:
|
|||||||
$ sudo apt-get -y install maven
|
$ sudo apt-get -y install maven
|
||||||
* Native libraries
|
* Native libraries
|
||||||
$ sudo apt-get -y install build-essential autoconf automake libtool cmake zlib1g-dev pkg-config libssl-dev libsasl2-dev
|
$ sudo apt-get -y install build-essential autoconf automake libtool cmake zlib1g-dev pkg-config libssl-dev libsasl2-dev
|
||||||
* ProtocolBuffer 2.5.0 (required)
|
* ProtocolBuffer 3.7.1 (required)
|
||||||
$ sudo apt-get -y install protobuf-compiler
|
$ mkdir -p /opt/protobuf-3.7-src \
|
||||||
|
&& curl -L -s -S \
|
||||||
|
https://github.com/protocolbuffers/protobuf/releases/download/v3.7.1/protobuf-java-3.7.1.tar.gz \
|
||||||
|
-o /opt/protobuf-3.7.1.tar.gz \
|
||||||
|
&& tar xzf /opt/protobuf-3.7.1.tar.gz --strip-components 1 -C /opt/protobuf-3.7-src \
|
||||||
|
&& cd /opt/protobuf-3.7-src \
|
||||||
|
&& ./configure\
|
||||||
|
&& make install \
|
||||||
|
&& rm -rf /opt/protobuf-3.7-src
|
||||||
|
|
||||||
Optional packages:
|
Optional packages:
|
||||||
|
|
||||||
@ -397,11 +405,10 @@ Installing required dependencies for clean install of macOS 10.14:
|
|||||||
* Install native libraries, only openssl is required to compile native code,
|
* Install native libraries, only openssl is required to compile native code,
|
||||||
you may optionally install zlib, lz4, etc.
|
you may optionally install zlib, lz4, etc.
|
||||||
$ brew install openssl
|
$ brew install openssl
|
||||||
* Protocol Buffers 2.5.0 (required), since 2.5.0 is no longer in Homebrew,
|
* Protocol Buffers 3.7.1 (required)
|
||||||
we need to compile it from source
|
$ wget https://github.com/protocolbuffers/protobuf/releases/download/v3.7.1/protobuf-java-3.7.1.tar.gz
|
||||||
$ wget https://github.com/protocolbuffers/protobuf/releases/download/v2.5.0/protobuf-2.5.0.tar.gz
|
$ mkdir -p protobuf-3.7 && tar zxvf protobuf-java-3.7.1.tar.gz --strip-components 1 -C protobuf-3.7
|
||||||
$ tar zxvf protobuf-2.5.0.tar.gz
|
$ cd protobuf-3.7
|
||||||
$ cd protobuf-2.5.0
|
|
||||||
$ ./configure
|
$ ./configure
|
||||||
$ make
|
$ make
|
||||||
$ make check
|
$ make check
|
||||||
@ -432,7 +439,7 @@ Requirements:
|
|||||||
* Windows System
|
* Windows System
|
||||||
* JDK 1.8
|
* JDK 1.8
|
||||||
* Maven 3.0 or later
|
* Maven 3.0 or later
|
||||||
* ProtocolBuffer 2.5.0
|
* ProtocolBuffer 3.7.1
|
||||||
* CMake 3.1 or newer
|
* CMake 3.1 or newer
|
||||||
* Visual Studio 2010 Professional or Higher
|
* Visual Studio 2010 Professional or Higher
|
||||||
* Windows SDK 8.1 (if building CPU rate control for the container executor)
|
* Windows SDK 8.1 (if building CPU rate control for the container executor)
|
||||||
|
@ -229,6 +229,13 @@
|
|||||||
<exclude>update*</exclude>
|
<exclude>update*</exclude>
|
||||||
</excludes>
|
</excludes>
|
||||||
</filter>
|
</filter>
|
||||||
|
<filter>
|
||||||
|
<artifact>com.google.protobuf:protobuf-java</artifact>
|
||||||
|
<excludes>
|
||||||
|
<exclude>google/protobuf/*.proto</exclude>
|
||||||
|
<exclude>google/protobuf/**/*.proto</exclude>
|
||||||
|
</excludes>
|
||||||
|
</filter>
|
||||||
</filters>
|
</filters>
|
||||||
<relocations>
|
<relocations>
|
||||||
<relocation>
|
<relocation>
|
||||||
|
@ -66,7 +66,7 @@ public String getClassName() {
|
|||||||
* @return may be null if the code was newer than our protobuf definitions or none was given.
|
* @return may be null if the code was newer than our protobuf definitions or none was given.
|
||||||
*/
|
*/
|
||||||
public RpcErrorCodeProto getErrorCode() {
|
public RpcErrorCodeProto getErrorCode() {
|
||||||
return RpcErrorCodeProto.valueOf(errorCode);
|
return RpcErrorCodeProto.forNumber(errorCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -106,7 +106,7 @@ Message getMessage() {
|
|||||||
@Override
|
@Override
|
||||||
void writeTo(ResponseBuffer out) throws IOException {
|
void writeTo(ResponseBuffer out) throws IOException {
|
||||||
int length = message.getSerializedSize();
|
int length = message.getSerializedSize();
|
||||||
length += CodedOutputStream.computeRawVarint32Size(length);
|
length += CodedOutputStream.computeUInt32SizeNoTag(length);
|
||||||
out.ensureCapacity(length);
|
out.ensureCapacity(length);
|
||||||
message.writeDelimitedTo(out);
|
message.writeDelimitedTo(out);
|
||||||
}
|
}
|
||||||
|
@ -3274,10 +3274,10 @@ private byte[] setupResponseForProtobuf(
|
|||||||
cos.writeRawByte((byte)((length >>> 16) & 0xFF));
|
cos.writeRawByte((byte)((length >>> 16) & 0xFF));
|
||||||
cos.writeRawByte((byte)((length >>> 8) & 0xFF));
|
cos.writeRawByte((byte)((length >>> 8) & 0xFF));
|
||||||
cos.writeRawByte((byte)((length >>> 0) & 0xFF));
|
cos.writeRawByte((byte)((length >>> 0) & 0xFF));
|
||||||
cos.writeRawVarint32(header.getSerializedSize());
|
cos.writeUInt32NoTag(header.getSerializedSize());
|
||||||
header.writeTo(cos);
|
header.writeTo(cos);
|
||||||
if (payload != null) {
|
if (payload != null) {
|
||||||
cos.writeRawVarint32(payload.getSerializedSize());
|
cos.writeUInt32NoTag(payload.getSerializedSize());
|
||||||
payload.writeTo(cos);
|
payload.writeTo(cos);
|
||||||
}
|
}
|
||||||
return buf;
|
return buf;
|
||||||
@ -3285,7 +3285,7 @@ private byte[] setupResponseForProtobuf(
|
|||||||
|
|
||||||
private static int getDelimitedLength(Message message) {
|
private static int getDelimitedLength(Message message) {
|
||||||
int length = message.getSerializedSize();
|
int length = message.getSerializedSize();
|
||||||
return length + CodedOutputStream.computeRawVarint32Size(length);
|
return length + CodedOutputStream.computeUInt32SizeNoTag(length);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -69,7 +69,7 @@ public void testVarInt() throws IOException {
|
|||||||
private void doVarIntTest(int value) throws IOException {
|
private void doVarIntTest(int value) throws IOException {
|
||||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||||
CodedOutputStream cout = CodedOutputStream.newInstance(baos);
|
CodedOutputStream cout = CodedOutputStream.newInstance(baos);
|
||||||
cout.writeRawVarint32(value);
|
cout.writeUInt32NoTag(value);
|
||||||
cout.flush();
|
cout.flush();
|
||||||
|
|
||||||
DataInputStream dis = new DataInputStream(
|
DataInputStream dis = new DataInputStream(
|
||||||
|
@ -75,7 +75,7 @@ private enum StatusFormat {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static Status getStatus(int header) {
|
static Status getStatus(int header) {
|
||||||
return Status.valueOf((int) STATUS.BITS.retrieve(header));
|
return Status.forNumber((int) STATUS.BITS.retrieve(header));
|
||||||
}
|
}
|
||||||
|
|
||||||
static ECN getECN(int header) {
|
static ECN getECN(int header) {
|
||||||
|
@ -293,7 +293,7 @@ public static DataChecksum.Type convert(HdfsProtos.ChecksumTypeProto type) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static HdfsProtos.ChecksumTypeProto convert(DataChecksum.Type type) {
|
public static HdfsProtos.ChecksumTypeProto convert(DataChecksum.Type type) {
|
||||||
return HdfsProtos.ChecksumTypeProto.valueOf(type.id);
|
return HdfsProtos.ChecksumTypeProto.forNumber(type.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static HdfsProtos.BlockChecksumTypeProto convert(
|
public static HdfsProtos.BlockChecksumTypeProto convert(
|
||||||
@ -1115,7 +1115,7 @@ public static BlockStoragePolicy convert(BlockStoragePolicyProto proto) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static FsActionProto convert(FsAction v) {
|
public static FsActionProto convert(FsAction v) {
|
||||||
return FsActionProto.valueOf(v != null ? v.ordinal() : 0);
|
return FsActionProto.forNumber(v != null ? v.ordinal() : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static XAttrProto convertXAttrProto(XAttr a) {
|
public static XAttrProto convertXAttrProto(XAttr a) {
|
||||||
@ -1157,7 +1157,7 @@ public static List<XAttr> convertXAttrs(List<XAttrProto> xAttrSpec) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static XAttrNamespaceProto convert(XAttr.NameSpace v) {
|
static XAttrNamespaceProto convert(XAttr.NameSpace v) {
|
||||||
return XAttrNamespaceProto.valueOf(v.ordinal());
|
return XAttrNamespaceProto.forNumber(v.ordinal());
|
||||||
}
|
}
|
||||||
|
|
||||||
static XAttr.NameSpace convert(XAttrNamespaceProto v) {
|
static XAttr.NameSpace convert(XAttrNamespaceProto v) {
|
||||||
@ -1249,7 +1249,7 @@ public static List<AclEntry> convertAclEntry(List<AclEntryProto> aclSpec) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static AclEntryScopeProto convert(AclEntryScope v) {
|
static AclEntryScopeProto convert(AclEntryScope v) {
|
||||||
return AclEntryScopeProto.valueOf(v.ordinal());
|
return AclEntryScopeProto.forNumber(v.ordinal());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static AclEntryScope convert(AclEntryScopeProto v) {
|
private static AclEntryScope convert(AclEntryScopeProto v) {
|
||||||
@ -1257,7 +1257,7 @@ private static AclEntryScope convert(AclEntryScopeProto v) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static AclEntryTypeProto convert(AclEntryType e) {
|
static AclEntryTypeProto convert(AclEntryType e) {
|
||||||
return AclEntryTypeProto.valueOf(e.ordinal());
|
return AclEntryTypeProto.forNumber(e.ordinal());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static AclEntryType convert(AclEntryTypeProto v) {
|
private static AclEntryType convert(AclEntryTypeProto v) {
|
||||||
@ -3220,7 +3220,7 @@ public static ErasureCodingPolicyState convertECState(
|
|||||||
|
|
||||||
public static HdfsProtos.ErasureCodingPolicyState convertECState(
|
public static HdfsProtos.ErasureCodingPolicyState convertECState(
|
||||||
ErasureCodingPolicyState state) {
|
ErasureCodingPolicyState state) {
|
||||||
return HdfsProtos.ErasureCodingPolicyState.valueOf(state.getValue());
|
return HdfsProtos.ErasureCodingPolicyState.forNumber(state.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -3356,7 +3356,7 @@ public static List<AddBlockFlagProto> convertAddBlockFlags(
|
|||||||
EnumSet<AddBlockFlag> flags) {
|
EnumSet<AddBlockFlag> flags) {
|
||||||
List<AddBlockFlagProto> ret = new ArrayList<>();
|
List<AddBlockFlagProto> ret = new ArrayList<>();
|
||||||
for (AddBlockFlag flag : flags) {
|
for (AddBlockFlag flag : flags) {
|
||||||
AddBlockFlagProto abfp = AddBlockFlagProto.valueOf(flag.getMode());
|
AddBlockFlagProto abfp = AddBlockFlagProto.forNumber(flag.getMode());
|
||||||
if (abfp != null) {
|
if (abfp != null) {
|
||||||
ret.add(abfp);
|
ret.add(abfp);
|
||||||
}
|
}
|
||||||
@ -3409,7 +3409,8 @@ public static List<OpenFilesTypeProto> convertOpenFileTypes(
|
|||||||
EnumSet<OpenFilesType> types) {
|
EnumSet<OpenFilesType> types) {
|
||||||
List<OpenFilesTypeProto> typeProtos = new ArrayList<>();
|
List<OpenFilesTypeProto> typeProtos = new ArrayList<>();
|
||||||
for (OpenFilesType type : types) {
|
for (OpenFilesType type : types) {
|
||||||
OpenFilesTypeProto typeProto = OpenFilesTypeProto.valueOf(type.getMode());
|
OpenFilesTypeProto typeProto = OpenFilesTypeProto
|
||||||
|
.forNumber(type.getMode());
|
||||||
if (typeProto != null) {
|
if (typeProto != null) {
|
||||||
typeProtos.add(typeProto);
|
typeProtos.add(typeProto);
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
import org.apache.commons.codec.binary.Base64;
|
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;
|
||||||
import com.google.protobuf.Message.Builder;
|
import com.google.protobuf.Message.Builder;
|
||||||
import com.google.protobuf.MessageOrBuilder;
|
import com.google.protobuf.MessageOrBuilder;
|
||||||
@ -31,7 +31,7 @@
|
|||||||
* Helper class for setting/getting data elements in an object backed by a
|
* Helper class for setting/getting data elements in an object backed by a
|
||||||
* protobuf implementation.
|
* protobuf implementation.
|
||||||
*/
|
*/
|
||||||
public class FederationProtocolPBTranslator<P extends GeneratedMessage,
|
public class FederationProtocolPBTranslator<P extends GeneratedMessageV3,
|
||||||
B extends Builder, T extends MessageOrBuilder> {
|
B extends Builder, T extends MessageOrBuilder> {
|
||||||
|
|
||||||
/** Optional proto byte stream used to create this object. */
|
/** Optional proto byte stream used to create this object. */
|
||||||
|
@ -276,12 +276,12 @@ public void add(Replica replica) {
|
|||||||
try {
|
try {
|
||||||
// zig-zag to reduce size of legacy blocks
|
// zig-zag to reduce size of legacy blocks
|
||||||
cos.writeSInt64NoTag(replica.getBlockId());
|
cos.writeSInt64NoTag(replica.getBlockId());
|
||||||
cos.writeRawVarint64(replica.getBytesOnDisk());
|
cos.writeUInt64NoTag(replica.getBytesOnDisk());
|
||||||
cos.writeRawVarint64(replica.getGenerationStamp());
|
cos.writeUInt64NoTag(replica.getGenerationStamp());
|
||||||
ReplicaState state = replica.getState();
|
ReplicaState state = replica.getState();
|
||||||
// although state is not a 64-bit value, using a long varint to
|
// although state is not a 64-bit value, using a long varint to
|
||||||
// allow for future use of the upper bits
|
// allow for future use of the upper bits
|
||||||
cos.writeRawVarint64(state.getValue());
|
cos.writeUInt64NoTag(state.getValue());
|
||||||
if (state == ReplicaState.FINALIZED) {
|
if (state == ReplicaState.FINALIZED) {
|
||||||
numFinalized++;
|
numFinalized++;
|
||||||
}
|
}
|
||||||
|
@ -1015,8 +1015,9 @@ private SectionName(String name) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int getOndiskTrunkSize(com.google.protobuf.GeneratedMessage s) {
|
private static int getOndiskTrunkSize(
|
||||||
return CodedOutputStream.computeRawVarint32Size(s.getSerializedSize())
|
com.google.protobuf.GeneratedMessageV3 s) {
|
||||||
|
return CodedOutputStream.computeUInt32SizeNoTag(s.getSerializedSize())
|
||||||
+ s.getSerializedSize();
|
+ s.getSerializedSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -433,7 +433,7 @@ private void dumpXattrs(INodeSection.XAttrFeatureProto xattrs) {
|
|||||||
int ns = (XATTR_NAMESPACE_MASK & (encodedName >> XATTR_NAMESPACE_OFFSET)) |
|
int ns = (XATTR_NAMESPACE_MASK & (encodedName >> XATTR_NAMESPACE_OFFSET)) |
|
||||||
((XATTR_NAMESPACE_EXT_MASK & (encodedName >> XATTR_NAMESPACE_EXT_OFFSET)) << 2);
|
((XATTR_NAMESPACE_EXT_MASK & (encodedName >> XATTR_NAMESPACE_EXT_OFFSET)) << 2);
|
||||||
o(INODE_SECTION_NS, XAttrProtos.XAttrProto.
|
o(INODE_SECTION_NS, XAttrProtos.XAttrProto.
|
||||||
XAttrNamespaceProto.valueOf(ns).toString());
|
XAttrNamespaceProto.forNumber(ns).toString());
|
||||||
o(SECTION_NAME, SerialNumberManager.XATTR.getString(
|
o(SECTION_NAME, SerialNumberManager.XATTR.getString(
|
||||||
XATTR_NAME_MASK & (encodedName >> XATTR_NAME_OFFSET),
|
XATTR_NAME_MASK & (encodedName >> XATTR_NAME_OFFSET),
|
||||||
stringTable));
|
stringTable));
|
||||||
|
@ -910,7 +910,7 @@ public void testFSServerDefaultsHelper() {
|
|||||||
b.setFileBufferSize(DFSConfigKeys.IO_FILE_BUFFER_SIZE_DEFAULT);
|
b.setFileBufferSize(DFSConfigKeys.IO_FILE_BUFFER_SIZE_DEFAULT);
|
||||||
b.setEncryptDataTransfer(DFSConfigKeys.DFS_ENCRYPT_DATA_TRANSFER_DEFAULT);
|
b.setEncryptDataTransfer(DFSConfigKeys.DFS_ENCRYPT_DATA_TRANSFER_DEFAULT);
|
||||||
b.setTrashInterval(DFSConfigKeys.FS_TRASH_INTERVAL_DEFAULT);
|
b.setTrashInterval(DFSConfigKeys.FS_TRASH_INTERVAL_DEFAULT);
|
||||||
b.setChecksumType(HdfsProtos.ChecksumTypeProto.valueOf(
|
b.setChecksumType(HdfsProtos.ChecksumTypeProto.forNumber(
|
||||||
DataChecksum.Type.valueOf(DFSConfigKeys.DFS_CHECKSUM_TYPE_DEFAULT).id));
|
DataChecksum.Type.valueOf(DFSConfigKeys.DFS_CHECKSUM_TYPE_DEFAULT).id));
|
||||||
HdfsProtos.FsServerDefaultsProto proto = b.build();
|
HdfsProtos.FsServerDefaultsProto proto = b.build();
|
||||||
|
|
||||||
|
@ -75,6 +75,9 @@ public void tearDown() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBlockReportExceedsLengthLimit() throws Exception {
|
public void testBlockReportExceedsLengthLimit() throws Exception {
|
||||||
|
//protobuf's default limit increased to 2GB from protobuf 3.x onwards.
|
||||||
|
//So there will not be any exception thrown from protobuf.
|
||||||
|
conf.setInt(IPC_MAXIMUM_DATA_LENGTH, IPC_MAXIMUM_DATA_LENGTH_DEFAULT / 2);
|
||||||
initCluster();
|
initCluster();
|
||||||
// Create a large enough report that we expect it will go beyond the RPC
|
// Create a large enough report that we expect it will go beyond the RPC
|
||||||
// server's length validation, and also protobuf length validation.
|
// server's length validation, and also protobuf length validation.
|
||||||
|
@ -84,7 +84,7 @@
|
|||||||
|
|
||||||
<!-- ProtocolBuffer version, used to verify the protoc version and -->
|
<!-- ProtocolBuffer version, used to verify the protoc version and -->
|
||||||
<!-- define the protobuf JAR version -->
|
<!-- 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>
|
<protoc.path>${env.HADOOP_PROTOC_PATH}</protoc.path>
|
||||||
|
|
||||||
<zookeeper.version>3.4.13</zookeeper.version>
|
<zookeeper.version>3.4.13</zookeeper.version>
|
||||||
@ -1918,6 +1918,9 @@
|
|||||||
<activation>
|
<activation>
|
||||||
<activeByDefault>false</activeByDefault>
|
<activeByDefault>false</activeByDefault>
|
||||||
</activation>
|
</activation>
|
||||||
|
<properties>
|
||||||
|
<protoc.path>/opt/protobuf-3.7/bin/protoc</protoc.path>
|
||||||
|
</properties>
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
|
@ -266,8 +266,8 @@ synchronized void writeDirEntry(DirEntry e) throws IOException {
|
|||||||
e.writeDelimitedTo(dirs);
|
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())
|
return CodedOutputStream.computeUInt32SizeNoTag(s.getSerializedSize())
|
||||||
+ s.getSerializedSize();
|
+ s.getSerializedSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,6 +55,7 @@
|
|||||||
<groupId>org.apache.hadoop</groupId>
|
<groupId>org.apache.hadoop</groupId>
|
||||||
<artifactId>hadoop-annotations</artifactId>
|
<artifactId>hadoop-annotations</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.protobuf</groupId>
|
<groupId>com.google.protobuf</groupId>
|
||||||
<artifactId>protobuf-java</artifactId>
|
<artifactId>protobuf-java</artifactId>
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
import org.apache.hadoop.yarn.proto.YarnProtos.SimplePlacementConstraintProto;
|
import org.apache.hadoop.yarn.proto.YarnProtos.SimplePlacementConstraintProto;
|
||||||
import org.apache.hadoop.yarn.proto.YarnProtos.TimedPlacementConstraintProto;
|
import org.apache.hadoop.yarn.proto.YarnProtos.TimedPlacementConstraintProto;
|
||||||
|
|
||||||
import com.google.protobuf.GeneratedMessage;
|
import com.google.protobuf.GeneratedMessageV3;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@code PlacementConstraintToProtoConverter} generates a
|
* {@code PlacementConstraintToProtoConverter} generates a
|
||||||
@ -50,7 +50,7 @@
|
|||||||
*/
|
*/
|
||||||
@Private
|
@Private
|
||||||
public class PlacementConstraintToProtoConverter
|
public class PlacementConstraintToProtoConverter
|
||||||
implements PlacementConstraint.Visitor<GeneratedMessage> {
|
implements PlacementConstraint.Visitor<GeneratedMessageV3> {
|
||||||
|
|
||||||
private PlacementConstraint placementConstraint;
|
private PlacementConstraint placementConstraint;
|
||||||
|
|
||||||
@ -65,7 +65,7 @@ public PlacementConstraintProto convert() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public GeneratedMessage visit(SingleConstraint constraint) {
|
public GeneratedMessageV3 visit(SingleConstraint constraint) {
|
||||||
SimplePlacementConstraintProto.Builder sb =
|
SimplePlacementConstraintProto.Builder sb =
|
||||||
SimplePlacementConstraintProto.newBuilder();
|
SimplePlacementConstraintProto.newBuilder();
|
||||||
|
|
||||||
@ -94,7 +94,7 @@ public GeneratedMessage visit(SingleConstraint constraint) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public GeneratedMessage visit(TargetExpression target) {
|
public GeneratedMessageV3 visit(TargetExpression target) {
|
||||||
PlacementConstraintTargetProto.Builder tb =
|
PlacementConstraintTargetProto.Builder tb =
|
||||||
PlacementConstraintTargetProto.newBuilder();
|
PlacementConstraintTargetProto.newBuilder();
|
||||||
|
|
||||||
@ -109,16 +109,16 @@ public GeneratedMessage visit(TargetExpression target) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public GeneratedMessage visit(TargetConstraint constraint) {
|
public GeneratedMessageV3 visit(TargetConstraint constraint) {
|
||||||
throw new YarnRuntimeException("Unexpected TargetConstraint found.");
|
throw new YarnRuntimeException("Unexpected TargetConstraint found.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public GeneratedMessage visit(CardinalityConstraint constraint) {
|
public GeneratedMessageV3 visit(CardinalityConstraint constraint) {
|
||||||
throw new YarnRuntimeException("Unexpected CardinalityConstraint found.");
|
throw new YarnRuntimeException("Unexpected CardinalityConstraint found.");
|
||||||
}
|
}
|
||||||
|
|
||||||
private GeneratedMessage visitAndOr(
|
private GeneratedMessageV3 visitAndOr(
|
||||||
CompositeConstraint<AbstractConstraint> composite, CompositeType type) {
|
CompositeConstraint<AbstractConstraint> composite, CompositeType type) {
|
||||||
CompositePlacementConstraintProto.Builder cb =
|
CompositePlacementConstraintProto.Builder cb =
|
||||||
CompositePlacementConstraintProto.newBuilder();
|
CompositePlacementConstraintProto.newBuilder();
|
||||||
@ -137,17 +137,17 @@ private GeneratedMessage visitAndOr(
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public GeneratedMessage visit(And constraint) {
|
public GeneratedMessageV3 visit(And constraint) {
|
||||||
return visitAndOr(constraint, CompositeType.AND);
|
return visitAndOr(constraint, CompositeType.AND);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public GeneratedMessage visit(Or constraint) {
|
public GeneratedMessageV3 visit(Or constraint) {
|
||||||
return visitAndOr(constraint, CompositeType.OR);
|
return visitAndOr(constraint, CompositeType.OR);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public GeneratedMessage visit(DelayedOr constraint) {
|
public GeneratedMessageV3 visit(DelayedOr constraint) {
|
||||||
CompositePlacementConstraintProto.Builder cb =
|
CompositePlacementConstraintProto.Builder cb =
|
||||||
CompositePlacementConstraintProto.newBuilder();
|
CompositePlacementConstraintProto.newBuilder();
|
||||||
|
|
||||||
@ -166,7 +166,7 @@ public GeneratedMessage visit(DelayedOr constraint) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public GeneratedMessage visit(TimedPlacementConstraint constraint) {
|
public GeneratedMessageV3 visit(TimedPlacementConstraint constraint) {
|
||||||
TimedPlacementConstraintProto.Builder tb =
|
TimedPlacementConstraintProto.Builder tb =
|
||||||
TimedPlacementConstraintProto.newBuilder();
|
TimedPlacementConstraintProto.newBuilder();
|
||||||
|
|
||||||
|
@ -154,10 +154,10 @@ public void setVolumeCapability(
|
|||||||
CsiAdaptorProtos.VolumeCapability vc =
|
CsiAdaptorProtos.VolumeCapability vc =
|
||||||
CsiAdaptorProtos.VolumeCapability.newBuilder()
|
CsiAdaptorProtos.VolumeCapability.newBuilder()
|
||||||
.setAccessMode(CsiAdaptorProtos.VolumeCapability
|
.setAccessMode(CsiAdaptorProtos.VolumeCapability
|
||||||
.AccessMode.valueOf(
|
.AccessMode.forNumber(
|
||||||
capability.getAccessMode().ordinal()))
|
capability.getAccessMode().ordinal()))
|
||||||
.setVolumeType(CsiAdaptorProtos.VolumeCapability
|
.setVolumeType(CsiAdaptorProtos.VolumeCapability
|
||||||
.VolumeType.valueOf(capability.getVolumeType().ordinal()))
|
.VolumeType.forNumber(capability.getVolumeType().ordinal()))
|
||||||
.addAllMountFlags(capability.getMountFlags())
|
.addAllMountFlags(capability.getMountFlags())
|
||||||
.build();
|
.build();
|
||||||
builder.setVolumeCapability(vc);
|
builder.setVolumeCapability(vc);
|
||||||
|
@ -68,9 +68,9 @@ public void addVolumeCapability(VolumeCapability volumeCapability) {
|
|||||||
CsiAdaptorProtos.VolumeCapability vc =
|
CsiAdaptorProtos.VolumeCapability vc =
|
||||||
CsiAdaptorProtos.VolumeCapability.newBuilder()
|
CsiAdaptorProtos.VolumeCapability.newBuilder()
|
||||||
.setAccessMode(CsiAdaptorProtos.VolumeCapability.AccessMode
|
.setAccessMode(CsiAdaptorProtos.VolumeCapability.AccessMode
|
||||||
.valueOf(volumeCapability.getAccessMode().ordinal()))
|
.forNumber(volumeCapability.getAccessMode().ordinal()))
|
||||||
.setVolumeType(CsiAdaptorProtos.VolumeCapability.VolumeType
|
.setVolumeType(CsiAdaptorProtos.VolumeCapability.VolumeType
|
||||||
.valueOf(volumeCapability.getVolumeType().ordinal()))
|
.forNumber(volumeCapability.getVolumeType().ordinal()))
|
||||||
.addAllMountFlags(volumeCapability.getMountFlags())
|
.addAllMountFlags(volumeCapability.getMountFlags())
|
||||||
.build();
|
.build();
|
||||||
builder.addVolumeCapabilities(vc);
|
builder.addVolumeCapabilities(vc);
|
||||||
|
Loading…
Reference in New Issue
Block a user