From 60de4c2e31fee195311a2b99846e8d69af5b2985 Mon Sep 17 00:00:00 2001 From: Wei-Chiu Chuang Date: Mon, 16 Mar 2020 23:36:56 -0700 Subject: [PATCH] HBASE-22103. HDFS-13209 in Hadoop 3.3.0 breaks asyncwal. (#1284) Signed-off-by: Duo Zhang --- .../FanOutOneBlockAsyncDFSOutputHelper.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/asyncfs/FanOutOneBlockAsyncDFSOutputHelper.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/asyncfs/FanOutOneBlockAsyncDFSOutputHelper.java index bd60729e87f9..9520e16c85cf 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/asyncfs/FanOutOneBlockAsyncDFSOutputHelper.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/asyncfs/FanOutOneBlockAsyncDFSOutputHelper.java @@ -221,6 +221,18 @@ public void end(DFSClient client, long inodeId) { }; } + private static FileCreator createFileCreator3_3() throws NoSuchMethodException { + Method createMethod = ClientProtocol.class.getMethod("create", String.class, FsPermission.class, + String.class, EnumSetWritable.class, boolean.class, short.class, long.class, + CryptoProtocolVersion[].class, String.class, String.class); + + return (instance, src, masked, clientName, flag, createParent, replication, blockSize, + supportedVersions) -> { + return (HdfsFileStatus) createMethod.invoke(instance, src, masked, clientName, flag, + createParent, replication, blockSize, supportedVersions, null, null); + }; + } + private static FileCreator createFileCreator3() throws NoSuchMethodException { Method createMethod = ClientProtocol.class.getMethod("create", String.class, FsPermission.class, String.class, EnumSetWritable.class, boolean.class, short.class, long.class, @@ -246,6 +258,12 @@ private static FileCreator createFileCreator2() throws NoSuchMethodException { } private static FileCreator createFileCreator() throws NoSuchMethodException { + try { + return createFileCreator3_3(); + } catch (NoSuchMethodException e) { + LOG.debug("ClientProtocol::create wrong number of arguments, should be hadoop 3.2 or below"); + } + try { return createFileCreator3(); } catch (NoSuchMethodException e) {