You've already forked pg_probackup
mirror of
https://github.com/postgrespro/pg_probackup.git
synced 2025-07-01 05:24:49 +02:00
[Issue #351] fix data type for header offset
This commit is contained in:
@ -2456,7 +2456,7 @@ write_backup_filelist(pgBackup *backup, parray *files, const char *root,
|
|||||||
{
|
{
|
||||||
len += sprintf(line+len, ",\"n_headers\":\"%i\"", file->n_headers);
|
len += sprintf(line+len, ",\"n_headers\":\"%i\"", file->n_headers);
|
||||||
len += sprintf(line+len, ",\"hdr_crc\":\"%u\"", file->hdr_crc);
|
len += sprintf(line+len, ",\"hdr_crc\":\"%u\"", file->hdr_crc);
|
||||||
len += sprintf(line+len, ",\"hdr_off\":\"%li\"", file->hdr_off);
|
len += sprintf(line+len, ",\"hdr_off\":\"%llu\"", file->hdr_off);
|
||||||
len += sprintf(line+len, ",\"hdr_size\":\"%i\"", file->hdr_size);
|
len += sprintf(line+len, ",\"hdr_size\":\"%i\"", file->hdr_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
10
src/data.c
10
src/data.c
@ -2160,7 +2160,7 @@ get_data_file_headers(HeaderMap *hdr_map, pgFile *file, uint32 backup_version, b
|
|||||||
|
|
||||||
if (fseek(in, file->hdr_off, SEEK_SET))
|
if (fseek(in, file->hdr_off, SEEK_SET))
|
||||||
{
|
{
|
||||||
elog(strict ? ERROR : WARNING, "Cannot seek to position %lu in page header map \"%s\": %s",
|
elog(strict ? ERROR : WARNING, "Cannot seek to position %llu in page header map \"%s\": %s",
|
||||||
file->hdr_off, hdr_map->path, strerror(errno));
|
file->hdr_off, hdr_map->path, strerror(errno));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@ -2177,7 +2177,7 @@ get_data_file_headers(HeaderMap *hdr_map, pgFile *file, uint32 backup_version, b
|
|||||||
|
|
||||||
if (fread(zheaders, 1, file->hdr_size, in) != file->hdr_size)
|
if (fread(zheaders, 1, file->hdr_size, in) != file->hdr_size)
|
||||||
{
|
{
|
||||||
elog(strict ? ERROR : WARNING, "Cannot read header file at offset: %li len: %i \"%s\": %s",
|
elog(strict ? ERROR : WARNING, "Cannot read header file at offset: %llu len: %i \"%s\": %s",
|
||||||
file->hdr_off, file->hdr_size, hdr_map->path, strerror(errno));
|
file->hdr_off, file->hdr_size, hdr_map->path, strerror(errno));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@ -2208,7 +2208,7 @@ get_data_file_headers(HeaderMap *hdr_map, pgFile *file, uint32 backup_version, b
|
|||||||
if (hdr_crc != file->hdr_crc)
|
if (hdr_crc != file->hdr_crc)
|
||||||
{
|
{
|
||||||
elog(strict ? ERROR : WARNING, "Header map for file \"%s\" crc mismatch \"%s\" "
|
elog(strict ? ERROR : WARNING, "Header map for file \"%s\" crc mismatch \"%s\" "
|
||||||
"offset: %lu, len: %lu, current: %u, expected: %u",
|
"offset: %llu, len: %lu, current: %u, expected: %u",
|
||||||
file->rel_path, hdr_map->path, file->hdr_off, read_len, hdr_crc, file->hdr_crc);
|
file->rel_path, hdr_map->path, file->hdr_off, read_len, hdr_crc, file->hdr_crc);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@ -2268,7 +2268,7 @@ write_page_headers(BackupPageHeader2 *headers, pgFile *file, HeaderMap *hdr_map,
|
|||||||
{
|
{
|
||||||
elog(LOG, "Creating page header map \"%s\"", map_path);
|
elog(LOG, "Creating page header map \"%s\"", map_path);
|
||||||
|
|
||||||
hdr_map->fp = fopen(map_path, 'a');
|
hdr_map->fp = fopen(map_path, "a");
|
||||||
if (hdr_map->fp == NULL)
|
if (hdr_map->fp == NULL)
|
||||||
elog(ERROR, "Cannot open header file \"%s\": %s",
|
elog(ERROR, "Cannot open header file \"%s\": %s",
|
||||||
map_path, strerror(errno));
|
map_path, strerror(errno));
|
||||||
@ -2297,7 +2297,7 @@ write_page_headers(BackupPageHeader2 *headers, pgFile *file, HeaderMap *hdr_map,
|
|||||||
file->rel_path, z_len);
|
file->rel_path, z_len);
|
||||||
}
|
}
|
||||||
|
|
||||||
elog(VERBOSE, "Writing headers for file \"%s\" offset: %li, len: %i, crc: %u",
|
elog(VERBOSE, "Writing headers for file \"%s\" offset: %llu, len: %i, crc: %u",
|
||||||
file->rel_path, file->hdr_off, z_len, file->hdr_crc);
|
file->rel_path, file->hdr_off, z_len, file->hdr_crc);
|
||||||
|
|
||||||
if (fwrite(zheaders, 1, z_len, hdr_map->fp) != z_len)
|
if (fwrite(zheaders, 1, z_len, hdr_map->fp) != z_len)
|
||||||
|
@ -208,6 +208,8 @@ do { \
|
|||||||
FIN_TRADITIONAL_CRC32(crc); \
|
FIN_TRADITIONAL_CRC32(crc); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
#define pg_off_t unsigned long long
|
||||||
|
|
||||||
|
|
||||||
/* Information about single file (or dir) in backup */
|
/* Information about single file (or dir) in backup */
|
||||||
typedef struct pgFile
|
typedef struct pgFile
|
||||||
@ -249,8 +251,8 @@ typedef struct pgFile
|
|||||||
/* Coordinates in header map */
|
/* Coordinates in header map */
|
||||||
int n_headers; /* number of blocks in the data file in backup */
|
int n_headers; /* number of blocks in the data file in backup */
|
||||||
pg_crc32 hdr_crc; /* CRC value of header file: name_hdr */
|
pg_crc32 hdr_crc; /* CRC value of header file: name_hdr */
|
||||||
off_t hdr_off; /* offset in header map */
|
pg_off_t hdr_off; /* offset in header map */
|
||||||
int hdr_size; /* offset in header map */
|
int hdr_size; /* length of headers */
|
||||||
} pgFile;
|
} pgFile;
|
||||||
|
|
||||||
typedef struct page_map_entry
|
typedef struct page_map_entry
|
||||||
@ -410,7 +412,7 @@ typedef struct HeaderMap
|
|||||||
char path_tmp[MAXPGPATH]; /* used only in merge */
|
char path_tmp[MAXPGPATH]; /* used only in merge */
|
||||||
FILE *fp; /* used only for writing */
|
FILE *fp; /* used only for writing */
|
||||||
char *buf; /* buffer */
|
char *buf; /* buffer */
|
||||||
off_t offset; /* current position in fp */
|
pg_off_t offset; /* current position in fp */
|
||||||
pthread_mutex_t mutex;
|
pthread_mutex_t mutex;
|
||||||
|
|
||||||
} HeaderMap;
|
} HeaderMap;
|
||||||
|
Reference in New Issue
Block a user