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

Commit9390959

Browse files
committed
libpq: drop pending pipelined commands in pqDropConnection().
The original coding did this in pqDropServerData(), which seemsfairly backwards. Pending commands are more like already-queuedoutput data, which is dropped in pqDropConnection(). Moving theoperation means that we clear the command queue immediately upondetecting connection drop, which improves the sanity of subsequentbehavior. In particular this eliminates duplicated error messagetext as a consequence of code added inb15f254, which supposedthat a nonempty command queue must mean the prior operation isstill active.There might be an argument for backpatching this to v14; but as withb15f254, I'm unsure about interactions with618c167. For now,given the lack of complaints about v14's behavior, leave it alone.Per report from Peter Eisentraut.Discussion:https://postgr.es/m/de57761c-b99b-3435-b0a6-474c72b1149a@enterprisedb.com
1 parentb5f4422 commit9390959

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

‎src/interfaces/libpq/fe-connect.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,7 @@ static intconnectDBStart(PGconn *conn);
377377
staticintconnectDBComplete(PGconn*conn);
378378
staticPGPinginternal_ping(PGconn*conn);
379379
staticPGconn*makeEmptyPGconn(void);
380+
staticvoidpqFreeCommandQueue(PGcmdQueueEntry*queue);
380381
staticboolfillPGconn(PGconn*conn,PQconninfoOption*connOptions);
381382
staticvoidfreePGconn(PGconn*conn);
382383
staticvoidclosePGconn(PGconn*conn);
@@ -462,6 +463,12 @@ pqDropConnection(PGconn *conn, bool flushInput)
462463
/* Always discard any unsent data */
463464
conn->outCount=0;
464465

466+
/* Likewise, discard any pending pipelined commands */
467+
pqFreeCommandQueue(conn->cmd_queue_head);
468+
conn->cmd_queue_head=conn->cmd_queue_tail=NULL;
469+
pqFreeCommandQueue(conn->cmd_queue_recycle);
470+
conn->cmd_queue_recycle=NULL;
471+
465472
/* Free authentication/encryption state */
466473
#ifdefENABLE_GSS
467474
{
@@ -569,12 +576,6 @@ pqDropServerData(PGconn *conn)
569576
}
570577
conn->notifyHead=conn->notifyTail=NULL;
571578

572-
pqFreeCommandQueue(conn->cmd_queue_head);
573-
conn->cmd_queue_head=conn->cmd_queue_tail=NULL;
574-
575-
pqFreeCommandQueue(conn->cmd_queue_recycle);
576-
conn->cmd_queue_recycle=NULL;
577-
578579
/* Reset ParameterStatus data, as well as variables deduced from it */
579580
pstatus=conn->pstatus;
580581
while (pstatus!=NULL)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp