age
age copied to clipboard
Flaky test cypher_delete fails on slow machines
Describe the bug Test cypher_delete sometimes fails. Mainly appears when the machine is running slowly.
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_16_STABLE).
What is the necessary configuration info needed?
./configure CFLAGS=" -Og" --enable-tap-tests --enable-debug --enable-cassert
What is the command that caused the error? To reproduce fail several times faster I do this Makefile patch (Only to reproduce fail faster. This fail may occur even without these changes):
diff --git a/Makefile b/Makefile
index 1224fc2a..0d51a9e0 100644
--- a/Makefile
+++ b/Makefile
@@ -85,35 +85,7 @@ SQLS := $(addsuffix .sql,$(SQLS))
DATA_built = $(age_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 \
- cypher_subquery \
- age_global_graph \
- age_load \
- index \
- analyze \
- graph_generation \
- name_validation \
- jsonb_operators \
- list_comprehension \
- map_projection \
- drop
-
+REGRESS=$(shell printf "cypher_delete %.0s" `seq 100` )
srcdir=`pwd`
ag_regress_dir = $(srcdir)/regress
Then i run make installcheck:
for i in `seq 1000`;do make installcheck || break;done
And get:
<...>
test cypher_delete ... ok 983 ms
test cypher_delete ... ok 932 ms
test cypher_delete ... ok 938 ms
test cypher_delete ... ok 899 ms
test cypher_delete ... FAILED 926 ms
test cypher_delete ... ok 921 ms
test cypher_delete ... ok 883 ms
<...>
regression.diffs:
diff -U3 /opt/pgpro/ent-14/src/apache-age-test/./regress/expected/cypher_delete.out /opt/pgpro/ent-14/src/apache-age-test/./regress/results/cypher_delete.out
--- /opt/pgpro/ent-14/src/apache-age-test/./regress/expected/cypher_delete.out 2024-05-22 09:54:54.000000000 +0000
+++ /opt/pgpro/ent-14/src/apache-age-test/./regress/results/cypher_delete.out 2024-05-23 11:36:29.531598703 +0000
@@ -62,14 +62,20 @@
--Should Fail
SELECT * FROM cypher('cypher_delete', $$MATCH(n1)-[e]->(n2) DELETE n1 RETURN n1$$) AS (a agtype);
-ERROR: Cannot delete a vertex that has edge(s). Delete the edge(s) first, or try DETACH DELETE.
--Cleanup
SELECT * FROM cypher('cypher_delete', $$MATCH(n) DELETE n RETURN n$$) AS (a agtype) ORDER BY a;
- a
------------------------------------------------------------------
- {"id": 844424930131972, "label": "v", "properties": {}}::vertex
- {"id": 844424930131973, "label": "v", "properties": {}}::vertex
-(2 rows)
-
+ERROR: Cannot delete a vertex that has edge(s). Delete the edge(s) first, or try DETACH DELETE.
--Test 4: DETACH DELETE a vertex
SELECT * FROM cypher('cypher_delete', $$CREATE (:v)-[:e]->(:v)$$) AS (a agtype);
a
@@ -100,8 +101,9 @@
SELECT * FROM cypher('cypher_delete', $$MATCH(n) RETURN n$$) AS (a agtype);
a
-----------------------------------------------------------------
+ {"id": 844424930131973, "label": "v", "properties": {}}::vertex
{"id": 844424930131975, "label": "v", "properties": {}}::vertex
-(1 row)
+(2 rows)
--Test 4: DETACH DELETE two vertices tied to the same edge
SELECT * FROM cypher('cypher_delete', $$CREATE (:v)-[:e]->(:v)$$) AS (a agtype);
@@ -168,18 +170,16 @@
(0 rows)
SELECT * FROM cypher('cypher_delete', $$MATCH(n) DELETE n SET n.lol = 'ftw' RETURN n$$) AS (a agtype) ORDER BY a;
- a
------------------------------------------------------------------------------------------------------
- {"id": 844424930131975, "label": "v", "properties": {"lol": "ftw"}}::vertex
- {"id": 844424930131982, "label": "v", "properties": {"lol": "ftw"}}::vertex
- {"id": 844424930131983, "label": "v", "properties": {"a": 0, "i": 0, "j": 5, "lol": "ftw"}}::vertex
- {"id": 844424930131984, "label": "v", "properties": {"i": 1, "lol": "ftw"}}::vertex [0/1780]
-(4 rows)
-
+ERROR: Cannot delete a vertex that has edge(s). Delete the edge(s) first, or try DETACH DELETE.
SELECT * FROM cypher('cypher_delete', $$MATCH(n) RETURN n$$) AS (a agtype);
- a
----
-(0 rows)
+ a
+---------------------------------------------------------------------------------------
+ {"id": 844424930131973, "label": "v", "properties": {}}::vertex
+ {"id": 844424930131975, "label": "v", "properties": {}}::vertex
+ {"id": 844424930131982, "label": "v", "properties": {}}::vertex
+ {"id": 844424930131983, "label": "v", "properties": {"a": 0, "i": 0, "j": 5}}::vertex
+ {"id": 844424930131984, "label": "v", "properties": {"i": 1}}::vertex
+(5 rows)
--Test 8:
SELECT * FROM cypher('cypher_delete', $$CREATE (n:v)-[:e]->(:v) CREATE (n)-[:e]->(:v)$$) AS (a agtype);
@@ -191,12 +191,17 @@
ERROR: Cannot delete a vertex that has edge(s). Delete the edge(s) first, or try DETACH DELETE.
--Cleanup
SELECT * FROM cypher('cypher_delete', $$MATCH(n) DETACH DELETE n RETURN n$$) AS (a agtype) ORDER BY a;
- a
------------------------------------------------------------------
+ a
+---------------------------------------------------------------------------------------
+ {"id": 844424930131973, "label": "v", "properties": {}}::vertex
+ {"id": 844424930131975, "label": "v", "properties": {}}::vertex
+ {"id": 844424930131982, "label": "v", "properties": {}}::vertex
+ {"id": 844424930131983, "label": "v", "properties": {"a": 0, "i": 0, "j": 5}}::vertex
+ {"id": 844424930131984, "label": "v", "properties": {"i": 1}}::vertex
{"id": 844424930131985, "label": "v", "properties": {}}::vertex
{"id": 844424930131986, "label": "v", "properties": {}}::vertex
{"id": 844424930131987, "label": "v", "properties": {}}::vertex
-(3 rows)
+(8 rows)
SELECT * FROM cypher('cypher_delete', $$MATCH(n) RETURN n$$) AS (a agtype);
a
Best regards, Egor Chindyaskin Postgres Professional: https://postgrespro.com/