@@ -873,6 +873,7 @@ int fio_send_pages(FILE* in, FILE* out, pgFile *file,
873873req .arg .clevel = clevel ;
874874
875875IO_CHECK (fio_write_all (fio_stdout ,& req ,sizeof (req )),sizeof (req ));
876+ file -> compress_alg = calg ;
876877
877878while (true)
878879{
@@ -886,7 +887,24 @@ int fio_send_pages(FILE* in, FILE* out, pgFile *file,
886887
887888blknum = hdr .arg ;
888889if (hdr .size == 0 )/* end of segment */
890+ {
891+ if (n_blocks_read == 0 )
892+ {
893+ BackupPageHeader ph ;
894+ ph .block = blknum ;
895+ ph .compressed_size = 0 ;
896+ if (fio_fwrite (out ,& ph ,sizeof ph )!= sizeof (ph ))
897+ {
898+ int errno_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+ }
889906break ;
907+ }
890908
891909Assert (hdr .size <=sizeof (buf ));
892910IO_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,
900918elog (ERROR ,"File: %s, cannot write backup at block %u: %s" ,
901919file -> path ,blknum ,strerror (errno_tmp ));
902920}
903- file -> compress_alg = calg ;
904921file -> read_size += BLCKSZ ;
905922file -> write_size += hdr .size ;
906923n_blocks_read ++ ;