From 52baefcba4577fd54788e417fabf3815a4d06164 Mon Sep 17 00:00:00 2001 From: Han Fei Date: Mon, 22 Jul 2019 17:00:57 +0800 Subject: [PATCH] add schema_version for TableInfo (#122) * add schema_version for TableInfo In order to make read procedure more efficiently. * address comment * pass all tests --- .../Storages/Transaction/SchemaBuilder.cpp | 4 +- dbms/src/Storages/Transaction/SchemaBuilder.h | 8 ++-- dbms/src/Storages/Transaction/TiDB.cpp | 5 +++ .../Storages/Transaction/TiDBSchemaSyncer.h | 8 ++-- .../Storages/Transaction/tests/table_info.cpp | 39 ++++++++++--------- 5 files changed, 37 insertions(+), 27 deletions(-) diff --git a/dbms/src/Storages/Transaction/SchemaBuilder.cpp b/dbms/src/Storages/Transaction/SchemaBuilder.cpp index 4524fe71411..d3309623490 100644 --- a/dbms/src/Storages/Transaction/SchemaBuilder.cpp +++ b/dbms/src/Storages/Transaction/SchemaBuilder.cpp @@ -82,6 +82,7 @@ inline AlterCommands detectSchemaChanges(Logger * log, const TiDB::TableInfo & t void SchemaBuilder::applyAlterTableImpl(TiDB::TableInfoPtr table_info, const String & db_name, StorageMergeTree * storage) { + table_info->schema_version = target_version; auto orig_table_info = storage->getTableInfo(); auto commands = detectSchemaChanges(log, *table_info, orig_table_info); @@ -308,8 +309,9 @@ void SchemaBuilder::applyCreateTable(TiDB::DBInfoPtr db_info, Int64 table_id) applyCreateTableImpl(*db_info, *table_info); } -void SchemaBuilder::applyCreateTableImpl(const TiDB::DBInfo & db_info, const TiDB::TableInfo & table_info) +void SchemaBuilder::applyCreateTableImpl(const TiDB::DBInfo & db_info, TiDB::TableInfo & table_info) { + table_info.schema_version = target_version; if (table_info.is_partition_table) { // create partition table. diff --git a/dbms/src/Storages/Transaction/SchemaBuilder.h b/dbms/src/Storages/Transaction/SchemaBuilder.h index bc2c1d6a267..60c374e2115 100644 --- a/dbms/src/Storages/Transaction/SchemaBuilder.h +++ b/dbms/src/Storages/Transaction/SchemaBuilder.h @@ -16,10 +16,12 @@ struct SchemaBuilder std::unordered_map & databases; + Int64 target_version; + Logger * log; - SchemaBuilder(SchemaGetter & getter_, Context & context_, std::unordered_map & dbs_) - : getter(getter_), context(context_), databases(dbs_), log(&Logger::get("SchemaBuilder")) + SchemaBuilder(SchemaGetter & getter_, Context & context_, std::unordered_map & dbs_, Int64 version) + : getter(getter_), context(context_), databases(dbs_), target_version(version), log(&Logger::get("SchemaBuilder")) {} void applyDiff(const SchemaDiff & diff); @@ -47,7 +49,7 @@ struct SchemaBuilder void applyCreatePhysicalTableImpl(const TiDB::DBInfo & db_info, const TiDB::TableInfo & table_info); - void applyCreateTableImpl(const TiDB::DBInfo & db_info, const TiDB::TableInfo & table_info); + void applyCreateTableImpl(const TiDB::DBInfo & db_info, TiDB::TableInfo & table_info); void applyDropTableImpl(const String &, const String &); }; diff --git a/dbms/src/Storages/Transaction/TiDB.cpp b/dbms/src/Storages/Transaction/TiDB.cpp index fcd8ba3b9a6..aec88397c61 100644 --- a/dbms/src/Storages/Transaction/TiDB.cpp +++ b/dbms/src/Storages/Transaction/TiDB.cpp @@ -255,6 +255,8 @@ String TableInfo::serialize(bool escaped) const try json->set("partition", Poco::Dynamic::Var()); } + json->set("schema_version", schema_version); + json->stringify(buf); if (!escaped) @@ -329,6 +331,9 @@ void TableInfo::deserialize(const String & json_str) try belonging_table_id = obj->getValue("belonging_table_id"); partition.deserialize(partition_obj); } + if (obj->has("schema_version")) { + schema_version = obj->getValue("schema_version"); + } } catch (const Poco::Exception & e) { diff --git a/dbms/src/Storages/Transaction/TiDBSchemaSyncer.h b/dbms/src/Storages/Transaction/TiDBSchemaSyncer.h index 0f3c29a2cd1..eefe2fb93ce 100644 --- a/dbms/src/Storages/Transaction/TiDBSchemaSyncer.h +++ b/dbms/src/Storages/Transaction/TiDBSchemaSyncer.h @@ -46,7 +46,7 @@ struct TiDBSchemaSyncer : public SchemaSyncer LOG_INFO(log, "try to sync schema version to: " + std::to_string(version)); if (!tryLoadSchemaDiffs(getter, version, context)) { - loadAllSchema(getter, context); + loadAllSchema(getter, version, context); } cur_version = version; return true; @@ -61,7 +61,7 @@ struct TiDBSchemaSyncer : public SchemaSyncer LOG_DEBUG(log, "try load schema diffs."); - SchemaBuilder builder(getter, context, databases); + SchemaBuilder builder(getter, context, databases, version); Int64 used_version = cur_version; std::vector diffs; @@ -78,7 +78,7 @@ struct TiDBSchemaSyncer : public SchemaSyncer return true; } - bool loadAllSchema(SchemaGetter & getter, Context & context) + bool loadAllSchema(SchemaGetter & getter, Int64 version, Context & context) { LOG_DEBUG(log, "try load all schemas."); @@ -89,7 +89,7 @@ struct TiDBSchemaSyncer : public SchemaSyncer LOG_DEBUG(log, "Load schema : " + db_info->name); } - SchemaBuilder builder(getter, context, databases); + SchemaBuilder builder(getter, context, databases, version); std::set db_ids; for (auto db : all_schema) diff --git a/dbms/src/Storages/Transaction/tests/table_info.cpp b/dbms/src/Storages/Transaction/tests/table_info.cpp index 078f54bd102..53ab08a6b8d 100644 --- a/dbms/src/Storages/Transaction/tests/table_info.cpp +++ b/dbms/src/Storages/Transaction/tests/table_info.cpp @@ -29,29 +29,30 @@ struct Case void verifyTableInfo() const { DBInfo db_info(db_info_json); - TableInfo tmp(table_info_json); - TableInfo table_info1 = tmp.producePartitionTableInfo(table_or_partition_id); - auto json1 = table_info1.serialize(false); + TableInfo table_info(table_info_json); + if (table_info.is_partition_table) + table_info = table_info.producePartitionTableInfo(table_or_partition_id); + auto json1 = table_info.serialize(false); TableInfo table_info2(json1); auto json2 = table_info2.serialize(false); if (json1 != json2) { throw Exception("Table info unescaped serde mismatch:\n" + json1 + "\n" + json2); } - String stmt = createTableStmt(db_info, table_info1); + String stmt = createTableStmt(db_info, table_info); if (stmt != create_stmt) { throw Exception("Table info create statement mismatch:\n" + stmt + "\n" + create_stmt); } ParserCreateQuery parser; - ASTPtr ast = parseQuery(parser, stmt.data(), stmt.data() + stmt.size(), "from verifyTableInfo " + table_info1.name, 0); + ASTPtr ast = parseQuery(parser, stmt.data(), stmt.data() + stmt.size(), "from verifyTableInfo " + table_info.name, 0); ASTCreateQuery & ast_create_query = typeid_cast(*ast); ASTExpressionList & ast_arguments = typeid_cast(*(ast_create_query.storage->engine->arguments)); ASTLiteral & ast_literal = typeid_cast(*(ast_arguments.children.back())); json1 = safeGet(ast_literal.value); - table_info1.deserialize(json1); - json2 = table_info1.serialize(false); + table_info.deserialize(json1); + json2 = table_info.serialize(false); if (json1 != json2) { throw Exception("Table info escaped serde mismatch:\n" + json1 + "\n" + json2); @@ -65,43 +66,43 @@ int main(int, char **) try Case{ 2049, R"json({"id":1939,"db_name":{"O":"customer","L":"customer"},"charset":"utf8mb4","collate":"utf8mb4_bin","state":5})json", - R"json({"id":2049,"name":{"O":"customerdebt","L":"customerdebt"},"cols":[{"id":1,"name":{"O":"id","L":"id"},"offset":0,"origin_default":null,"default":null,"type":{"Tp":8,"Flag":515,"Flen":20,"Decimal":0},"state":5,"comment":"i\"d"}],"state":5,"pk_is_handle":true,"comment":"负债信息","update_timestamp":404545295996944390,"partition":null})json", - R"stmt(CREATE TABLE `customer`.`customerdebt`(`id` Int64) Engine = TxnMergeTree((`id`), 8192, '{"cols":[{"comment":"i\\"d","default":null,"id":1,"name":{"L":"id","O":"id"},"offset":0,"origin_default":null,"state":5,"type":{"Decimal":0,"Elems":null,"Flag":515,"Flen":20,"Tp":8}}],"comment":"\\u8D1F\\u503A\\u4FE1\\u606F","id":2049,"name":{"L":"customerdebt","O":"customerdebt"},"partition":null,"pk_is_handle":true,"state":5,"update_timestamp":404545295996944390}'))stmt" + R"json({"id":2049,"name":{"O":"customerdebt","L":"customerdebt"},"cols":[{"id":1,"name":{"O":"id","L":"id"},"offset":0,"origin_default":null,"default":null,"type":{"Tp":8,"Flag":515,"Flen":20,"Decimal":0},"state":5,"comment":"i\"d"}],"state":5,"pk_is_handle":true,"schema_version":-1,"comment":"负债信息","update_timestamp":404545295996944390,"partition":null})json", + R"stmt(CREATE TABLE `customer`.`customerdebt`(`id` Int64) Engine = TxnMergeTree((`id`), 8192, '{"cols":[{"comment":"i\\"d","default":null,"id":1,"name":{"L":"id","O":"id"},"offset":0,"origin_default":null,"state":5,"type":{"Decimal":0,"Elems":null,"Flag":515,"Flen":20,"Tp":8}}],"comment":"\\u8D1F\\u503A\\u4FE1\\u606F","id":2049,"name":{"L":"customerdebt","O":"customerdebt"},"partition":null,"pk_is_handle":true,"schema_version":-1,"state":5,"update_timestamp":404545295996944390}'))stmt" }, Case { 31, R"json({"id":1,"db_name":{"O":"db1","L":"db1"},"charset":"utf8mb4","collate":"utf8mb4_bin","state":5})json", - R"json({"id":31,"name":{"O":"simple_t","L":"simple_t"},"charset":"","collate":"","cols":[{"id":1,"name":{"O":"i","L":"i"},"offset":0,"origin_default":null,"default":null,"generated_expr_string":"","generated_stored":false,"dependences":null,"type":{"Tp":3,"Flag":0,"Flen":11,"Decimal":0,"Charset":"binary","Collate":"binary","Elems":null},"state":5,"comment":""}],"index_info":null,"fk_info":null,"state":5,"pk_is_handle":false,"comment":"","auto_inc_id":0,"max_col_id":1,"max_idx_id":0,"update_timestamp":404545295996944390,"ShardRowIDBits":0,"partition":null})json", - R"stmt(CREATE TABLE `db1`.`simple_t`(`i` Nullable(Int32), `_tidb_rowid` Int64) Engine = TxnMergeTree((`_tidb_rowid`), 8192, '{"cols":[{"comment":"","default":null,"id":1,"name":{"L":"i","O":"i"},"offset":0,"origin_default":null,"state":5,"type":{"Decimal":0,"Elems":null,"Flag":0,"Flen":11,"Tp":3}}],"comment":"","id":31,"name":{"L":"simple_t","O":"simple_t"},"partition":null,"pk_is_handle":false,"state":5,"update_timestamp":404545295996944390}'))stmt" + R"json({"id":31,"name":{"O":"simple_t","L":"simple_t"},"charset":"","collate":"","cols":[{"id":1,"name":{"O":"i","L":"i"},"offset":0,"origin_default":null,"default":null,"generated_expr_string":"","generated_stored":false,"dependences":null,"type":{"Tp":3,"Flag":0,"Flen":11,"Decimal":0,"Charset":"binary","Collate":"binary","Elems":null},"state":5,"comment":""}],"index_info":null,"fk_info":null,"state":5,"pk_is_handle":false,"schema_version":-1,"comment":"","auto_inc_id":0,"max_col_id":1,"max_idx_id":0,"update_timestamp":404545295996944390,"ShardRowIDBits":0,"partition":null})json", + R"stmt(CREATE TABLE `db1`.`simple_t`(`i` Nullable(Int32), `_tidb_rowid` Int64) Engine = TxnMergeTree((`_tidb_rowid`), 8192, '{"cols":[{"comment":"","default":null,"id":1,"name":{"L":"i","O":"i"},"offset":0,"origin_default":null,"state":5,"type":{"Decimal":0,"Elems":null,"Flag":0,"Flen":11,"Tp":3}}],"comment":"","id":31,"name":{"L":"simple_t","O":"simple_t"},"partition":null,"pk_is_handle":false,"schema_version":-1,"state":5,"update_timestamp":404545295996944390}'))stmt" }, Case { 33, R"json({"id":2,"db_name":{"O":"db2","L":"db2"},"charset":"utf8mb4","collate":"utf8mb4_bin","state":5})json", - R"json({"id":33,"name":{"O":"pk_t","L":"pk_t"},"charset":"","collate":"","cols":[{"id":1,"name":{"O":"i","L":"i"},"offset":0,"origin_default":null,"default":null,"generated_expr_string":"","generated_stored":false,"dependences":null,"type":{"Tp":3,"Flag":3,"Flen":11,"Decimal":0,"Charset":"binary","Collate":"binary","Elems":null},"state":5,"comment":""}],"index_info":null,"fk_info":null,"state":5,"pk_is_handle":true,"comment":"","auto_inc_id":0,"max_col_id":1,"max_idx_id":0,"update_timestamp":404545312978108418,"ShardRowIDBits":0,"partition":null})json", - R"stmt(CREATE TABLE `db2`.`pk_t`(`i` Int32) Engine = TxnMergeTree((`i`), 8192, '{"cols":[{"comment":"","default":null,"id":1,"name":{"L":"i","O":"i"},"offset":0,"origin_default":null,"state":5,"type":{"Decimal":0,"Elems":null,"Flag":3,"Flen":11,"Tp":3}}],"comment":"","id":33,"name":{"L":"pk_t","O":"pk_t"},"partition":null,"pk_is_handle":true,"state":5,"update_timestamp":404545312978108418}'))stmt" + R"json({"id":33,"name":{"O":"pk_t","L":"pk_t"},"charset":"","collate":"","cols":[{"id":1,"name":{"O":"i","L":"i"},"offset":0,"origin_default":null,"default":null,"generated_expr_string":"","generated_stored":false,"dependences":null,"type":{"Tp":3,"Flag":3,"Flen":11,"Decimal":0,"Charset":"binary","Collate":"binary","Elems":null},"state":5,"comment":""}],"index_info":null,"fk_info":null,"state":5,"pk_is_handle":true,"schema_version":-1,"comment":"","auto_inc_id":0,"max_col_id":1,"max_idx_id":0,"update_timestamp":404545312978108418,"ShardRowIDBits":0,"partition":null})json", + R"stmt(CREATE TABLE `db2`.`pk_t`(`i` Int32) Engine = TxnMergeTree((`i`), 8192, '{"cols":[{"comment":"","default":null,"id":1,"name":{"L":"i","O":"i"},"offset":0,"origin_default":null,"state":5,"type":{"Decimal":0,"Elems":null,"Flag":3,"Flen":11,"Tp":3}}],"comment":"","id":33,"name":{"L":"pk_t","O":"pk_t"},"partition":null,"pk_is_handle":true,"schema_version":-1,"state":5,"update_timestamp":404545312978108418}'))stmt" }, Case { 35, R"json({"id":1,"db_name":{"O":"db1","L":"db1"},"charset":"utf8mb4","collate":"utf8mb4_bin","state":5})json", - R"json({"id":35,"name":{"O":"not_null_t","L":"not_null_t"},"charset":"","collate":"","cols":[{"id":1,"name":{"O":"i","L":"i"},"offset":0,"origin_default":null,"default":null,"generated_expr_string":"","generated_stored":false,"dependences":null,"type":{"Tp":3,"Flag":4097,"Flen":11,"Decimal":0,"Charset":"binary","Collate":"binary","Elems":null},"state":5,"comment":""}],"index_info":null,"fk_info":null,"state":5,"pk_is_handle":false,"comment":"","auto_inc_id":0,"max_col_id":1,"max_idx_id":0,"update_timestamp":404545324922961926,"ShardRowIDBits":0,"partition":null})json", - R"stmt(CREATE TABLE `db1`.`not_null_t`(`i` Int32, `_tidb_rowid` Int64) Engine = TxnMergeTree((`_tidb_rowid`), 8192, '{"cols":[{"comment":"","default":null,"id":1,"name":{"L":"i","O":"i"},"offset":0,"origin_default":null,"state":5,"type":{"Decimal":0,"Elems":null,"Flag":4097,"Flen":11,"Tp":3}}],"comment":"","id":35,"name":{"L":"not_null_t","O":"not_null_t"},"partition":null,"pk_is_handle":false,"state":5,"update_timestamp":404545324922961926}'))stmt" + R"json({"id":35,"name":{"O":"not_null_t","L":"not_null_t"},"charset":"","collate":"","cols":[{"id":1,"name":{"O":"i","L":"i"},"offset":0,"origin_default":null,"default":null,"generated_expr_string":"","generated_stored":false,"dependences":null,"type":{"Tp":3,"Flag":4097,"Flen":11,"Decimal":0,"Charset":"binary","Collate":"binary","Elems":null},"state":5,"comment":""}],"index_info":null,"fk_info":null,"state":5,"pk_is_handle":false,"schema_version":-1,"comment":"","auto_inc_id":0,"max_col_id":1,"max_idx_id":0,"update_timestamp":404545324922961926,"ShardRowIDBits":0,"partition":null})json", + R"stmt(CREATE TABLE `db1`.`not_null_t`(`i` Int32, `_tidb_rowid` Int64) Engine = TxnMergeTree((`_tidb_rowid`), 8192, '{"cols":[{"comment":"","default":null,"id":1,"name":{"L":"i","O":"i"},"offset":0,"origin_default":null,"state":5,"type":{"Decimal":0,"Elems":null,"Flag":4097,"Flen":11,"Tp":3}}],"comment":"","id":35,"name":{"L":"not_null_t","O":"not_null_t"},"partition":null,"pk_is_handle":false,"schema_version":-1,"state":5,"update_timestamp":404545324922961926}'))stmt" }, Case { 37, R"json({"id":2,"db_name":{"O":"db2","L":"db2"},"charset":"utf8mb4","collate":"utf8mb4_bin","state":5})json", - R"json({"id":37,"name":{"O":"mytable","L":"mytable"},"charset":"","collate":"","cols":[{"id":1,"name":{"O":"mycol","L":"mycol"},"offset":0,"origin_default":null,"default":null,"generated_expr_string":"","generated_stored":false,"dependences":null,"type":{"Tp":15,"Flag":4099,"Flen":256,"Decimal":0,"Charset":"utf8","Collate":"utf8_bin","Elems":null},"state":5,"comment":""}],"index_info":[{"id":1,"idx_name":{"O":"PRIMARY","L":"primary"},"tbl_name":{"O":"","L":""},"idx_cols":[{"name":{"O":"mycol","L":"mycol"},"offset":0,"length":-1}],"is_unique":true,"is_primary":true,"state":5,"comment":"","index_type":1}],"fk_info":null,"state":5,"pk_is_handle":true,"comment":"","auto_inc_id":0,"max_col_id":1,"max_idx_id":1,"update_timestamp":404566455285710853,"ShardRowIDBits":0,"partition":null})json", - R"stmt(CREATE TABLE `db2`.`mytable`(`mycol` String) Engine = TxnMergeTree((`mycol`), 8192, '{"cols":[{"comment":"","default":null,"id":1,"name":{"L":"mycol","O":"mycol"},"offset":0,"origin_default":null,"state":5,"type":{"Decimal":0,"Elems":null,"Flag":4099,"Flen":256,"Tp":15}}],"comment":"","id":37,"name":{"L":"mytable","O":"mytable"},"partition":null,"pk_is_handle":true,"state":5,"update_timestamp":404566455285710853}'))stmt" + R"json({"id":37,"name":{"O":"mytable","L":"mytable"},"charset":"","collate":"","cols":[{"id":1,"name":{"O":"mycol","L":"mycol"},"offset":0,"origin_default":null,"default":null,"generated_expr_string":"","generated_stored":false,"dependences":null,"type":{"Tp":15,"Flag":4099,"Flen":256,"Decimal":0,"Charset":"utf8","Collate":"utf8_bin","Elems":null},"state":5,"comment":""}],"index_info":[{"id":1,"idx_name":{"O":"PRIMARY","L":"primary"},"tbl_name":{"O":"","L":""},"idx_cols":[{"name":{"O":"mycol","L":"mycol"},"offset":0,"length":-1}],"is_unique":true,"is_primary":true,"state":5,"comment":"","index_type":1}],"fk_info":null,"state":5,"pk_is_handle":true,"schema_version":-1,"comment":"","auto_inc_id":0,"max_col_id":1,"max_idx_id":1,"update_timestamp":404566455285710853,"ShardRowIDBits":0,"partition":null})json", + R"stmt(CREATE TABLE `db2`.`mytable`(`mycol` String) Engine = TxnMergeTree((`mycol`), 8192, '{"cols":[{"comment":"","default":null,"id":1,"name":{"L":"mycol","O":"mycol"},"offset":0,"origin_default":null,"state":5,"type":{"Decimal":0,"Elems":null,"Flag":4099,"Flen":256,"Tp":15}}],"comment":"","id":37,"name":{"L":"mytable","O":"mytable"},"partition":null,"pk_is_handle":true,"schema_version":-1,"state":5,"update_timestamp":404566455285710853}'))stmt" }, Case { 32, R"json({"id":1,"db_name":{"O":"test","L":"test"},"charset":"utf8mb4","collate":"utf8mb4_bin","state":5})json", - R"json({"id":31,"name":{"O":"range_part_t","L":"range_part_t"},"charset":"utf8mb4","collate":"utf8mb4_bin","cols":[{"id":1,"name":{"O":"i","L":"i"},"offset":0,"origin_default":null,"default":null,"default_bit":null,"generated_expr_string":"","generated_stored":false,"dependences":null,"type":{"Tp":3,"Flag":0,"Flen":11,"Decimal":0,"Charset":"binary","Collate":"binary","Elems":null},"state":5,"comment":"","version":0}],"index_info":null,"fk_info":null,"state":5,"pk_is_handle":false,"comment":"","auto_inc_id":0,"max_col_id":1,"max_idx_id":0,"update_timestamp":407445773801488390,"ShardRowIDBits":0,"partition":{"type":1,"expr":"`i`","columns":null,"enable":true,"definitions":[{"id":32,"name":{"O":"p0","L":"p0"},"less_than":["0"]},{"id":33,"name":{"O":"p1","L":"p1"},"less_than":["100"]}],"num":0},"compression":"","version":1})json", - R"stmt(CREATE TABLE `test`.`range_part_t_32`(`i` Nullable(Int32), `_tidb_rowid` Int64) Engine = TxnMergeTree((`_tidb_rowid`), 8192, '{"belonging_table_id":31,"cols":[{"comment":"","default":null,"id":1,"name":{"L":"i","O":"i"},"offset":0,"origin_default":null,"state":5,"type":{"Decimal":0,"Elems":null,"Flag":0,"Flen":11,"Tp":3}}],"comment":"","id":32,"is_partition_sub_table":true,"name":{"L":"range_part_t_32","O":"range_part_t_32"},"partition":{"definitions":[{"comment":"","id":32,"name":{"L":"p0","O":"p0"}},{"comment":"","id":33,"name":{"L":"p1","O":"p1"}}],"enable":true,"expr":"`i`","num":0,"type":1},"pk_is_handle":false,"state":5,"update_timestamp":407445773801488390}'))stmt" + R"json({"id":31,"name":{"O":"range_part_t","L":"range_part_t"},"charset":"utf8mb4","collate":"utf8mb4_bin","cols":[{"id":1,"name":{"O":"i","L":"i"},"offset":0,"origin_default":null,"default":null,"default_bit":null,"generated_expr_string":"","generated_stored":false,"dependences":null,"type":{"Tp":3,"Flag":0,"Flen":11,"Decimal":0,"Charset":"binary","Collate":"binary","Elems":null},"state":5,"comment":"","version":0}],"index_info":null,"fk_info":null,"state":5,"pk_is_handle":false,"schema_version":-1,"comment":"","auto_inc_id":0,"max_col_id":1,"max_idx_id":0,"update_timestamp":407445773801488390,"ShardRowIDBits":0,"partition":{"type":1,"expr":"`i`","columns":null,"enable":true,"definitions":[{"id":32,"name":{"O":"p0","L":"p0"},"less_than":["0"]},{"id":33,"name":{"O":"p1","L":"p1"},"less_than":["100"]}],"num":0},"compression":"","version":1})json", + R"stmt(CREATE TABLE `test`.`range_part_t_32`(`i` Nullable(Int32), `_tidb_rowid` Int64) Engine = TxnMergeTree((`_tidb_rowid`), 8192, '{"belonging_table_id":31,"cols":[{"comment":"","default":null,"id":1,"name":{"L":"i","O":"i"},"offset":0,"origin_default":null,"state":5,"type":{"Decimal":0,"Elems":null,"Flag":0,"Flen":11,"Tp":3}}],"comment":"","id":32,"is_partition_sub_table":true,"name":{"L":"range_part_t_32","O":"range_part_t_32"},"partition":{"definitions":[{"comment":"","id":32,"name":{"L":"p0","O":"p0"}},{"comment":"","id":33,"name":{"L":"p1","O":"p1"}}],"enable":true,"expr":"`i`","num":0,"type":1},"pk_is_handle":false,"schema_version":-1,"state":5,"update_timestamp":407445773801488390}'))stmt" } };