Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitdac1d43

Browse files
committed
Fx handling files with zero length
1 parent16f5c9a commitdac1d43

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

‎src/utils/file.c‎

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -873,6 +873,7 @@ int fio_send_pages(FILE* in, FILE* out, pgFile *file,
873873
req.arg.clevel=clevel;
874874

875875
IO_CHECK(fio_write_all(fio_stdout,&req,sizeof(req)),sizeof(req));
876+
file->compress_alg=calg;
876877

877878
while (true)
878879
{
@@ -886,7 +887,24 @@ int fio_send_pages(FILE* in, FILE* out, pgFile *file,
886887

887888
blknum=hdr.arg;
888889
if (hdr.size==0)/* end of segment */
890+
{
891+
if (n_blocks_read==0)
892+
{
893+
BackupPageHeaderph;
894+
ph.block=blknum;
895+
ph.compressed_size=0;
896+
if (fio_fwrite(out,&ph,sizeofph)!=sizeof(ph))
897+
{
898+
interrno_tmp=errno;
899+
fio_fclose(out);
900+
elog(ERROR,"File: %s, cannot write backup at block %u: %s",
901+
file->path,blknum,strerror(errno_tmp));
902+
}
903+
n_blocks_read++;
904+
file->write_size=sizeof(ph);
905+
}
889906
break;
907+
}
890908

891909
Assert(hdr.size <=sizeof(buf));
892910
IO_CHECK(fio_read_all(fio_stdin,buf,hdr.size),hdr.size);
@@ -900,7 +918,6 @@ int fio_send_pages(FILE* in, FILE* out, pgFile *file,
900918
elog(ERROR,"File: %s, cannot write backup at block %u: %s",
901919
file->path,blknum,strerror(errno_tmp));
902920
}
903-
file->compress_alg=calg;
904921
file->read_size+=BLCKSZ;
905922
file->write_size+=hdr.size;
906923
n_blocks_read++;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp