ops: migrate legacy event sequences safely
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
// 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")
|
||||
}
|
||||
Reference in New Issue
Block a user