age: Periodic regression test "expr" failures

Describe the bug Regression test “expr” fails in rare cases

How are you accessing AGE (Command line, driver, etc.)? Accessing AGE through command line.

What data setup do we need to do? Apache AGE (master branch) with PostgreSQL (REL_15_STABLE).

What is the necessary configuration info needed? ./configure CFLAGS=" -Og" --enable-tap-tests --enable-debug --enable-cassert --prefix=/tmp/pgsql

What is the command that caused the error? I removed all tests except “expr” from the Makefile and put “make installcheck” in a loop to reproduce the failure.

diff --git a/Makefile b/Makefile
index ab98665..2f08858 100644
--- a/Makefile
+++ b/Makefile
@@ -76,30 +76,8 @@ EXTENSION = age
 DATA = age--1.4.0.sql
 
 # sorted in dependency order
-REGRESS = scan \
-          graphid \
-          agtype \
-          catalog \
-          cypher \
-          expr \
-          cypher_create \
-          cypher_match \
-          cypher_unwind \
-          cypher_set \
-          cypher_remove \
-          cypher_delete \
-          cypher_with \
-          cypher_vle \
-          cypher_union \
-          cypher_call \
-          cypher_merge \
-          age_global_graph \
-          age_load \
-          index \
-          analyze \
-          graph_generation \
-          name_validation \
-          drop
+
+REGRESS = expr
 
 srcdir=`pwd`

Start tests:

for i in `seq 1000000`;do echo "iteration $i";NO_TEMP_INSTALL=1 make -s installcheck || break;done

The test may fail at a random iteration. I received failures at iteration ~600, at iteration ~3500, and during the last run the test failed at iteration 199 with following “regression.diffs”:

iteration 199
+++ regress install-check in  +++
============== creating temporary instance            ==============
============== initializing database system           ==============
============== starting postmaster                    ==============
running on port 61958 with PID 3302580
============== creating database "contrib_regression" ==============
CREATE DATABASE
ALTER DATABASE
ALTER DATABASE
ALTER DATABASE
ALTER DATABASE
ALTER DATABASE
ALTER DATABASE
============== installing age                         ==============
CREATE EXTENSION
============== running regression test queries        ==============
test expr                         ... FAILED      643 ms
============== shutting down postmaster               ==============

======================
 1 of 1 tests failed. 
======================

regression.diffs:

diff -U3 /home/test/work/subtree/age/regress/expected/expr.out /home/test/work/subtree/age/regre>
--- /home/test/work/subtree/age/regress/expected/expr.out       2023-12-06 13:30:29.282207296 +0>
+++ /home/test/work/subtree/age/regress/results/expr.out        2023-12-06 13:42:58.481465465 +0>
@@ -7217,12 +7217,12 @@
 SELECT * FROM cypher('keys', $$MATCH ()-[e]-() RETURN keys(e)$$) AS (edge_keys agtype);
  edge_keys
 -----------
- []
- []
  ["song"]
  ["song"]
  ["song"]
  ["song"]
+ []
+ []
 (6 rows)

 SELECT * FROM cypher('keys', $$RETURN keys({a:1,b:'two',c:[1,2,3]})$$) AS (keys agtype);

But in some cases the test may fail with another regression.diffs:

diff -U3 /opt/pgpro/ent-14/src/apache-age-test/./regress/expected/expr.out /opt/pgpro/ent-14/src/apache-age-test/./regress/results/expr.out
--- /opt/pgpro/ent-14/src/apache-age-test/./regress/expected/expr.out	2023-09-26 17:35:01.000000000 +0300
+++ /opt/pgpro/ent-14/src/apache-age-test/./regress/results/expr.out	2023-11-30 06:00:38.531000000 +0300
@@ -6612,6 +6612,7 @@
 ERROR:  keys() argument must be a vertex, edge, object or null
 SELECT * from cypher('keys', $$MATCH u=()-[]-() RETURN keys(u)$$) as (keys agtype);
 ERROR:  keys() argument must be a vertex, edge, object or null
