Merge r1601537 from trunk. YARN-2030. Augmented RMStateStore with state machine. Contributed by Binglin Chang