@@ -300,7 +300,7 @@ prepare_page(pgFile *file, XLogRecPtr prev_backup_start_lsn,
300
300
while (!page_is_valid && try_again -- )
301
301
{
302
302
/* read the block */
303
- int read_len = fio_pread (in , page , blknum * BLCKSZ );
303
+ int read_len = fio_pread (in , page , (( int64 ) blknum ) * BLCKSZ );
304
304
305
305
/* The block could have been truncated. It is fine. */
306
306
if (read_len == 0 )
@@ -609,7 +609,7 @@ backup_data_file(pgFile *file, const char *from_fullpath, const char *to_fullpat
609
609
elog (ERROR , "Cannot read file \"%s\"" , from_fullpath );
610
610
}
611
611
612
- file -> read_size = rc * BLCKSZ ;
612
+ file -> read_size = (( int64 ) rc ) * BLCKSZ ;
613
613
614
614
/* refresh n_blocks for FULL and DELTA */
615
615
if (backup_mode == BACKUP_MODE_FULL ||
@@ -758,7 +758,7 @@ catchup_data_file(pgFile *file, const char *from_fullpath, const char *to_fullpa
758
758
elog (ERROR , "Cannot read file \"%s\"" , from_fullpath );
759
759
}
760
760
761
- file -> read_size = rc * BLCKSZ ;
761
+ file -> read_size = (( int64 ) rc ) * BLCKSZ ;
762
762
763
763
/* Determine that file didn`t changed in case of incremental catchup */
764
764
if (backup_mode != BACKUP_MODE_FULL &&
@@ -1072,7 +1072,7 @@ restore_data_file_internal(FILE *in, FILE *out, pgFile *file, uint32 backup_vers
1072
1072
if (fio_fseek (out , 0 ) < 0 )
1073
1073
elog (ERROR , "Cannot seek to the start of file \"%s\": %s" , to_fullpath , strerror (errno ));
1074
1074
1075
- if (fio_ftruncate (out , blknum * BLCKSZ ) != 0 )
1075
+ if (fio_ftruncate (out , (( int64 ) blknum ) * BLCKSZ ) != 0 )
1076
1076
elog (ERROR , "Cannot truncate file \"%s\": %s" , to_fullpath , strerror (errno ));
1077
1077
1078
1078
break ;
@@ -1123,7 +1123,7 @@ restore_data_file_internal(FILE *in, FILE *out, pgFile *file, uint32 backup_vers
1123
1123
cur_pos_in != headers [n_hdr ].pos )
1124
1124
{
1125
1125
if (fseek (in , headers [n_hdr ].pos , SEEK_SET ) != 0 )
1126
- elog (ERROR , "Cannot seek to offset %u of \"%s\": %s" ,
1126
+ elog (ERROR , "Cannot seek to offset %ld of \"%s\": %s" ,
1127
1127
headers [n_hdr ].pos , from_fullpath , strerror (errno ));
1128
1128
1129
1129
cur_pos_in = headers [n_hdr ].pos ;
@@ -1158,7 +1158,7 @@ restore_data_file_internal(FILE *in, FILE *out, pgFile *file, uint32 backup_vers
1158
1158
* When restoring file from FULL backup, pages are written sequentially,
1159
1159
* so there is no need to issue fseek for every page.
1160
1160
*/
1161
- write_pos = blknum * BLCKSZ ;
1161
+ write_pos = (( int64 ) blknum ) * BLCKSZ ;
1162
1162
1163
1163
if (cur_pos_out != write_pos )
1164
1164
{
@@ -1742,7 +1742,7 @@ validate_file_pages(pgFile *file, const char *fullpath, XLogRecPtr stop_lsn,
1742
1742
elog (ERROR , "Cannot seek block %u of \"%s\": %s" ,
1743
1743
blknum , fullpath , strerror (errno ));
1744
1744
else
1745
- elog (INFO , "Seek to %u " , headers [n_hdr ].pos );
1745
+ elog (INFO , "Seek to %ld " , headers [n_hdr ].pos );
1746
1746
1747
1747
cur_pos_in = headers [n_hdr ].pos ;
1748
1748
}
@@ -1879,7 +1879,7 @@ validate_file_pages(pgFile *file, const char *fullpath, XLogRecPtr stop_lsn,
1879
1879
/* read local data file and construct map with block checksums */
1880
1880
PageState *
1881
1881
get_checksum_map (const char * fullpath , uint32 checksum_version ,
1882
- int n_blocks , XLogRecPtr dest_stop_lsn , BlockNumber segmentno )
1882
+ int64 n_blocks , XLogRecPtr dest_stop_lsn , BlockNumber segmentno )
1883
1883
{
1884
1884
PageState * checksum_map = NULL ;
1885
1885
FILE * in = NULL ;
@@ -1894,7 +1894,7 @@ get_checksum_map(const char *fullpath, uint32 checksum_version,
1894
1894
1895
1895
/* truncate up to blocks */
1896
1896
if (ftruncate (fileno (in ), n_blocks * BLCKSZ ) != 0 )
1897
- elog (ERROR , "Cannot truncate file to blknum %u \"%s\": %s" ,
1897
+ elog (ERROR , "Cannot truncate file to blknum %ld \"%s\": %s" ,
1898
1898
n_blocks , fullpath , strerror (errno ));
1899
1899
1900
1900
setvbuf (in , in_buf , _IOFBF , STDIO_BUFSIZE );
@@ -1948,7 +1948,7 @@ get_checksum_map(const char *fullpath, uint32 checksum_version,
1948
1948
/* return bitmap of valid blocks, bitmap is empty, then NULL is returned */
1949
1949
datapagemap_t *
1950
1950
get_lsn_map (const char * fullpath , uint32 checksum_version ,
1951
- int n_blocks , XLogRecPtr shift_lsn , BlockNumber segmentno )
1951
+ int64 n_blocks , XLogRecPtr shift_lsn , BlockNumber segmentno )
1952
1952
{
1953
1953
FILE * in = NULL ;
1954
1954
BlockNumber blknum = 0 ;
@@ -1965,7 +1965,7 @@ get_lsn_map(const char *fullpath, uint32 checksum_version,
1965
1965
1966
1966
/* truncate up to blocks */
1967
1967
if (ftruncate (fileno (in ), n_blocks * BLCKSZ ) != 0 )
1968
- elog (ERROR , "Cannot truncate file to blknum %u \"%s\": %s" ,
1968
+ elog (ERROR , "Cannot truncate file to blknum %ld \"%s\": %s" ,
1969
1969
n_blocks , fullpath , strerror (errno ));
1970
1970
1971
1971
setvbuf (in , in_buf , _IOFBF , STDIO_BUFSIZE );
@@ -2296,9 +2296,9 @@ copy_pages(const char *to_fullpath, const char *from_fullpath,
2296
2296
2297
2297
else if (rc == PageIsOk )
2298
2298
{
2299
- if (fseek (out , blknum * BLCKSZ , SEEK_SET ) != 0 )
2300
- elog (ERROR , "Cannot seek to position %u in destination file \"%s\": %s" ,
2301
- blknum * BLCKSZ , to_fullpath , strerror (errno ));
2299
+ if (fseek (out , (( int64 ) blknum ) * BLCKSZ , SEEK_SET ) != 0 )
2300
+ elog (ERROR , "Cannot seek to position %ld in destination file \"%s\": %s" ,
2301
+ (( int64 ) blknum ) * BLCKSZ , to_fullpath , strerror (errno ));
2302
2302
2303
2303
if (write_page (file , out , curr_page ) != BLCKSZ )
2304
2304
elog (ERROR , "File: \"%s\", cannot write at block %u: %s" ,
0 commit comments