Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

placement rule information lost after truncate partition #44031

Closed
tiancaiamao opened this issue May 22, 2023 · 0 comments · Fixed by #44043
Closed

placement rule information lost after truncate partition #44031

tiancaiamao opened this issue May 22, 2023 · 0 comments · Fixed by #44043

Comments

@tiancaiamao
Copy link
Contributor

tiancaiamao commented May 22, 2023

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

CREATE PLACEMENT POLICY hisdata_ods_table_2constraints_1 LEADER_CONSTRAINTS="[+dc=nmlt]" FOLLOWER_CONSTRAINTS="{+dc=nmlt: 2}"

create table t1(id int ,name char(10),salary varchar(10));
create table t2(id int ,name char(10),salary int) partition by range (salary)(partition p1 values less than (5000),partition p2 values less than (10000));

alter table t1 placement policy hisdata_ods_table_2constraints_1;
alter table t2 placement policy hisdata_ods_table_2constraints_1;
with tmp as (select a.DB_NAME,a.TABLE_NAME,b.REGION_ID,b.PEER_ID,b.STORE_ID,b.IS_LEADER, c.LABEL->>'$[3]' as label from TIKV_REGION_STATUS a, TIKV_REGION_PEERS b, TIKV_STORE_STATUS c where a.REGION_ID=b.REGION_ID and b.STORE_ID=c.STORE_ID and a.db_name='test' and lower(a.table_name)='t2' group by a.DB_NAME,a.TABLE_NAME,b.REGION_ID, b.PEER_ID,b.STORE_ID,b.IS_LEADER,c.LABEL ), tmp1 as ( select a.db_name ,a.table_name ,sum(case when a.label->>'$.value' = 'nmlt' and a.is_leader then 1 else 0 end) sum_nmlt_leader ,sum(case when a.label->>'$.value' <> 'nmlt' and a.is_leader then 1 else 0 end) sum_nmdx_leader ,sum(case when a.label->>'$.value' = 'nmlt' then 1 else 0 end) sum_nmlt ,sum(case when a.label->>'$.value' <> 'nmlt' then 1 else 0 end) sum_nmdx from tmp a group by 1,2 ) select db_name,table_name,sum_nmlt_leader,sum_nmdx_leader,sum_nmlt,sum_nmdx, sum_nmlt/sum_nmdx from tmp1 order by 1,2;

image
image

2. What did you expect to see? (Required)

truncate table test.t1;

image

alter table test.t2 truncate partition p2;

image

3. What did you see instead (Required)

I expect the placement rule work after truncate partition.
But as you can see, after truncate, the new partition does not obey the placement rule.

The root cause is that, the placement policy informaction is recored in the table info, not in the partition definition.
After truncate, the new partition inherit the placement policy from the partition definition, so it's lost.

See the ddl history info to verify that:

