diff --git hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StripeStoreFlusher.java hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StripeStoreFlusher.java index 768c691..1c1baaa 100644 --- hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StripeStoreFlusher.java +++ hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StripeStoreFlusher.java @@ -21,6 +21,7 @@ package org.apache.hadoop.hbase.regionserver; import static org.apache.hadoop.hbase.regionserver.StripeStoreFileManager.OPEN_KEY; import java.io.IOException; +import java.util.Collections; import java.util.List; import org.apache.commons.logging.Log; @@ -54,14 +55,13 @@ public class StripeStoreFlusher extends StoreFlusher { @Override public List flushSnapshot(MemStoreSnapshot snapshot, long cacheFlushSeqNum, MonitoredTask status) throws IOException { - List result = null; int cellsCount = snapshot.getCellsCount(); - if (cellsCount == 0) return result; // don't flush if there are no entries + if (cellsCount == 0) return Collections.emptyList(); // don't flush if there are no entries long smallestReadPoint = store.getSmallestReadPoint(); InternalScanner scanner = createScanner(snapshot.getScanner(), smallestReadPoint); if (scanner == null) { - return result; // NULL scanner returned from coprocessor hooks means skip normal processing + return Collections.emptyList(); // NULL scanner returned from coprocessor hooks means skip normal processing } // Let policy select flush method. @@ -69,6 +69,7 @@ public class StripeStoreFlusher extends StoreFlusher { boolean success = false; StripeMultiFileWriter mw = null; + List result = null; try { mw = req.createWriter(); // Writer according to the policy. StripeMultiFileWriter.WriterFactory factory = createWriterFactory( @@ -83,7 +84,9 @@ public class StripeStoreFlusher extends StoreFlusher { } } finally { if (!success && (mw != null)) { - if (result != null) { + if (result == null) { + result = Collections.emptyList(); + } else { result.clear(); } for (Path leftoverFile : mw.abortWriters()) {