Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 0 additions & 47 deletions cmd/integration/commands/state_history.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,8 @@ func init() {
withDataDir2(distributionCmd)
withHistoryDomain(distributionCmd)

withDataDir2(rebuildCmd)
withHistoryDomain(rebuildCmd)

historyCmd.AddCommand(printCmd)
historyCmd.AddCommand(distributionCmd)
historyCmd.AddCommand(rebuildCmd)

rootCmd.AddCommand(historyCmd)
}
Expand Down Expand Up @@ -227,46 +223,3 @@ var distributionCmd = &cobra.Command{
}
},
}

var rebuildCmd = &cobra.Command{
Use: "rebuild",
Short: "Regenerate .ef .efi .v .vi domain history snapshots from step 0",
Run: func(cmd *cobra.Command, args []string) {
logger := debug.SetupCobra(cmd, "integration")

dirs, l, err := datadir.New(datadirCli).MustFlock()
if err != nil {
logger.Error("Opening Datadir", "error", err)
return
}
defer l.Unlock()

history, settings, err := openHistory(cmd.Context(), dirs, historyDomain, toStep, logger)
if err != nil {
logger.Error("Failed to open history", "error", err)
return
}
stepSize := settings.StepSize
stepsInFrozenFile := settings.StepsInFrozenFile

roTx := history.BeginFilesRoForDebug()
defer roTx.Close()

for i := uint64(0); i < roTx.FirstStepNotInFiles().ToTxNum(stepSize); {
fromTxNum := i
i += stepSize * stepsInFrozenFile

if i > roTx.FirstStepNotInFiles().ToTxNum(stepSize) {
i = roTx.FirstStepNotInFiles().ToTxNum(stepSize)
}

fmt.Printf("Compacting files %d-%d step\n", fromTxNum/stepSize, i/stepSize)

err = roTx.CompactRange(context.TODO(), fromTxNum, i)
if err != nil {
logger.Error("Failed to rebuild history", "error", err)
return
}
}
},
}
Loading
Loading