From 5e29b109e412f8e27a76e0e0ef54d7628fcc9967 Mon Sep 17 00:00:00 2001 From: Alex Leblang Date: Wed, 29 Nov 2017 17:11:54 -0500 Subject: [PATCH] HBASE-19369 Switch to Builder Pattern In WAL This patch makes the switch for the ProtobufLogWriter. I believe that I still need to make some changes in Async Version but I was hoping to get some feedback on whether this is the correct start. --- .../apache/hadoop/hbase/regionserver/wal/ProtobufLogWriter.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/ProtobufLogWriter.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/ProtobufLogWriter.java index d1e72f7..bc1db0a 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/ProtobufLogWriter.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/ProtobufLogWriter.java @@ -89,8 +89,12 @@ public class ProtobufLogWriter extends AbstractProtobufLogWriter @Override protected void initOutput(FileSystem fs, Path path, boolean overwritable, int bufferSize, short replication, long blockSize) throws IOException, StreamLacksCapabilityException { - this.output = fs.createNonRecursive(path, overwritable, bufferSize, replication, blockSize, - null); + if (!(fs instanceof DistributedFileSystem)) { + this.output = fs.createNonRecursive(path, overwritable, bufferSize, replication, blockSize, + null); + } else { + this.output = fs.create(path, overwritable, bufferSize).replicate().replication(replication, blockSize).build(); + } // TODO Be sure to add a check for hsync if this branch includes HBASE-19024 if (!(CommonFSUtils.hasCapability(output, "hflush"))) { throw new StreamLacksCapabilityException("hflush"); -- 2.7.4 (Apple Git-66)