Re: Statement timeout behavior in extended queries - Mailing list pgsql-hackers

From Tsunakawa, Takayuki
Subject Re: Statement timeout behavior in extended queries
Date
Msg-id 0A3221C70F24FB45833433255569204D1F6BF355@G01JPEXMBYT05
Whole thread Raw
In response to Re: [HACKERS] Statement timeout behavior in extended queries  (Tatsuo Ishii <ishii@sraoss.co.jp>)
List pgsql-hackers
Hello,


I've reviewed the patch.  My understanding is as follows.  Please correct me if I'm wrong.

* The difference is that the Execute message stops the statement_timeout timer, so that the execution of one statement
doesn'tshorten the timeout period of subsequent statements when they are run in batch followed by a single Sync
message.

* This patch is also necessary (or desirable) for the feature "Pipelining/batch mode support for libpq," which is being
developedfor PG 10.  This patch enables correct timeout handling for each statement execution in a batch.  Without this
patch,the entire batch of statements is subject to statement_timeout.  That's different from what the manual describes
aboutstatement_timeout.  statement_timeout should measure execution of each statement.
 


Below are what I found in the patch.


(1)
+static bool st_timeout = false;

I think the variable name would better be stmt_timeout_enabled or stmt_timer_started, because other existing names use
stmtto abbreviate statement, and thhis variable represents a state (see xact_started for example.)
 


(2)
+static void enable_statement_timeout(void)
+{

+static void disable_statement_timeout(void)
+{

"static void" and the remaining line should be on different lines, as other functions do.



(3)
+            /*
+             * Sanity check
+             */
+            if (!xact_started)
+            {
+                ereport(ERROR,
+                        (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+                         errmsg("Transaction must have been already started to set statement timeout")));
+            }

I think this fragment can be deleted, because enable/disable_timeout() is used only at limited places in postgres.c, so
Idon't see the chance of misuse.
 


Regards
Takayuki Tsunakawa




pgsql-hackers by date:

Previous
From: Ashutosh Bapat
Date:
Subject: Re: Foreign tables don't enforce the partition constraint
Next
From: Michael Banck
Date:
Subject: Re: gitlab post-mortem: pg_basebackup waiting forcheckpoint