Floci's shutdown removes every application's Flink cluster, and nothing
started them again, so after a restart with persistent storage an
application still reported RUNNING with no cluster and no job behind
it.
At startup, each application that was RUNNING or still STARTING goes
back to STARTING, and its cluster starts in the background. A cluster
that outlived Floci is kept when its JobManager, TaskManager and job
still run. Otherwise what survives of it is removed, under the current
or the old floci- names, and the application gets a new cluster, as
StartApplication starts one, in the application's own account, and the
readiness poller runs its job afresh and reports it RUNNING. An
application whose cluster cannot be started goes back to READY, from
which StartApplication starts it again. An application stopped while
its restore is starting the cluster is STOPPING, as AWS reports a stop
in progress, until the restore has removed that cluster by its
containers' IDs, and READY then. StartApplication and DeleteApplication
refuse it meanwhile, so no second start runs under the cluster's names.
One still STOPPING at the next start has what survives of its cluster
removed before it turns READY. Each removal is confirmed with Docker:
while Docker keeps the cluster, the application stays STOPPING and the
cluster stays named and tracked, for shutdown and the next start.
Records stored under the keys of older builds move onto their current
keys first, so no application is restored twice. A start that shutdown
overtakes removes its containers.
Part of #5664.