+CONTEXT:  parallel worker
 SELECT create_graph('list');
 NOTICE:  graph "list" has been created
  create_graph 

Expected behavior Consistent test passing

Best regards, Egor Chindyaskin Postgres Professional: http://postgrespro.com/

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 1
  • Comments: 15 (14 by maintainers)

Most upvoted comments

@rafsun42 Thank you! I have tested PR #1483. I have understood how to reproduce the issue faster. If you run tests on a virtual machine exactly with 2 cores, the error will repeat itself many times faster. So, on 2 core system I get the following results: regression.out:

test scan                         ... ok          292 ms
test graphid                      ... ok           11 ms
test agtype                       ... ok           68 ms
test catalog                      ... ok           71 ms
test cypher                       ... ok           21 ms
test expr                         ... FAILED      371 ms
test cypher_create                ... ok           88 ms
test cypher_match                 ... ok          500 ms
test cypher_unwind                ... ok           40 ms
test cypher_set                   ... ok           90 ms
test cypher_remove                ... ok           68 ms
test cypher_delete                ... ok          161 ms
test cypher_with                  ... ok           58 ms
test cypher_vle                   ... ok          792 ms
test cypher_union                 ... ok           21 ms
test cypher_call                  ... ok           33 ms
test cypher_merge                 ... ok          183 ms
test age_global_graph             ... ok          104 ms
test age_load                     ... ok         1283 ms
test index                        ... ok          100 ms
test analyze                      ... ok           19 ms
test graph_generation             ... ok           57 ms
test name_validation              ... ok          110 ms
test jsonb_operators              ... ok           78 ms
test drop                         ... ok          221 ms

regression.diffs:

diff -U3 /home/egor/work/age/regress/expected/expr.out /home/egor/work/age/regress/results/expr.out
--- /home/egor/work/age/regress/expected/expr.out       2024-01-11 13:04:18.474303239 +0300
+++ /home/egor/work/age/regress/results/expr.out        2024-01-12 07:55:56.036808105 +0300
@@ -1506,11 +1506,13 @@
        RETURN e
 $$) AS (i bigint);
 ERROR:  cannot cast agtype edge to type int
+CONTEXT:  parallel worker
 SELECT * FROM cypher('type_coercion', $$
        MATCH p=()-[]-()
        RETURN p
 $$) AS (i bigint);
 ERROR:  cannot cast agtype path to type int
+CONTEXT:  parallel worker
 --
 -- Test typecasting '::' transform and execution logic
 --
@@ -7249,6 +7251,7 @@
 \set debug_parallel_query to regress -- suppresses context message from a parallel worker
 SELECT * from cypher('keys', $$MATCH u=()-[]-() RETURN keys(u)$$) as (keys agtype);
 ERROR:  keys() argument must be a vertex, edge, object or null
+CONTEXT:  parallel worker
 \unset debug_parallel_query
 SELECT create_graph('list');
 NOTICE:  graph "list" has been created

Also, due to the setting of 2 cores, the “cypher_match” test began to fail. I’ve created a PR #1507 that fixes this test.

@rafsun42 We should make those changes so that these regression tests don’t fail. Failing, but still okay, doesn’t give warm fuzzies.

Interesting.

As Postgres suggests, regression tests are ‘not so pedantic’. Therefore, some tests might fail despite the test queries yielding correct results.

The first one is failing due to row-ordering difference. However, the output itself is correct. Since the order is not well-defined by the specification, we can assume ordering differences do not indicate incorrect result.

The second one is failing due to an addition of the notice ‘CONTEXT: parallel worker’. Since the diff does not show any other changes, I am assuming the query is producing the expected result. Except it is being executed by parallel workers.

It may be possible to fix the fails by adding an order by clause and setting config parameters.