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

@zhaojinchao95

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions