Skip to content

Commit 76f9267

Browse files
committed
[Issue #228] fix decompression errors
1 parent 8cbbce0 commit 76f9267

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

src/data.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ compress_and_backup_page(pgFile *file, BlockNumber blknum,
528528
file->write_size += write_buffer_size;
529529
file->uncompressed_size += BLCKSZ;
530530

531-
return write_buffer_size;
531+
return compressed_size;
532532
}
533533

534534
/*

src/dir.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,21 @@ pgFileDelete(pgFile *file, const char *full_path)
250250
elog(ERROR, "Cannot remove file \"%s\": %s", full_path,
251251
strerror(errno));
252252
}
253+
254+
if (file->n_headers > 0)
255+
{
256+
char full_path_hdr[MAXPGPATH];
257+
258+
snprintf(full_path_hdr, MAXPGPATH, "%s_hdr", full_path);
259+
260+
if (remove(full_path_hdr) == -1)
261+
{
262+
if (errno == ENOENT)
263+
return;
264+
elog(ERROR, "Cannot remove file \"%s\": %s", full_path_hdr,
265+
strerror(errno));
266+
}
267+
}
253268
}
254269

255270
/*

src/utils/file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1783,7 +1783,7 @@ static void fio_send_pages_impl(int out, char* buf)
17831783
headers[hdr_num].lsn = page_st.lsn;
17841784
headers[hdr_num].checksum = page_st.checksum;
17851785
headers[hdr_num].pos = hdr_cur_pos;
1786-
headers[hdr_num].compressed_size = hdr.size;
1786+
headers[hdr_num].compressed_size = compressed_size;
17871787

17881788
hdr_cur_pos += hdr.size;
17891789
}

0 commit comments

Comments
 (0)