You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-07-17 01:12:23 +02:00
Improve performance of non-blocking reads by using maximum buffer size.
Since the introduction of blocking read drivers (e.g. IoHandleRead, TlsClient) the non-blocking drivers have used the same rules for determining maximum buffer size, i.e. read only as much as requested. This is necessary so the blocking drivers don't get stuck waiting for data that might not be coming. Instead mark blocking drivers so IoRead knows how much buffer to allow for the read. The non-blocking drivers can now request the maximum number of bytes allowed by buffer-size.
This commit is contained in:
@ -551,10 +551,13 @@ testRun(void)
|
||||
TEST_ERROR(ioRead(ioHandleReadIo(read), buffer), FileReadError, "unable to read data from read test after 1000ms");
|
||||
TEST_RESULT_UINT(bufSize(buffer), 16, "buffer is only partially read");
|
||||
|
||||
// Read a buffer that is transmitted in two parts
|
||||
// Read a buffer that is transmitted in two parts with blocking on the read side
|
||||
buffer = bufNew(16);
|
||||
bufLimitSet(buffer, 12);
|
||||
|
||||
TEST_RESULT_UINT(ioRead(ioHandleReadIo(read), buffer), 16, "read buffer");
|
||||
TEST_RESULT_UINT(ioRead(ioHandleReadIo(read), buffer), 12, "read buffer");
|
||||
bufLimitClear(buffer);
|
||||
TEST_RESULT_UINT(ioRead(ioHandleReadIo(read), buffer), 4, "read buffer");
|
||||
TEST_RESULT_STR(strPtr(strNewBuf(buffer)), "1234567812345678", "check buffer");
|
||||
|
||||
// Check EOF
|
||||
|
Reference in New Issue
Block a user