ops: migrate legacy event sequences safely

This commit is contained in:
kami
2026-07-30 15:47:43 +04:00
parent fbb13c89d2
commit 524d93d7cd
5 changed files with 236 additions and 1 deletions
+29
View File
@@ -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")
}