[postgis-tickets] [SCM] PostGIS branch master updated. 3.3.0rc2-756-gb0d9783f4

git at osgeo.org git at osgeo.org
Fri May 5 05:53:49 PDT 2023


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "PostGIS".

The branch, master has been updated
       via  b0d9783f417b3116d5624cc060979decacd978ba (commit)
      from  92b7574189989702147ee663a7c33f03008f2d8a (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit b0d9783f417b3116d5624cc060979decacd978ba
Author: Sandro Santilli <strk at kbt.io>
Date:   Fri May 5 14:38:22 2023 +0200

    Tweak buffer interrupt test tolerance based on time needed to update temp table

diff --git a/regress/core/interrupt_buffer.sql b/regress/core/interrupt_buffer.sql
index c0d6a4fb5..1a1f6682b 100644
--- a/regress/core/interrupt_buffer.sql
+++ b/regress/core/interrupt_buffer.sql
@@ -1,16 +1,35 @@
-CREATE TEMPORARY TABLE _time AS SELECT now() t;
-
 CREATE FUNCTION _timecheck(label text, tolerated interval) RETURNS text
 AS $$
 DECLARE
   ret TEXT;
   lap INTERVAL;
 BEGIN
+	-- We use now() here to get the time at the
+	-- start of the transaction, which started when
+	-- this function was called, so the earliest
+	-- posssible time
   lap := now()-t FROM _time;
-  IF lap <= tolerated THEN ret := label || ' interrupted on time';
-  ELSE ret := label || ' interrupted late: ' || lap;
+
+  UPDATE _time SET t = clock_timestamp();
+
+	-- Increase tolerated value based on some machine-dependent
+	-- timing. This code uses the time it took to update a temporary
+	-- table but we could use something more meaningful, maybe
+	-- finding it in a GUC or something set by a pre-hook
+	tolerated = tolerated + (clock_timestamp()-now());
+
+  IF lap <= tolerated THEN
+		ret := format(
+			'%s interrupted on time',
+			label
+		);
+  ELSE
+		ret := format(
+			'%s interrupted late: %s (%s tolerated)',
+			label, lap, tolerated
+		);
   END IF;
-  UPDATE _time SET t = now();
+
   RETURN ret;
 END;
 $$ LANGUAGE 'plpgsql' VOLATILE;
@@ -25,13 +44,15 @@ SELECT 1::int as id, ST_Collect(g) g FROM (
  ) foo
 ;
 
-UPDATE _time SET t = now(); -- reset time as creating tables spends some
+CREATE TEMPORARY TABLE _time AS SELECT now() t;
+
 
 -----------------
 -- ST_Buffer
 -----------------
 
 SET statement_timeout TO 100;
+
 select ST_Buffer(g,100) from _inputs WHERE id = 1;
 --( select (st_dumppoints(st_buffer(st_makepoint(0,0),10000,100000))).geom g) foo;
 -- it may take some more to interrupt st_buffer, see

-----------------------------------------------------------------------

Summary of changes:
 regress/core/interrupt_buffer.sql | 33 +++++++++++++++++++++++++++------
 1 file changed, 27 insertions(+), 6 deletions(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list