30 lines
882 B
Go
30 lines
882 B
Go
// orchestra-migrate contains explicit, one-shot durable-store migrations.
|
|
// It deliberately never starts the coordinator: run it only while all
|
|
// coordinator processes for the target data directory are stopped.
|
|
package main
|
|
|
|
import (
|
|
"flag"
|
|
"fmt"
|
|
"log"
|
|
"orchestra/internal/store"
|
|
)
|
|
|
|
func main() {
|
|
dir := flag.String("data", "", "Orchestra data directory")
|
|
confirm := flag.Bool("confirm", false, "confirm that every coordinator using -data is stopped")
|
|
flag.Parse()
|
|
if *dir == "" || !*confirm {
|
|
log.Fatal("usage: orchestra-migrate -data DIR -confirm (with all coordinators stopped)")
|
|
}
|
|
changed, err := store.NormalizeLegacyEventSequence(*dir)
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
if changed {
|
|
fmt.Println("normalized legacy event sequence; preserved events.jsonl.legacy-* backup")
|
|
return
|
|
}
|
|
fmt.Println("event sequence already canonical; no migration needed")
|
|
}
|