Closed bleidens closed 3 months ago
Rebased this on top of master
.
The implementation seems to work fine.
I'm reposting the conversation that we have in our internal chat here just for historical purposes.
The changes from this PR seems like this when the backup has a custom name:
$ barman list-backup all
pg17 20240725T183731 - F - 'full_2' - Thu Jul 25 16:37:33 2024 - Size: 251.3 MiB - WAL Size: 48.0 MiB
pg17 20240725T183723 - I - 'incremental_2' - Thu Jul 25 16:37:24 2024 - Size: 35.3 MiB - WAL Size: 32.0 MiB
pg17 20240725T183718 - I - 'incremental_1' - Thu Jul 25 16:37:19 2024 - Size: 35.3 MiB - WAL Size: 32.0 MiB
pg17 20240725T183702 - F - 'full' - Thu Jul 25 16:37:05 2024 - Size: 251.3 MiB - WAL Size: 32.0 MiB
support 20240725T183751 - R - 'rsync_incremental' - Thu Jul 25 16:37:55 2024 - Size: 235.2 MiB - WAL Size: 0 B
support 20240725T183740 - R - 'rsync_full' - Thu Jul 25 16:37:47 2024 - Size: 235.2 MiB - WAL Size: 32.0 Mi
I think it should show like this instead:
$ barman list-backup all
pg17 20240725T183731 'full_2' - F - Thu Jul 25 16:37:33 2024 - Size: 251.3 MiB - WAL Size: 48.0 MiB
pg17 20240725T183723 'incremental_2' - I - Thu Jul 25 16:37:24 2024 - Size: 35.3 MiB - WAL Size: 32.0 MiB
pg17 20240725T183718 'incremental_1' - I - Thu Jul 25 16:37:19 2024 - Size: 35.3 MiB - WAL Size: 32.0 MiB
pg17 20240725T183702 'full' - F - Thu Jul 25 16:37:05 2024 - Size: 251.3 MiB - WAL Size: 32.0 MiB
support 20240725T183751 'rsync_incremental' - R - Thu Jul 25 16:37:55 2024 - Size: 235.2 MiB - WAL Size: 0 B
support 20240725T183740 'rsync_full' - R - Thu Jul 25 16:37:47 2024 - Size: 235.2 MiB - WAL Size: 32.0 MiB
Even though that seems a bit broken visually, this remains consistent with the output previous to the changes introduced by the PR, which would look like this:
$ barman list-backup all
pg17 20240725T183731 'full_2' - Thu Jul 25 16:37:33 2024 - Size: 251.3 MiB - WAL Size: 48.0 MiB
pg17 20240725T183723 'incremental_2' - Thu Jul 25 16:37:24 2024 - Size: 35.3 MiB - WAL Size: 32.0 MiB
pg17 20240725T183718 'incremental_1' - Thu Jul 25 16:37:19 2024 - Size: 35.3 MiB - WAL Size: 32.0 MiB
pg17 20240725T183702 'full' - Thu Jul 25 16:37:05 2024 - Size: 251.3 MiB - WAL Size: 32.0 MiB
support 20240725T183751 'rsync_incremental' - Thu Jul 25 16:37:55 2024 - Size: 235.2 MiB - WAL Size: 0 B
support 20240725T183740 'rsync_full' - Thu Jul 25 16:37:47 2024 - Size: 235.2 MiB - WAL Size: 32.0 MiB
About my previous comment, maybe get_backup_type
could have no parameters, or even be a property backup_type
, which would always return either full
, rsync
or `incremental.
I guess the only place where we will use the "short" version is in list-backup
. So, there we could simply convert text to upper case and select only the first character.
Add a new label to each backup in the
list-backup
output that references the backup type considering:If a backup doesn't have a parent backup nor the backup method set to rsync, it's labeled as a full backup. This also adds a new field "backup_type" to the JSON output, containing the type label.
To get the correct backup type without relying on volatile information, a new property
backup_type
was added to theLocalBackupInfo
object, which returns the label forbackup.info
at backup time instead of relying on the configuration at runtime.References: BAR-207