storage: add a migration for missing HardState
storage: add a migration for missing HardState

See #6991. It's possible that the HardState is missing after a snapshot was
applied (so there is a TruncatedState). In this case, synthesize a HardState
(simply setting everything that was in the snapshot to committed). Having lost
the original HardState can theoretically mean that the replica was further
ahead or had voted, and so there's no guarantee that this will be correct. But
it will be correct in the majority of cases, and some state *has* to be
recovered.

To illustrate this in the scenario in #6991: There, we (presumably) have
applied an empty snapshot (no real data, but a Raft log which starts and
ends at index ten as designated by its TruncatedState). We don't have a
HardState, so Raft will crash because its Commit index zero isn't in line
with the fact that our Raft log starts only at index ten.

The migration sees that there is a TruncatedState, but no HardState. It will
synthesize a HardState with Commit:10 (and the corresponding Term from the
TruncatedState, which is five).

glycerine/cockroach,cockroachdb/cockroach,petermattis/cockroach,maxlang/cockroach,vaibhavarora/cockroach,glycerine/cockroach,vivekmenezes/cockroach,veteranlu/cockroach,glycerine/cockroach,veteranlu/cockroach,vaibhavarora/cockroach,paperstreet/cockroach,glycerine/cockroach,vivekmenezes/cockroach,vaibhavarora/cockroach,cockroachdb/cockroach,arjun4084346/cockroach,glycerine/cockroach,petermattis/cockroach,maxlang/cockroach,maxlang/cockroach,sunya123/cockroach,vaibhavarora/cockroach,sunya123/cockroach,vivekmenezes/cockroach,glycerine/cockroach,arjun4084346/cockroach,sunya123/cockroach,arjun4084346/cockroach,glycerine/cockroach,maxlang/cockroach,cockroachdb/cockroach,maxlang/cockroach,paperstreet/cockroach,cockroachdb/cockroach,veteranlu/cockroach,arjun4084346/cockroach,sunya123/cockroach,vaibhavarora/cockroach,cockroachdb/cockroach,paperstreet/cockroach,veteranlu/cockroach,glycerine/cockroach,vivekmenezes/cockroach,vaibhavarora/cockroach,arjun4084346/cockroach,vivekmenezes/cockroach,paperstreet/cockroach,veteranlu/cockroach,sunya123/cockroach,sunya123/cockroach,arjun4084346/cockroach,vivekmenezes/cockroach,petermattis/cockroach,sunya123/cockroach,vaibhavarora/cockroach,arjun4084346/cockroach,cockroachdb/cockroach,vaibhavarora/cockroach,paperstreet/cockroach,veteranlu/cockroach,petermattis/cockroach,petermattis/cockroach,petermattis/cockroach,maxlang/cockroach,arjun4084346/cockroach,veteranlu/cockroach,maxlang/cockroach,cockroachdb/cockroach,vivekmenezes/cockroach,paperstreet/cockroach,vivekmenezes/cockroach,veteranlu/cockroach,petermattis/cockroach,paperstreet/cockroach,petermattis/cockroach,paperstreet/cockroach,maxlang/cockroach,sunya123/cockroach,cockroachdb/cockroach