HBASE-12150 Backport replication changes from HBASE-12145