YARN-2823. Fixed ResourceManager app-attempt state machine to inform schedulers about previous finished attempts of a running appliation to avoid expectation mismatch w.r.t transferred containers. Contributed by Jian He.

(cherry picked from commit a5657182a7accebe08cd86e46b4cdeb163d4d1f2)