TEZ-1642. TestAMRecovery sometimes fail. (zjffdu)

(cherry picked from commit 6dda1d77bcd6460780144ae2aab905c2a255e94a)