/
catchup_push_handler.go
41 lines (35 loc) · 1.2 KB
/
catchup_push_handler.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
32
33
34
35
36
37
38
39
40
41
package postgres
import (
"github.com/spf13/viper"
"github.com/wal-g/tracelog"
"github.com/wal-g/wal-g/internal"
"github.com/wal-g/wal-g/utility"
)
func extendExcludedFiles() {
for _, fname := range []string{"pg_hba.conf", "postgresql.conf"} {
ExcludedFilenames[fname] = utility.Empty{}
}
}
// HandleCatchupPush is invoked to perform a wal-g catchup-push
func HandleCatchupPush(pgDataDirectory string, fromLSN uint64) {
pgDataDirectory = utility.ResolveSymlink(pgDataDirectory)
fakePreviousBackupSentinelDto := BackupSentinelDto{
BackupStartLSN: &fromLSN,
}
extendExcludedFiles()
backupArguments := BackupArguments{
isPermanent: false,
verifyPageChecksums: false,
pgDataDirectory: pgDataDirectory,
forceIncremental: true,
backupsFolder: utility.CatchupPath,
tarBallComposerType: RegularComposer,
userData: viper.GetString(internal.SentinelUserDataSetting),
}
backupConfig, err := NewBackupHandler(backupArguments)
tracelog.ErrorLogger.FatalOnError(err)
backupConfig.checkPgVersionAndPgControl()
backupConfig.prevBackupInfo.sentinelDto = fakePreviousBackupSentinelDto
backupConfig.curBackupInfo.startLSN = fromLSN
backupConfig.createAndPushBackup()
}