Skip to content

Commit c9d3c58

Browse files
committed
Fix archive_catalog problem exposed by b1975e3.
Now it's legal to find in archive two files with equal segno. This can happen if both compressed and non-compessed versions are present.
1 parent 6b8ab83 commit c9d3c58

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/catalog.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -791,8 +791,15 @@ catalog_get_timelines(InstanceConfig *instance)
791791
/* check, if segments are consequent */
792792
XLogSegNo expected_segno = tlinfo->end_segno + 1;
793793

794-
/* some segments are missing. remember them in lost_segments to report */
795-
if (segno != expected_segno)
794+
/*
795+
* Some segments are missing. remember them in lost_segments to report.
796+
* Normally we expect that segment numbers form an increasing sequence,
797+
* though it's legal to find two files with equal segno in case there
798+
* are both compressed and non-compessed versions. For example
799+
* 000000010000000000000002 and 000000010000000000000002.gz
800+
*
801+
*/
802+
if (segno != expected_segno && segno != tlinfo->end_segno)
796803
{
797804
xlogInterval *interval = palloc(sizeof(xlogInterval));;
798805
interval->begin_segno = expected_segno;

0 commit comments

Comments
 (0)