TEZ-1637. Improved shuffle error handling across NM restarts.
Contributed by Rajesh Balamohan.
(cherry picked from commit 62536218271317d8b8e57c7ce172d247a95db3ba)