2
0

Merge pull request #565 from furdarius/8kb-default-chunked-buffer

Set 8KB as default size of ChunkReader buffer
This commit is contained in:
Jack Christensen
2019-08-03 09:59:46 -05:00
committed by GitHub
+5 -1
View File
@@ -28,7 +28,11 @@ func NewChunkReader(r io.Reader) *ChunkReader {
func NewChunkReaderEx(r io.Reader, options Options) (*ChunkReader, error) {
if options.MinBufLen == 0 {
options.MinBufLen = 4096
// By historical reasons Postgres currently has 8KB send buffer inside,
// so here we want to have at least the same size buffer.
// @see https://github.com/postgres/postgres/blob/249d64999615802752940e017ee5166e726bc7cd/src/backend/libpq/pqcomm.c#L134
// @see https://www.postgresql.org/message-id/0cdc5485-cb3c-5e16-4a46-e3b2f7a41322%40ya.ru
options.MinBufLen = 8192
}
return &ChunkReader{