@@ -304,9 +304,9 @@ func run() (retVal error) {
304
304
defer db.Close()
305
305
306
306
// Generate a single datetime that will be used in all files generated by pg_back
307
-
var uniformTimestamp time.Time
307
+
var fileTime time.Time
308
308
if opts.UniformTimestamp {
309
-
uniformTimestamp = time.Now()
309
+
fileTime = time.Now()
310
310
}
311
311
312
312
if !opts.DumpOnly {
@@ -322,7 +322,7 @@ func run() (retVal error) {
322
322
} else {
323
323
l.Infoln("dumping globals without role passwords")
324
324
}
325
-
if err := dumpGlobals(opts.Directory, opts.Mode, opts.TimeFormat, dumpRolePasswords, conninfo, producedFiles, uniformTimestamp); err != nil {
325
+
if err := dumpGlobals(opts.Directory, opts.Mode, opts.TimeFormat, dumpRolePasswords, conninfo, producedFiles, fileTime); err != nil {
326
326
return fmt.Errorf("pg_dumpall of globals failed: %w", err)
327
327
}
328
328
@@ -332,15 +332,15 @@ func run() (retVal error) {
332
332
perr *pgPrivError
333
333
)
334
334
335
-
if err := dumpSettings(opts.Directory, opts.Mode, opts.TimeFormat, db, producedFiles, uniformTimestamp); err != nil {
335
+
if err := dumpSettings(opts.Directory, opts.Mode, opts.TimeFormat, db, producedFiles, fileTime); err != nil {
336
336
if errors.As(err, &verr) || errors.As(err, &perr) {
337
337
l.Warnln(err)
338
338
} else {
339
339
return fmt.Errorf("could not dump configuration parameters: %w", err)
340
340
}
341
341
}
342
342
343
-
if err := dumpConfigFiles(opts.Directory, opts.Mode, opts.TimeFormat, db, producedFiles, uniformTimestamp); err != nil {
343
+
if err := dumpConfigFiles(opts.Directory, opts.Mode, opts.TimeFormat, db, producedFiles, fileTime); err != nil {
344
344
return fmt.Errorf("could not dump configuration files: %w", err)
345
345
}
346
346
}
@@ -392,7 +392,7 @@ func run() (retVal error) {
392
392
CipherPassphrase: passphrase,
393
393
CipherPublicKey: publicKey,
394
394
EncryptKeepSrc: opts.EncryptKeepSrc,
395
-
When: uniformTimestamp,
395
+
When: fileTime,
396
396
ExitCode: -1,
397
397
PgDumpVersion: pgDumpVersion,
398
398
}
@@ -944,7 +944,7 @@ func pgToolVersion(tool string) int {
944
944
return numver
945
945
}
946
946
947
-
func dumpGlobals(dir string, mode int, timeFormat string, withRolePasswords bool, conninfo *ConnInfo, fc chan<- sumFileJob, uniformTimestamp time.Time) error {
947
+
func dumpGlobals(dir string, mode int, timeFormat string, withRolePasswords bool, conninfo *ConnInfo, fc chan<- sumFileJob, when time.Time) error {
948
948
command := execPath("pg_dumpall")
949
949
args := []string{"-g", "-w"}
950
950
@@ -976,11 +976,11 @@ func dumpGlobals(dir string, mode int, timeFormat string, withRolePasswords bool
976
976
args = append(args, "--no-role-passwords")
977
977
}
978
978
979
-
if uniformTimestamp.IsZero() {
980
-
uniformTimestamp = time.Now()
979
+
if when.IsZero() {
980
+
when = time.Now()
981
981
}
982
982
983
-
file := formatDumpPath(dir, timeFormat, "sql", "pg_globals", uniformTimestamp, 0)
983
+
file := formatDumpPath(dir, timeFormat, "sql", "pg_globals", when, 0)
984
984
args = append(args, "-f", file)
985
985
986
986
if err := os.MkdirAll(filepath.Dir(file), 0700); err != nil {
@@ -1021,8 +1021,12 @@ func dumpGlobals(dir string, mode int, timeFormat string, withRolePasswords bool
1021
1021
return nil
1022
1022
}
1023
1023
1024
-
func dumpSettings(dir string, mode int, timeFormat string, db *pg, fc chan<- sumFileJob, uniformTimestamp time.Time) error {
1025
-
file := formatDumpPath(dir, timeFormat, "out", "pg_settings", uniformTimestamp, 0)
1024
+
func dumpSettings(dir string, mode int, timeFormat string, db *pg, fc chan<- sumFileJob, when time.Time) error {
1025
+
if when.IsZero() {
1026
+
when = time.Now()
1027
+
}
1028
+
1029
+
file := formatDumpPath(dir, timeFormat, "out", "pg_settings", when, 0)
1026
1030
1027
1031
if err := os.MkdirAll(filepath.Dir(file), 0o700); err != nil {
1028
1032
return err
@@ -1056,12 +1060,12 @@ func dumpSettings(dir string, mode int, timeFormat string, db *pg, fc chan<- sum
1056
1060
return nil
1057
1061
}
1058
1062
1059
-
func dumpConfigFiles(dir string, mode int, timeFormat string, db *pg, fc chan<- sumFileJob, uniformTimestamp time.Time) error {
1063
+
func dumpConfigFiles(dir string, mode int, timeFormat string, db *pg, fc chan<- sumFileJob, when time.Time) error {
1060
1064
for _, param := range []string{"hba_file", "ident_file"} {
1061
-
if uniformTimestamp.IsZero() {
1062
-
uniformTimestamp = time.Now()
1065
+
if when.IsZero() {
1066
+
when = time.Now()
1063
1067
}
1064
-
file := formatDumpPath(dir, timeFormat, "out", param, uniformTimestamp, 0)
1068
+
file := formatDumpPath(dir, timeFormat, "out", param, when, 0)
1065
1069
1066
1070
if err := os.MkdirAll(filepath.Dir(file), 0700); err != nil {
1067
1071
return err
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4