Refine the code.
refine the UT.
Merge remote-tracking branch 'origin/hbase-11339-core-snapshot' into hbase-11339-sweep-tool