2022-11-18 mysql列存储引擎-assert failed on i < m_idx.size() at rc_attr.h:342-问题分析

时间:2022-11-19 10:02:38


摘要:

mysql列存储引擎-assert failed on i < m_idx.size() at rc_attr.h:342-问题分析

关联ISSUE: ​​https://github.com/stoneatom/stonedb/issues/964​

DDL:

CREATE TABLE `t1` (
`id` int(11) DEFAULT NULL,
`name` varchar(20) DEFAULT NULL,
KEY `idx_n` (`name`)
) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
CREATE TABLE `t2` (
`id` int(11) DEFAULT NULL,
`name` varchar(20) DEFAULT NULL,
KEY `idx_n` (`name`)
)DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;

insert into t1 values(1,'abc');
insert into t1 values(2,'def');
select t1.id,t1.name,t2.id,t2.name from t1 left join t2 on t1.name=t2.name where t1.name in ('abc');

过程记录:

异常堆栈:

(gdb) bt
#0 0x0000000002d04c16 in Tianmu::core::RCAttr::get_dpn (this=0x7f65b08faa00, i=0) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-30-119/storage/tianmu/core/rc_attr.h:343
#1 0x0000000002ff3def in Tianmu::core::RCAttr::LockPackForUse (this=0x7f65b08faa00, pn=0) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-30-119/storage/tianmu/core/rc_attr.cpp:760
#2 0x0000000002cda9a8 in Tianmu::core::RCTable::LockPackForUse (this=0x7f65b08fa0a0, attr=0, pack_no=0) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-30-119/storage/tianmu/core/rc_table.cpp:208
#3 0x0000000002fcb805 in Tianmu::core::VCPackGuardian::LockPackrow (this=0x7f65b0902d28, mit=...) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-30-119/storage/tianmu/core/pack_guardian.cpp:77
#4 0x0000000002caf1f2 in Tianmu::vcolumn::VirtualColumn::LockSourcePacks (this=0x7f65b0902c50, mit=...) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-30-119/storage/tianmu/vc/virtual_column.h:45
#5 0x0000000002d4600b in Tianmu::core::TempTable::SendResult (this=0x7f65b08fbbf0, limit=1, offset=0, sender=..., pagewise=false)
at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-30-119/storage/tianmu/core/temp_table_low.cpp:458
#6 0x0000000002d452bf in Tianmu::core::TempTable::FillMaterializedBuffers (this=0x7f65b08fbbf0, local_limit=1, local_offset=0, sender=0x7f65b08f9fe0, pagewise=false)
at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-30-119/storage/tianmu/core/temp_table_low.cpp:315
#7 0x0000000002d2f26b in Tianmu::core::TempTable::Materialize (this=0x7f65b08fbbf0, in_subq=false, sender=0x7f65b08f9fe0, lazy=false)
at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-30-119/storage/tianmu/core/temp_table.cpp:2033
#8 0x0000000002c76fa3 in Tianmu::core::Engine::Execute (this=0x59353a0, thd=0x7f65b00031d0, lex=0x7f65b00054f8, result_output=0x7f65b0012488, unit_for_union=0x0)
at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-30-119/storage/tianmu/core/engine_execute.cpp:482
#9 0x0000000002c75d16 in Tianmu::core::Engine::HandleSelect (this=0x59353a0, thd=0x7f65b00031d0, lex=0x7f65b00054f8, result=@0x7f89202becd8: 0x7f65b0012488, setup_tables_done_option=0,
res=@0x7f89202becd4: 0, optimize_after_tianmu=@0x7f89202beccc: 1, tianmu_free_join=@0x7f89202becd0: 1, with_insert=0)
at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-30-119/storage/tianmu/core/engine_execute.cpp:238
#10 0x0000000002d5f439 in Tianmu::handler::ha_my_tianmu_query (thd=0x7f65b00031d0, lex=0x7f65b00054f8, result_output=@0x7f89202becd8: 0x7f65b0012488, setup_tables_done_option=0, res=@0x7f89202becd4: 0,
optimize_after_tianmu=@0x7f89202beccc: 1, tianmu_free_join=@0x7f89202becd0: 1, with_insert=0) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-30-119/storage/tianmu/handler/ha_rcengine.cpp:82
#11 0x000000000239ef34 in execute_sqlcom_select (thd=0x7f65b00031d0, all_tables=0x7f65b0010ad0) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-30-119/sql/sql_parse.cc:5184
#12 0x00000000023982b8 in mysql_execute_command (thd=0x7f65b00031d0, first_level=true) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-30-119/sql/sql_parse.cc:2831
#13 0x000000000239fefd in mysql_parse (thd=0x7f65b00031d0, parser_state=0x7f89202bfe70) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-30-119/sql/sql_parse.cc:5622
#14 0x0000000002395195 in dispatch_command (thd=0x7f65b00031d0, com_data=0x7f89202c0610, command=COM_QUERY) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-30-119/sql/sql_parse.cc:1495
#15 0x00000000023940c1 in do_command (thd=0x7f65b00031d0) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-30-119/sql/sql_parse.cc:1034
#16 0x00000000024c6cc1 in handle_connection (arg=0x17e13bd0) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-30-119/sql/conn_handler/connection_handler_per_thread.cc:313
#17 0x0000000002bac43c in pfs_spawn_thread (arg=0x17e29420) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-30-119/storage/perfschema/pfs.cc:2197
#18 0x00007f892af92ea5 in start_thread () from /lib64/libpthread.so.0
#19 0x00007f892820fb0d in clone () from /lib64/libc.so.6

