woblerr commented on issue #112:
URL: 
https://github.com/apache/cloudberry-backup/issues/112#issuecomment-5286004262

   Hi,
   
   `gpbackup` already initializes the history database automatically. If 
`gpbackup_history.db` does not exist, it creates the file and initializes the 
required schema when writing the first backup entry. Therefore, a separate 
`gpbackman` initialization command does not seem necessary.
   
   `gpbackman` currently supports several ways to select the history database:
   
   1. Specify the full path explicitly:
   
      ```bash
      gpbackman --history-db /path/to/gpbackup_history.db ...
      ```
   
   2. Resolve it from `$COORDINATOR_DATA_DIRECTORY`:
   
      ```bash
      gpbackman --auto-load-history-db ...
      ```
   
      This resolves to:
   
      ```text
      $COORDINATOR_DATA_DIRECTORY/gpbackup_history.db
      ```
   
   3. If neither option is specified, `gpbackman` looks for 
`gpbackup_history.db` in the current working directory.
   
   An environment variable can also already be used together with the existing 
flag:
   
   ```bash
   gpbackman \
     --history-db "$GPBACKMAN_HISTORY_DIR/gpbackup_history.db" \
     ...
   ```
   
   Considering these options, adding another built-in environment variable for 
selecting the same file looks redundant.
   
   `gpbackup` itself always writes history to the canonical cluster path:
   
   ```text
   <primary coordinator data directory>/gpbackup_history.db
   ```
   
   The history database is cluster-wide, and other functionality, including 
incremental backup discovery, restore metadata lookup, and standby history 
synchronization, relies on this canonical location.
   
   The actual issue in the described use case is that `backup-clean` and 
`history-clean` do not support filtering by database. I think it would be 
better to keep one cluster history database and add a database filter, for 
example:
   
   ```bash
   gpbackman backup-clean \
     --database db1 \
     --older-than-days 7
   
   gpbackman history-clean \
     --database db1 \
     --older-than-days 30
   ```
   
   Alternatively, we could add symmetric `--db-include` and `--db-exclude` 
options.
   
   The `database_name` field is already stored in the `backups` table.
   
   Would database filtering for `backup-clean` and `history-clean` solve your 
use case?
   


-- 
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]

Reply via email to