Skip to content

Commit 7680c9f

Browse files
committed
Merge commit 'fb4ae4a2356804d64e51213c43632bd78629d922' into PGPRO9_5
2 parents e9ad682 + fb4ae4a commit 7680c9f

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

contrib/pg_arman/data.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ restore_data_file(const char *from_root,
519519
if (i == BLCKSZ)
520520
goto skip_checksum;
521521
}
522-
((PageHeader) page.data)->pd_checksum = pg_checksum_page(page.data, header.block);
522+
((PageHeader) page.data)->pd_checksum = pg_checksum_page(page.data, file->segno * RELSEG_SIZE + header.block);
523523
}
524524

525525
skip_checksum:

contrib/pg_arman/dir.c

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ dir_read_file_list(const char *root, const char *file_txt)
547547
pg_crc32 crc;
548548
unsigned int mode; /* bit length of mode_t depends on platforms */
549549
struct tm tm;
550-
pgFile *file;
550+
pgFile *file;
551551

552552
memset(&tm, 0, sizeof(tm));
553553
if (sscanf(buf, "%s %c %lu %u %o %d-%d-%d %d:%d:%d",
@@ -590,6 +590,30 @@ dir_read_file_list(const char *root, const char *file_txt)
590590
strcpy(file->path, path);
591591

592592
parray_append(files, file);
593+
594+
if(file->is_datafile)
595+
{
596+
int find_dot;
597+
int check_digit;
598+
char *text_segno;
599+
size_t path_len = strlen(file->path);
600+
for(find_dot = path_len-1; file->path[find_dot] != '.' && find_dot >= 0; find_dot--);
601+
if (find_dot <= 0)
602+
continue;
603+
604+
text_segno = file->path + find_dot + 1;
605+
for(check_digit=0; text_segno[check_digit] != '\0'; check_digit++)
606+
if (!isdigit(text_segno[check_digit]))
607+
{
608+
check_digit = -1;
609+
break;
610+
}
611+
612+
if (check_digit == -1)
613+
continue;
614+
615+
file->segno = (int) strtol(text_segno, NULL, 10);
616+
}
593617
}
594618

595619
fclose(fp);

0 commit comments

Comments
 (0)