diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/WALUtil.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/WALUtil.java index 1b17adc90ca..09920896cfa 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/WALUtil.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/WALUtil.java @@ -176,7 +176,20 @@ public class WALUtil { */ public static long getWALBlockSize(Configuration conf, FileSystem fs, Path dir) throws IOException { - return conf.getLong("hbase.regionserver.hlog.blocksize", - CommonFSUtils.getDefaultBlockSize(fs, dir) * 2); + return getWALBlockSize(conf, fs, dir, false); + } + + /** + * Public because of FSHLog. Should be package-private + * @param isRecoverEdits the created writer is for recovered edits or WAL. For recovered edits, it + * is true and for WAL it is false. + */ + public static long getWALBlockSize(Configuration conf, FileSystem fs, Path dir, + boolean isRecoverEdits) throws IOException { + long defaultBlockSize = CommonFSUtils.getDefaultBlockSize(fs, dir) * 2; + if (isRecoverEdits) { + return conf.getLong("hbase.regionserver.recoverededits.blocksize", defaultBlockSize); + } + return conf.getLong("hbase.regionserver.hlog.blocksize", defaultBlockSize); } } diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/FSHLogProvider.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/FSHLogProvider.java index 44f692d620f..7cd39ea788e 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/FSHLogProvider.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/FSHLogProvider.java @@ -55,10 +55,13 @@ public class FSHLogProvider extends AbstractFSWALProvider { /** * Public because of FSHLog. Should be package-private + * @param overwritable if the created writer can overwrite. For recovered edits, it is true and + * for WAL it is false. Thus we can distinguish WAL and recovered edits by this. */ public static Writer createWriter(final Configuration conf, final FileSystem fs, final Path path, final boolean overwritable) throws IOException { - return createWriter(conf, fs, path, overwritable, WALUtil.getWALBlockSize(conf, fs, path)); + return createWriter(conf, fs, path, overwritable, + WALUtil.getWALBlockSize(conf, fs, path, overwritable)); } /**