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

Refactor DDL Module to support a large number of tables with frequent ddl actions #7437

Merged
merged 88 commits into from
Jun 15, 2023
Merged
Show file tree
Hide file tree
Changes from 66 commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
00a43c5
first commit for demo
hongyunyan May 8, 2023
cd934ed
update code
hongyunyan May 9, 2023
050919b
compile tiflash work
hongyunyan May 10, 2023
00ae54d
Merge branch 'master' of https://github.com/pingcap/tiflash into hong…
hongyunyan May 10, 2023
9f9c183
basically pass the ft, some case still failed
hongyunyan May 15, 2023
00a84cd
update code
hongyunyan May 15, 2023
66cc723
fix some failed ft cases
hongyunyan May 16, 2023
52d36d8
for time metrics:
hongyunyan May 17, 2023
90a5d9c
Merge branch 'master' of https://github.com/pingcap/tiflash into hong…
hongyunyan May 17, 2023
0923fd0
work for performance test
hongyunyan May 22, 2023
37c65ba
basiclly statisfy ft and simple performance test
hongyunyan May 23, 2023
73944d1
add fts
hongyunyan May 29, 2023
c80da8a
fix test
hongyunyan May 30, 2023
eecfaee
fix ut and fix the drop recover issue
hongyunyan May 31, 2023
f1c0534
fix available
hongyunyan May 31, 2023
c390103
fix useless change
hongyunyan May 31, 2023
88d2657
pass all fts
hongyunyan Jun 2, 2023
d7991ff
fix ut and ft
hongyunyan Jun 5, 2023
840e6aa
fix format
hongyunyan Jun 5, 2023
cb066e8
fix conflict
hongyunyan Jun 5, 2023
ec7c4bc
fix format
hongyunyan Jun 5, 2023
3099788
for mvcc get
hongyunyan Jun 5, 2023
af63f29
fix static analysis
hongyunyan Jun 5, 2023
687b5bb
for test
hongyunyan Jun 6, 2023
2280684
for test
hongyunyan Jun 6, 2023
ae6545d
for test
hongyunyan Jun 6, 2023
05b723c
fix test
hongyunyan Jun 6, 2023
afa0503
add new test
hongyunyan Jun 6, 2023
6a7622c
for comment
hongyunyan Jun 6, 2023
522fe7f
update code
hongyunyan Jun 7, 2023
a86fa9e
remove useless change
hongyunyan Jun 7, 2023
0714147
clean code 1
hongyunyan Jun 7, 2023
5d926fc
clean code2
hongyunyan Jun 7, 2023
cf9f38a
clean code3
hongyunyan Jun 7, 2023
393b9fe
clean code
hongyunyan Jun 7, 2023
1f9097c
clean code
hongyunyan Jun 7, 2023
d984c77
clean code
hongyunyan Jun 8, 2023
1947bb1
clean code
hongyunyan Jun 8, 2023
175c2b3
clean code
hongyunyan Jun 8, 2023
7a64a49
clean code
hongyunyan Jun 8, 2023
be085cd
for test
hongyunyan Jun 8, 2023
36b5d5a
clean code
hongyunyan Jun 8, 2023
a32a868
clean code
hongyunyan Jun 9, 2023
665a13f
clean code
hongyunyan Jun 9, 2023
6d97104
fix comments
hongyunyan Jun 12, 2023
36093c0
update code
hongyunyan Jun 12, 2023
2a3b688
remove header
hongyunyan Jun 12, 2023
cd87578
update test
hongyunyan Jun 12, 2023
beb4ff1
update code
hongyunyan Jun 12, 2023
d98a471
update code
hongyunyan Jun 12, 2023
6d38e6b
add ut
hongyunyan Jun 12, 2023
d5247b6
add ut
hongyunyan Jun 12, 2023
05d80f7
update code
hongyunyan Jun 13, 2023
551120c
update code
hongyunyan Jun 13, 2023
5d691ec
fix typo
hongyunyan Jun 13, 2023
4930b22
update comments
hongyunyan Jun 13, 2023
d81e18f
Update dbms/src/TiDB/Schema/TiDBSchemaSyncer.h
hongyunyan Jun 13, 2023
e5d748f
check client-c
hongyunyan Jun 14, 2023
177d6f8
update code
hongyunyan Jun 14, 2023
18d918e
fix comments
hongyunyan Jun 14, 2023
7cf360c
update code
hongyunyan Jun 14, 2023
8cad0ba
support config for bg sync schema interval
hongyunyan Jun 14, 2023
ddc833a
merge conflict
hongyunyan Jun 14, 2023
3e112f3
fix typo
hongyunyan Jun 14, 2023
75c204b
update code
hongyunyan Jun 14, 2023
c8b76a4
fix
hongyunyan Jun 14, 2023
71cb4d2
Unify logging for keyspace
JaySon-Huang Jun 14, 2023
c8bfec4
Refine some logging
JaySon-Huang Jun 14, 2023
8df743c
Refine logging in Builder
JaySon-Huang Jun 14, 2023
6e7bd47
Refine include header
JaySon-Huang Jun 14, 2023
c252a4d
Add comment about empty table
JaySon-Huang Jun 14, 2023
5d6ba29
header
JaySon-Huang Jun 15, 2023
47915cd
Update comments
JaySon-Huang Jun 15, 2023
002fbfc
update comment
JaySon-Huang Jun 15, 2023
22b0cfd
Merge pull request #2 from JaySon-Huang/hongyunyan_ddl_demo
hongyunyan Jun 15, 2023
1a3eeef
Update dbms/src/Debug/MockSchemaNameMapper.h
hongyunyan Jun 15, 2023
434a40f
update comments
hongyunyan Jun 15, 2023
5c1a01c
Merge branch 'hongyunyan_ddl_demo' of https://github.com/hongyunyan/t…
hongyunyan Jun 15, 2023
8ce6146
add log
hongyunyan Jun 15, 2023
9544efe
update
hongyunyan Jun 15, 2023
59cb534
Update dbms/src/Flash/Coprocessor/DAGStorageInterpreter.cpp
hongyunyan Jun 15, 2023
246b839
Update dbms/src/Flash/Coprocessor/DAGStorageInterpreter.cpp
hongyunyan Jun 15, 2023
405454b
Update dbms/src/Flash/Coprocessor/DAGStorageInterpreter.cpp
hongyunyan Jun 15, 2023
ad11d96
Merge branch 'master' into hongyunyan_ddl_demo
ti-chi-bot[bot] Jun 15, 2023
b0e4a1e
add log
hongyunyan Jun 15, 2023
fa293c5
Merge branch 'hongyunyan_ddl_demo' of https://github.com/hongyunyan/t…
hongyunyan Jun 15, 2023
6023c2d
Merge branch 'master' into hongyunyan_ddl_demo
ti-chi-bot[bot] Jun 15, 2023
0382ec1
Merge branch 'master' into hongyunyan_ddl_demo
ti-chi-bot[bot] Jun 15, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions dbms/src/Common/FailPoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,6 @@ namespace DB
M(exception_between_rename_table_data_and_metadata) \
M(exception_between_create_database_meta_and_directory) \
M(exception_before_rename_table_old_meta_removed) \
M(exception_after_step_1_in_exchange_partition) \
M(exception_before_step_2_rename_in_exchange_partition) \
M(exception_after_step_2_in_exchange_partition) \
M(exception_before_step_3_rename_in_exchange_partition) \
M(exception_after_step_3_in_exchange_partition) \
M(region_exception_after_read_from_storage_some_error) \
M(region_exception_after_read_from_storage_all_error) \
M(exception_before_dmfile_remove_encryption) \
Expand Down Expand Up @@ -67,7 +62,6 @@ namespace DB
M(exception_mpp_hash_probe) \
M(exception_before_drop_segment) \
M(exception_after_drop_segment) \
M(exception_between_schema_change_in_the_same_diff) \
M(force_ps_wal_compact) \
M(pause_before_full_gc_prepare) \
M(force_owner_mgr_state) \
Expand Down Expand Up @@ -125,7 +119,6 @@ namespace DB
M(pause_after_copr_streams_acquired) \
M(pause_query_init)


