talmacschen-arch commented on code in PR #97:
URL: https://github.com/apache/cloudberry-backup/pull/97#discussion_r3159300287
##########
gpbackman/cmd/wrappers.go:
##########
@@ -81,12 +81,24 @@ func setLogLevelFile(level string) error {
return nil
}
+// getHistoryDBPath resolves the path to the gpbackup_history.db file.
+// When the --history-db flag is empty, fall back (in order) to the
+// COORDINATOR_DATA_DIRECTORY and MASTER_DATA_DIRECTORY environment variables
+// that the standard Cloudberry/Greenplum environment scripts export, so that
+// users running gpbackman from a sourced cluster shell do not need to repeat
+// the path on every invocation. As a last resort, return the bare filename
+// (resolved against the current working directory), preserving the previous
+// behaviour.
func getHistoryDBPath(historyDBPath string) string {
- var historyDBName = historyDBNameConst
if historyDBPath != "" {
return historyDBPath
}
- return historyDBName
+ for _, envVar := range historyDBEnvVars {
Review Comment:
Implemented option B in 77e41407:
- New `--auto-load-history-db` persistent flag (default off). When off,
behaviour matches upstream `main` — `getHistoryDBPath` returns
`gpbackup_history.db` resolved against cwd. When on, the env-var chain
(`$COORDINATOR_DATA_DIRECTORY` → `$MASTER_DATA_DIRECTORY` → cwd) kicks in.
- Destructive commands (`backup-delete`, `backup-clean`, `history-clean`)
inherit the same flag, so they require either an explicit `--history-db` or a
deliberate opt-in — the cross-cluster footgun is closed by default.
- Also folded in the wording fix on `wrappers.go:87` (dropped "Greenplum")
and trimmed the README description per the other threads.
- The not-found error message now mentions `--auto-load-history-db` rather
than implying that setting env vars alone is enough.
- Tests cover the opt-in matrix (off + env → cwd, on + env → env path, on +
no env → cwd, explicit `--history-db` always wins).
The `OpenHistoryDB` safe-open change (`os.Stat` pre-check + `mode=rw` URI)
from the original commits is preserved as-is. PTAL when you have a moment.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]