HBASE-20986 Separate the config of block size when we do log splitting and write Hlog
Signed-off-by: Guanghao Zhang <zghao@apache.org>
This commit is contained in:
parent
7e9f8c60e2
commit
9d594ac86a
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,10 +55,13 @@ public class FSHLogProvider extends AbstractFSWALProvider<FSHLog> {
|
|||
|
||||
/**
|
||||
* 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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue