storage: migrate raft state on startup
storage: migrate raft state on startup

In #7310, we added (and enforced) assumptions on what was
persisted to disk, but did not ensure that older versions
were migrated properly. This in turn lead to #7389.

A migration is only necessary for ranges which had never
been truncated, and so it should be fairly rare in practice.

The migration simply writes the truncated state that would
otherwise been synthesized by the old code, which is technically
a consistency violation, but should work well in practice because
all nodes will write that state on startup when they are rebooted.

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