Repository navigation
Description
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/
Activity
rafsun42 commentedon Dec 8, 2023
Do these failures occur if
NO_TEMP_INSTALL=1is not set? I am assuming this env variable is causing the tests to run in an existing installation of Postgres, rather than a temporary one.saygoodbyye commentedon Dec 11, 2023
Yes, test fail occurs without this env variable aswell. I've checked this recently
regression.diffs:
Alse reproduced another diff:
rafsun42 commentedon Dec 28, 2023
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.
jrgemignani commentedon Jan 3, 2024
@rafsun42 We should make those changes so that these regression tests don't fail. Failing, but still okay, doesn't give warm fuzzies.
rafsun42 commentedon Jan 3, 2024
@saygoodbyye I could not reproduce the failure on my machine. But, I added a draft PR #1483 which may solve this issue. Let us know if it does, if possible.
saygoodbyye commentedon Jan 12, 2024
@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:
regression.diffs:
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 commentedon Jan 12, 2024
@saygoodbyye It seems
debug_parallel_query to regressdidn't quite work. I will try to reproduce the issue with smaller number of cores.rafsun42 commentedon Jan 15, 2024
@saygoodbyye May I ask your CPU info and linux distro where you ran the tests?
saygoodbyye commentedon Jan 16, 2024
@rafsun42 , i5-12400F, Ubuntu 22.04
rafsun42 commentedon Jan 16, 2024
@saygoodbyye
It seems the
debug_parallel_queryparameter was calledforce_parallel_modein PG15. If you are in PG15, could you try settingforce_parallel_modetoregressinstead. This should suppress the+CONTEXT: parallel workerline as explained here.saygoodbyye commentedon Mar 13, 2024
@rafsun42
I got around to this test again. I tried setting the debug_parallel_query parameter to regress and it worked for apache age 16 and master. For versions 11 to 15, setting the force_parallel_query parameter to regress worked, as you suggested. If you don't mind, I would prepare a PR for all apache age branches with my patches bellow:
16-master:
11-15:
rafsun42 commentedon Mar 14, 2024
@saygoodbyye Sure.
I have one question. Do you think we should unset
debug_parallel_query\force_parallel_modeat the end of that particular query?Also, my draft pr #1483 addresses similar issue. You can include it with your PR, so all relevent changes are put together.
saygoodbyye commentedon Mar 15, 2024
@rafsun42
Thank you. I noticed that this is not the only query that can cause the "CONTEXT: parallel worker" message to appear, so I decided to set this option for the entire test.
github-actions commentedon May 11, 2024
This issue is stale because it has been open 45 days with no activity. Remove "Abondoned" label or comment or this will be closed in 7 days.
MuhammadTahaNaveed commentedon May 11, 2024
Closing this as the issue has been resolved by PRs #1772 and #1678.