Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: Query ERROR 1105 (HY000): assert failed on i < m_idx.size() at rc_attr.h:342 #964

Closed
2 of 3 tasks
davidshiz opened this issue Nov 17, 2022 · 2 comments · Fixed by #970
Closed
2 of 3 tasks

bug: Query ERROR 1105 (HY000): assert failed on i < m_idx.size() at rc_attr.h:342 #964

davidshiz opened this issue Nov 17, 2022 · 2 comments · Fixed by #970
Assignees
Labels
A-bug Something isn't working prio: high High priority

Comments

@davidshiz
Copy link
Collaborator

Have you read the Contributing Guidelines on issues?

Please confirm if bug report does NOT exists already ?

  • I confirm there is no existing issue for this

Describe the problem

mysql> select t1.id,t1.name,t2.id,t2.name from t1 left join t2 on t1.name=t2.name where t1.name in ('abc');
ERROR 1105 (HY000): assert failed on i < m_idx.size() at rc_attr.h:342, msg: [bad dpn index 0/0]

Expected behavior

mysql> select t1.id,t1.name,t2.id,t2.name from t1 left join t2 on t1.name=t2.name where t1.name in ('abc');
+------+------+------+------+
| id   | name | id   | name |
+------+------+------+------+
|    1 | abc  | NULL | NULL |
+------+------+------+------+
1 row in set (0.00 sec)

How To Reproduce

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');

Environment

root@localhost:/# /stonedb57/install/bin/mysqld --version
/stonedb57/install/bin/mysqld  Ver 5.7.36-StoneDB for Linux on x86_64 (build-)
build information as follow:
        Repository address: https://github.com/stoneatom/stonedb.git:stonedb-5.7-dev
        Branch name: stonedb-5.7-dev
        Last commit ID: d0c2e01b6
        Last commit time: Date:   Wed Nov 2 19:58:00 2022 +0800
        Build time: Date: Sun 06 Nov 2022 08:50:06 AM UTC
root@ub01:~# cat /etc/os-release
NAME="Ubuntu"
VERSION="20.04.5 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.5 LTS"
VERSION_ID="20.04"

Are you interested in submitting a PR to solve the problem?

  • Yes, I will!
@davidshiz davidshiz added the A-bug Something isn't working label Nov 17, 2022
@adofsauron
Copy link
Collaborator

adofsauron commented Nov 18, 2022

(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

@adofsauron
Copy link
Collaborator

adofsauron commented Nov 18, 2022

The reason is that there is no data in the t2 table, and an error occurs when data is loaded during the join operation

For comparison, t2 can be queried normally when inserted into the data

mysql> select t1.id,t1.name,t2.id,t2.name from t1 left join t2 on t1.name=t2.name where t1.name in ('abc');
+------+------+------+------+
| id   | name | id   | name |
+------+------+------+------+
|    1 | abc  | NULL | NULL |
+------+------+------+------+
1 row in set (0.01 sec)

@davidshiz davidshiz changed the title bug: QUERY ERROR 1105 (HY000): assert failed on i < m_idx.size() at rc_attr.h:342 bug: Query ERROR 1105 (HY000): assert failed on i < m_idx.size() at rc_attr.h:342 Nov 18, 2022
@RingsC RingsC added the prio: high High priority label Nov 21, 2022
@mergify mergify bot closed this as completed in #970 Nov 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-bug Something isn't working prio: high High priority
Projects
None yet
3 participants