Skip to content

Conversation

@woblerr
Copy link
Owner

@woblerr woblerr commented Sep 15, 2025

  • Added --detail option for backup-info command:
    Adds the object filtering details column.
    When --detail is set, each row shows:

    • include-table / exclude-table: a comma-separated list of fully-qualified tables in the form <schema>.<table>;
    • include-schema / exclude-schema: a comma-separated list of schema names;
    • empty value if no object filtering was used.
  • Added --timestamp option for backup-info command:

    • Shows the backup with the given timestamp and all its dependent backups.
    • Always includes deleted and failed backups.
    • Always adds the object filtering details column.
  • Updated docs and tests.

Details about object filtering are presented as follows, depending on the active filtering type:
  * include-table / exclude-table: a comma-separated list of fully-qualified table names in the format <schema>.<table>;
  * include-schema / exclude-schema: a comma-separated list of schema names;
  * if no object filtering was used, the value is empty.
Update backups structure in prepare script.
The details are presented as follows, depending on the active filtering type:
  * include-table / exclude-table: a comma-separated list of fully-qualified table names in the format <schema>.<table>;
  * include-schema / exclude-schema: a comma-separated list of schema names;
  * if no object filtering was used, the value is empty.
@woblerr woblerr requested a review from Copilot September 15, 2025 23:32
@woblerr woblerr self-assigned this Sep 15, 2025
@woblerr woblerr added documentation Improvements or additions to documentation enhancement New feature or request labels Sep 15, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Adds --timestamp and --detail options to the backup-info command. The --timestamp option displays backup chains including dependent backups, while the --detail option adds an "object filtering details" column showing specific table or schema names for filtered backups.

  • Added --timestamp option to display backup chains for a specific backup with dependent backups
  • Added --detail option to show object filtering details in a new column
  • Updated tests and documentation to reflect the new functionality

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
gpbckpconfig/struct.go Added GetObjectFilteringDetails method to format filtering details as comma-separated strings
gpbckpconfig/struct_test.go Added comprehensive tests for the new GetObjectFilteringDetails method
cmd/backup_info.go Implemented the new --timestamp and --detail command-line options with validation
cmd/constants.go Added constant for the new --detail flag
e2e_tests/scripts/run_tests/run_backup-info.sh Updated test suite to include backup chain and detail column tests
e2e_tests/scripts/prepare/prepare_gpdb_backups.sh Modified backup setup to use schema-based filtering for better test coverage
e2e_tests/README.md Minor documentation update removing WAL archiving reference
COMMANDS.md Updated documentation with detailed examples of the new options

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +154 to +166
func (backupConfig BackupConfig) GetObjectFilteringDetails() string {
filter, _ := backupConfig.GetObjectFilteringInfo()
switch filter {
case objectFilteringIncludeTable:
return strings.Join(backupConfig.IncludeRelations, ", ")
case objectFilteringExcludeTable:
return strings.Join(backupConfig.ExcludeRelations, ", ")
case objectFilteringIncludeSchema:
return strings.Join(backupConfig.IncludeSchemas, ", ")
case objectFilteringExcludeSchema:
return strings.Join(backupConfig.ExcludeSchemas, ", ")
default:
return ""
Copy link

Copilot AI Sep 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error from GetObjectFilteringInfo() is being ignored. Consider handling the error or adding a comment explaining why it's safe to ignore it in this context.

Suggested change
func (backupConfig BackupConfig) GetObjectFilteringDetails() string {
filter, _ := backupConfig.GetObjectFilteringInfo()
switch filter {
case objectFilteringIncludeTable:
return strings.Join(backupConfig.IncludeRelations, ", ")
case objectFilteringExcludeTable:
return strings.Join(backupConfig.ExcludeRelations, ", ")
case objectFilteringIncludeSchema:
return strings.Join(backupConfig.IncludeSchemas, ", ")
case objectFilteringExcludeSchema:
return strings.Join(backupConfig.ExcludeSchemas, ", ")
default:
return ""
func (backupConfig BackupConfig) GetObjectFilteringDetails() (string, error) {
filter, err := backupConfig.GetObjectFilteringInfo()
if err != nil {
return "", err
}
switch filter {
case objectFilteringIncludeTable:
return strings.Join(backupConfig.IncludeRelations, ", "), nil
case objectFilteringExcludeTable:
return strings.Join(backupConfig.ExcludeRelations, ", "), nil
case objectFilteringIncludeSchema:
return strings.Join(backupConfig.IncludeSchemas, ", "), nil
case objectFilteringExcludeSchema:
return strings.Join(backupConfig.ExcludeSchemas, ", "), nil
default:
return "", nil

Copilot uses AI. Check for mistakes.
Comment on lines +151 to +152
err = checkCompatibleFlags(flags, timestampFlagName,
typeFlagName, tableFlagName, schemaFlagName, excludeFlagName, failedFlagName, deletedFlagName, detailFlagName)
Copy link

Copilot AI Sep 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The list of incompatible flags is long and repeated in the error message on line 154. Consider defining this as a constant slice to avoid duplication and improve maintainability.

Copilot uses AI. Check for mistakes.
Comment on lines +74 to +77
if [ ! -n "${got_details}" ]; then
echo "[ERROR] Expected details column to be non-empty"
exit 1
fi
Copy link

Copilot AI Sep 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The condition [ ! -n \"${got_details}\" ] is equivalent to [ -z \"${got_details}\" ] which is more idiomatic for checking if a string is empty. Consider using the latter for better readability.

Copilot uses AI. Check for mistakes.
@woblerr woblerr merged commit 9ea9690 into master Sep 18, 2025
6 checks passed
@woblerr woblerr deleted the backup_info_timestamp branch September 18, 2025 18:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants