HADOOP-9235. (cherry picked from commit 7262c0f)