Merge r1503934 from trunk to branch-2 for MAPREDUCE-5398. MR changes for YARN-513 (Jian He via bikas)