question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Invalid binding table configuration in ShardingRuleConfiguration when alter SHARDING TABLE RULE

See original GitHub issue

Which version of ShardingSphere did you use?

master

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

ShardingSphere-Proxy

Expected behavior

No error msg

Actual behavior

五月 09, 2022 6:54:08 下午 com.google.common.eventbus.EventBus$LoggingHandler handleException
严重: Exception thrown by subscriber method start(org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.cache.event.StartScalingEvent) on subscriber org.apache.shardingsphere.data.pipeline.scenario.rulealtered.RuleAlteredJobWorker@6dde1bf5 when dispatching event: StartScalingEvent(databaseName=sharding_db, activeVersion=0, newVersion=1)
java.lang.IllegalArgumentException: Invalid binding table configuration in ShardingRuleConfiguration.
	at com.google.common.base.Preconditions.checkArgument(Preconditions.java:142)
	at org.apache.shardingsphere.sharding.rule.ShardingRule.<init>(ShardingRule.java:120)
	at org.apache.shardingsphere.sharding.schedule.ShardingRuleAlteredDetector.findRuleAlteredLogicTables(ShardingRuleAlteredDetector.java:80)
	at org.apache.shardingsphere.data.pipeline.scenario.rulealtered.RuleAlteredJobWorker.createJobConfig(RuleAlteredJobWorker.java:193)
	at org.apache.shardingsphere.data.pipeline.scenario.rulealtered.RuleAlteredJobWorker.start(RuleAlteredJobWorker.java:172)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.google.common.eventbus.Subscriber.invokeSubscriberMethod(Subscriber.java:87)
	at com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Subscriber.java:144)
	at com.google.common.eventbus.Subscriber$1.run(Subscriber.java:72)
	at com.google.common.util.concurrent.DirectExecutor.execute(DirectExecutor.java:30)
	at com.google.common.eventbus.Subscriber.dispatchEvent(Subscriber.java:67)
	at com.google.common.eventbus.Dispatcher$PerThreadQueuedDispatcher.dispatch(Dispatcher.java:108)
	at com.google.common.eventbus.EventBus.post(EventBus.java:212)
	at org.apache.shardingsphere.proxy.backend.text.distsql.rdl.rule.RuleDefinitionBackendHandler.persistRuleConfigurationChange(RuleDefinitionBackendHandler.java:161)
	at org.apache.shardingsphere.proxy.backend.text.distsql.rdl.rule.RuleDefinitionBackendHandler.prepareScaling(RuleDefinitionBackendHandler.java:150)
	at org.apache.shardingsphere.proxy.backend.text.distsql.rdl.rule.RuleDefinitionBackendHandler.execute(RuleDefinitionBackendHandler.java:83)
	at org.apache.shardingsphere.proxy.backend.text.distsql.rdl.rule.RuleDefinitionBackendHandler.execute(RuleDefinitionBackendHandler.java:58)
	at org.apache.shardingsphere.proxy.backend.text.DatabaseRequiredBackendHandler.execute(DatabaseRequiredBackendHandler.java:51)
	at org.apache.shardingsphere.proxy.frontend.mysql.command.query.text.query.MySQLComQueryPacketExecutor.execute(MySQLComQueryPacketExecutor.java:97)
	at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.executeCommand(CommandExecutorTask.java:107)
	at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.run(CommandExecutorTask.java:77)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)

Configuration

databaseName: sharding_db

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

rules:
- !SHARDING
  tables:
    t_order:
      actualDataNodes: ds_${0..1}.t_order_${0..1}
      tableStrategy:
        standard:
          shardingColumn: order_id
          shardingAlgorithmName: t_order_inline
      keyGenerateStrategy:
        column: order_id
        keyGeneratorName: snowflake
    t_order_item:
      actualDataNodes: ds_${0..1}.t_order_item_${0..1}
      tableStrategy:
        standard:
          shardingColumn: order_id
          shardingAlgorithmName: t_order_item_inline
      keyGenerateStrategy:
        column: order_item_id
        keyGeneratorName: snowflake
  bindingTables:
    - t_order,t_order_item
  defaultDatabaseStrategy:
    standard:
      shardingColumn: user_id
      shardingAlgorithmName: database_inline
  defaultTableStrategy:
    none:

  shardingAlgorithms:
    database_inline:
      type: INLINE
      props:
        algorithm-expression: ds_${user_id % 2}
    t_order_inline:
      type: INLINE
      props:
        algorithm-expression: t_order_${order_id % 2}
    t_order_item_inline:
      type: INLINE
      props:
        algorithm-expression: t_order_item_${order_id % 2}

  keyGenerators:
    snowflake:
      type: SNOWFLAKE

  scalingName: default_scaling
  scaling:
    default_scaling:
      input:
        workerThread: 40
        batchSize: 1000
      output:
        workerThread: 40
        batchSize: 1000
      streamChannel:
        type: MEMORY
        props:
          block-queue-size: 10000
      completionDetector:
        type: IDLE
        props:
          incremental-task-idle-seconds-threshold: 1800
      dataConsistencyChecker:
        type: DATA_MATCH
        props:
          chunk-size: 1000

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

ADD RESOURCE ds_2 (
    HOST=127.0.0.1,
    PORT=3306,
    DB=ds0,
    USER=root,
    PASSWORD=123456
);
ADD RESOURCE ds_3 (
    HOST=127.0.0.1,
    PORT=3306,
    DB=ds0,
    USER=root,
    PASSWORD=123456
);
ADD RESOURCE ds_4 (
    HOST=127.0.0.1,
    PORT=3306,
    DB=ds0,
    USER=root,
    PASSWORD=123456
);


ALTER SHARDING TABLE RULE t_order(
 RESOURCES(ds_2,ds_3,ds_4),
 SHARDING_COLUMN=order_id,
 TYPE(NAME=hash_mod,PROPERTIES("sharding-count"=6)),
 KEY_GENERATE_STRATEGY(COLUMN=order_id,TYPE(NAME=snowflake))
 );

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:12 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
strongduanmucommented, May 10, 2022

Hi, I want to investigate this.

@yx9o Welcome.

1reaction
yx9ocommented, May 9, 2022

Hi, I want to investigate this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[GitHub] [shardingsphere] yx9o commented on issue #17487
[GitHub] [shardingsphere] yx9o commented on issue #17487: Invalid binding table configuration in ShardingRuleConfiguration when alter SHARDING ...
Read more >
SQL Error Code - Apache ShardingSphere
42S02, 20002, Can not find data source in sharding rule, invalid actual data node `%s`. 44000, 20003, Data nodes must be configured for...
Read more >
ShardingSphere 4.x -Sharding-JDBC-Configuration manual ...
ShardingSphere 4.x -Sharding-JDBC-Configuration manual-Spring Boot configuration ... spring.shardingsphere.sharding.binding-tables=t_order,t_order_item
Read more >
RELEASE-NOTES.md · ShardingSphere/Apache ... - Gitee
... or altering readwrite-splitting rule, check duplicate write or read resources; DistSQL: Add validity check for ALTER SHARDING BINDING TABLE RULES ...
Read more >
Using CONNECT - Partitioning and Sharding - MariaDB
Indexing with Table Partitioning; Sharding with Table Partitioning. Sharding on a Special Column. Current Partition Limitations. Update statement; Alter ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found