-
Notifications
You must be signed in to change notification settings - Fork 0
/
wal_restore.go
31 lines (27 loc) · 972 Bytes
/
wal_restore.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package pg
import (
"github.com/apecloud/dataprotection-wal-g/internal"
"github.com/apecloud/dataprotection-wal-g/internal/databases/postgres"
"github.com/spf13/cobra"
"github.com/wal-g/tracelog"
)
const (
WalRestoreUsage = "wal-restore target-pgdata source-pgdata"
WalRestoreShortDescription = "Restores WAL segments from storage."
WalRestoreLongDescription = "Restores the missing WAL segments that will be needed to perform pg_rewind from storage."
)
// walRestoreCmd represents the walRestore command
var walRestoreCmd = &cobra.Command{
Use: WalRestoreUsage,
Short: WalRestoreShortDescription,
Long: WalRestoreLongDescription,
Args: cobra.ExactArgs(2),
Run: func(cmd *cobra.Command, args []string) {
folder, err := internal.ConfigureFolder()
tracelog.ErrorLogger.FatalfOnError("Error on configure external folder %v\n", err)
postgres.HandleWALRestore(args[0], args[1], folder)
},
}
func init() {
Cmd.AddCommand(walRestoreCmd)
}