Skip to content

Commit fc81de2

Browse files
committed
Merge branch 'master' into issue_150
2 parents 4f10eb3 + b08e9b4 commit fc81de2

File tree

7 files changed

+165
-94
lines changed

7 files changed

+165
-94
lines changed

doc/pgprobackup.xml

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -2438,14 +2438,14 @@ pg_probackup show -B <replaceable>backup_dir</replaceable> [--instance <replacea
24382438
</para>
24392439
<programlisting>
24402440
ARCHIVE INSTANCE 'node'
2441-
===================================================================================================================
2442-
TLI Parent TLI Switchpoint Min Segno Max Segno N segments Size Zratio N backups Status
2443-
===================================================================================================================
2444-
5 1 0/B000000 000000000000000B 000000000000000C 2 685kB 48.00 0 OK
2445-
4 3 0/18000000 0000000000000018 000000000000001A 3 648kB 77.00 0 OK
2446-
3 2 0/15000000 0000000000000015 0000000000000017 3 648kB 77.00 0 OK
2447-
2 1 0/B000108 000000000000000B 0000000000000015 5 892kB 94.00 1 DEGRADED
2448-
1 0 0/0 0000000000000001 000000000000000A 10 8774kB 19.00 1 OK
2441+
===================================================================================================================================
2442+
TLI Parent TLI Switchpoint Min Segno Max Segno N segments Size Zratio N backups Status
2443+
===================================================================================================================================
2444+
5 1 0/B000000 00000005000000000000000B 00000005000000000000000C 2 685kB 48.00 0 OK
2445+
4 3 0/18000000 000000040000000000000018 00000004000000000000001A 3 648kB 77.00 0 OK
2446+
3 2 0/15000000 000000030000000000000015 000000030000000000000017 3 648kB 77.00 0 OK
2447+
2 1 0/B000108 00000002000000000000000B 000000020000000000000015 5 892kB 94.00 1 DEGRADED
2448+
1 0 0/0 000000010000000000000001 00000001000000000000000A 10 8774kB 19.00 1 OK
24492449
</programlisting>
24502450
<para>
24512451
For each timeline, the following information is provided:
@@ -2543,8 +2543,8 @@ pg_probackup show -B <replaceable>backup_dir</replaceable> [--instance <replacea
25432543
"tli": 5,
25442544
"parent-tli": 1,
25452545
"switchpoint": "0/B000000",
2546-
"min-segno": "000000000000000B",
2547-
"max-segno": "000000000000000C",
2546+
"min-segno": "00000005000000000000000B",
2547+
"max-segno": "00000005000000000000000C",
25482548
"n-segments": 2,
25492549
"size": 685320,
25502550
"zratio": 48.00,
@@ -2557,8 +2557,8 @@ pg_probackup show -B <replaceable>backup_dir</replaceable> [--instance <replacea
25572557
"tli": 4,
25582558
"parent-tli": 3,
25592559
"switchpoint": "0/18000000",
2560-
"min-segno": "0000000000000018",
2561-
"max-segno": "000000000000001A",
2560+
"min-segno": "000000040000000000000018",
2561+
"max-segno": "00000004000000000000001A",
25622562
"n-segments": 3,
25632563
"size": 648625,
25642564
"zratio": 77.00,
@@ -2571,8 +2571,8 @@ pg_probackup show -B <replaceable>backup_dir</replaceable> [--instance <replacea
25712571
"tli": 3,
25722572
"parent-tli": 2,
25732573
"switchpoint": "0/15000000",
2574-
"min-segno": "0000000000000015",
2575-
"max-segno": "0000000000000017",
2574+
"min-segno": "000000030000000000000015",
2575+
"max-segno": "000000030000000000000017",
25762576
"n-segments": 3,
25772577
"size": 648911,
25782578
"zratio": 77.00,
@@ -2585,21 +2585,21 @@ pg_probackup show -B <replaceable>backup_dir</replaceable> [--instance <replacea
25852585
"tli": 2,
25862586
"parent-tli": 1,
25872587
"switchpoint": "0/B000108",
2588-
"min-segno": "000000000000000B",
2589-
"max-segno": "0000000000000015",
2588+
"min-segno": "00000002000000000000000B",
2589+
"max-segno": "000000020000000000000015",
25902590
"n-segments": 5,
25912591
"size": 892173,
25922592
"zratio": 94.00,
25932593
"closest-backup-id": "PXS92O",
25942594
"status": "DEGRADED",
25952595
"lost-segments": [
25962596
{
2597-
"begin-segno": "000000000000000D",
2598-
"end-segno": "000000000000000E"
2597+
"begin-segno": "00000002000000000000000D",
2598+
"end-segno": "00000002000000000000000E"
25992599
},
26002600
{
2601-
"begin-segno": "0000000000000010",
2602-
"end-segno": "0000000000000012"
2601+
"begin-segno": "000000020000000000000010",
2602+
"end-segno": "000000020000000000000012"
26032603
}
26042604
],
26052605
"backups": [
@@ -2634,8 +2634,8 @@ pg_probackup show -B <replaceable>backup_dir</replaceable> [--instance <replacea
26342634
"tli": 1,
26352635
"parent-tli": 0,
26362636
"switchpoint": "0/0",
2637-
"min-segno": "0000000000000001",
2638-
"max-segno": "000000000000000A",
2637+
"min-segno": "000000010000000000000001",
2638+
"max-segno": "00000001000000000000000A",
26392639
"n-segments": 10,
26402640
"size": 8774805,
26412641
"zratio": 19.00,
@@ -2679,8 +2679,8 @@ pg_probackup show -B <replaceable>backup_dir</replaceable> [--instance <replacea
26792679
"tli": 1,
26802680
"parent-tli": 0,
26812681
"switchpoint": "0/0",
2682-
"min-segno": "0000000000000001",
2683-
"max-segno": "000000000000000B",
2682+
"min-segno": "000000010000000000000001",
2683+
"max-segno": "00000001000000000000000B",
26842684
"n-segments": 11,
26852685
"size": 8860892,
26862686
"zratio": 20.00,
@@ -3049,10 +3049,10 @@ pg_probackup show -B <replaceable>backup_dir</replaceable> --instance node --arc
30493049
</programlisting>
30503050
<programlisting>
30513051
ARCHIVE INSTANCE 'node'
3052-
===============================================================================================================
3053-
TLI Parent TLI Switchpoint Min Segno Max Segno N segments Size Zratio N backups Status
3054-
===============================================================================================================
3055-
1 0 0/0 0000000000000001 0000000000000047 71 36MB 31.00 6 OK
3052+
===============================================================================================================================
3053+
TLI Parent TLI Switchpoint Min Segno Max Segno N segments Size Zratio N backups Status
3054+
===============================================================================================================================
3055+
1 0 0/0 000000010000000000000001 000000010000000000000047 71 36MB 31.00 6 OK
30563056
</programlisting>
30573057
<para>
30583058
WAL purge without <option>--wal-depth</option> cannot
@@ -3063,10 +3063,10 @@ pg_probackup delete -B <replaceable>backup_dir</replaceable> --instance node --d
30633063
</programlisting>
30643064
<programlisting>
30653065
ARCHIVE INSTANCE 'node'
3066-
===============================================================================================================
3067-
TLI Parent TLI Switchpoint Min Segno Max Segno N segments Size Zratio N backups Status
3068-
===============================================================================================================
3069-
1 0 0/0 0000000000000002 0000000000000047 70 34MB 32.00 6 OK
3066+
===============================================================================================================================
3067+
TLI Parent TLI Switchpoint Min Segno Max Segno N segments Size Zratio N backups Status
3068+
===============================================================================================================================
3069+
1 0 0/0 000000010000000000000002 000000010000000000000047 70 34MB 32.00 6 OK
30703070
</programlisting>
30713071
<para>
30723072
If you would like, for example, to keep only those WAL
@@ -3078,10 +3078,10 @@ pg_probackup delete -B <replaceable>backup_dir</replaceable> --instance node --d
30783078
</programlisting>
30793079
<programlisting>
30803080
ARCHIVE INSTANCE 'node'
3081-
================================================================================================================
3082-
TLI Parent TLI Switchpoint Min Segno Max Segno N segments Size Zratio N backups Status
3083-
================================================================================================================
3084-
1 0 0/0 0000000000000046 0000000000000047 2 143kB 228.00 6 OK
3081+
================================================================================================================================
3082+
TLI Parent TLI Switchpoint Min Segno Max Segno N segments Size Zratio N backups Status
3083+
================================================================================================================================
3084+
1 0 0/0 000000010000000000000046 000000010000000000000047 2 143kB 228.00 6 OK
30853085
</programlisting>
30863086
<para>
30873087
Alternatively, you can use the <option>--wal-depth</option>
@@ -3092,10 +3092,10 @@ pg_probackup backup -B <replaceable>backup_dir</replaceable> --instance node -b
30923092
</programlisting>
30933093
<programlisting>
30943094
ARCHIVE INSTANCE 'node'
3095-
===============================================================================================================
3096-
TLI Parent TLI Switchpoint Min Segno Max Segno N segments Size Zratio N backups Status
3097-
===============================================================================================================
3098-
1 0 0/0 0000000000000048 0000000000000049 1 72kB 228.00 7 OK
3095+
===============================================================================================================================
3096+
TLI Parent TLI Switchpoint Min Segno Max Segno N segments Size Zratio N backups Status
3097+
===============================================================================================================================
3098+
1 0 0/0 000000010000000000000048 000000010000000000000049 1 72kB 228.00 7 OK
30993099
</programlisting>
31003100
<note>
31013101
<para>

src/catalog.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -697,8 +697,8 @@ catalog_get_timelines(InstanceConfig *instance)
697697
char arclog_path[MAXPGPATH];
698698

699699
/* for fancy reporting */
700-
char begin_segno_str[20];
701-
char end_segno_str[20];
700+
char begin_segno_str[XLOG_FNAME_LEN];
701+
char end_segno_str[XLOG_FNAME_LEN];
702702

703703
/* read all xlog files that belong to this archive */
704704
sprintf(arclog_path, "%s/%s/%s", backup_path, "wal", instance->name);
@@ -1132,8 +1132,8 @@ catalog_get_timelines(InstanceConfig *instance)
11321132
* covered by other larger interval.
11331133
*/
11341134

1135-
GetXLogSegName(begin_segno_str, interval->begin_segno, instance->xlog_seg_size);
1136-
GetXLogSegName(end_segno_str, interval->end_segno, instance->xlog_seg_size);
1135+
GetXLogFileName(begin_segno_str, tlinfo->tli, interval->begin_segno, instance->xlog_seg_size);
1136+
GetXLogFileName(end_segno_str, tlinfo->tli, interval->end_segno, instance->xlog_seg_size);
11371137

11381138
elog(LOG, "Timeline %i to stay reachable from timeline %i "
11391139
"protect from purge WAL interval between "
@@ -1187,8 +1187,8 @@ catalog_get_timelines(InstanceConfig *instance)
11871187
else
11881188
interval->end_segno = segno;
11891189

1190-
GetXLogSegName(begin_segno_str, interval->begin_segno, instance->xlog_seg_size);
1191-
GetXLogSegName(end_segno_str, interval->end_segno, instance->xlog_seg_size);
1190+
GetXLogFileName(begin_segno_str, tlinfo->tli, interval->begin_segno, instance->xlog_seg_size);
1191+
GetXLogFileName(end_segno_str, tlinfo->tli, interval->end_segno, instance->xlog_seg_size);
11921192

11931193
elog(LOG, "Archive backup %s to stay consistent "
11941194
"protect from purge WAL interval "

src/delete.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -806,8 +806,8 @@ delete_walfiles_in_tli(XLogRecPtr keep_lsn, timelineInfo *tlinfo,
806806
{
807807
XLogSegNo FirstToDeleteSegNo;
808808
XLogSegNo OldestToKeepSegNo = 0;
809-
char first_to_del_str[20];
810-
char oldest_to_keep_str[20];
809+
char first_to_del_str[XLOG_FNAME_LEN];
810+
char oldest_to_keep_str[XLOG_FNAME_LEN];
811811
int rc;
812812
int i;
813813
size_t wal_size_logical = 0;
@@ -842,8 +842,8 @@ delete_walfiles_in_tli(XLogRecPtr keep_lsn, timelineInfo *tlinfo,
842842
if (OldestToKeepSegNo > 0 && OldestToKeepSegNo > FirstToDeleteSegNo)
843843
{
844844
/* translate segno number into human readable format */
845-
GetXLogSegName(first_to_del_str, FirstToDeleteSegNo, xlog_seg_size);
846-
GetXLogSegName(oldest_to_keep_str, OldestToKeepSegNo, xlog_seg_size);
845+
GetXLogFileName(first_to_del_str, tlinfo->tli, FirstToDeleteSegNo, xlog_seg_size);
846+
GetXLogFileName(oldest_to_keep_str, tlinfo->tli, OldestToKeepSegNo, xlog_seg_size);
847847

848848
elog(INFO, "On timeline %i WAL segments between %s and %s %s be removed",
849849
tlinfo->tli, first_to_del_str,
@@ -870,8 +870,8 @@ delete_walfiles_in_tli(XLogRecPtr keep_lsn, timelineInfo *tlinfo,
870870

871871
if (FirstToDeleteSegNo > 0 && OldestToKeepSegNo > 0)
872872
{
873-
GetXLogSegName(first_to_del_str, FirstToDeleteSegNo, xlog_seg_size);
874-
GetXLogSegName(oldest_to_keep_str, OldestToKeepSegNo, xlog_seg_size);
873+
GetXLogFileName(first_to_del_str, tlinfo->tli, FirstToDeleteSegNo, xlog_seg_size);
874+
GetXLogFileName(oldest_to_keep_str, tlinfo->tli, OldestToKeepSegNo, xlog_seg_size);
875875

876876
elog(LOG, "On timeline %i first segment %s is greater than oldest segment to keep %s",
877877
tlinfo->tli, first_to_del_str, oldest_to_keep_str);

src/show.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ typedef struct ShowArchiveRow
4343
char tli[20];
4444
char parent_tli[20];
4545
char switchpoint[20];
46-
char min_segno[20];
47-
char max_segno[20];
46+
char min_segno[XLOG_FNAME_LEN+1];
47+
char max_segno[XLOG_FNAME_LEN+1];
4848
char n_segments[20];
4949
char size[20];
5050
char zratio[20];
@@ -748,7 +748,7 @@ static void
748748
show_archive_plain(const char *instance_name, uint32 xlog_seg_size,
749749
parray *tli_list, bool show_name)
750750
{
751-
char segno_tmp[20];
751+
char segno_tmp[XLOG_FNAME_LEN];
752752
parray *actual_tli_list = parray_new();
753753
#define SHOW_ARCHIVE_FIELDS_COUNT 10
754754
int i;
@@ -807,14 +807,14 @@ show_archive_plain(const char *instance_name, uint32 xlog_seg_size,
807807
cur++;
808808

809809
/* Min Segno */
810-
GetXLogSegName(segno_tmp, tlinfo->begin_segno, xlog_seg_size);
810+
GetXLogFileName(segno_tmp, tlinfo->tli, tlinfo->begin_segno, xlog_seg_size);
811811
snprintf(row->min_segno, lengthof(row->min_segno), "%s",segno_tmp);
812812

813813
widths[cur] = Max(widths[cur], strlen(row->min_segno));
814814
cur++;
815815

816816
/* Max Segno */
817-
GetXLogSegName(segno_tmp, tlinfo->end_segno, xlog_seg_size);
817+
GetXLogFileName(segno_tmp, tlinfo->tli, tlinfo->end_segno, xlog_seg_size);
818818
snprintf(row->max_segno, lengthof(row->max_segno), "%s", segno_tmp);
819819

820820
widths[cur] = Max(widths[cur], strlen(row->max_segno));
@@ -939,7 +939,7 @@ show_archive_json(const char *instance_name, uint32 xlog_seg_size,
939939
int i,j;
940940
PQExpBuffer buf = &show_buf;
941941
parray *actual_tli_list = parray_new();
942-
char segno_tmp[20];
942+
char segno_tmp[XLOG_FNAME_LEN+1];
943943

944944
if (!first_instance)
945945
appendPQExpBufferChar(buf, ',');
@@ -968,7 +968,7 @@ show_archive_json(const char *instance_name, uint32 xlog_seg_size,
968968
for (i = parray_num(actual_tli_list) - 1; i >= 0; i--)
969969
{
970970
timelineInfo *tlinfo = (timelineInfo *) parray_get(actual_tli_list, i);
971-
char tmp_buf[20];
971+
char tmp_buf[XLOG_FNAME_LEN+1];
972972
float zratio = 0;
973973

974974
if (i != (parray_num(actual_tli_list) - 1))
@@ -986,11 +986,11 @@ show_archive_json(const char *instance_name, uint32 xlog_seg_size,
986986
(uint32) (tlinfo->switchpoint >> 32), (uint32) tlinfo->switchpoint);
987987
json_add_value(buf, "switchpoint", tmp_buf, json_level, true);
988988

989-
GetXLogSegName(segno_tmp, tlinfo->begin_segno, xlog_seg_size);
989+
GetXLogFileName(segno_tmp, tlinfo->tli, tlinfo->begin_segno, xlog_seg_size);
990990
snprintf(tmp_buf, lengthof(tmp_buf), "%s", segno_tmp);
991991
json_add_value(buf, "min-segno", tmp_buf, json_level, true);
992992

993-
GetXLogSegName(segno_tmp, tlinfo->end_segno, xlog_seg_size);
993+
GetXLogFileName(segno_tmp, tlinfo->tli, tlinfo->end_segno, xlog_seg_size);
994994
snprintf(tmp_buf, lengthof(tmp_buf), "%s", segno_tmp);
995995
json_add_value(buf, "max-segno", tmp_buf, json_level, true);
996996

@@ -1033,11 +1033,11 @@ show_archive_json(const char *instance_name, uint32 xlog_seg_size,
10331033

10341034
json_add(buf, JT_BEGIN_OBJECT, &json_level);
10351035

1036-
GetXLogSegName(segno_tmp, lost_segments->begin_segno, xlog_seg_size);
1036+
GetXLogFileName(segno_tmp, tlinfo->tli, lost_segments->begin_segno, xlog_seg_size);
10371037
snprintf(tmp_buf, lengthof(tmp_buf), "%s", segno_tmp);
10381038
json_add_value(buf, "begin-segno", tmp_buf, json_level, true);
10391039

1040-
GetXLogSegName(segno_tmp, lost_segments->end_segno, xlog_seg_size);
1040+
GetXLogFileName(segno_tmp, tlinfo->tli, lost_segments->end_segno, xlog_seg_size);
10411041
snprintf(tmp_buf, lengthof(tmp_buf), "%s", segno_tmp);
10421042
json_add_value(buf, "end-segno", tmp_buf, json_level, true);
10431043
json_add(buf, JT_END_OBJECT, &json_level);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy