diff --git a/src/data.c b/src/data.c index 553a32d7..19e55592 100644 --- a/src/data.c +++ b/src/data.c @@ -528,7 +528,7 @@ compress_and_backup_page(pgFile *file, BlockNumber blknum, file->write_size += write_buffer_size; file->uncompressed_size += BLCKSZ; - return write_buffer_size; + return compressed_size; } /* diff --git a/src/dir.c b/src/dir.c index a7e93fa1..db3df2f2 100644 --- a/src/dir.c +++ b/src/dir.c @@ -250,6 +250,21 @@ delete_file: elog(ERROR, "Cannot remove file \"%s\": %s", full_path, strerror(errno)); } + + if (file->n_headers > 0) + { + char full_path_hdr[MAXPGPATH]; + + snprintf(full_path_hdr, MAXPGPATH, "%s_hdr", full_path); + + if (remove(full_path_hdr) == -1) + { + if (errno == ENOENT) + return; + elog(ERROR, "Cannot remove file \"%s\": %s", full_path_hdr, + strerror(errno)); + } + } } /* diff --git a/src/utils/file.c b/src/utils/file.c index 75fbca21..8639fff0 100644 --- a/src/utils/file.c +++ b/src/utils/file.c @@ -1783,7 +1783,7 @@ static void fio_send_pages_impl(int out, char* buf) headers[hdr_num].lsn = page_st.lsn; headers[hdr_num].checksum = page_st.checksum; headers[hdr_num].pos = hdr_cur_pos; - headers[hdr_num].compressed_size = hdr.size; + headers[hdr_num].compressed_size = compressed_size; hdr_cur_pos += hdr.size; }