apache / shardingsphere

Distributed SQL transaction & query engine for data sharding, scaling, encryption, and more - on any database.
Apache License 2.0
19.88k stars 6.73k forks source link

NPE occurs when I start proxy without autoTable shardingStrategy configuration #26750

Open strongduanmu opened 1 year ago

strongduanmu commented 1 year ago

Bug Report

Which version of ShardingSphere did you use?

437c447

Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?

ShardingSphere-Proxy

Expected behavior

Throw corrent exception instead of NPE.

Actual behavior

img_v2_470988a3-5dac-48c2-b1f6-6031922669bg

Reason analyze (If you can)

Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.

Config like following:

databaseName: sharding_db

dataSources:
  ds_0:
    url: jdbc:mysql://127.0.0.1:3306/demo_ds_0?serverTimezone=UTC&useSSL=false&allowPublicKeyRetrieval=true
    username: root
    password: 123456
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 1800000
    maxPoolSize: 50
    minPoolSize: 1
  ds_1:
    url: jdbc:mysql://127.0.0.1:3306/demo_ds_1?serverTimezone=UTC&useSSL=false&allowPublicKeyRetrieval=true
    username: root
    password: 123456
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 1800000
    maxPoolSize: 50
    minPoolSize: 1

rules:
- !SHARDING
  bindingTables:
    - bmsql_warehouse, bmsql_customer
    - bmsql_stock, bmsql_district, bmsql_order_line
  defaultDatabaseStrategy:
    none:
  defaultTableStrategy:
    none:
  keyGenerators:
    snowflake:
      type: SNOWFLAKE
  autoTables:
    bmsql_config:
      actualDataSources: ds_0
    bmsql_warehouse:
      actualDataSources: ds_${0..0}
      shardingStrategy:
        standard:
          shardingColumn: w_id
          shardingAlgorithmName: mod_1
    bmsql_district:
      actualDataSources: ds_${0..0}
      shardingStrategy:
        standard:
          shardingColumn: d_w_id
          shardingAlgorithmName: mod_1
    bmsql_customer:
      actualDataSources: ds_${0..0}
      shardingStrategy:
        standard:
          shardingColumn: c_w_id
          shardingAlgorithmName: mod_1
    bmsql_item:
      actualDataSources: ds_${0..0}
      shardingStrategy:
        standard:
          shardingColumn: i_id
          shardingAlgorithmName: mod_1
    bmsql_history:
      actualDataSources: ds_${0..0}
      shardingStrategy:
        standard:
          shardingColumn: h_w_id
          shardingAlgorithmName: mod_1
    bmsql_oorder:
      actualDataSources: ds_${0..0}
      shardingStrategy:
        standard:
          shardingColumn: o_w_id
          shardingAlgorithmName: mod_1
    bmsql_stock:
      actualDataSources: ds_${0..0}
      shardingStrategy:
        standard:
          shardingColumn: s_w_id
          shardingAlgorithmName: mod_1
    bmsql_new_order:
      actualDataSources: ds_${0..0}
      shardingStrategy:
        standard:
          shardingColumn: no_w_id
          shardingAlgorithmName: mod_1
    bmsql_order_line:
      actualDataSources: ds_${0..0}
      shardingStrategy:
        standard:
          shardingColumn: ol_w_id
          shardingAlgorithmName: mod_1
  shardingAlgorithms:
    mod_1:
      type: MOD
      props:
        sharding-count: 1

Example codes for reproduce this issue (such as a github link).

github-actions[bot] commented 1 year ago

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

github-actions[bot] commented 11 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.