Skip to content

Rule in SQL supports to define 2:2:1 cluster topology #47254

@nolouch

Description

@nolouch

Enhancement

Problems

The customer wants to define a cluster with 5 replicas and distributed in 3 regions, leader can be in every region. currently, the rule in SQL cannot conver it.

//  cannot be 2:2:1 distributed
MySQL > create  placement policy mydeploy FOLLOWER_CONSTRAINTS='{ "+region=us-east-1":1, "+region=us-east-2": 2, "+region=us-west-1": 1}';

// leader is located in  us-east-1
MySQL > create  placement policy mydeploy  LEADER_CONSTRAINTS='{"+region=us-east-1":1}'  FOLLOWER_CONSTRAINTS='{ "+region=us-east-1":1, "+region=us-east-2": 2, "+region=us-west-1": 1}';


// cannot create
mysql> create placement policy mydeploy221 CONSTRAINTS='{ "+region=us-east-1":2, "+region=us-east-2": 2, "+region=us-west-1": 1}';
ERROR 1105 (HY000): invalid label constraints format: 'Constraints' should be [constraint1, ...] or any yaml compatible array representation

Implement

Supports:

  1. supports high level policy for CONSTRAINTS
create placement policy mydeploy221 CONSTRAINTS='{ "+region=us-east-1":2, "+region=us-east-2": 2, "+region=us-west-1": 1}'
  1. syntax sugar
CREATE PLACEMENT POLICY REGIONS="us-east-1,us-east-2,us-west-1" SCHEUDLE="replicas(2:2:1)"

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/enhancementThe issue or PR belongs to an enhancement.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions