[MDEV-22878] galera.wsrep_strict_ddl hangs in 10.5 after merge Created: 2020-06-12  Updated: 2020-06-16  Resolved: 2020-06-12

Status: Closed
Project: MariaDB Server
Component/s: Galera, Optimizer, Tests
Affects Version/s: None
Fix Version/s: 10.5.4

Type: Bug Priority: Blocker
Reporter: Sergei Golubchik Assignee: Sergei Golubchik
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-20051 Add new mode to wsrep_OSU_method in w... Closed
relates to MDEV-22835 galera.wsrep_strict_ddl MTR failed: c... Closed

 Description   

after

commit e9dbbf11204
Author: Igor Babaev <igor@mariadb.com>
Date:   Sat Jun 6 11:38:38 2020 -0700
 
    MDEV-22748 MariaDB crash on WITH RECURSIVE large query

was merged into 10.5, galera.wsrep_strict_ddl started to fail, it times out because the test hangs on the line

CREATE VIEW x1 AS SELECT * FROM before_t1;

The first server gets stuck in this loop:

bool st_select_lex::cleanup()
{
  ...
  for (TABLE_LIST *tbl= get_table_list(); tbl; tbl= tbl->next_local)
  {

and tbl == tbl->next_local, so it loops there forever.

Nothing fails in 10.4, so presumably the fix was incorrectly merged into 10.5



 Comments   
Comment by Marko Mäkelä [ 2020-06-12 ]

The parameter wsrep_strict_ddl was introduced in MDEV-20051 (10.5.1).

Comment by Elena Stepanova [ 2020-06-12 ]

Essential part of the test case:

--source include/galera_cluster.inc
 
create table t1(a int) engine=MyISAM;
 
set @@global.wsrep_strict_ddl=ON;
 
--error ER_GALERA_REPLICATION_NOT_SUPPORTED
CREATE VIEW x1 AS SELECT * FROM t1;

Also reproducible with Aria.

The test case needs to be put into suite/galera/t/ folder and run as

WSREP_PROVIDER=<path to Galera-4 library> perl ./mtr galera.<testcase name>

Galera library can be found here: http://yum.mariadb.org/galera4/repo4/

Comment by Julius Goryavsky [ 2020-06-12 ]

I suspect that IF this is an operator execution problem (but not Galera problem), then the fact is that the bool st_select_lex_unit::cleanup() function calls "free_tmp_table(thd, table)":

    if (union_result)
    {
      delete union_result;
      union_result=0; // Safety
      if (table)
        free_tmp_table(thd, table);
      table= 0; // Safety
    }

and this destroys tmp->next_local which is used in the loop.

Comment by Seppo Jaakola [ 2020-06-12 ]

stack trace of hanging CREATE VIEW execution:

(gdb) bt
#0 0x000055e82deb112f in TABLE_LIST::is_recursive_with_table (this=0x7f0cc4012b50)
at /home/seppo/work/wsrep/mariadb-server/sql/sql_cte.cc:1186
#1 0x000055e82dd61138 in st_select_lex::cleanup (this=0x7f0cc4013228)
at /home/seppo/work/wsrep/mariadb-server/sql/sql_union.cc:2717
#2 0x000055e82dd609c2 in st_select_lex_unit::cleanup (this=0x7f0cc4004d90)
at /home/seppo/work/wsrep/mariadb-server/sql/sql_union.cc:2559
#3 0x000055e82dd6f51f in mysql_create_view (thd=0x7f0cc4000d78, views=0x7f0cc4012b50, mode=VIEW_CREATE_NEW)
at /home/seppo/work/wsrep/mariadb-server/sql/sql_view.cc:730
#4 0x000055e82dc49659 in mysql_execute_command (thd=0x7f0cc4000d78)
at /home/seppo/work/wsrep/mariadb-server/sql/sql_parse.cc:5758
#5 0x000055e82dc50473 in mysql_parse (thd=0x7f0cc4000d78,
rawbuf=0x7f0cc4012a30 "CREATE VIEW x1 AS SELECT * FROM before_t1", length=41, parser_state=0x7f0cf7fb3510,
is_com_multi=false, is_next_command=false) at /home/seppo/work/wsrep/mariadb-server/sql/sql_parse.cc:7992
#6 0x000055e82dc4fb82 in wsrep_mysql_parse (thd=0x7f0cc4000d78,
rawbuf=0x7f0cc4012a30 "CREATE VIEW x1 AS SELECT * FROM before_t1", length=41, parser_state=0x7f0cf7fb3510,
is_com_multi=false, is_next_command=false) at /home/seppo/work/wsrep/mariadb-server/sql/sql_parse.cc:7795
#7 0x000055e82dc3c704 in dispatch_command (command=COM_QUERY, thd=0x7f0cc4000d78,
packet=0x7f0cc4008f59 "CREATE VIEW x1 AS SELECT * FROM before_t1", packet_length=41, is_com_multi=false,
is_next_command=false) at /home/seppo/work/wsrep/mariadb-server/sql/sql_parse.cc:1860
#8 0x000055e82dc3af37 in do_command (thd=0x7f0cc4000d78) at /home/seppo/work/wsrep/mariadb-server/sql/sql_parse.cc:1355
#9 0x000055e82dddf513 in do_handle_one_connection (connect=0x55e831d5b3f8, put_in_cache=true)
at /home/seppo/work/wsrep/mariadb-server/sql/sql_connect.cc:1411

... and there table_list has cycle:

(gdb) p tbl
$4 = (TABLE_LIST *) 0x7f1d1c00ce20
(gdb) p tbl->next_local
$5 = (TABLE_LIST *) 0x7f1d1c00ce20

Generated at Thu Feb 08 09:18:09 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.