jojochuang commented on a change in pull request #1301: HBASE-23833. The
relocated hadoop-thirdparty protobuf breaks HBase asyncwal
URL: https://github.com/apache/hbase/pull/1301#discussion_r395391730
##########
File path:
hbase-server/src/main/java/org/apache/hadoop/hbase/io/asyncfs/FanOutOneBlockAsyncDFSOutputSaslHelper.java
##########
@@ -355,6 +353,55 @@ private void sendSaslMessage(ChannelHandlerContext ctx,
byte[] payload) throws I
return Collections.singletonList(new
CipherOption(CipherSuite.AES_CTR_NOPADDING));
}
+ private static class BuilderPayloadSetter {
+ private static Class<?> byteStringClass;
+ private static Class<?> builderClass;
+ private static Method copyFromMethod;
+ private static Method setPayloadMethod = null;
+
+ static void setter(DataTransferEncryptorMessageProto.Builder builder,
byte[] payload) {
+ Object byteStringObject = null;
+ try {
+ byteStringObject = copyFromMethod.invoke(null, payload);
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ } catch (InvocationTargetException e) {
+ e.printStackTrace();
+ }
+
+ if (setPayloadMethod == null) {
+ try {
+ setPayloadMethod = builderClass.getMethod("setPayload",
byteStringClass);
+ } catch (NoSuchMethodException e) {
+ e.printStackTrace();
+ }
+ }
+
+ try {
+ setPayloadMethod.invoke(builder, byteStringObject);
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ } catch (InvocationTargetException e) {
+ e.printStackTrace();
+ }
+ }
+
+ static {
+ builderClass = DataTransferEncryptorMessageProto.Builder.class;
+ byteStringClass = com.google.protobuf.ByteString.class;
+ try {
+ byteStringClass =
Class.forName("org.apache.hadoop.thirdparty.protobuf.ByteString");
+ } catch (ClassNotFoundException e) {
+ e.printStackTrace();
Review comment:
Done.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services