[postgis-tickets] [SCM] PostGIS branch master updated. 3.3.0rc2-765-g5e61ca2e1

git at osgeo.org git at osgeo.org
Fri May 5 12:07:54 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  5e61ca2e1e04ae438cc0200133a9ef1c8a89e97f (commit)
       via  43474d716f06ce9cd8e6c62c8878131552924c97 (commit)
       via  1a86c1b128e4b39f193f7be09da645708866bb12 (commit)
      from  c84141b87bdf7f310f1d41cd8d66fa57541b0021 (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 5e61ca2e1e04ae438cc0200133a9ef1c8a89e97f
Author: Sandro Santilli <strk at kbt.io>
Date:   Fri May 5 21:07:35 2023 +0200

    Raise clien_min_messages to WARNING for interrupt tests

diff --git a/regress/core/interrupt.sql b/regress/core/interrupt.sql
index bc47d59f7..616e74fd7 100644
--- a/regress/core/interrupt.sql
+++ b/regress/core/interrupt.sql
@@ -1,5 +1,5 @@
 -- liblwgeom interruption
-set client_min_messages to NOTICE;
+set client_min_messages to WARNING;
 
 \i :regdir/utils/timecheck.sql
 
diff --git a/regress/core/interrupt_buffer.sql b/regress/core/interrupt_buffer.sql
index 6372f63a6..11f117a28 100644
--- a/regress/core/interrupt_buffer.sql
+++ b/regress/core/interrupt_buffer.sql
@@ -1,3 +1,5 @@
+set client_min_messages to WARNING;
+
 CREATE TEMP TABLE _inputs AS
 SELECT 1::int as id, ST_Collect(g) g FROM (
  SELECT ST_MakeLine(
diff --git a/regress/core/interrupt_expected b/regress/core/interrupt_expected
index d6bbb771b..8b22c31aa 100644
--- a/regress/core/interrupt_expected
+++ b/regress/core/interrupt_expected
@@ -1,4 +1,3 @@
-NOTICE:  liblwgeom code interrupted
 ERROR:  canceling statement due to statement timeout
 segmentize interrupted on time
 1|LINESTRING(0 0,2 0,4 0)

commit 43474d716f06ce9cd8e6c62c8878131552924c97
Author: Sandro Santilli <strk at kbt.io>
Date:   Fri May 5 20:43:55 2023 +0200

    Use test.executor_slow_factor in timeout tests, reuse common code

diff --git a/regress/core/interrupt.sql b/regress/core/interrupt.sql
index e5213094e..bc47d59f7 100644
--- a/regress/core/interrupt.sql
+++ b/regress/core/interrupt.sql
@@ -1,37 +1,7 @@
 -- liblwgeom interruption
 set client_min_messages to NOTICE;
 
-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 := format(
-			'%s interrupted on time',
-			label
-		);
-  ELSE
-		ret := format(
-			'%s interrupted late: %s (%s tolerated)',
-			label, lap, tolerated
-		);
-  END IF;
-
-  UPDATE _time SET t = clock_timestamp();
-
-  RETURN ret;
-END;
-$$ LANGUAGE 'plpgsql' VOLATILE;
-
-CREATE TEMPORARY TABLE _time AS SELECT now() t;
+\i :regdir/utils/timecheck.sql
 
 -----------------
 -- ST_Segmentize
@@ -40,6 +10,7 @@ CREATE TEMPORARY TABLE _time AS SELECT now() t;
 SET statement_timeout TO 100;
 -- would run for many seconds if uninterruptible...
 SELECT 'segmentize', ST_NPoints(ST_Segmentize(ST_MakeLine(ST_Point(4,39), ST_Point(1,41)), 1e-8));
+
 SELECT _timecheck('segmentize', '300ms');
 SET statement_timeout TO 0;
 -- Not affected by old timeout
diff --git a/regress/core/interrupt_buffer.sql b/regress/core/interrupt_buffer.sql
index 47620324f..6372f63a6 100644
--- a/regress/core/interrupt_buffer.sql
+++ b/regress/core/interrupt_buffer.sql
@@ -1,33 +1,3 @@
-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 := format(
-			'%s interrupted on time',
-			label
-		);
-  ELSE
-		ret := format(
-			'%s interrupted late: %s (%s tolerated)',
-			label, lap, tolerated
-		);
-  END IF;
-
-  UPDATE _time SET t = clock_timestamp();
-
-  RETURN ret;
-END;
-$$ LANGUAGE 'plpgsql' VOLATILE;
-
 CREATE TEMP TABLE _inputs AS
 SELECT 1::int as id, ST_Collect(g) g FROM (
  SELECT ST_MakeLine(
@@ -38,11 +8,7 @@ SELECT 1::int as id, ST_Collect(g) g FROM (
  ) foo
 ;
 
--- Run ST_Buffer once to ensure the libary is loaded
--- before taking the start time
-SELECT NULL FROM ST_Buffer('POINT(0 0)'::geometry, 3, 1);
-
-CREATE TEMPORARY TABLE _time AS SELECT now() t;
+\i :regdir/utils/timecheck.sql
 
 -----------------
 -- ST_Buffer
diff --git a/regress/core/interrupt_relate.sql b/regress/core/interrupt_relate.sql
index 22f06afbc..547caa2bc 100644
--- a/regress/core/interrupt_relate.sql
+++ b/regress/core/interrupt_relate.sql
@@ -1,31 +1,5 @@
 set client_min_messages to WARNING;
 
-CREATE FUNCTION _timecheck(label text, tolerated interval) RETURNS text
-AS $$
-DECLARE
-  ret TEXT;
-  lap INTERVAL;
-BEGIN
-  lap := now()-t FROM _time;
-
-  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 = clock_timestamp();
-
-  RETURN ret;
-END;
-$$ LANGUAGE 'plpgsql' VOLATILE;
-
 CREATE TEMP TABLE _inputs AS
 SELECT 1::int as id, ST_Collect(g) g FROM (
  SELECT ST_MakeLine(
@@ -36,7 +10,7 @@ SELECT 1::int as id, ST_Collect(g) g FROM (
  ) foo
 ;
 
-CREATE TEMPORARY TABLE _time AS SELECT now() t;
+\i :regdir/utils/timecheck.sql
 
 -----------------------------
 -- IM9 based predicates
diff --git a/regress/utils/timecheck.sql b/regress/utils/timecheck.sql
new file mode 100644
index 000000000..a578acd3a
--- /dev/null
+++ b/regress/utils/timecheck.sql
@@ -0,0 +1,47 @@
+CREATE FUNCTION _timecheck(label text, tolerated interval) RETURNS text
+AS $$
+DECLARE
+  ret TEXT;
+  lap INTERVAL;
+	rec RECORD;
+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
+  SELECT now()-t lap, sf slow_factor
+	FROM _time INTO rec;
+
+	RAISE DEBUG 'Requested tolerance: %', tolerated;
+	RAISE DEBUG 'Slow factor: %', rec.slow_factor;
+
+	tolerated := tolerated * rec.slow_factor;
+
+	RAISE DEBUG 'Resulting tolerance: %', tolerated;
+
+  IF rec.lap <= tolerated THEN
+		ret := format(
+			'%s interrupted on time',
+			label
+		);
+  ELSE
+		ret := format(
+			'%s interrupted late: %s (%s tolerated)',
+			label, rec.lap, tolerated
+		);
+  END IF;
+
+  UPDATE _time SET t = clock_timestamp();
+
+  RETURN ret;
+END;
+$$ LANGUAGE 'plpgsql' VOLATILE;
+
+CREATE TEMPORARY TABLE _time AS
+SELECT
+	now() t,
+	COALESCE(
+    current_setting('test.executor_slow_factor', true),
+    '1'
+  )::float8 sf;
+

commit 1a86c1b128e4b39f193f7be09da645708866bb12
Author: Sandro Santilli <strk at kbt.io>
Date:   Fri May 5 20:42:34 2023 +0200

    Make a test.executor_slow_factor setting available in regress db
    
    The slow factor will represent how slower a test executor is compared
    to the test executor expected by the developers writing the tests and
    tweaking expected times.

diff --git a/regress/run_test.pl b/regress/run_test.pl
index 3f143f225..1c36e90b6 100755
--- a/regress/run_test.pl
+++ b/regress/run_test.pl
@@ -329,6 +329,28 @@ else
 
 my $libver = sql("select postgis_lib_version()");
 
+sub compute_executor_slow_factor
+{
+    my $ms_to_fetch_full_version = sql(<<EOF
+        CREATE TEMP TABLE _start AS SELECT clock_timestamp() c;
+        SELECT FROM postgis_full_version();
+        SELECT EXTRACT(milliseconds FROM clock_timestamp()-c)
+             FROM _start;
+EOF
+    );
+    my $default_ms_to_fetch_full_version = 10;
+    my $test_executor_slow_factor = 1;
+    if ( $ms_to_fetch_full_version gt $default_ms_to_fetch_full_version )
+    {
+        $test_executor_slow_factor = $ms_to_fetch_full_version / $default_ms_to_fetch_full_version;
+    }
+    #
+    print "Executor slow factor: $test_executor_slow_factor ($ms_to_fetch_full_version ms to fetch full version)\n";
+    sql("ALTER DATABASE $DB SET test.executor_slow_factor = $test_executor_slow_factor");
+}
+
+compute_executor_slow_factor;
+
 if ( ! $libver )
 {
 	`dropdb $DB`;

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

Summary of changes:
 regress/core/interrupt.sql        | 35 +++--------------------------
 regress/core/interrupt_buffer.sql | 36 ++----------------------------
 regress/core/interrupt_expected   |  1 -
 regress/core/interrupt_relate.sql | 28 +----------------------
 regress/run_test.pl               | 22 ++++++++++++++++++
 regress/utils/timecheck.sql       | 47 +++++++++++++++++++++++++++++++++++++++
 6 files changed, 75 insertions(+), 94 deletions(-)
 create mode 100644 regress/utils/timecheck.sql


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list