[MDEV-14932] Transaction not registered for MariaDB 2PC, but transaction is active Created: 2018-01-12  Updated: 2018-02-16  Resolved: 2018-02-02

Status: Closed
Project: MariaDB Server
Component/s: Partitioning, Versioned Tables
Affects Version/s: 10.3.4
Fix Version/s: 10.3.5

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Aleksey Midenkov
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Problem/Incident
is caused by MDEV-14730 Assertion `m_lock_type == 2' failed i... Closed

 Description   

with Aria

--source include/have_partition.inc
 
CREATE TABLE t1 (i INT) ENGINE=Aria WITH SYSTEM VERSIONING PARTITION BY system_time INTERVAL 1 MONTH (PARTITION p1 HISTORY, PARTITION pn CURRENT);
CREATE TABLE t2 ENGINE=Aria SELECT * FROM INFORMATION_SCHEMA.TABLES;
INSERT INTO t2 SELECT * FROM INFORMATION_SCHEMA.TABLES;
 
# Cleanup
DROP TABLE t1, t2;

bb-10.3-temporal ac95aa888380 ASAN

==25032==ERROR: AddressSanitizer: heap-use-after-free on address 0x611000026680 at pc 0x564d2dcb670c bp 0x7f40e8e7d9f0 sp 0x7f40e8e7d9e8
READ of size 8 at 0x611000026680 thread T5
    #0 0x564d2dcb670b in maria_status /data/src/bb-10.3-temporal/storage/maria/ma_info.c:59
    #1 0x564d2dcf3ebc in ha_maria::info(unsigned int) /data/src/bb-10.3-temporal/storage/maria/ha_maria.cc:2507
    #2 0x564d2e8a53f0 in ha_partition::info(unsigned int) /data/src/bb-10.3-temporal/sql/ha_partition.cc:8172
    #3 0x564d2e87558c in ha_partition::update_create_info(HA_CREATE_INFO*) /data/src/bb-10.3-temporal/sql/ha_partition.cc:2121
    #4 0x564d2d24fb4b in get_schema_tables_record /data/src/bb-10.3-temporal/sql/sql_show.cc:5574
    #5 0x564d2d247c65 in fill_schema_table_by_open /data/src/bb-10.3-temporal/sql/sql_show.cc:4623
    #6 0x564d2d24bd9e in get_all_tables(THD*, TABLE_LIST*, Item*) /data/src/bb-10.3-temporal/sql/sql_show.cc:5299
    #7 0x564d2d27c1a0 in get_schema_tables_result(JOIN*, enum_schema_table_state) /data/src/bb-10.3-temporal/sql/sql_show.cc:8684
    #8 0x564d2d16ffe7 in JOIN::exec_inner() /data/src/bb-10.3-temporal/sql/sql_select.cc:4008
    #9 0x564d2d16e249 in JOIN::exec() /data/src/bb-10.3-temporal/sql/sql_select.cc:3839
    #10 0x564d2d1718b1 in mysql_select(THD*, TABLE_LIST*, unsigned int, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*) /data/src/bb-10.3-temporal/sql/sql_select.cc:4255
    #11 0x564d2d14c446 in handle_select(THD*, LEX*, select_result*, unsigned long) /data/src/bb-10.3-temporal/sql/sql_select.cc:379
    #12 0x564d2d0c1e4e in mysql_execute_command(THD*) /data/src/bb-10.3-temporal/sql/sql_parse.cc:4815
    #13 0x564d2d0d64cb in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /data/src/bb-10.3-temporal/sql/sql_parse.cc:7993
    #14 0x564d2d0b0be2 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /data/src/bb-10.3-temporal/sql/sql_parse.cc:1826
    #15 0x564d2d0adc43 in do_command(THD*) /data/src/bb-10.3-temporal/sql/sql_parse.cc:1370
    #16 0x564d2d423aed in do_handle_one_connection(CONNECT*) /data/src/bb-10.3-temporal/sql/sql_connect.cc:1401
    #17 0x564d2d423502 in handle_one_connection /data/src/bb-10.3-temporal/sql/sql_connect.cc:1307
    #18 0x564d2df61e30 in pfs_spawn_thread /data/src/bb-10.3-temporal/storage/perfschema/pfs.cc:1863
    #19 0x7f40f538f493 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x7493)
    #20 0x7f40f377593e in __clone (/lib/x86_64-linux-gnu/libc.so.6+0xe893e)
 
0x611000026680 is located 128 bytes inside of 244-byte region [0x611000026600,0x6110000266f4)
freed by thread T5 here:
    #0 0x7f40f55f9527 in __interceptor_free (/usr/lib/x86_64-linux-gnu/libasan.so.1+0x54527)
    #1 0x564d2e964a31 in free_memory /data/src/bb-10.3-temporal/mysys/safemalloc.c:279
    #2 0x564d2e964092 in sf_free /data/src/bb-10.3-temporal/mysys/safemalloc.c:197
    #3 0x564d2e932e42 in my_free /data/src/bb-10.3-temporal/mysys/my_malloc.c:215
    #4 0x564d2dcbe214 in _ma_trnman_end_trans_hook /data/src/bb-10.3-temporal/storage/maria/ma_state.c:546
    #5 0x564d2dd00beb in trnman_end_trn /data/src/bb-10.3-temporal/storage/maria/trnman.c:473
    #6 0x564d2dd7932e in ma_commit /data/src/bb-10.3-temporal/storage/maria/ma_commit.c:38
    #7 0x564d2dcf5f47 in ha_maria::external_lock(THD*, int) /data/src/bb-10.3-temporal/storage/maria/ha_maria.cc:2778
    #8 0x564d2d7d5bf5 in handler::ha_external_lock(THD*, int) /data/src/bb-10.3-temporal/sql/handler.cc:6106
    #9 0x564d2da75fcc in unlock_external /data/src/bb-10.3-temporal/sql/lock.cc:729
    #10 0x564d2da733e1 in mysql_unlock_tables(THD*, st_mysql_lock*, bool) /data/src/bb-10.3-temporal/sql/lock.cc:434
    #11 0x564d2da7322d in mysql_unlock_tables(THD*, st_mysql_lock*) /data/src/bb-10.3-temporal/sql/lock.cc:420
    #12 0x564d2d05adb9 in select_create::send_eof() /data/src/bb-10.3-temporal/sql/sql_insert.cc:4630
    #13 0x564d2d1d2ff7 in do_select /data/src/bb-10.3-temporal/sql/sql_select.cc:18831
    #14 0x564d2d170755 in JOIN::exec_inner() /data/src/bb-10.3-temporal/sql/sql_select.cc:4056
    #15 0x564d2d16e249 in JOIN::exec() /data/src/bb-10.3-temporal/sql/sql_select.cc:3839
    #16 0x564d2d1718b1 in mysql_select(THD*, TABLE_LIST*, unsigned int, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*) /data/src/bb-10.3-temporal/sql/sql_select.cc:4255
    #17 0x564d2d14c446 in handle_select(THD*, LEX*, select_result*, unsigned long) /data/src/bb-10.3-temporal/sql/sql_select.cc:379
    #18 0x564d2d0be28f in mysql_execute_command(THD*) /data/src/bb-10.3-temporal/sql/sql_parse.cc:4221
    #19 0x564d2d0d64cb in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /data/src/bb-10.3-temporal/sql/sql_parse.cc:7993
    #20 0x564d2d0b0be2 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /data/src/bb-10.3-temporal/sql/sql_parse.cc:1826
    #21 0x564d2d0adc43 in do_command(THD*) /data/src/bb-10.3-temporal/sql/sql_parse.cc:1370
    #22 0x564d2d423aed in do_handle_one_connection(CONNECT*) /data/src/bb-10.3-temporal/sql/sql_connect.cc:1401
    #23 0x564d2d423502 in handle_one_connection /data/src/bb-10.3-temporal/sql/sql_connect.cc:1307
    #24 0x564d2df61e30 in pfs_spawn_thread /data/src/bb-10.3-temporal/storage/perfschema/pfs.cc:1863
    #25 0x7f40f538f493 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x7493)
 
previously allocated by thread T5 here:
    #0 0x7f40f55f973f in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.1+0x5473f)
    #1 0x564d2e963834 in sf_malloc /data/src/bb-10.3-temporal/mysys/safemalloc.c:118
    #2 0x564d2e932535 in my_malloc /data/src/bb-10.3-temporal/mysys/my_malloc.c:101
    #3 0x564d2dcbb2ab in _ma_setup_live_state /data/src/bb-10.3-temporal/storage/maria/ma_state.c:80
    #4 0x564d2dcf6cc1 in ha_maria::implicit_commit(THD*, bool) /data/src/bb-10.3-temporal/storage/maria/ha_maria.cc:2965
    #5 0x564d2d7b3c53 in ha_commit_trans(THD*, bool) /data/src/bb-10.3-temporal/sql/handler.cc:1358
    #6 0x564d2d3e45a4 in Table_locker::~Table_locker() (/data/bld/bb-10.3-temporal-asan/bin/mysqld+0x11095a4)
    #7 0x564d2d3e53c1 in partition_info::vers_scan_min_max(THD*, partition_element*) (/data/bld/bb-10.3-temporal-asan/bin/mysqld+0x110a3c1)
    #8 0x564d2d3cfaca in partition_info::vers_setup_stats(THD*, bool) /data/src/bb-10.3-temporal/sql/partition_info.cc:1291
    #9 0x564d2d362db2 in open_table_from_share(THD*, TABLE_SHARE*, char const*, unsigned int, unsigned int, unsigned int, TABLE*, bool) /data/src/bb-10.3-temporal/sql/table.cc:3521
    #10 0x564d2cf7cdbb in open_table(THD*, TABLE_LIST*, Open_table_context*) /data/src/bb-10.3-temporal/sql/sql_base.cc:1907
    #11 0x564d2cf83edb in open_and_process_table /data/src/bb-10.3-temporal/sql/sql_base.cc:3467
    #12 0x564d2cf86837 in open_tables(THD*, DDL_options_st const&, TABLE_LIST**, unsigned int*, unsigned int, Prelocking_strategy*) /data/src/bb-10.3-temporal/sql/sql_base.cc:3987
    #13 0x564d2cf747da in open_tables /data/src/bb-10.3-temporal/sql/sql_base.h:238
    #14 0x564d2cf8b827 in open_normal_and_derived_tables(THD*, TABLE_LIST*, unsigned int, unsigned int) /data/src/bb-10.3-temporal/sql/sql_base.cc:4930
    #15 0x564d2cf8bca9 in open_tables_only_view_structure(THD*, TABLE_LIST*, bool) /data/src/bb-10.3-temporal/sql/sql_base.cc:4987
    #16 0x564d2d247ac9 in fill_schema_table_by_open /data/src/bb-10.3-temporal/sql/sql_show.cc:4585
    #17 0x564d2d24bd9e in get_all_tables(THD*, TABLE_LIST*, Item*) /data/src/bb-10.3-temporal/sql/sql_show.cc:5299
    #18 0x564d2d27c1a0 in get_schema_tables_result(JOIN*, enum_schema_table_state) /data/src/bb-10.3-temporal/sql/sql_show.cc:8684
    #19 0x564d2d16ffe7 in JOIN::exec_inner() /data/src/bb-10.3-temporal/sql/sql_select.cc:4008
    #20 0x564d2d16e249 in JOIN::exec() /data/src/bb-10.3-temporal/sql/sql_select.cc:3839
    #21 0x564d2d1718b1 in mysql_select(THD*, TABLE_LIST*, unsigned int, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*) /data/src/bb-10.3-temporal/sql/sql_select.cc:4255
    #22 0x564d2d14c446 in handle_select(THD*, LEX*, select_result*, unsigned long) /data/src/bb-10.3-temporal/sql/sql_select.cc:379
    #23 0x564d2d0be28f in mysql_execute_command(THD*) /data/src/bb-10.3-temporal/sql/sql_parse.cc:4221
    #24 0x564d2d0d64cb in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /data/src/bb-10.3-temporal/sql/sql_parse.cc:7993
    #25 0x564d2d0b0be2 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /data/src/bb-10.3-temporal/sql/sql_parse.cc:1826
    #26 0x564d2d0adc43 in do_command(THD*) /data/src/bb-10.3-temporal/sql/sql_parse.cc:1370
    #27 0x564d2d423aed in do_handle_one_connection(CONNECT*) /data/src/bb-10.3-temporal/sql/sql_connect.cc:1401
    #28 0x564d2d423502 in handle_one_connection /data/src/bb-10.3-temporal/sql/sql_connect.cc:1307
    #29 0x564d2df61e30 in pfs_spawn_thread /data/src/bb-10.3-temporal/storage/perfschema/pfs.cc:1863
 
Thread T5 created by T0 here:
    #0 0x7f40f55c8bba in pthread_create (/usr/lib/x86_64-linux-gnu/libasan.so.1+0x23bba)
    #1 0x564d2df623f8 in spawn_thread_v1 /data/src/bb-10.3-temporal/storage/perfschema/pfs.cc:1913
    #2 0x564d2ce788ff in inline_mysql_thread_create /data/src/bb-10.3-temporal/include/mysql/psi/mysql_thread.h:1268
    #3 0x564d2ce8e64e in create_thread_to_handle_connection(CONNECT*) /data/src/bb-10.3-temporal/sql/mysqld.cc:6549
    #4 0x564d2ce8ed53 in create_new_thread /data/src/bb-10.3-temporal/sql/mysqld.cc:6619
    #6 0x564d2ce8dadf in mysqld_main(int, char**) /data/src/bb-10.3-temporal/sql/mysqld.cc:6169
    #7 0x564d2ce76e2f in main /data/src/bb-10.3-temporal/sql/main.cc:25
    #8 0x7f40f36ad2b0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202b0)
 
SUMMARY: AddressSanitizer: heap-use-after-free /data/src/bb-10.3-temporal/storage/maria/ma_info.c:59 maria_status
Shadow bytes around the buggy address:
  0x0c227fffcc80: fd fd fd fd fd fd fd fd fd fd fd fd fd fa fa fa
  0x0c227fffcc90: fa fa fa fa fa fa fa fa fd fd fd fd fd fd fd fd
  0x0c227fffcca0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c227fffccb0: fd fd fd fd fd fd fd fa fa fa fa fa fa fa fa fa
  0x0c227fffccc0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
=>0x0c227fffccd0:[fd]fd fd fd fd fd fd fd fd fd fd fd fd fd fd fa
  0x0c227fffcce0: fa fa fa fa fa fa fa fa fd fd fd fd fd fd fd fd
  0x0c227fffccf0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c227fffcd00: fd fd fd fd fd fd fd fa fa fa fa fa fa fa fa fa
  0x0c227fffcd10: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c227fffcd20: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fa
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07 
  Heap left redzone:       fa
  Heap right redzone:      fb
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack partial redzone:   f4
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Contiguous container OOB:fc
  ASan internal:           fe
==25032==ABORTING

with InnoDB

--source include/have_innodb.inc
--source include/have_partition.inc
 
CREATE OR REPLACE TABLE t1 (i INT) ENGINE=InnoDB WITH SYSTEM VERSIONING PARTITION BY system_time INTERVAL 1 MONTH (PARTITION p1 HISTORY, PARTITION pn CURRENT);
CREATE OR REPLACE TABLE t2 ENGINE=InnoDB SELECT * FROM INFORMATION_SCHEMA.TABLES;
INSERT INTO t2 SELECT * FROM INFORMATION_SCHEMA.TABLES;
 
# Cleanup
DROP TABLE t1, t2;

2018-01-12  3:59:42 9 [ERROR] Transaction not registered for MariaDB 2PC, but transaction is active



 Comments   
Comment by Eugene Kosov (Inactive) [ 2018-01-16 ]

Innodb, watch 'trx->is_registered':

bbt sql_print_error
watch -l *(bool *) 0x7fffeba2bab9
commands
bt
end

Old value = <unreadable>
New value = true
trx_register_for_2pc (trx=0x7fffeba2b8e8) at ha_innodb.cc:2869
2869            ut_ad(trx->active_commit_ordered == 0);
#0  trx_register_for_2pc (trx=0x7fffeba2b8e8) at ha_innodb.cc:2869
#1  innobase_register_trx (hton=0x6160000087f0, thd=0x62a0000ba270, trx=0x7fffeba2b8e8) at ha_innodb.cc:3096
#2  ha_innobase::external_lock (this=0x61d000219908, thd=0x62a0000ba270, lock_type=1) at ha_innodb.cc:16128
#3  handler::ha_external_lock (this=0x61d000219908, thd=0x62a0000ba270, lock_type=1) at handler.cc:6106
#4  lock_external (thd=0x62a0000ba270, tables=0x629000152a70, count=1) at lock.cc:396
#5  mysql_lock_tables (thd=0x62a0000ba270, sql_lock=0x629000152a50, flags=0) at lock.cc:341
#6  mysql_lock_tables (thd=0x62a0000ba270, tables=0x7fffdeb9f770, count=1, flags=0) at lock.cc:304
#7  select_create::create_table_from_items (this=0x62b000002c18, thd=0x62a0000ba270, items=0x7fffdeb9ff20, lock=0x7fffdeb9ff60, hooks=0x7fffdeb9ffc0) at sql_insert.cc:4298
#8  select_create::prepare (this=0x62b000002c18, _values=List<Item> with 21 elements, u=0x62a0000be000) at sql_insert.cc:4405
#9  JOIN::prepare (this=0x62b000002d10, tables_init=0x62b000000b68, wild_num=1, conds_init=0x0, og_num=0, order_init=0x0, skip_order_by=false, group_init=0x0, having_init=0x0, proc_param_init=0x0, select_lex_arg=0x62a0000be758, unit_arg=0x62a0000be000) at sql_select.cc:1439
#10 mysql_select (thd=0x62a0000ba270, tables=0x62b000000b68, wild_num=1, fields=List<Item> with 21 elements, conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2953054976, result=0x62b000002c18, unit=0x62a0000be000, select_lex=0x62a0000be758) at sql_select.cc:4228
#11 handle_select (thd=0x62a0000ba270, lex=0x62a0000bdf38, result=0x62b000002c18, setup_tables_done_option=0) at sql_select.cc:367
#12 mysql_execute_command (thd=0x62a0000ba270) at sql_parse.cc:4221
#13 mysql_parse (thd=0x62a0000ba270, rawbuf=0x62b000000288 "create table t2 engine=innodb select * from information_schema.tables", length=69, parser_state=0x7fffdeba89e0, is_com_multi=false, is_next_command=false) at sql_parse.cc:7993
#14 dispatch_command (command=COM_QUERY, thd=0x62a0000ba270, packet=0x62900012c271 "create table t2 engine=innodb select * from information_schema.tables", packet_length=69, is_com_multi=false, is_next_command=false) at sql_parse.cc:1825
 
Old value = true
New value = false
trx_deregister_from_2pc (trx=0x7fffeba2b8e8) at ha_innodb.cc:2881
2881            trx->active_commit_ordered = 0;
#0  trx_deregister_from_2pc (trx=0x7fffeba2b8e8) at ha_innodb.cc:2881
#1  innobase_commit (hton=0x6160000087f0, thd=0x62a0000ba270, commit_trx=false) at ha_innodb.cc:4612
#2  commit_one_phase_2 (thd=0x62a0000ba270, all=false, trans=0x62a0000bd6c8, is_real_trans=true) at handler.cc:1610
#3  ha_commit_one_phase (thd=0x62a0000ba270, all=false) at handler.cc:1590
#4  ha_commit_trans (thd=0x62a0000ba270, all=false) at handler.cc:1454
#5  Table_locker::~Table_locker (this=0x7fffdeb991e0) at partition_info.cc:1086
#6  partition_info::vers_scan_min_max (this=0x61d000226b08, thd=0x62a0000ba270, part=0x61d000226d40) at partition_info.cc:1175
#7  partition_info::vers_setup_stats (this=0x61d000226b08, thd=0x62a0000ba270, is_create_table_ind=false) at partition_info.cc:1291
#8  open_table_from_share (thd=0x62a0000ba270, share=0x61c000050108, alias=0x62d0002264d0 "t1", db_stat=33, prgflag=8, ha_open_flags=18, outparam=0x61f000056af0, is_create_table=false) at table.cc:3521
#9  open_table (thd=0x62a0000ba270, table_list=0x62d0002264d8, ot_ctx=0x7fffdeb9d3e0) at sql_base.cc:1904
#10 open_and_process_table (thd=0x62a0000ba270, lex=0x7fffdeb9e100, tables=0x62d0002264d8, counter=0x7fffdeb9dca0, flags=1346, prelocking_strategy=0x7fffdeb9dc80, has_prelocking_list=false, ot_ctx=0x7fffdeb9d3e0) at sql_base.cc:3467
#11 open_tables (thd=0x62a0000ba270, options=..., start=0x7fffdeb9dc60, counter=0x7fffdeb9dca0, flags=1346, prelocking_strategy=0x7fffdeb9dc80) at sql_base.cc:3985
#12 open_tables (thd=0x62a0000ba270, tables=0x7fffdeb9dc60, counter=0x7fffdeb9dca0, flags=1346, prelocking_strategy=0x7fffdeb9dc80) at sql_base.h:237
#13 open_normal_and_derived_tables (thd=0x62a0000ba270, tables=0x62d0002264d8, flags=1346, dt_phases=35) at sql_base.cc:4930
#14 open_tables_only_view_structure (thd=0x62a0000ba270, table_list=0x62d0002264d8, can_deadlock=true) at sql_base.cc:4981
#15 fill_schema_table_by_open (thd=0x62a0000ba270, mem_root=0x7fffdeba0570, is_show_fields_or_keys=false, table=0x625000159188, schema_table=0x3bfbe20 <schema_tables+1920>, orig_db_name=0x62900015a7f8, orig_table_name=0x62900015a868, open_tables_state_backup=0x7fffdeba04b0, can_deadlock=true) at sql_show.cc:4585
#16 get_all_tables (thd=0x62a0000ba270, tables=0x62b000000b68, cond=0x0) at sql_show.cc:5299
#17 get_schema_tables_result (join=0x62b000002d10, executed_place=PROCESSED_BY_JOIN_EXEC) at sql_show.cc:8684
#18 JOIN::exec_inner (this=0x62b000002d10) at sql_select.cc:4003
#19 JOIN::exec (this=0x62b000002d10) at sql_select.cc:3834
#20 mysql_select (thd=0x62a0000ba270, tables=0x62b000000b68, wild_num=1, fields=List<Item> with 21 elements, conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2953054976, result=0x62b000002c18, unit=0x62a0000be000, select_lex=0x62a0000be758) at sql_select.cc:4250
#21 handle_select (thd=0x62a0000ba270, lex=0x62a0000bdf38, result=0x62b000002c18, setup_tables_done_option=0) at sql_select.cc:367
#22 mysql_execute_command (thd=0x62a0000ba270) at sql_parse.cc:4221
#23 mysql_parse (thd=0x62a0000ba270, rawbuf=0x62b000000288 "create table t2 engine=innodb select * from information_schema.tables", length=69, parser_state=0x7fffdeba89e0, is_com_multi=false, is_next_command=false) at sql_parse.cc:7993
 
#0  sql_print_error (format=0x7fffeba2b8e8 "") at log.cc:8760
#1  innobase_commit (hton=0x6160000087f0, thd=0x62a0000ba270, commit_trx=true) at ha_innodb.cc:4582
#2  ha_innobase::external_lock (this=0x61d000219908, thd=0x62a0000ba270, lock_type=2) at ha_innodb.cc:16219
#3  handler::ha_external_lock (this=0x61d000219908, thd=0x62a0000ba270, lock_type=2) at handler.cc:6106
#4  unlock_external (thd=0x62a0000ba270, table=0x629000152a70, count=1) at lock.cc:729
#5  mysql_unlock_tables (thd=0x62a0000ba270, sql_lock=0x629000152a50, free_lock=false) at lock.cc:434
#6  mysql_unlock_tables (thd=0x62a0000ba270, sql_lock=0x629000152a50) at lock.cc:418
#7  select_create::send_eof (this=0x62b000002c18) at sql_insert.cc:4630
#8  do_select (join=0x62b000002d10, procedure=0x0) at sql_select.cc:18826
#9  JOIN::exec_inner (this=0x62b000002d10) at sql_select.cc:4051
#10 JOIN::exec (this=0x62b000002d10) at sql_select.cc:3834
#11 mysql_select (thd=0x62a0000ba270, tables=0x62b000000b68, wild_num=1, fields=List<Item> with 21 elements, conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2953054976, result=0x62b000002c18, unit=0x62a0000be000, select_lex=0x62a0000be758) at sql_select.cc:4250
#12 handle_select (thd=0x62a0000ba270, lex=0x62a0000bdf38, result=0x62b000002c18, setup_tables_done_option=0) at sql_select.cc:367
#13 mysql_execute_command (thd=0x62a0000ba270) at sql_parse.cc:4221
#14 mysql_parse (thd=0x62a0000ba270, rawbuf=0x62b000000288 "create table t2 engine=innodb select * from information_schema.tables", length=69, parser_state=0x7fffdeba89e0, is_com_multi=false, is_next_command=false) at sql_parse.cc:7993

bool open_tables_only_view_structure(THD *thd, TABLE_LIST *table_list,
                                     bool can_deadlock)
{
  DBUG_ENTER("open_tables_only_view_structure");
  /*
    Let us set fake sql_command so views won't try to merge
    themselves into main statement. If we don't do this,
    SELECT * from information_schema.xxxx will cause problems.
    SQLCOM_SHOW_FIELDS is used because it satisfies
    'LEX::only_view_structure()'.
  */
  enum_sql_command save_sql_command= thd->lex->sql_command;
  thd->lex->sql_command= SQLCOM_SHOW_FIELDS;

Comment by Aleksey Midenkov [ 2018-02-02 ]

Analysis

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