First Commit. Matching required patch code in this version from issue
HBASE-9927 from @Ted Yu.