apache / shardingsphere

Empowering Data Intelligence with Distributed SQL for Sharding, Scalability, and Security Across All Databases.
Apache License 2.0
19.94k stars 6.74k forks source link

When querying multiple tables, the custom database and table sharding algorithm fails, but it takes effect when querying a single table. #30320

Closed vwater closed 3 months ago

vwater commented 8 months ago
<!-- 多数据源 -->
    <dependency>
        <groupId>com.baomidou</groupId>
        <artifactId>dynamic-datasource-spring-boot-starter</artifactId>
        <version>3.4.1</version>
    </dependency>
com.baomidou mybatis-plus-boot-starter 3.4.3.4
    <dependency>
        <groupId>org.apache.shardingsphere</groupId>
        <artifactId>shardingsphere-jdbc-core-spring-boot-starter</artifactId>
        <version>5.2.1</version>
        <exclusions>
            <exclusion>
                <artifactId>guava</artifactId>
                <groupId>com.google.guava</groupId>
            </exclusion>
            <exclusion>
                <artifactId>snakeyaml</artifactId>
                <groupId>org.yaml</groupId>
            </exclusion>
        </exclusions>
    </dependency>

image image image image image

vwater commented 8 months ago

Here is my demo, https://github.com/vwater/sharding-learn.git Execute unit test method testMultiQuery() I found that when sharding is combined with mybatisplus mybatisPlusTenantInterceptor, even if the code reaches the custom database sharding algorithm and custom table sharding algorithm, it will eventually perform a full database scan and a full table scan, causing the custom database sharding algorithm to fail. image

github-actions[bot] commented 7 months ago

There hasn't been any activity on this issue recently, and in order to prioritize active issues, it will be marked as stale.

terrymanu commented 3 months ago

shardingsphere-jdbc-core-spring-boot-starter is deprecated and removed in 5.3.0, please try new version and use ShardingSphere Driver.