Skip to content

Question about SINGLE rules configuration #37581

@jpenalver10

Description

@jpenalver10

Hi, I've a questions regarding the SINGLE table configuration, that are not clear for me reading the documentation and making tests.

Regarding this configuration (using PostgreSQL):

rules:
  - !SINGLE
    tables:
      - main.outbox_dm_tables.*
      - main.db_sharding.*
      - main.non-existing
    defaultDataSource: main

I want to do some questions about the definition format of tables:

  • main.outbox_dm_tables.* this would means "All tables from outbox_dm_tables schema goes to main shard"?
  • main.db_sharding.sharding_tenant_config this would means "Only the table sharding_tenant_config from db_sharding schema goes to main shard"?
  • As I know, the SINGLE rules are the default beahviour for all tables that are not defined in other ways (not SHARDING etc) and I have defined a default data source. It means that all tables in another schema (suppose infrastructure) will be routing by default to main shard? In my config this happens when I add this rule main.non-existing, that is intentionally incorrect, so all tables in a infrastructure schema are routing to default, but if I removed main.non-existing the tables can't be located by ShardingSphere.
Caused by: org.apache.shardingsphere.infra.exception.kernel.metadata.TableNotFoundException: Table or view 'qrtz_LOCKS' does not exist.
	at org.apache.shardingsphere.infra.binder.engine.segment.dml.from.type.SimpleTableSegmentBinder.lambda$checkTableExists$12(SimpleTableSegmentBinder.java:178)
	at org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions.checkState(ShardingSpherePreconditions.java:44)
	at org.apache.shardingsphere.infra.binder.engine.segment.dml.from.type.SimpleTableSegmentBinder.checkTableExists(SimpleTableSegmentBinder.java:178)
	at org.apache.shardingsphere.infra.binder.engine.segment.dml.from.type.SimpleTableSegmentBinder.bind(SimpleTableSegmentBinder.java:90)
	at org.apache.shardingsphere.infra.binder.engine.segment.dml.from.TableSegmentBinder.bind(TableSegmentBinder.java:57)
	at org.apache.shardingsphere.infra.binder.engine.statement.dml.SelectStatementBinder.lambda$bind$1(SelectStatementBinder.java:64)
	at java.base/java.util.Optional.map(Optional.java:260)
	at org.apache.shardingsphere.infra.binder.engine.statement.dml.SelectStatementBinder.bind(SelectStatementBinder.java:64)
Image

Thank you so much

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions