guo-shaoge / py_placement_rule

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

1. disable_s3.py: ./disable_s3.py ori.json &> disable_s3.json
```
From:
{
    group_id: tiflash,
    constraints: [
        {
            key: engine,
            op: in,
            values: [
                tiflash,
            ],
        },
        {
        },
    ],
}

To:
{
    group_id: tiflash,
    constraints: [
        {
            key: engine,
            op: in,
            values: [
                tiflash,
            ],
        },
        {
            key: engine_role,
            op: notIn,
            values: [
                write,
            ],
        },
    ],
}
```

2. enable_s3.py:
```
From:
{
    group_id: tiflash,
    constraints: [
        {
            key: engine,
            op: in,
            values: [
                tiflash,
            ],
        },
        {
            key: engine_role,
            op: notIn,
            values: [
                write,
            ],
        },
    ],
}

To:
{
    group_id: enable_s3_wn_region,
    constraints: [
        {
            key: engine,
            op: in,
            values: [
                tiflash,
            ],
        },
        {
            key: engine_role,
            op: in,
            values: [
                write,
            ],
        },
    ],
}
```
3. remove_non_s3.py
```
From:
{
    group_id: tiflash,
    count: n,
    constraints: [
        {
            key: engine,
            op: in,
            values: [
                tiflash,
            ],
        },
        {
            key: engine_role,
            op: notIn,
            values: [
                write,
            ],
        },
    ],
}

To:
{
    group_id: tiflash,
    count: 0
    constraints: [
        {
            key: engine,
            op: in,
            values: [
                tiflash,
            ],
        },
        {
            key: engine_role,
            op: notIn,
            values: [
                write,
            ],
        },
    ],
}
```
4. remote_s3.py
```
From:
{
    group_id: enable_s3_wn_region,
    count: n,
    constraints: [
        {
            key: engine,
            op: in,
            values: [
                tiflash,
            ],
        },
        {
            key: engine_role,
            op: in,
            values: [
                write,
            ],
        },
    ],
}

To:
{
    group_id: enable_s3_wn_region,
    count: 0,
    constraints: [
        {
            key: engine,
            op: in,
            values: [
                tiflash,
            ],
        },
        {
            key: engine_role,
            op: in,
            values: [
                write,
            ],
        },
    ],
}
```

enable.py: add rule to add s3 wn tiflash replica
    
    usage: ./enable.py ori_rules.json keyspace_id_you_want

filter_keyspace.py: remove other keyspace rule, only left keyspace you want.

    usage: ./filter.py ori_rules.json keyspace_id_you_want

filter_table.py: remove other table, only left table you want.

    usage: ./filter.py ori_rules.json table_id_you_want

enable_all_except.py: add rules to add s3 wn tiflash replica except specific keyspaceid

    usage: ./enable.py ori_rules.json keyspace_id_you_dont_need

About


Languages

Language:Python 100.0%