Improve the implementation.
Merge remote-tracking branch 'origin/hbase-11339-core' into hbase-11339-core-compaction