Skip to content

Consider adjusting the SHARDING API to bring keyGenerateStrategy to the same level as tables to support column-level auto-increment and global auto-increment #38178

Description

@zhaojinchao95

Hi all,

To better solve the primary key generation problem in distributed systems,we will to change sharding api to to support column-level auto-increment and global auto-increment.

Before:

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_item_id
        keyGeneratorName: snowflake
  keyGenerators:
    snowflake:
      type: SNOWFLAKE

After:

rules:
- !SHARDING
  tables:
    t_order:
      actualDataNodes: ds_${0..1}.t_order_${0..1}
      tableStrategy:
        standard:
          shardingColumn: order_id
          shardingAlgorithmName: t_order_inline
  keyGenerateStrategies:
    t_order:
       keyGenerateType: column
       keyGeneratorName: snowflake
       logicTable: t_order
       keyGenerateColumn: id
  keyGenerators:
    snowflake:
      type: SNOWFLAKE

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions