Open timothy-e opened 4 months ago
Repro inspired from src/postgres/src/test/regress/sql/yb_join_batching.sql
.
CREATE TABLE p1 (a int, b int, c varchar, primary key(a,b));
INSERT INTO p1 SELECT i, i % 25, to_char(i, 'FM0000') FROM generate_series(0, 599) i WHERE i % 2 = 0;
CREATE INDEX p1_b_idx ON p1 (b ASC);
ANALYZE p1;
CREATE TABLE p2 (a int, b int, c varchar, primary key(a,b));
INSERT INTO p2 SELECT i, i % 25, to_char(i, 'FM0000') FROM generate_series(0, 599) i WHERE i % 3 = 0;
ANALYZE p2;
/*+ Leading((p2 p1)) */ SELECT * FROM p1 JOIN p2 ON p1.a = p2.b AND p2.a = p1.b AND p1.a = p2.a;
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
The connection to the server was lost. Attempting reset: Succeeded.
coredump bt:
#0 0x00007ffa286f9acf in raise () from /lib64/libc.so.6
#1 0x00007ffa286ccea5 in abort () from /lib64/libc.so.6
#2 0x0000000000a67a1d in ExceptionalCondition (
conditionName=conditionName@entry=0xce5cd8 "!(!bms_is_empty(unbatchablerelids) || bms_equal(pclause_batched_inner_attnos, batched_inner_attnos))",
errorType=errorType@entry=0xb75880 "FailedAssertion", fileName=fileName@entry=0xce5b68 "../../../../../../../src/postgres/src/backend/optimizer/path/indxpath.c",
lineNumber=lineNumber@entry=782) at ../../../../../../../src/postgres/src/backend/utils/error/assert.c:54
#3 0x0000000000802db0 in yb_get_batched_index_paths (bitindexpaths=0x7fff807b72c0, clauses=0x7fff807b6d30, index=0x17af7f0c4360, rel=0x17af7fde5dd0, root=0x17af7f0c09e0)
at ../../../../../../../src/postgres/src/backend/optimizer/path/indxpath.c:782
#4 get_join_index_paths (root=root@entry=0x17af7f0c09e0, rel=rel@entry=0x17af7fde5dd0, index=index@entry=0x17af7f0c4360, rclauseset=rclauseset@entry=0x7fff807b71b0,
jclauseset=jclauseset@entry=0x7fff807b70a0, eclauseset=eclauseset@entry=0x7fff807b6f90, bitindexpaths=0x7fff807b72c0, relids=<optimized out>, considered_relids=0x7fff807b6f80)
at ../../../../../../../src/postgres/src/backend/optimizer/path/indxpath.c:942
#5 0x0000000000802fe7 in consider_index_join_outer_rels (root=root@entry=0x17af7f0c09e0, rel=rel@entry=0x17af7fde5dd0, index=index@entry=0x17af7f0c4360,
rclauseset=rclauseset@entry=0x7fff807b71b0, jclauseset=jclauseset@entry=0x7fff807b70a0, eclauseset=eclauseset@entry=0x7fff807b6f90, bitindexpaths=0x7fff807b72c0,
indexjoinclauses=0x17af7e427a40, considered_clauses=2, considered_relids=0x7fff807b6f80) at ../../../../../../../src/postgres/src/backend/optimizer/path/indxpath.c:620
#6 0x00000000008036af in consider_index_join_clauses (bitindexpaths=0x7fff807b72c0, eclauseset=0x7fff807b6f90, jclauseset=0x7fff807b70a0, rclauseset=0x7fff807b71b0,
index=0x17af7f0c4360, rel=0x17af7fde5dd0, root=0x17af7f0c09e0) at ../../../../../../../src/postgres/src/backend/optimizer/path/indxpath.c:519
#7 create_index_paths (root=root@entry=0x17af7f0c09e0, rel=rel@entry=0x17af7fde5dd0) at ../../../../../../../src/postgres/src/backend/optimizer/path/indxpath.c:316
#8 0x00000000007f1fd1 in set_plain_rel_pathlist (rte=0x17af7f10ed28, rel=0x17af7fde5dd0, root=0x17af7f0c09e0)
at ../../../../../../../src/postgres/src/backend/optimizer/path/allpaths.c:811
#9 set_rel_pathlist (root=root@entry=0x17af7f0c09e0, rel=0x17af7fde5dd0, rti=rti@entry=1, rte=0x17af7f10ed28)
at ../../../../../../../src/postgres/src/backend/optimizer/path/allpaths.c:529
#10 0x00000000007f2990 in set_base_rel_pathlists (root=<optimized out>) at ../../../../../../../src/postgres/src/backend/optimizer/path/allpaths.c:361
#11 make_one_rel (root=root@entry=0x17af7f0c09e0, joinlist=joinlist@entry=0x17af7f0c3b18) at ../../../../../../../src/postgres/src/backend/optimizer/path/allpaths.c:231
#12 0x000000000081c201 in query_planner (root=root@entry=0x17af7f0c09e0, tlist=tlist@entry=0x17af7f0c2468, qp_callback=qp_callback@entry=0x81d6da <standard_qp_callback>,
qp_extra=qp_extra@entry=0x7fff807b74c0) at ../../../../../../../src/postgres/src/backend/optimizer/plan/planmain.c:265
#13 0x0000000000820bd9 in grouping_planner (root=root@entry=0x17af7f0c09e0, inheritance_update=inheritance_update@entry=false, tuple_fraction=<optimized out>,
tuple_fraction@entry=0) at ../../../../../../../src/postgres/src/backend/optimizer/plan/planner.c:2096
#14 0x0000000000824203 in subquery_planner (glob=glob@entry=0x17af7f0c1db0, parse=parse@entry=0x17af7f10ec10, parent_root=parent_root@entry=0x0,
hasRecursion=hasRecursion@entry=false, tuple_fraction=tuple_fraction@entry=0) at ../../../../../../../src/postgres/src/backend/optimizer/plan/planner.c:981
#15 0x000000000082539a in standard_planner (parse=parse@entry=0x17af7f10ec10, cursorOptions=cursorOptions@entry=256, boundParams=boundParams@entry=0x0)
at ../../../../../../../src/postgres/src/backend/optimizer/plan/planner.c:410
#16 0x00007ffa16c93c80 in pg_hint_plan_planner (parse=0x17af7f10ec10, cursorOptions=256, boundParams=0x0)
at ../../../../../src/postgres/third-party-extensions/pg_hint_plan/pg_hint_plan.c:3186
#17 0x0000000000825a09 in planner (parse=parse@entry=0x17af7f10ec10, cursorOptions=cursorOptions@entry=256, boundParams=boundParams@entry=0x0)
at ../../../../../../../src/postgres/src/backend/optimizer/plan/planner.c:266
#18 0x0000000000915684 in pg_plan_query (querytree=querytree@entry=0x17af7f10ec10, cursorOptions=cursorOptions@entry=256, boundParams=boundParams@entry=0x0)
at ../../../../../../src/postgres/src/backend/tcop/postgres.c:912
#19 0x00000000009157fb in pg_plan_queries (querytrees=<optimized out>, cursorOptions=cursorOptions@entry=256, boundParams=boundParams@entry=0x0)
at ../../../../../../src/postgres/src/backend/tcop/postgres.c:978
#20 0x0000000000916810 in exec_simple_query (query_string=0x17af7fde4120 "/*+ Leading((p2 p1)) */ SELECT * FROM p1 JOIN p2 ON p1.a = p2.b AND p2.a = p1.b AND p1.a = p2.a;")
at ../../../../../../src/postgres/src/backend/tcop/postgres.c:1156
#21 yb_exec_simple_query_impl (query_string=query_string@entry=0x17af7fde4120) at ../../../../../../src/postgres/src/backend/tcop/postgres.c:4900
#22 0x000000000091470c in yb_exec_query_wrapper_one_attempt (exec_context=exec_context@entry=0x17af7fde4000, retry_data=retry_data@entry=0x7fff807b7c00,
functor=functor@entry=0x916327 <yb_exec_simple_query_impl>, functor_context=functor_context@entry=0x17af7fde4120, attempt=attempt@entry=0, retry=retry@entry=0x7fff807b7bbf)
at ../../../../../../src/postgres/src/backend/tcop/postgres.c:4868
#23 0x0000000000915397 in yb_exec_query_wrapper (exec_context=exec_context@entry=0x17af7fde4000, retry_data=retry_data@entry=0x7fff807b7c00,
functor=functor@entry=0x916327 <yb_exec_simple_query_impl>, functor_context=functor_context@entry=0x17af7fde4120)
at ../../../../../../src/postgres/src/backend/tcop/postgres.c:4892
#24 0x00000000009153eb in yb_exec_simple_query (
query_string=query_string@entry=0x17af7fde4120 "/*+ Leading((p2 p1)) */ SELECT * FROM p1 JOIN p2 ON p1.a = p2.b AND p2.a = p1.b AND p1.a = p2.a;",
exec_context=exec_context@entry=0x17af7fde4000) at ../../../../../../src/postgres/src/backend/tcop/postgres.c:4915
#25 0x0000000000917f6e in PostgresMain (argc=<optimized out>, argv=argv@entry=0x17af7fde1528, dbname=<optimized out>, username=<optimized out>)
at ../../../../../../src/postgres/src/backend/tcop/postgres.c:5590
#26 0x000000000087130c in BackendRun (port=0x17af7f84a960) at ../../../../../../src/postgres/src/backend/postmaster/postmaster.c:4746
#27 BackendStartup (port=0x17af7f84a960) at ../../../../../../src/postgres/src/backend/postmaster/postmaster.c:4405
#28 ServerLoop () at ../../../../../../src/postgres/src/backend/postmaster/postmaster.c:1783
#29 0x00000000008736bb in PostmasterMain (argc=argc@entry=25, argv=argv@entry=0x17af7fdde1a0) at ../../../../../../src/postgres/src/backend/postmaster/postmaster.c:1439
#30 0x00000000007b69d6 in PostgresServerProcessMain (argc=25, argv=0x17af7fdde1a0) at ../../../../../../src/postgres/src/backend/main/main.c:234
#31 0x00000000007b69f6 in main ()
Tested on pg15 b6a814b45d954c0f770ac0b7c3eaba5230e3c326, master 2a5d90ab954bc86e0e54b1d407d9a44c39746054, fastdebug gcc11 almalinux 8.
Jira Link: DB-11819
Description
causes a crash:
dump-test.txt
Issue Type
kind/bug
Warning: Please confirm that this issue does not contain any sensitive information