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

column after 'where' does not specify the table name,causes it to be issued to all nodes #2152

Closed
wenyh1 opened this issue Sep 27, 2020 · 1 comment
Assignees
Labels
autotest-added the case has append to autotest
Milestone

Comments

@wenyh1
Copy link
Member

wenyh1 commented Sep 27, 2020

  • dble version:3.20.07.99

  • preconditions :
    tables:
    1.drop table if exists tb_parent;
    create table if not exists tb_parent (
    id int not null,
    id2 int not null,
    content varchar(250) not null,
    primary key(id)
    )engine=innodb charset=utf8;
    insert into tb_parent values(1,1,'1'),(2,2,'2'),(513,513,'513');
    2.drop table if exists tb_child2;
    create table if not exists tb_child2 (
    child2_id int not null,
    content varchar(250) not null
    )engine=innodb charset=utf8;
    insert into tb_child2 values(1,'1');
    insert into tb_child2 values(2,'2');
    insert into tb_child2 values(513,'513');

  • configs:

cluster.cnf



bootstrap.cnf



db.xml



user.xml



sharding.xml

<shardingTable name="tb_parent" shardingNode="dn1,dn2" function="func_jumpHash" shardingColumn="id">
    <childTable name="tb_child2" joinColumn="child2_id" parentColumn="id"/>
</shardingTable>

<function name="func_jumpHash" class="jumpStringHash">
    <property name="partitionCount">2</property>
    <property name="hashSlice">0:2</property>
</function>

  • steps:
    step1. execute the following sql(notes here 'id' after 'where' does not specify the table name):
explain select * from tb_parent inner join tb_child2  on tb_child2.child2_id = tb_parent.id where id = 0;
  • expect result:
    1.
+---------------+----------+------------------------------------------------------------------------------------------------------------+
| SHARDING_NODE | TYPE     | SQL/REF                                                                                                    |
+---------------+----------+------------------------------------------------------------------------------------------------------------+
| dn1           | BASE SQL | select * from tb_parent inner join tb_child2  on tb_child2.child2_id = tb_parent.id where tb_parent.id = 0 |
+---------------+----------+------------------------------------------------------------------------------------------------------------+
1 row in set (0.01 sec)
  • real result:
    1.
+-----------------+---------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| SHARDING_NODE   | TYPE          | SQL/REF                                                                                                                                                                                                                    |
+-----------------+---------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| dn1_0           | BASE SQL      | select `tb_parent`.`id`,`tb_parent`.`id2`,`tb_parent`.`content`,`tb_child2`.`child2_id`,`tb_child2`.`content` from  `tb_parent` join  `tb_child2` on `tb_parent`.`id` = `tb_child2`.`child2_id` where `tb_parent`.`id` = 0 |
| dn2_0           | BASE SQL      | select `tb_parent`.`id`,`tb_parent`.`id2`,`tb_parent`.`content`,`tb_child2`.`child2_id`,`tb_child2`.`content` from  `tb_parent` join  `tb_child2` on `tb_parent`.`id` = `tb_child2`.`child2_id` where `tb_parent`.`id` = 0 |
| merge_1         | MERGE         | dn1_0; dn2_0                                                                                                                                                                                                               |
| shuffle_field_1 | SHUFFLE_FIELD | merge_1                                                                                                                                                                                                                    |
+-----------------+---------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
4 rows in set (0.01 sec)
  • supplements:
    1.
@yanhuqing666 yanhuqing666 added this to the 3.20.10.0 milestone Sep 27, 2020
@wenyh1 wenyh1 self-assigned this Sep 28, 2020
@wenyh1 wenyh1 mentioned this issue Nov 4, 2020
@wjl1619 wjl1619 added resolve problem has been fixed by developer and removed resolve problem has been fixed by developer labels Nov 11, 2020
@wenyh1 wenyh1 mentioned this issue Nov 13, 2020
@yanhuqing666 yanhuqing666 modified the milestones: 3.20.10.0, 3.21.01.0 Nov 13, 2020
@wenyh1 wenyh1 removed their assignment Jan 21, 2021
@wjl1619 wjl1619 added the autotest-wait issue waits to be added to autotest label Jan 21, 2021
@wjl1619
Copy link
Member

wjl1619 commented Jan 21, 2021

verified on version: 5.7.21-dble-9.9.9.9-34779f524977e7d02db811cc3e986309049908c5-20210121062858

@wjl1619 wjl1619 closed this as completed Jan 21, 2021
@quexiuping quexiuping added autotest-added the case has append to autotest and removed autotest-wait issue waits to be added to autotest labels Apr 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autotest-added the case has append to autotest
Projects
None yet
Development

No branches or pull requests

4 participants