提前上下文访问的堆栈:

(gdb) bt
#0 Tianmu::core::RCAttr::get_dpn (this=0x7f67d88fd100, i=0) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-30-119/storage/tianmu/core/rc_attr.h:343
#1 0x0000000002ff3d28 in Tianmu::core::RCAttr::GetPrefixLength (this=0x7f67d88fd100, pack=0) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-30-119/storage/tianmu/core/rc_attr.cpp:751
#2 0x0000000002cff16f in Tianmu::core::RCAttr::RoughCheck (this=0x7f67d88fd100, pack=0, d=..., additional_nulls_possible=false)
at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-30-119/storage/tianmu/core/rcattr_exeq_rs.cpp:300
#3 0x0000000002dd1d1c in Tianmu::vcolumn::SingleColumn::RoughCheckImpl (this=0x7f67d88ff2a0, mit=..., d=...)
at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-30-119/storage/tianmu/vc/single_column.cpp:184
#4 0x0000000002de5209 in Tianmu::vcolumn::VirtualColumnBase::RoughCheck (this=0x7f67d88ff2a0, it=..., d=...)
at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-30-119/storage/tianmu/vc/virtual_column_base.h:358
#5 0x0000000002f821f9 in Tianmu::core::Descriptor::EvaluateRoughlyPack (this=0x7f67d8905fc0, mit=...) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-30-119/storage/tianmu/core/descriptor.cpp:441
#6 0x0000000002fe0023 in Tianmu::core::ParameterizedFilter::RoughUpdateMultiIndex (this=0x7f67d88fe670)
at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-30-119/storage/tianmu/core/parameterized_filter.cpp:348
#7 0x0000000002fe4812 in Tianmu::core::ParameterizedFilter::UpdateMultiIndex (this=0x7f67d88fe670, count_only=false, limit=-1)
at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-30-119/storage/tianmu/core/parameterized_filter.cpp:1113
#8 0x0000000002ca55e8 in Tianmu::core::Query::Preexecute (this=0x7f8b5083c780, qu=..., sender=0x7f67d88fe450, display_now=true)
at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-30-119/storage/tianmu/core/query.cpp:793
#9 0x0000000002c76e7f in Tianmu::core::Engine::Execute (this=0x53543a0, thd=0x7f67d8007770, lex=0x7f67d8009a98, result_output=0x7f67d8014f58, unit_for_union=0x0)
at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-30-119/storage/tianmu/core/engine_execute.cpp:477
#10 0x0000000002c75d16 in Tianmu::core::Engine::HandleSelect (this=0x53543a0, thd=0x7f67d8007770, lex=0x7f67d8009a98, result=@0x7f8b5083ccd8: 0x7f67d8014f58, setup_tables_done_option=0,
res=@0x7f8b5083ccd4: 0, optimize_after_tianmu=@0x7f8b5083cccc: 1, tianmu_free_join=@0x7f8b5083ccd0: 1, with_insert=0)
at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-30-119/storage/tianmu/core/engine_execute.cpp:238
#11 0x0000000002d5f439 in Tianmu::handler::ha_my_tianmu_query (thd=0x7f67d8007770, lex=0x7f67d8009a98, result_output=@0x7f8b5083ccd8: 0x7f67d8014f58, setup_tables_done_option=0, res=@0x7f8b5083ccd4: 0,
optimize_after_tianmu=@0x7f8b5083cccc: 1, tianmu_free_join=@0x7f8b5083ccd0: 1, with_insert=0) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-30-119/storage/tianmu/handler/ha_rcengine.cpp:82
#12 0x000000000239ef34 in execute_sqlcom_select (thd=0x7f67d8007770, all_tables=0x7f67d80135a0) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-30-119/sql/sql_parse.cc:5184
#13 0x00000000023982b8 in mysql_execute_command (thd=0x7f67d8007770, first_level=true) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-30-119/sql/sql_parse.cc:2831
#14 0x000000000239fefd in mysql_parse (thd=0x7f67d8007770, parser_state=0x7f8b5083de70) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-30-119/sql/sql_parse.cc:5622
#15 0x0000000002395195 in dispatch_command (thd=0x7f67d8007770, com_data=0x7f8b5083e610, command=COM_QUERY) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-30-119/sql/sql_parse.cc:1495
#16 0x00000000023940c1 in do_command (thd=0x7f67d8007770) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-30-119/sql/sql_parse.cc:1034
#17 0x00000000024c6cc1 in handle_connection (arg=0x178b3ad0) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-30-119/sql/conn_handler/connection_handler_per_thread.cc:313
#18 0x0000000002bac43c in pfs_spawn_thread (arg=0x178c9320) at /home/jenkins/workspace/stonedb5.7-zsl-centos7.9-30-119/storage/perfschema/pfs.cc:2197
#19 0x00007f8b5b514ea5 in start_thread () from /lib64/libpthread.so.0
#20 0x00007f8b58791b0d in clone () from /lib64/libc.so.6

问题原因:

当表刚创建,未插入数据时,相关的dpn元数据为空.

此时去加载dpn元数据, 被assert断言crash