#define APPLY_FOR_RANDOM_FAILPOINTS(M) \
M(random_tunnel_wait_timeout_failpoint) \
M(random_tunnel_write_failpoint) \
Expand Down
3 changes: 1 addition & 2 deletions dbms/src/Common/TiFlashMetrics.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,7 @@ namespace DB
F(type_passthrough_zstd_compression, {"type", "passthrough_zstd_compression"})) \
M(tiflash_schema_version, "Current version of tiflash cached schema", Gauge) \
M(tiflash_schema_applying, "Whether the schema is applying or not (holding lock)", Gauge) \
M(tiflash_schema_apply_count, "Total number of each kinds of apply", Counter, F(type_diff, {"type", "diff"}), \
F(type_full, {"type", "full"}), F(type_failed, {"type", "failed"}), \
M(tiflash_schema_apply_count, "Total number of each kinds of apply", Counter, F(type_failed, {"type", "failed"}), \
F(type_drop_keyspace, {"type", "drop_keyspace"})) \
M(tiflash_schema_trigger_count, "Total number of each kinds of schema sync trigger", Counter, /**/ \
F(type_timer, {"type", "timer"}), F(type_raft_decode, {"type", "raft_decode"}), F(type_cop_read, {"type", "cop_read"})) \
Expand Down
4 changes: 4 additions & 0 deletions dbms/src/Debug/DBGInvoker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ DBGInvoker::DBGInvoker()
regSchemalessFunc("gc_schemas", dbgFuncGcSchemas);
regSchemalessFunc("reset_schemas", dbgFuncResetSchemas);
regSchemalessFunc("is_tombstone", dbgFuncIsTombstone);
regSchemalessFunc("refresh_table_schema", dbgFuncRefreshTableSchema);
regSchemalessFunc("refresh_mapped_table_schema", dbgFuncRefreshMappedTableSchema);

regSchemalessFunc("region_split", MockRaftCommand::dbgFuncRegionBatchSplit);
regSchemalessFunc("region_prepare_merge", MockRaftCommand::dbgFuncPrepareMerge);
Expand Down Expand Up @@ -118,6 +120,8 @@ DBGInvoker::DBGInvoker()

regSchemalessFunc("mapped_database", dbgFuncMappedDatabase);
regSchemalessFunc("mapped_table", dbgFuncMappedTable);
regSchemalessFunc("mapped_table_exists", dbgFuncTableExists);
regSchemalessFunc("mapped_database_exists", dbgFuncDatabaseExists);
regSchemafulFunc("query_mapped", dbgFuncQueryMapped);
regSchemalessFunc("get_tiflash_replica_count", dbgFuncGetTiflashReplicaCount);
regSchemalessFunc("get_partition_tables_tiflash_replica_count", dbgFuncGetPartitionTablesTiflashReplicaCount);
Expand Down
2 changes: 1 addition & 1 deletion dbms/src/Debug/MockRaftStoreProxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -825,7 +825,7 @@ TableID MockRaftStoreProxy::bootstrapTable(
MockTiDB::instance().newTable("d", "prevt" + toString(random()), columns, tso, "", "dt");
UInt64 table_id = MockTiDB::instance().newTable("d", "t" + toString(random()), columns, tso, "", "dt");

auto schema_syncer = tmt.getSchemaSyncer();
auto schema_syncer = tmt.getSchemaSyncerManager();
schema_syncer->syncSchemas(ctx, NullspaceID);
this->table_id = table_id;
return table_id;
Expand Down
5 changes: 5 additions & 0 deletions dbms/src/Debug/MockSchemaGetter.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ struct MockSchemaGetter
return MockTiDB::instance().getTableInfoByID(table_id);
}

static std::tuple<TiDB::DBInfoPtr, TiDB::TableInfoPtr> getDatabaseAndTableInfo(DatabaseID db_id, TableID table_id)
{
return std::make_tuple(getDatabase(db_id), getTableInfo(db_id, table_id));
}

static std::vector<TiDB::DBInfoPtr> listDBs()
{
std::vector<TiDB::DBInfoPtr> res;
Expand Down
9 changes: 5 additions & 4 deletions dbms/src/Debug/MockSchemaNameMapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,17 @@ namespace DB

struct MockSchemaNameMapper : public SchemaNameMapper
{
String mapDatabaseName(const TiDB::DBInfo & db_info) const override { return db_info.name; }
String mapTableName(const TiDB::TableInfo & table_info) const override { return table_info.name; }
String mapDatabaseName(const TiDB::DBInfo & db_info) const override { return "db_" + std::to_string(db_info.id); }
String mapDatabaseName(DatabaseID database_id, KeyspaceID /*keyspace_id*/) const override { return "db_" + std::to_string(database_id); }
String mapTableName(const TiDB::TableInfo & table_info) const override { return "t_" + std::to_string(table_info.id); }

String mapPartitionName(const TiDB::TableInfo & table_info) const override
{
return table_info.name + "_" + std::to_string(table_info.id);
}

String debugDatabaseName(const TiDB::DBInfo & db_info) const override { return db_info.name; }
String debugTableName(const TiDB::TableInfo & table_info) const override { return table_info.name; }
String debugDatabaseName(const TiDB::DBInfo & db_info) const override { return "db_" + std::to_string(db_info.id); }
String debugTableName(const TiDB::TableInfo & table_info) const override { return "t_" + std::to_string(table_info.id); }
hongyunyan marked this conversation as resolved.
Show resolved Hide resolved
};

} // namespace DB
19 changes: 16 additions & 3 deletions dbms/src/Debug/MockTiDB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,14 @@ DatabaseID MockTiDB::newDataBase(const String & database_name)

if (databases.find(database_name) == databases.end())
{
schema_id = databases.size() + 1;
if (databases.empty())
{
schema_id = 1;
}
else
{
schema_id = databases.cbegin()->second + 1;
}
databases.emplace(database_name, schema_id);
}

Expand Down Expand Up @@ -224,6 +231,7 @@ TiDB::TableInfoPtr MockTiDB::parseColumns(
{
String & name = string_tokens[index];
index_info.idx_cols[index].name = name;
index_info.idx_cols[index].offset = pk_column_pos_map[name];
index_info.idx_cols[index].length = -1;
}
}
Expand Down Expand Up @@ -273,13 +281,15 @@ TableID MockTiDB::newTable(
return addTable(database_name, std::move(*table_info));
}

int MockTiDB::newTables(
std::vector<TableID> MockTiDB::newTables(
const String & database_name,
const std::vector<std::tuple<String, ColumnsDescription, String>> & tables,
Timestamp tso,
const String & engine_type)
{
std::lock_guard lock(tables_mutex);
std::vector<TableID> table_ids;
hongyunyan marked this conversation as resolved.
Show resolved Hide resolved
table_ids.reserve(tables.size());
if (databases.find(database_name) == databases.end())
{
throw Exception("MockTiDB not found db: " + database_name, ErrorCodes::LOGICAL_ERROR);
Expand Down Expand Up @@ -310,6 +320,8 @@ int MockTiDB::newTables(
opt.old_schema_id = table->database_id;
opt.old_table_id = table->id();
diff.affected_opts.push_back(std::move(opt));

table_ids.push_back(table->id());
}

if (diff.affected_opts.empty())
Expand All @@ -318,7 +330,8 @@ int MockTiDB::newTables(
diff.schema_id = diff.affected_opts[0].schema_id;
diff.version = version;
version_diff[version] = diff;
return 0;

return table_ids;
}

TableID MockTiDB::addTable(const String & database_name, TiDB::TableInfo && table_info)
Expand Down
2 changes: 1 addition & 1 deletion dbms/src/Debug/MockTiDB.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class MockTiDB : public ext::Singleton<MockTiDB>
const String & handle_pk_name,
const String & engine_type);

int newTables(
std::vector<TableID> newTables(
const String & database_name,
const std::vector<std::tuple<String, ColumnsDescription, String>> & tables,
Timestamp tso,
Expand Down
6 changes: 4 additions & 2 deletions dbms/src/Debug/dbgFuncCoprocessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <Debug/dbgFuncCoprocessorUtils.h>
#include <Debug/dbgNaturalDag.h>
#include <Debug/dbgQueryExecutor.h>
#include <Debug/dbgTools.h>
#include <Interpreters/Context.h>
#include <Parsers/ASTLiteral.h>
#include <Storages/IManageableStorage.h>
Expand Down Expand Up @@ -49,7 +50,9 @@ BlockInputStreamPtr dbgFuncTiDBQuery(Context & context, const ASTs & args)
context,
query,
[&](const String & database_name, const String & table_name) {
auto storage = context.getTable(database_name, table_name);
auto mapped_database_name = mappedDatabase(context, database_name);
auto mapped_table_name = mappedTable(context, database_name, table_name);
auto storage = context.getTable(mapped_database_name, mapped_table_name.second);
auto managed_storage = std::dynamic_pointer_cast<IManageableStorage>(storage);
if (!managed_storage //
|| !(managed_storage->engineType() == ::TiDB::StorageEngine::DT
Expand All @@ -58,7 +61,6 @@ BlockInputStreamPtr dbgFuncTiDBQuery(Context & context, const ASTs & args)
return managed_storage->getTableInfo();
},
properties);

return executeQuery(context, region_id, properties, query_tasks, func_wrap_output_stream);
}

Expand Down
9 changes: 1 addition & 8 deletions dbms/src/Debug/dbgFuncMockRaftCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,9 @@ void MockRaftCommand::dbgFuncRegionBatchSplit(Context & context, const ASTs & ar
std::vector<Field> end_keys1;
std::vector<Field> end_keys2;

std::unordered_map<String, size_t> column_name_columns_index_map;
for (size_t i = 0; i < table_info.columns.size(); i++)
{
column_name_columns_index_map.emplace(table_info.columns[i].name, i);
}

for (size_t i = 0; i < handle_column_size; i++)
{
auto idx = column_name_columns_index_map[table_info.getPrimaryIndexInfo().idx_cols[i].name];
auto & column_info = table_info.columns[idx];
auto & column_info = table_info.columns[table_info.getPrimaryIndexInfo().idx_cols[i].offset];

auto start_field1 = RegionBench::convertField(column_info, typeid_cast<const ASTLiteral &>(*args[3 + i]).value);
TiDB::DatumBumpy start_datum1 = TiDB::DatumBumpy(start_field1, column_info.tp);
Expand Down
25 changes: 6 additions & 19 deletions dbms/src/Debug/dbgFuncMockRaftSnapshot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,6 @@ RegionPtr GenDbgRegionSnapshotWithData(Context & context, const ASTs & args)
size_t handle_column_size = is_common_handle ? table_info.getPrimaryIndexInfo().idx_cols.size() : 1;
RegionPtr region;

std::unordered_map<String, size_t> column_name_columns_index_map;
for (size_t i = 0; i < table_info.columns.size(); i++)
{
column_name_columns_index_map.emplace(table_info.columns[i].name, i);
}

if (!is_common_handle)
{
auto start = static_cast<HandleID>(safeGet<UInt64>(typeid_cast<const ASTLiteral &>(*args[3]).value));
Expand All @@ -94,8 +88,7 @@ RegionPtr GenDbgRegionSnapshotWithData(Context & context, const ASTs & args)
std::vector<Field> end_keys;
for (size_t i = 0; i < handle_column_size; i++)
{
auto idx = column_name_columns_index_map[table_info.getPrimaryIndexInfo().idx_cols[i].name];
auto & column_info = table_info.columns[idx];
auto & column_info = table_info.columns[table_info.getPrimaryIndexInfo().idx_cols[i].offset];
auto start_field = RegionBench::convertField(column_info, typeid_cast<const ASTLiteral &>(*args[3 + i]).value);
TiDB::DatumBumpy start_datum = TiDB::DatumBumpy(start_field, column_info.tp);
start_keys.emplace_back(start_datum.field());
Expand Down Expand Up @@ -136,9 +129,9 @@ RegionPtr GenDbgRegionSnapshotWithData(Context & context, const ASTs & args)
std::vector<Field> keys; // handle key
for (size_t i = 0; i < table_info.getPrimaryIndexInfo().idx_cols.size(); i++)
{
auto idx = column_name_columns_index_map[table_info.getPrimaryIndexInfo().idx_cols[i].name];
auto & column_info = table_info.columns[idx];
auto start_field = RegionBench::convertField(column_info, fields[idx]);
auto & idx_col = table_info.getPrimaryIndexInfo().idx_cols[i];
auto & column_info = table_info.columns[idx_col.offset];
auto start_field = RegionBench::convertField(column_info, fields[idx_col.offset]);
TiDB::DatumBumpy start_datum = TiDB::DatumBumpy(start_field, column_info.tp);
keys.emplace_back(start_datum.field());
}
Expand Down Expand Up @@ -213,15 +206,9 @@ void MockRaftCommand::dbgFuncRegionSnapshot(Context & context, const ASTs & args
std::vector<Field> start_keys;
std::vector<Field> end_keys;

std::unordered_map<String, size_t> column_name_columns_index_map;
for (size_t i = 0; i < table_info.columns.size(); i++)
{
column_name_columns_index_map.emplace(table_info.columns[i].name, i);
}
for (size_t i = 0; i < handle_column_size; i++)
{
auto idx = column_name_columns_index_map[table_info.getPrimaryIndexInfo().idx_cols[i].name];
const auto & column_info = table_info.columns[idx];
const auto & column_info = table_info.columns[table_info.getPrimaryIndexInfo().idx_cols[i].offset];
auto start_field = RegionBench::convertField(column_info, typeid_cast<const ASTLiteral &>(*args[1 + i]).value);
TiDB::DatumBumpy start_datum = TiDB::DatumBumpy(start_field, column_info.tp);
start_keys.emplace_back(start_datum.field());
Expand Down Expand Up @@ -610,7 +597,7 @@ RegionPtrWithBlock::CachePtr GenRegionPreDecodeBlockData(const RegionPtr & regio

if (!atomic_decode(false))
{
tmt.getSchemaSyncer()->syncSchemas(context, keyspace_id);
tmt.getSchemaSyncerManager()->syncSchemas(context, keyspace_id);

if (!atomic_decode(true))
throw Exception("Pre-decode " + region->toString() + " cache to table " + std::to_string(table_id) + " block failed",
Expand Down
4 changes: 3 additions & 1 deletion dbms/src/Debug/dbgFuncMockTiDBTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#include <Debug/MockTiDB.h>
#include <Debug/dbgFuncMockTiDBTable.h>
#include <Debug/dbgTools.h>
#include <Interpreters/Context.h>
#include <Interpreters/InterpreterCreateQuery.h>
#include <Parsers/ASTExpressionList.h>
Expand Down Expand Up @@ -304,7 +305,8 @@ void MockTiDBTable::dbgFuncCreateTiDBTables(Context & context, const ASTs & args
if (args.size() < 2)
throw Exception("Args not matched, should be: db_name, table_name, [table_name], ..., [table_name]", ErrorCodes::BAD_ARGUMENTS);
const String & database_name = typeid_cast<const ASTIdentifier &>(*args[0]).name;
auto db = context.getDatabase(database_name);
auto mapped_database_name = mappedDatabase(context, database_name);
auto db = context.getDatabase(mapped_database_name);

std::vector<std::tuple<String, ColumnsDescription, String>> tables;

Expand Down
9 changes: 2 additions & 7 deletions dbms/src/Debug/dbgFuncRegion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,10 @@ void dbgFuncPutRegion(Context & context, const ASTs & args, DBGInvoker::Printer
{
std::vector<Field> start_keys;
std::vector<Field> end_keys;
std::unordered_map<String, size_t> column_name_columns_index_map;
for (size_t i = 0; i < table_info.columns.size(); i++)
{
column_name_columns_index_map.emplace(table_info.columns[i].name, i);
}

for (size_t i = 0; i < handle_column_size; i++)
{
auto idx = column_name_columns_index_map[table_info.getPrimaryIndexInfo().idx_cols[i].name];
const auto & column_info = table_info.columns[idx];
const auto & column_info = table_info.columns[table_info.getPrimaryIndexInfo().idx_cols[i].offset];
auto start_field = RegionBench::convertField(column_info, typeid_cast<const ASTLiteral &>(*args[1 + i]).value);
TiDB::DatumBumpy start_datum = TiDB::DatumBumpy(start_field, column_info.tp);
start_keys.emplace_back(start_datum.field());
Expand Down
Loading