This patch MUST be applied to all branches containing HADOOP-18378 so as to ensure reliable test runs. Contributed by Ashutosh Gupta