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

Appearance settings

Commit 63c2810

Browse filesBrowse files
committed
fix restoring highly compressed WAL
gzip surprisingly emits a lot of zeroes when compression ratio is high. It triggered branch where FIO_PAGE_ZERO is emitted in agent but not handled in fio_sned_file_gz properly. Fix it.
1 parent e39a31e commit 63c2810
Copy full SHA for 63c2810

File tree

1 file changed

+16
-5
lines changed
Filter options

1 file changed

+16
-5
lines changed

‎src/utils/file.c

Copy file name to clipboardExpand all lines: src/utils/file.c
+16-5Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2537,11 +2537,22 @@ fio_send_file_gz(const char *from_fullpath, FILE* out, char **errormsg)
25372537
exit_code = hdr.arg;
25382538
goto cleanup;
25392539
}
2540-
else if (hdr.cop == FIO_PAGE)
2540+
else if (hdr.cop == FIO_PAGE || hdr.cop == FIO_PAGE_ZERO)
25412541
{
25422542
int rc;
2543-
Assert(hdr.size <= CHUNK_SIZE);
2544-
IO_CHECK(fio_read_all(fio_stdin, in_buf, hdr.size), hdr.size);
2543+
unsigned size;
2544+
if (hdr.cop == FIO_PAGE)
2545+
{
2546+
Assert(hdr.size <= CHUNK_SIZE);
2547+
size = hdr.size;
2548+
IO_CHECK(fio_read_all(fio_stdin, in_buf, hdr.size), hdr.size);
2549+
}
2550+
else
2551+
{
2552+
Assert(hdr.arg <= CHUNK_SIZE);
2553+
size = hdr.arg;
2554+
memset(in_buf, 0, hdr.arg);
2555+
}
25452556

25462557
/* We have received a chunk of compressed data, lets decompress it */
25472558
if (strm == NULL)
@@ -2552,7 +2563,7 @@ fio_send_file_gz(const char *from_fullpath, FILE* out, char **errormsg)
25522563

25532564
/* The fields next_in, avail_in initialized before init */
25542565
strm->next_in = (Bytef *)in_buf;
2555-
strm->avail_in = hdr.size;
2566+
strm->avail_in = size;
25562567

25572568
rc = inflateInit2(strm, 15 + 16);
25582569

@@ -2569,7 +2580,7 @@ fio_send_file_gz(const char *from_fullpath, FILE* out, char **errormsg)
25692580
else
25702581
{
25712582
strm->next_in = (Bytef *)in_buf;
2572-
strm->avail_in = hdr.size;
2583+
strm->avail_in = size;
25732584
}
25742585

25752586
strm->next_out = (Bytef *)out_buf; /* output buffer */

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.