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

Commit1d4be6b

Browse files
committed
Fix LZ4 tests for remaining buffer space.
We should flush the buffer when the remaining space is less thanthe maximum amount that we might need, not when it is less than orequal to the maximum amount we might need.Jeevan Ladhe, per an observation from me.Discussion:http://postgr.es/m/CANm22CgVMa85O1akgs+DOPE8NSrT1zbz5_vYfS83_r+6nCivLQ@mail.gmail.com
1 parent7cf085f commit1d4be6b

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

‎src/backend/replication/basebackup_lz4.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ bbsink_lz4_archive_contents(bbsink *sink, size_t avail_in)
193193
* LZ4F_compressBound(), ask the next sink to process the data so that we
194194
* can empty the buffer.
195195
*/
196-
if ((mysink->base.bbs_next->bbs_buffer_length-mysink->bytes_written) <=
196+
if ((mysink->base.bbs_next->bbs_buffer_length-mysink->bytes_written)<
197197
avail_in_bound)
198198
{
199199
bbsink_archive_contents(sink->bbs_next,mysink->bytes_written);
@@ -238,7 +238,7 @@ bbsink_lz4_end_archive(bbsink *sink)
238238

239239
Assert(mysink->base.bbs_next->bbs_buffer_length >=lz4_footer_bound);
240240

241-
if ((mysink->base.bbs_next->bbs_buffer_length-mysink->bytes_written) <=
241+
if ((mysink->base.bbs_next->bbs_buffer_length-mysink->bytes_written)<
242242
lz4_footer_bound)
243243
{
244244
bbsink_archive_contents(sink->bbs_next,mysink->bytes_written);

‎src/bin/pg_basebackup/bbstreamer_lz4.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ bbstreamer_lz4_compressor_new(bbstreamer *next, int compresslevel)
9999
compressed_bound=LZ4F_compressBound(streamer->base.bbs_buffer.maxlen,prefs);
100100

101101
/* Enlarge buffer if it falls short of compression bound. */
102-
if (streamer->base.bbs_buffer.maxlen <=compressed_bound)
102+
if (streamer->base.bbs_buffer.maxlen<compressed_bound)
103103
enlargeStringInfo(&streamer->base.bbs_buffer,compressed_bound);
104104

105105
ctxError=LZ4F_createCompressionContext(&streamer->cctx,LZ4F_VERSION);
@@ -170,7 +170,7 @@ bbstreamer_lz4_compressor_content(bbstreamer *streamer,
170170
*/
171171
out_bound=LZ4F_compressBound(len,&mystreamer->prefs);
172172
Assert(mystreamer->base.bbs_buffer.maxlen >=out_bound);
173-
if (avail_out <=out_bound)
173+
if (avail_out<out_bound)
174174
{
175175
bbstreamer_content(mystreamer->base.bbs_next,member,
176176
mystreamer->base.bbs_buffer.data,
@@ -218,7 +218,7 @@ bbstreamer_lz4_compressor_finalize(bbstreamer *streamer)
218218
/* Find out the footer bound and update the output buffer. */
219219
footer_bound=LZ4F_compressBound(0,&mystreamer->prefs);
220220
Assert(mystreamer->base.bbs_buffer.maxlen >=footer_bound);
221-
if ((mystreamer->base.bbs_buffer.maxlen-mystreamer->bytes_written) <=
221+
if ((mystreamer->base.bbs_buffer.maxlen-mystreamer->bytes_written)<
222222
footer_bound)
223223
{
224224
bbstreamer_content(mystreamer->base.bbs_next,NULL,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp