-
Notifications
You must be signed in to change notification settings - Fork 0
Add --timestamp and --detail options for backup-info command. #34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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.
There was a problem hiding this 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
--timestampoption to display backup chains for a specific backup with dependent backups - Added
--detailoption 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.
| 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 "" |
Copilot
AI
Sep 15, 2025
There was a problem hiding this comment.
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.
| 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 |
| err = checkCompatibleFlags(flags, timestampFlagName, | ||
| typeFlagName, tableFlagName, schemaFlagName, excludeFlagName, failedFlagName, deletedFlagName, detailFlagName) |
Copilot
AI
Sep 15, 2025
There was a problem hiding this comment.
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.
| if [ ! -n "${got_details}" ]; then | ||
| echo "[ERROR] Expected details column to be non-empty" | ||
| exit 1 | ||
| fi |
Copilot
AI
Sep 15, 2025
There was a problem hiding this comment.
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.
Added
--detailoption forbackup-infocommand:Adds the
object filtering detailscolumn.When
--detailis set, each row shows:<schema>.<table>;Added
--timestampoption forbackup-infocommand:object filtering detailscolumn.