[bocs@vm10-2-103-13 ~]$ curl http://10.2.103.18:10084/ddl/history?limit=7
[
 {
  "id": 435,
  "type": 23,
  "schema_id": 1,
  "table_id": 428,
  "schema_name": "test",
  "table_name": "t2",
  "state": 6,
  "warning": null,
  "err": null,
  "err_count": 0,
  "row_count": 0,
  "raw_args": [
   [
    430
   ]
  ],
  "schema_state": 0,
  "snapshot_ver": 0,
  "real_start_ts": 441579226251919373,
  "start_ts": 441579226251919361,
  "dependency_id": 0,
  "query": "alter table test.t2 truncate partition p2",
  "binlog": {
   "SchemaVersion": 290,
   "DBInfo": null,
   "TableInfo": {
    "id": 428,
    "name": {
     "O": "t2",
     "L": "t2"
    },
    "charset": "utf8mb4",
    "collate": "utf8mb4_bin",
    "cols": [
     {
      "id": 1,
      "name": {
       "O": "id",
       "L": "id"
      },
      "offset": 0,
      "origin_default": null,
      "origin_default_bit": null,
      "default": null,
      "default_bit": null,
      "default_is_expr": false,
      "generated_expr_string": "",
      "generated_stored": false,
      "dependences": null,
      "type": {
       "Tp": 3,
       "Flag": 0,
       "Flen": 11,
       "Decimal": 0,
       "Charset": "binary",
       "Collate": "binary",
       "Elems": null,
       "ElemsIsBinaryLit": null
      },
      "state": 5,
      "comment": "",
      "hidden": false,
      "change_state_info": null,
      "version": 2
     },
     {
      "id": 2,
      "name": {
       "O": "name",
       "L": "name"
      },
      "offset": 1,
      "origin_default": null,
      "origin_default_bit": null,
      "default": null,
      "default_bit": null,
      "default_is_expr": false,
      "generated_expr_string": "",
      "generated_stored": false,
      "dependences": null,
      "type": {
       "Tp": 254,
       "Flag": 0,
       "Flen": 10,
       "Decimal": 0,
       "Charset": "utf8mb4",
       "Collate": "utf8mb4_bin",
       "Elems": null,
       "ElemsIsBinaryLit": null
      },
      "state": 5,
      "comment": "",
      "hidden": false,
      "change_state_info": null,
      "version": 2
     },
     {
      "id": 3,
      "name": {
       "O": "salary",
       "L": "salary"
      },
      "offset": 2,
      "origin_default": null,
      "origin_default_bit": null,
      "default": null,
      "default_bit": null,
      "default_is_expr": false,
      "generated_expr_string": "",
      "generated_stored": false,
      "dependences": null,
      "type": {
       "Tp": 3,
       "Flag": 0,
       "Flen": 11,
       "Decimal": 0,
       "Charset": "binary",
       "Collate": "binary",
       "Elems": null,
       "ElemsIsBinaryLit": null
      },
      "state": 5,
      "comment": "",
      "hidden": false,
      "change_state_info": null,
      "version": 2
     }
    ],
    "index_info": null,
    "constraint_info": null,
    "fk_info": null,
    "state": 5,
    "pk_is_handle": false,
    "is_common_handle": false,
    "common_handle_version": 0,
    "comment": "",
    "auto_inc_id": 0,
    "auto_id_cache": 0,
    "auto_rand_id": 0,
    "max_col_id": 3,
    "max_idx_id": 0,
    "max_fk_id": 0,
    "max_cst_id": 0,
    "update_timestamp": 441579226251919373,
    "ShardRowIDBits": 0,
    "max_shard_row_id_bits": 0,
    "auto_random_bits": 0,
    "auto_random_range_bits": 0,
    "pre_split_regions": 0,
    "partition": {
     "type": 1,
     "expr": "`salary`",
     "columns": null,
     "enable": true,
     "definitions": [
      {
       "id": 429,
       "name": {
        "O": "p1",
        "L": "p1"
       },
       "less_than": [
        "5000"
       ],
       "in_values": null,
       "policy_ref_info": null
      },
      {
       "id": 436,
       "name": {
        "O": "p2",
        "L": "p2"
       },
       "less_than": [
        "10000"
       ],
       "in_values": null,
       "policy_ref_info": null
      }
     ],
     "adding_definitions": null,
     "dropping_definitions": null,
     "states": null,
     "num": 2
    },
    "compression": "",
    "view": null,
    "sequence": null,
    "Lock": null,
    "version": 5,
    "tiflash_replica": null,
    "is_columnar": false,
    "temp_table_type": 0,
    "cache_table_status": 0,
    "policy_ref_info": {
     "id": 1,
     "name": {
      "O": "hisdata_ods_table_2constraints_1",
      "L": "hisdata_ods_table_2constraints_1"
     }
    },
    "stats_options": null,
    "exchange_partition_info": null,
    "ttl_info": null
   },
   "FinishedTS": 441579226278133766,
   "MultipleTableInfos": null
  },
  "version": 1,
  "reorg_meta": null,
  "multi_schema_info": null,
  "priority": 0,
  "seq_num": 224,
  "charset": "",
  "collate": ""
 },
 {
  "id": 434,
  "type": 11,
  "schema_id": 1,
  "table_id": 424,
  "schema_name": "test",
  "table_name": "t1",
  "state": 6,
  "warning": null,
  "err": null,
  "err_count": 0,
  "row_count": 0,
  "raw_args": [
   "dIAAAAAAAAGo",
   null
  ],
  "schema_state": 5,
  "snapshot_ver": 0,
  "real_start_ts": 441579209907503119,
  "start_ts": 441579209907503107,
  "dependency_id": 0,
  "query": "truncate table test.t1",
  "binlog": {
   "SchemaVersion": 289,
   "DBInfo": null,
   "TableInfo": {
    "id": 433,
    "name": {
     "O": "t1",
     "L": "t1"
    },
    "charset": "utf8mb4",
    "collate": "utf8mb4_bin",
    "cols": [
     {
      "id": 1,
      "name": {
       "O": "id",
       "L": "id"
      },
      "offset": 0,
      "origin_default": null,
      "origin_default_bit": null,
      "default": null,
      "default_bit": null,
      "default_is_expr": false,
      "generated_expr_string": "",
      "generated_stored": false,
      "dependences": null,
      "type": {
       "Tp": 3,
       "Flag": 0,
       "Flen": 11,
       "Decimal": 0,
       "Charset": "binary",
       "Collate": "binary",
       "Elems": null,
       "ElemsIsBinaryLit": null
      },
      "state": 5,
      "comment": "",
      "hidden": false,
      "change_state_info": null,
      "version": 2
     },
     {
      "id": 2,
      "name": {
       "O": "name",
       "L": "name"
      },
      "offset": 1,
      "origin_default": null,
      "origin_default_bit": null,
      "default": null,
      "default_bit": null,
      "default_is_expr": false,
      "generated_expr_string": "",
      "generated_stored": false,
      "dependences": null,
      "type": {
       "Tp": 254,
       "Flag": 0,
       "Flen": 10,
       "Decimal": 0,
       "Charset": "utf8mb4",
       "Collate": "utf8mb4_bin",
       "Elems": null,
       "ElemsIsBinaryLit": null
      },
      "state": 5,
      "comment": "",
      "hidden": false,
      "change_state_info": null,
      "version": 2
     },
     {
      "id": 3,
      "name": {
       "O": "salary",
       "L": "salary"
      },
      "offset": 2,
      "origin_default": null,
      "origin_default_bit": null,
      "default": null,
      "default_bit": null,
      "default_is_expr": false,
      "generated_expr_string": "",
      "generated_stored": false,
      "dependences": null,
      "type": {
       "Tp": 15,
       "Flag": 0,
       "Flen": 10,
       "Decimal": 0,
       "Charset": "utf8mb4",
       "Collate": "utf8mb4_bin",
       "Elems": null,
       "ElemsIsBinaryLit": null
      },
      "state": 5,
      "comment": "",
      "hidden": false,
      "change_state_info": null,
      "version": 2
     }
    ],
    "index_info": null,
    "constraint_info": null,
    "fk_info": null,
    "state": 5,
    "pk_is_handle": false,
    "is_common_handle": false,
    "common_handle_version": 0,
    "comment": "",
    "auto_inc_id": 0,
    "auto_id_cache": 0,
    "auto_rand_id": 0,
    "max_col_id": 3,
    "max_idx_id": 0,
    "max_fk_id": 0,
    "max_cst_id": 0,
    "update_timestamp": 441579057470767107,
    "ShardRowIDBits": 0,
    "max_shard_row_id_bits": 0,
    "auto_random_bits": 0,
    "auto_random_range_bits": 0,
    "pre_split_regions": 0,
    "partition": null,
    "compression": "",
    "view": null,
    "sequence": null,
    "Lock": null,
    "version": 5,
    "tiflash_replica": null,
    "is_columnar": false,
    "temp_table_type": 0,
    "cache_table_status": 0,
    "policy_ref_info": {
     "id": 1,
     "name": {
      "O": "hisdata_ods_table_2constraints_1",
      "L": "hisdata_ods_table_2constraints_1"
     }
    },
    "stats_options": null,
    "exchange_partition_info": null,
    "ttl_info": null
   },
   "FinishedTS": 441579209933455366,
   "MultipleTableInfos": null
  },
  "version": 1,
  "reorg_meta": null,
  "multi_schema_info": null,
  "priority": 0,
  "seq_num": 223,
  "charset": "",
  "collate": ""
 },
 {
  "id": 432,
  "type": 56,
  "schema_id": 1,
  "table_id": 428,
  "schema_name": "test",
  "table_name": "t2",
  "state": 6,
  "warning": null,
  "err": null,
  "err_count": 0,
  "row_count": 0,
  "raw_args": null,
  "schema_state": 5,
  "snapshot_ver": 0,
  "real_start_ts": 441579178515759110,
  "start_ts": 441579178502389765,
  "dependency_id": 0,
  "query": "alter table t2 placement policy hisdata_ods_table_2constraints_1",
  "binlog": {
   "SchemaVersion": 288,
   "DBInfo": null,
   "TableInfo": {
    "id": 428,
    "name": {
     "O": "t2",
     "L": "t2"
    },
    "charset": "utf8mb4",
    "collate": "utf8mb4_bin",
    "cols": [
     {
      "id": 1,
      "name": {
       "O": "id",
       "L": "id"
      },
      "offset": 0,
      "origin_default": null,
      "origin_default_bit": null,
      "default": null,
      "default_bit": null,
      "default_is_expr": false,
      "generated_expr_string": "",
      "generated_stored": false,
      "dependences": null,
      "type": {
       "Tp": 3,
       "Flag": 0,
       "Flen": 11,
       "Decimal": 0,
       "Charset": "binary",
       "Collate": "binary",
       "Elems": null,
       "ElemsIsBinaryLit": null
      },
      "state": 5,
      "comment": "",
      "hidden": false,
      "change_state_info": null,
      "version": 2
     },
     {
      "id": 2,
      "name": {
       "O": "name",
       "L": "name"
      },
      "offset": 1,
      "origin_default": null,
      "origin_default_bit": null,
      "default": null,
      "default_bit": null,
      "default_is_expr": false,
      "generated_expr_string": "",
      "generated_stored": false,
      "dependences": null,
      "type": {
       "Tp": 254,
       "Flag": 0,
       "Flen": 10,
       "Decimal": 0,
       "Charset": "utf8mb4",
       "Collate": "utf8mb4_bin",
       "Elems": null,
       "ElemsIsBinaryLit": null
      },
      "state": 5,
      "comment": "",
      "hidden": false,
      "change_state_info": null,
      "version": 2
     },
     {
      "id": 3,
      "name": {
       "O": "salary",
       "L": "salary"
      },
      "offset": 2,
      "origin_default": null,
      "origin_default_bit": null,
      "default": null,
      "default_bit": null,
      "default_is_expr": false,
      "generated_expr_string": "",
      "generated_stored": false,
      "dependences": null,
      "type": {
       "Tp": 3,
       "Flag": 0,
       "Flen": 11,
       "Decimal": 0,
       "Charset": "binary",
       "Collate": "binary",
       "Elems": null,
       "ElemsIsBinaryLit": null
      },
      "state": 5,
      "comment": "",
      "hidden": false,
      "change_state_info": null,
      "version": 2
     }
    ],
    "index_info": null,
    "constraint_info": null,
    "fk_info": null,
    "state": 5,
    "pk_is_handle": false,
    "is_common_handle": false,
    "common_handle_version": 0,
    "comment": "",
    "auto_inc_id": 0,
    "auto_id_cache": 0,
    "auto_rand_id": 0,
    "max_col_id": 3,
    "max_idx_id": 0,
    "max_fk_id": 0,
    "max_cst_id": 0,
    "update_timestamp": 441579178515759110,
    "ShardRowIDBits": 0,
    "max_shard_row_id_bits": 0,
    "auto_random_bits": 0,
    "auto_random_range_bits": 0,
    "pre_split_regions": 0,
    "partition": {
     "type": 1,
     "expr": "`salary`",
     "columns": null,
     "enable": true,
     "definitions": [
      {
       "id": 429,
       "name": {
        "O": "p1",
        "L": "p1"
       },
       "less_than": [
        "5000"
       ],
       "in_values": null,
       "policy_ref_info": null
      },
      {
       "id": 430,
       "name": {
        "O": "p2",
        "L": "p2"
       },
       "less_than": [
        "10000"
       ],
       "in_values": null,
       "policy_ref_info": null
      }
     ],
     "adding_definitions": null,
     "dropping_definitions": null,
     "states": null,
     "num": 2
    },
    "compression": "",
    "view": null,
    "sequence": null,
    "Lock": null,
    "version": 5,
    "tiflash_replica": null,
    "is_columnar": false,
    "temp_table_type": 0,
    "cache_table_status": 0,
    "policy_ref_info": {
     "id": 1,
     "name": {
      "O": "hisdata_ods_table_2constraints_1",
      "L": "hisdata_ods_table_2constraints_1"
     }
    },
    "stats_options": null,
    "exchange_partition_info": null,
    "ttl_info": null
   },
   "FinishedTS": 441579178541973509,
   "MultipleTableInfos": null
  },
  "version": 1,
  "reorg_meta": null,
  "multi_schema_info": null,
  "priority": 0,
  "seq_num": 222,
  "charset": "",
  "collate": ""
 },
 {
  "id": 431,
  "type": 3,
  "schema_id": 1,
  "table_id": 428,
  "schema_name": "test",
  "table_name": "t2",
  "state": 6,
  "warning": null,
  "err": null,
  "err_count": 0,
  "row_count": 0,
  "raw_args": null,
  "schema_state": 5,
  "snapshot_ver": 0,
  "real_start_ts": 441579174006620163,
  "start_ts": 441579173993512969,
  "dependency_id": 0,
  "query": "create table t2(id int ,name char(10),salary int) partition by range (salary)(partition p1 values less than (5000),partition p2 values less than (10000))",
  "binlog": {
   "SchemaVersion": 287,
   "DBInfo": null,
   "TableInfo": {
    "id": 428,
    "name": {
     "O": "t2",
     "L": "t2"
    },
    "charset": "utf8mb4",
    "collate": "utf8mb4_bin",
    "cols": [
     {
      "id": 1,
      "name": {
       "O": "id",
       "L": "id"
      },
      "offset": 0,
      "origin_default": null,
      "origin_default_bit": null,
      "default": null,
      "default_bit": null,
      "default_is_expr": false,
      "generated_expr_string": "",
      "generated_stored": false,
      "dependences": null,
      "type": {
       "Tp": 3,
       "Flag": 0,
       "Flen": 11,
       "Decimal": 0,
       "Charset": "binary",
       "Collate": "binary",
       "Elems": null,
       "ElemsIsBinaryLit": null
      },
      "state": 5,
      "comment": "",
      "hidden": false,
      "change_state_info": null,
      "version": 2
     },
     {
      "id": 2,
      "name": {
       "O": "name",
       "L": "name"
      },
      "offset": 1,
      "origin_default": null,
      "origin_default_bit": null,
      "default": null,
      "default_bit": null,
      "default_is_expr": false,
      "generated_expr_string": "",
      "generated_stored": false,
      "dependences": null,
      "type": {
       "Tp": 254,
       "Flag": 0,
       "Flen": 10,
       "Decimal": 0,
       "Charset": "utf8mb4",
       "Collate": "utf8mb4_bin",
       "Elems": null,
       "ElemsIsBinaryLit": null
      },
      "state": 5,
      "comment": "",
      "hidden": false,
      "change_state_info": null,
      "version": 2
     },
     {
      "id": 3,
      "name": {
       "O": "salary",
       "L": "salary"
      },
      "offset": 2,
      "origin_default": null,
      "origin_default_bit": null,
      "default": null,
      "default_bit": null,
      "default_is_expr": false,
      "generated_expr_string": "",
      "generated_stored": false,
      "dependences": null,
      "type": {
       "Tp": 3,
       "Flag": 0,
       "Flen": 11,
       "Decimal": 0,
       "Charset": "binary",
       "Collate": "binary",
       "Elems": null,
       "ElemsIsBinaryLit": null
      },
      "state": 5,
      "comment": "",
      "hidden": false,
      "change_state_info": null,
      "version": 2
     }
    ],
    "index_info": null,
    "constraint_info": null,
    "fk_info": null,
    "state": 5,
    "pk_is_handle": false,
    "is_common_handle": false,
    "common_handle_version": 0,
    "comment": "",
    "auto_inc_id": 0,
    "auto_id_cache": 0,
    "auto_rand_id": 0,
    "max_col_id": 3,
    "max_idx_id": 0,
    "max_fk_id": 0,
    "max_cst_id": 0,
    "update_timestamp": 441579174006620163,
    "ShardRowIDBits": 0,
    "max_shard_row_id_bits": 0,
    "auto_random_bits": 0,
    "auto_random_range_bits": 0,
    "pre_split_regions": 0,
    "partition": {
     "type": 1,
     "expr": "`salary`",
     "columns": null,
     "enable": true,
     "definitions": [
      {
       "id": 429,
       "name": {
        "O": "p1",
        "L": "p1"
       },
       "less_than": [
        "5000"
       ],
       "in_values": null,
       "policy_ref_info": null
      },
      {
       "id": 430,
       "name": {
        "O": "p2",
        "L": "p2"
       },
       "less_than": [
        "10000"
       ],
       "in_values": null,
       "policy_ref_info": null
      }
     ],
     "adding_definitions": null,
     "dropping_definitions": null,
     "states": null,
     "num": 2
    },
    "compression": "",
    "view": null,
    "sequence": null,
    "Lock": null,
    "version": 5,
    "tiflash_replica": null,
    "is_columnar": false,
    "temp_table_type": 0,
    "cache_table_status": 0,
    "policy_ref_info": null,
    "stats_options": null,
    "exchange_partition_info": null,
    "ttl_info": null
   },
   "FinishedTS": 441579174019727365,
   "MultipleTableInfos": null
  },
  "version": 1,
  "reorg_meta": null,
  "multi_schema_info": null,
  "priority": 0,
  "seq_num": 221,
  "charset": "",
  "collate": ""
 },
 {
  "id": 427,
  "type": 4,
  "schema_id": 1,
  "table_id": 212,
  "schema_name": "test",
  "table_name": "t2",
  "state": 6,
  "warning": null,
  "err": null,
  "err_count": 0,
  "row_count": 0,
  "raw_args": [
   "dIAAAAAAAADU",
   [],
   [
    "schema/test/t2"
   ]
  ],
  "schema_state": 0,
  "snapshot_ver": 0,
  "real_start_ts": 441579109453660161,
  "start_ts": 441579109440815108,
  "dependency_id": 0,
  "query": "drop table t2",
  "binlog": {
   "SchemaVersion": 286,
   "DBInfo": null,
   "TableInfo": {
    "id": 212,
    "name": {
     "O": "t2",
     "L": "t2"
    },
    "charset": "gbk",
    "collate": "gbk_chinese_ci",
    "cols": [
     {
      "id": 1,
      "name": {
       "O": "id",
       "L": "id"
      },
      "offset": 0,
      "origin_default": null,
      "origin_default_bit": null,
      "default": null,
      "default_bit": null,
      "default_is_expr": false,
      "generated_expr_string": "",
      "generated_stored": false,
      "dependences": null,
      "type": {
       "Tp": 3,
       "Flag": 0,
       "Flen": 11,
       "Decimal": 0,
       "Charset": "binary",
       "Collate": "binary",
       "Elems": null,
       "ElemsIsBinaryLit": null
      },
      "state": 5,
      "comment": "",
      "hidden": false,
      "change_state_info": null,
      "version": 2
     }
    ],
    "index_info": null,
    "constraint_info": null,
    "fk_info": null,
    "state": 0,
    "pk_is_handle": false,
    "is_common_handle": false,
    "common_handle_version": 0,
    "comment": "",
    "auto_inc_id": 0,
    "auto_id_cache": 0,
    "auto_rand_id": 0,
    "max_col_id": 1,
    "max_idx_id": 0,
    "max_fk_id": 0,
    "max_cst_id": 0,
    "update_timestamp": 440607314893602820,
    "ShardRowIDBits": 0,
    "max_shard_row_id_bits": 0,
    "auto_random_bits": 0,
    "auto_random_range_bits": 0,
    "pre_split_regions": 0,
    "partition": null,
    "compression": "",
    "view": null,
    "sequence": null,
    "Lock": null,
    "version": 4,
    "tiflash_replica": null,
    "is_columnar": false,
    "temp_table_type": 0,
    "cache_table_status": 0,
    "policy_ref_info": null,
    "stats_options": null,
    "exchange_partition_info": null,
    "ttl_info": null
   },
   "FinishedTS": 441579109532303365,
   "MultipleTableInfos": null
  },
  "version": 1,
  "reorg_meta": null,
  "multi_schema_info": null,
  "priority": 0,
  "seq_num": 220,
  "charset": "",
  "collate": ""
 },
 {
  "id": 426,
  "type": 56,
  "schema_id": 1,
  "table_id": 424,
  "schema_name": "test",
  "table_name": "t1",
  "state": 6,
  "warning": null,
  "err": null,
  "err_count": 0,
  "row_count": 0,
  "raw_args": null,
  "schema_state": 5,
  "snapshot_ver": 0,
  "real_start_ts": 441579057470767107,
  "start_ts": 441579057457659908,
  "dependency_id": 0,
  "query": "alter table t1 placement policy hisdata_ods_table_2constraints_1",
  "binlog": {
   "SchemaVersion": 283,
   "DBInfo": null,
   "TableInfo": {
    "id": 424,
    "name": {
     "O": "t1",
     "L": "t1"
    },
    "charset": "utf8mb4",
    "collate": "utf8mb4_bin",
    "cols": [
     {
      "id": 1,
      "name": {
       "O": "id",
       "L": "id"
      },
      "offset": 0,
      "origin_default": null,
      "origin_default_bit": null,
      "default": null,
      "default_bit": null,
      "default_is_expr": false,
      "generated_expr_string": "",
      "generated_stored": false,
      "dependences": null,
      "type": {
       "Tp": 3,
       "Flag": 0,
       "Flen": 11,
       "Decimal": 0,
       "Charset": "binary",
       "Collate": "binary",
       "Elems": null,
       "ElemsIsBinaryLit": null
      },
      "state": 5,
      "comment": "",
      "hidden": false,
      "change_state_info": null,
      "version": 2
     },
     {
      "id": 2,
      "name": {
       "O": "name",
       "L": "name"
      },
      "offset": 1,
      "origin_default": null,
      "origin_default_bit": null,
      "default": null,
      "default_bit": null,
      "default_is_expr": false,
      "generated_expr_string": "",
      "generated_stored": false,
      "dependences": null,
      "type": {
       "Tp": 254,
       "Flag": 0,
       "Flen": 10,
       "Decimal": 0,
       "Charset": "utf8mb4",
       "Collate": "utf8mb4_bin",
       "Elems": null,
       "ElemsIsBinaryLit": null
      },
      "state": 5,
      "comment": "",
      "hidden": false,
      "change_state_info": null,
      "version": 2
     },
     {
      "id": 3,
      "name": {
       "O": "salary",
       "L": "salary"
      },
      "offset": 2,
      "origin_default": null,
      "origin_default_bit": null,
      "default": null,
      "default_bit": null,
      "default_is_expr": false,
      "generated_expr_string": "",
      "generated_stored": false,
      "dependences": null,
      "type": {
       "Tp": 15,
       "Flag": 0,
       "Flen": 10,
       "Decimal": 0,
       "Charset": "utf8mb4",
       "Collate": "utf8mb4_bin",
       "Elems": null,
       "ElemsIsBinaryLit": null
      },
      "state": 5,
      "comment": "",
      "hidden": false,
      "change_state_info": null,
      "version": 2
     }
    ],
    "index_info": null,
    "constraint_info": null,
    "fk_info": null,
    "state": 5,
    "pk_is_handle": false,
    "is_common_handle": false,
    "common_handle_version": 0,
    "comment": "",
    "auto_inc_id": 0,
    "auto_id_cache": 0,
    "auto_rand_id": 0,
    "max_col_id": 3,
    "max_idx_id": 0,
    "max_fk_id": 0,
    "max_cst_id": 0,
    "update_timestamp": 441579057470767107,
    "ShardRowIDBits": 0,
    "max_shard_row_id_bits": 0,
    "auto_random_bits": 0,
    "auto_random_range_bits": 0,
    "pre_split_regions": 0,
    "partition": null,
    "compression": "",
    "view": null,
    "sequence": null,
    "Lock": null,
    "version": 5,
    "tiflash_replica": null,
    "is_columnar": false,
    "temp_table_type": 0,
    "cache_table_status": 0,
    "policy_ref_info": {
     "id": 1,
     "name": {
      "O": "hisdata_ods_table_2constraints_1",
      "L": "hisdata_ods_table_2constraints_1"
     }
    },
    "stats_options": null,
    "exchange_partition_info": null,
    "ttl_info": null
   },
   "FinishedTS": 441579057496719369,
   "MultipleTableInfos": null
  },
  "version": 1,
  "reorg_meta": null,
  "multi_schema_info": null,
  "priority": 0,
  "seq_num": 219,
  "charset": "",
  "collate": ""
 },
 {
  "id": 425,
  "type": 3,
  "schema_id": 1,
  "table_id": 424,
  "schema_name": "test",
  "table_name": "t1",
  "state": 6,
  "warning": null,
  "err": null,
  "err_count": 0,
  "row_count": 0,
  "raw_args": null,
  "schema_state": 5,
  "snapshot_ver": 0,
  "real_start_ts": 441579051795087375,
  "start_ts": 441579051795087363,
  "dependency_id": 0,
  "query": "create table t1(id int ,name char(10),salary varchar(10))",
  "binlog": {
   "SchemaVersion": 282,
   "DBInfo": null,
   "TableInfo": {
    "id": 424,
    "name": {
     "O": "t1",
     "L": "t1"
    },
    "charset": "utf8mb4",
    "collate": "utf8mb4_bin",
    "cols": [
     {
      "id": 1,
      "name": {
       "O": "id",
       "L": "id"
      },
      "offset": 0,
      "origin_default": null,
      "origin_default_bit": null,
      "default": null,
      "default_bit": null,
      "default_is_expr": false,
      "generated_expr_string": "",
      "generated_stored": false,
      "dependences": null,
      "type": {
       "Tp": 3,
       "Flag": 0,
       "Flen": 11,
       "Decimal": 0,
       "Charset": "binary",
       "Collate": "binary",
       "Elems": null,
       "ElemsIsBinaryLit": null
      },
      "state": 5,
      "comment": "",
      "hidden": false,
      "change_state_info": null,
      "version": 2
     },
     {
      "id": 2,
      "name": {
       "O": "name",
       "L": "name"
      },
      "offset": 1,
      "origin_default": null,
      "origin_default_bit": null,
      "default": null,
      "default_bit": null,
      "default_is_expr": false,
      "generated_expr_string": "",
      "generated_stored": false,
      "dependences": null,
      "type": {
       "Tp": 254,
       "Flag": 0,
       "Flen": 10,
       "Decimal": 0,
       "Charset": "utf8mb4",
       "Collate": "utf8mb4_bin",
       "Elems": null,
       "ElemsIsBinaryLit": null
      },
      "state": 5,
      "comment": "",
      "hidden": false,
      "change_state_info": null,
      "version": 2
     },
     {
      "id": 3,
      "name": {
       "O": "salary",
       "L": "salary"
      },
      "offset": 2,
      "origin_default": null,
      "origin_default_bit": null,
      "default": null,
      "default_bit": null,
      "default_is_expr": false,
      "generated_expr_string": "",
      "generated_stored": false,
      "dependences": null,
      "type": {
       "Tp": 15,
       "Flag": 0,
       "Flen": 10,
       "Decimal": 0,
       "Charset": "utf8mb4",
       "Collate": "utf8mb4_bin",
       "Elems": null,
       "ElemsIsBinaryLit": null
      },
      "state": 5,
      "comment": "",
      "hidden": false,
      "change_state_info": null,
      "version": 2
     }
    ],
    "index_info": null,
    "constraint_info": null,
    "fk_info": null,
    "state": 5,
    "pk_is_handle": false,
    "is_common_handle": false,
    "common_handle_version": 0,
    "comment": "",
    "auto_inc_id": 0,
    "auto_id_cache": 0,
    "auto_rand_id": 0,
    "max_col_id": 3,
    "max_idx_id": 0,
    "max_fk_id": 0,
    "max_cst_id": 0,
    "update_timestamp": 441579051795087375,
    "ShardRowIDBits": 0,
    "max_shard_row_id_bits": 0,
    "auto_random_bits": 0,
    "auto_random_range_bits": 0,
    "pre_split_regions": 0,
    "partition": null,
    "compression": "",
    "view": null,
    "sequence": null,
    "Lock": null,
    "version": 5,
    "tiflash_replica": null,
    "is_columnar": false,
    "temp_table_type": 0,
    "cache_table_status": 0,
    "policy_ref_info": null,
    "stats_options": null,
    "exchange_partition_info": null,
    "ttl_info": null
   },
   "FinishedTS": 441579051821301765,
   "MultipleTableInfos": null
  },
  "version": 1,
  "reorg_meta": null,
  "multi_schema_info": null,
  "priority": 0,
  "seq_num": 218,
  "charset": "",
  "collate": ""
 }

4. What is your TiDB version? (Required)

@tiancaiamao tiancaiamao added the type/bug The issue is confirmed as a bug. label May 22, 2023
@ti-chi-bot ti-chi-bot bot added may-affects-5.1 This bug maybe affects 5.1.x versions. may-affects-5.2 This bug maybe affects 5.2.x versions. may-affects-5.3 This bug maybe affects 5.3.x versions. may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-6.1 may-affects-6.5 may-affects-7.1 labels May 22, 2023
@lcwangchao lcwangchao added affects-6.1 affects-6.2 affects-6.3 affects-6.4 affects-6.5 affects-6.6 affects-7.0 affects-7.1 and removed may-affects-5.1 This bug maybe affects 5.1.x versions. may-affects-5.2 This bug maybe affects 5.2.x versions. may-affects-5.3 This bug maybe affects 5.3.x versions. may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-6.1 may-affects-6.5 may-affects-7.1 labels May 22, 2023
ti-chi-bot bot pushed a commit that referenced this issue May 22, 2023
ti-chi-bot bot pushed a commit that referenced this issue May 23, 2023
@jebter jebter added the sig/sql-infra SIG: SQL Infra label May 23, 2023
ti-chi-bot bot pushed a commit that referenced this issue May 23, 2023
lcwangchao pushed a commit to lcwangchao/tidb that referenced this issue May 24, 2023
ti-chi-bot bot pushed a commit that referenced this issue May 24, 2023
@VelocityLight VelocityLight added the affects-5.4 This bug affects 5.4.x versions. label May 26, 2023
ti-chi-bot bot pushed a commit that referenced this issue May 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants