vault backup: 2024-12-15 15:52:17

This commit is contained in:
Jerry Jacobs 2024-12-15 15:52:17 +01:00
parent a5ab9ed28a
commit 5ed523e41f
1 changed files with 21 additions and 1 deletions

View File

@ -1 +1,21 @@
https://github.com/jibudata/amberapp/blob/34852920052c58f3d518a28e4d09a50584cf40f8/pkg/postgres/postgres.go
* https://github.com/jibudata/amberapp/blob/34852920052c58f3d518a28e4d09a50584cf40f8/pkg/postgres/postgres.go
* Quiesce & Unquiesce
```go
func takeSnapshot(db *sql.DB, dataset string, height int, tag string) error {
log.Printf("Taking a ZFS snapshot: %s@%d%s", dataset, height, tag)
log.Printf(" calling pg_backup_start('blkchain', true)") // pg < 15 use pg_start_backup
if _, err := db.Exec(`SELECT pg_backupstart('blkchain', true)`); err != nil {
return err
}
log.Printf(" executing COPY (SELECT) TO PROGRAM 'zfs snapshot %s@%d%s'", dataset, height, tag)
if _, err := db.Exec(fmt.Sprintf(`COPY (SELECT) TO PROGRAM 'zfs snapshot %s@%d%s'`, dataset, height, tag)); err != nil {
return err
}
log.Printf(" calling pg_backup_stop()") // pg < 15 use pg_stop_backup
if _, err := db.Exec(`SELECT pg_backup_stop()`); err != nil {
return err
}
return nil
}
```