HBASE-11742 (Backport HBASE-7987 and HBASE-11185 to 0.98) (Esteban Gutierrez and Matteo Bertozzi)