diff --git a/doc/xml/release/2024/2.54.xml b/doc/xml/release/2024/2.54.xml index 34b082fbc..621f3327f 100644 --- a/doc/xml/release/2024/2.54.xml +++ b/doc/xml/release/2024/2.54.xml @@ -1,5 +1,28 @@ + + + + + + + + + + + + + + + + + + + +

Fix query performance for large datasets.

+
+
+ diff --git a/doc/xml/release/contributor.xml b/doc/xml/release/contributor.xml index d1d89d62c..8f7361ffc 100644 --- a/doc/xml/release/contributor.xml +++ b/doc/xml/release/contributor.xml @@ -85,6 +85,11 @@ andr-sokolov + + Antoine Millet + NaPs + + Anton Glushakov glushakov @@ -985,6 +990,11 @@ tanelsuurhans + + Thibault Vincent + npdgm + + Tim Garton ralfthewise diff --git a/src/postgres/client.c b/src/postgres/client.c index d8535227a..0addaf6d4 100644 --- a/src/postgres/client.c +++ b/src/postgres/client.c @@ -6,6 +6,7 @@ Postgres Client #include #include "common/debug.h" +#include "common/io/fd.h" #include "common/log.h" #include "common/wait.h" #include "postgres/client.h" @@ -198,7 +199,7 @@ pgClientQuery(PgClient *const this, const String *const query, const PgClientQue PQconsumeInput(this->connection); busy = PQisBusy(this->connection); } - while (busy && waitMore(wait)); + while (busy && fdReadyRead(PQsocket(this->connection), waitRemains(wait))); // If the query is still busy after the timeout attempt to cancel if (busy) diff --git a/test/src/common/harnessPq.c b/test/src/common/harnessPq.c index b3617d2a3..7ae7d29e5 100644 --- a/test/src/common/harnessPq.c +++ b/test/src/common/harnessPq.c @@ -13,6 +13,7 @@ Pq Test Harness #include "common/type/string.h" #include "common/type/variantList.h" +#include "common/harnessFd.h" #include "common/harnessPq.h" #include "common/harnessTest.h" @@ -269,6 +270,19 @@ PQisBusy(PGconn *conn) return hrnPqScriptRun(HRN_PQ_ISBUSY, NULL, (HrnPqScript *)conn)->resultInt; } +/*********************************************************************************************************************************** +Shim for PQsocket() +***********************************************************************************************************************************/ +int +PQsocket(const PGconn *conn) +{ + int result = hrnPqScriptRun(HRN_PQ_SOCKET, NULL, (HrnPqScript *)conn)->resultInt; + + hrnFdReadyShimOne(result == true); + + return result; +} + /*********************************************************************************************************************************** Shim for PQgetCancel() ***********************************************************************************************************************************/ diff --git a/test/src/common/harnessPq.h b/test/src/common/harnessPq.h index 4031f0be9..5463f101d 100644 --- a/test/src/common/harnessPq.h +++ b/test/src/common/harnessPq.h @@ -36,6 +36,7 @@ Function constants #define HRN_PQ_RESULTERRORMESSAGE "PQresultErrorMessage" #define HRN_PQ_RESULTSTATUS "PQresultStatus" #define HRN_PQ_SENDQUERY "PQsendQuery" +#define HRN_PQ_SOCKET "PQsocket" #define HRN_PQ_STATUS "PQstatus" /*********************************************************************************************************************************** diff --git a/test/src/module/postgres/clientTest.c b/test/src/module/postgres/clientTest.c index 9168268f9..b0a08af65 100644 --- a/test/src/module/postgres/clientTest.c +++ b/test/src/module/postgres/clientTest.c @@ -153,10 +153,13 @@ testRun(void) {.function = HRN_PQ_SENDQUERY, .param = "[\"" TEST_QUERY "\"]", .resultInt = 1}, {.function = HRN_PQ_CONSUMEINPUT, .sleep = 600}, {.function = HRN_PQ_ISBUSY, .resultInt = 1}, + {.function = HRN_PQ_SOCKET, .resultInt = 1}, {.function = HRN_PQ_CONSUMEINPUT}, {.function = HRN_PQ_ISBUSY, .resultInt = 1}, + {.function = HRN_PQ_SOCKET, .resultInt = 1}, {.function = HRN_PQ_CONSUMEINPUT}, {.function = HRN_PQ_ISBUSY, .resultInt = 1}, + {.function = HRN_PQ_SOCKET}, {.function = HRN_PQ_GETCANCEL}, {.function = HRN_PQ_CANCEL, .resultInt = 1}, {.function = HRN_PQ_FREECANCEL}, @@ -182,10 +185,13 @@ testRun(void) {.function = HRN_PQ_SENDQUERY, .param = "[\"" TEST_QUERY "\"]", .resultInt = 1}, {.function = HRN_PQ_CONSUMEINPUT, .sleep = 300}, {.function = HRN_PQ_ISBUSY, .resultInt = 1}, + {.function = HRN_PQ_SOCKET, .resultInt = 1}, {.function = HRN_PQ_CONSUMEINPUT, .sleep = 300}, {.function = HRN_PQ_ISBUSY, .resultInt = 1}, + {.function = HRN_PQ_SOCKET, .resultInt = 1}, {.function = HRN_PQ_CONSUMEINPUT}, {.function = HRN_PQ_ISBUSY, .resultInt = 1}, + {.function = HRN_PQ_SOCKET}, {.function = HRN_PQ_GETCANCEL}, {.function = HRN_PQ_CANCEL, .resultInt = 0, .resultZ = TEST_PQ_ERROR}, {.function = HRN_PQ_FREECANCEL}); @@ -208,10 +214,13 @@ testRun(void) {.function = HRN_PQ_SENDQUERY, .param = "[\"" TEST_QUERY "\"]", .resultInt = 1}, {.function = HRN_PQ_CONSUMEINPUT, .sleep = 600}, {.function = HRN_PQ_ISBUSY, .resultInt = 1}, + {.function = HRN_PQ_SOCKET, .resultInt = 1}, {.function = HRN_PQ_CONSUMEINPUT}, {.function = HRN_PQ_ISBUSY, .resultInt = 1}, + {.function = HRN_PQ_SOCKET, .resultInt = 1}, {.function = HRN_PQ_CONSUMEINPUT}, {.function = HRN_PQ_ISBUSY, .resultInt = 1}, + {.function = HRN_PQ_SOCKET}, {.function = HRN_PQ_GETCANCEL, .resultNull = true}); TEST_ERROR(