HBase compaction行为及触发条件
HBase compaction come in two varieties: minor and major.
for the minor:
将最新的几个小文件合成一个大文件。
何时合并行为发生?
当文件满足下面所有条件时,合并行为将发生:
1> 参与合并的文件个数 >= hbase.hstore.compaction.min (default is 3), 但最多不超过hbase.hstore.compaction.max(default is 10)
2> 参与合并的文件需满足的条件:?
文件大小 < hbase.hstore.compaction.max.size (default is Long.MAX_VALUE)
且,文件大小 < 所有创建日期比该文件大(新)的文件大小之和*1.2
文件大小 < hbase.hstore.compactoin.min.size(memstore flush size)
3> 文件选择的优先级
优先考虑老文件。
for the major:
将所有文件合并
Which compaction type is run is automatically determined when the compaction
check is executed。 The check is triggered either after a memstore has been flushed to
disk, after the compact or major_compact shell commands or corresponding API calls
have been invoked, or by a background thread.