Skip to content

Commit f8a6a26

Browse files
committed
[Issue #140] report correctly the total size of data to delete during backup and WAL retention purge
1 parent 7244ee3 commit f8a6a26

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

src/catalog.c

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ timelineInfoNew(TimeLineID tli)
3838
tlinfo->xlog_filelist = parray_new();
3939
tlinfo->anchor_lsn = InvalidXLogRecPtr;
4040
tlinfo->anchor_tli = 0;
41+
tlinfo->n_xlog_files = 0;
4142
return tlinfo;
4243
}
4344

src/delete.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ do_delete(time_t backup_id)
3535
parray *backup_list,
3636
*delete_list;
3737
pgBackup *target_backup = NULL;
38-
int size_to_delete = 0;
38+
size_t size_to_delete = 0;
3939
char size_to_delete_pretty[20];
4040

4141
/* Get complete list of backups */
@@ -814,8 +814,8 @@ delete_walfiles_in_tli(XLogRecPtr keep_lsn, timelineInfo *tlinfo,
814814
char oldest_to_keep_str[20];
815815
int rc;
816816
int i;
817-
int wal_size_logical = 0;
818-
int wal_size_actual = 0;
817+
size_t wal_size_logical = 0;
818+
size_t wal_size_actual = 0;
819819
char wal_pretty_size[20];
820820
bool purge_all = false;
821821

src/pg_probackup.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ struct timelineInfo {
445445
* otherwise 0 */
446446
XLogSegNo begin_segno; /* first present segment in this timeline */
447447
XLogSegNo end_segno; /* last present segment in this timeline */
448-
int n_xlog_files; /* number of segments (only really existing)
448+
size_t n_xlog_files; /* number of segments (only really existing)
449449
* does not include lost segments */
450450
size_t size; /* space on disk taken by regular WAL files */
451451
parray *backups; /* array of pgBackup sturctures with info

src/show.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -822,7 +822,7 @@ show_archive_plain(const char *instance_name, uint32 xlog_seg_size,
822822
cur++;
823823

824824
/* N files */
825-
snprintf(row->n_segments, lengthof(row->n_segments), "%u",
825+
snprintf(row->n_segments, lengthof(row->n_segments), "%lu",
826826
tlinfo->n_xlog_files);
827827
widths[cur] = Max(widths[cur], strlen(row->n_segments));
828828
cur++;
@@ -996,7 +996,7 @@ show_archive_json(const char *instance_name, uint32 xlog_seg_size,
996996
json_add_value(buf, "max-segno", tmp_buf, json_level, true);
997997

998998
json_add_key(buf, "n-segments", json_level);
999-
appendPQExpBuffer(buf, "%d", tlinfo->n_xlog_files);
999+
appendPQExpBuffer(buf, "%lu", tlinfo->n_xlog_files);
10001000

10011001
json_add_key(buf, "size", json_level);
10021002
appendPQExpBuffer(buf, "%lu", tlinfo->size);

0 commit comments

Comments
 (0)