From a53b85ec22c707d4730bab6af0595c3d001ffd32 Mon Sep 17 00:00:00 2001 From: lixiaobao Date: Tue, 27 Nov 2018 20:30:23 +0800 Subject: [PATCH] HBASE-21507 Compaction failed when execute AbstractMultiFileWriter.beforeShipped() method Signed-off-by: zhangduo Signed-off-by: Anoop Sam John --- .../hbase/regionserver/AbstractMultiFileWriter.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/AbstractMultiFileWriter.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/AbstractMultiFileWriter.java index 2fdab813132..43d0ad8858a 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/AbstractMultiFileWriter.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/AbstractMultiFileWriter.java @@ -21,12 +21,10 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Collection; import java.util.List; - import org.apache.hadoop.fs.Path; import org.apache.yetus.audience.InterfaceAudience; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.apache.hadoop.hbase.regionserver.CellSink; /** * Base class for cell sink that separates the provided cells into multiple files. @@ -119,9 +117,12 @@ public abstract class AbstractMultiFileWriter implements CellSink, ShipperListen @Override public void beforeShipped() throws IOException { - if (this.writers() != null) { - for (StoreFileWriter writer : writers()) { - writer.beforeShipped(); + Collection writers = writers(); + if (writers != null) { + for (StoreFileWriter writer : writers) { + if (writer != null) { + writer.beforeShipped(); + } } } }