diff --git a/dbms/src/Debug/MockTiDB.cpp b/dbms/src/Debug/MockTiDB.cpp index f3ee51028c3..26181c20bb4 100644 --- a/dbms/src/Debug/MockTiDB.cpp +++ b/dbms/src/Debug/MockTiDB.cpp @@ -299,10 +299,7 @@ TiDB::TableInfoPtr MockTiDB::parseColumns( std::transform(engine_type.begin(), engine_type.end(), engine_type.begin(), [](unsigned char c) { return std::tolower(c); }); - if (engine_type == "dt") - table_info.engine_type = TiDB::StorageEngine::DT; - - if (table_info.engine_type != TiDB::StorageEngine::DT) + if (engine_type != "dt") { throw Exception("Unknown engine type : " + engine_type + ", must be 'dt'", ErrorCodes::BAD_ARGUMENTS); } diff --git a/dbms/src/Debug/dbgFuncMockTiDBTable.cpp b/dbms/src/Debug/dbgFuncMockTiDBTable.cpp index 2b3c85d6068..f78cc7e72ab 100644 --- a/dbms/src/Debug/dbgFuncMockTiDBTable.cpp +++ b/dbms/src/Debug/dbgFuncMockTiDBTable.cpp @@ -66,8 +66,6 @@ void MockTiDBTable::dbgFuncMockTiDBTable(Context & context, const ASTs & args, D = InterpreterCreateQuery::getColumnsDescription(typeid_cast(*columns_ast), context); String engine_type("dt"); - if (context.getTMTContext().getEngineType() == ::TiDB::StorageEngine::TMT) - engine_type = "tmt"; if (args.size() == 5) engine_type = safeGet(typeid_cast(*args[4]).value); @@ -355,8 +353,6 @@ void MockTiDBTable::dbgFuncCreateTiDBTables(Context & context, const ASTs & args } auto tso = context.getTMTContext().getPDClient()->getTS(); String engine_type("dt"); - if (context.getTMTContext().getEngineType() == ::TiDB::StorageEngine::TMT) - engine_type = "tmt"; MockTiDB::instance().newTables(database_name, tables, tso, engine_type); output(""); } diff --git a/dbms/src/Interpreters/tests/gtest_interpreter_create_query.cpp b/dbms/src/Interpreters/tests/gtest_interpreter_create_query.cpp index 1e1675b7cc4..60b7bb376d5 100644 --- a/dbms/src/Interpreters/tests/gtest_interpreter_create_query.cpp +++ b/dbms/src/Interpreters/tests/gtest_interpreter_create_query.cpp @@ -108,7 +108,6 @@ class InterperCreateQueryTiFlashTest : public ::testing::Test TiDB::DBInfo db_info(db_info_json, NullspaceID); TiDB::TableInfo table_info(table_info_json, NullspaceID); - table_info.engine_type = ::TiDB::StorageEngine::DT; ParserCreateQuery parser; ASTPtr ast @@ -167,4 +166,4 @@ try } CATCH } // namespace tests -} // namespace DB \ No newline at end of file +} // namespace DB diff --git a/dbms/src/Server/DTTool/DTTool.h b/dbms/src/Server/DTTool/DTTool.h index 40976fdbb1e..f0399b8de5d 100644 --- a/dbms/src/Server/DTTool/DTTool.h +++ b/dbms/src/Server/DTTool/DTTool.h @@ -116,7 +116,6 @@ class ImitativeEnv global_context->initializeGlobalPageIdAllocator(); global_context->initializeGlobalStoragePoolIfNeed(global_context->getPathPool()); raft_config.ignore_databases = {"default", "system"}; - raft_config.engine = TiDB::StorageEngine::DT; global_context->createTMTContext(raft_config, pingcap::ClusterConfig()); global_context->setDeltaIndexManager(1024 * 1024 * 100 /*100MB*/); diff --git a/dbms/src/Server/RaftConfigParser.cpp b/dbms/src/Server/RaftConfigParser.cpp index a151b07d4c6..0f5a1db5b06 100644 --- a/dbms/src/Server/RaftConfigParser.cpp +++ b/dbms/src/Server/RaftConfigParser.cpp @@ -85,20 +85,6 @@ TiFlashRaftConfig TiFlashRaftConfig::parseSettings(Poco::Util::AbstractConfigura LOG_INFO(log, "Found ignore databases: {}", fmt_buf.toString()); } - if (config.has("raft.storage_engine")) - { - String s_engine = config.getString("raft.storage_engine"); - std::transform(s_engine.begin(), s_engine.end(), s_engine.begin(), [](char ch) { return std::tolower(ch); }); - if (s_engine == "tmt") - res.engine = ::TiDB::StorageEngine::TMT; - else if (s_engine == "dt") - res.engine = ::TiDB::StorageEngine::DT; - else - res.engine = DEFAULT_ENGINE; - } - - LOG_INFO(log, "Default storage engine [type={}]", static_cast(res.engine)); - return res; } diff --git a/dbms/src/Server/RaftConfigParser.h b/dbms/src/Server/RaftConfigParser.h index 2019374df5f..33dbcff85ae 100644 --- a/dbms/src/Server/RaftConfigParser.h +++ b/dbms/src/Server/RaftConfigParser.h @@ -44,9 +44,6 @@ struct TiFlashRaftConfig bool for_unit_test = false; - static constexpr TiDB::StorageEngine DEFAULT_ENGINE = TiDB::StorageEngine::DT; - TiDB::StorageEngine engine = DEFAULT_ENGINE; - public: TiFlashRaftConfig() = default; diff --git a/dbms/src/Storages/KVStore/TMTContext.cpp b/dbms/src/Storages/KVStore/TMTContext.cpp index 825d8d7d8cc..0ff11218734 100644 --- a/dbms/src/Storages/KVStore/TMTContext.cpp +++ b/dbms/src/Storages/KVStore/TMTContext.cpp @@ -158,7 +158,6 @@ TMTContext::TMTContext( context.getSettingsRef().task_scheduler_thread_soft_limit, context.getSettingsRef().task_scheduler_thread_hard_limit, context.getSettingsRef().task_scheduler_active_set_soft_limit))) - , engine(raft_config.engine) , batch_read_index_timeout_ms(DEFAULT_BATCH_READ_INDEX_TIMEOUT_MS) , wait_index_timeout_ms(DEFAULT_WAIT_INDEX_TIMEOUT_MS) , read_index_worker_tick_ms(DEFAULT_READ_INDEX_WORKER_TICK_MS) diff --git a/dbms/src/Storages/KVStore/TMTContext.h b/dbms/src/Storages/KVStore/TMTContext.h index 55694ce3bc8..03bec14ab64 100644 --- a/dbms/src/Storages/KVStore/TMTContext.h +++ b/dbms/src/Storages/KVStore/TMTContext.h @@ -126,8 +126,6 @@ class TMTContext : private boost::noncopyable const std::unordered_set & getIgnoreDatabases() const; - ::TiDB::StorageEngine getEngineType() const { return engine; } - void reloadConfig(const Poco::Util::AbstractConfiguration & config); bool isInitialized() const; @@ -172,8 +170,6 @@ class TMTContext : private boost::noncopyable std::shared_ptr schema_sync_manager; MPPTaskManagerPtr mpp_task_manager; - ::TiDB::StorageEngine engine; - std::atomic_uint64_t batch_read_index_timeout_ms; std::atomic_uint64_t wait_index_timeout_ms; std::atomic_uint64_t read_index_worker_tick_ms; diff --git a/dbms/src/TestUtils/TiFlashTestEnv.cpp b/dbms/src/TestUtils/TiFlashTestEnv.cpp index 6a937f47031..2e93b3c67d9 100644 --- a/dbms/src/TestUtils/TiFlashTestEnv.cpp +++ b/dbms/src/TestUtils/TiFlashTestEnv.cpp @@ -164,7 +164,6 @@ void TiFlashTestEnv::addGlobalContext( TiFlashRaftConfig raft_config; raft_config.ignore_databases = {"system"}; - raft_config.engine = TiDB::StorageEngine::DT; raft_config.for_unit_test = true; global_context->createTMTContext(raft_config, pingcap::ClusterConfig()); diff --git a/dbms/src/TiDB/Schema/SchemaBuilder.cpp b/dbms/src/TiDB/Schema/SchemaBuilder.cpp index e5fccd1ebfe..7f46967e349 100644 --- a/dbms/src/TiDB/Schema/SchemaBuilder.cpp +++ b/dbms/src/TiDB/Schema/SchemaBuilder.cpp @@ -1089,27 +1089,16 @@ String createTableStmt( writeString(columns[i].type->getName(), stmt_buf); } - // storage engine type - if (table_info.engine_type == TiDB::StorageEngine::DT) + writeString(") Engine = DeltaMerge((", stmt_buf); + for (size_t i = 0; i < pks.size(); i++) { - writeString(") Engine = DeltaMerge((", stmt_buf); - for (size_t i = 0; i < pks.size(); i++) - { - if (i > 0) - writeString(", ", stmt_buf); - writeBackQuotedString(pks[i], stmt_buf); - } - writeString("), '", stmt_buf); - writeEscapedString(table_info.serialize(), stmt_buf); - writeString(fmt::format("', {})", tombstone), stmt_buf); - } - else - { - throw TiFlashException( - Errors::DDL::Internal, - "Unknown engine type : {}", - fmt::underlying(table_info.engine_type)); + if (i > 0) + writeString(", ", stmt_buf); + writeBackQuotedString(pks[i], stmt_buf); } + writeString("), '", stmt_buf); + writeEscapedString(table_info.serialize(), stmt_buf); + writeString(fmt::format("', {})", tombstone), stmt_buf); return stmt; } @@ -1138,12 +1127,6 @@ void SchemaBuilder::applyCreateStorageInstance( return; } // Else the storage instance does not exist, create it. - /// Normal CREATE table. - if (table_info->engine_type == StorageEngine::UNSPECIFIED) - { - auto & tmt_context = context.getTMTContext(); - table_info->engine_type = tmt_context.getEngineType(); - } // We need to create a Storage instance to handle its raft log and snapshot when it // is "dropped" but not physically removed in TiDB. To handle it porperly, we get a diff --git a/dbms/src/TiDB/Schema/TiDB.h b/dbms/src/TiDB/Schema/TiDB.h index 3c45e5dc423..88398458139 100644 --- a/dbms/src/TiDB/Schema/TiDB.h +++ b/dbms/src/TiDB/Schema/TiDB.h @@ -309,8 +309,6 @@ struct TableInfo // The TiFlash replica info persisted by TiDB TiFlashReplicaInfo replica_info; - TiDB::StorageEngine engine_type = TiDB::StorageEngine::UNSPECIFIED; // TODO(hyy):seems could be removed - ColumnID getColumnID(const String & name) const; String getColumnName(ColumnID id) const; KeyspaceID getKeyspaceID() const; diff --git a/dbms/src/TiDB/Schema/tests/gtest_table_info.cpp b/dbms/src/TiDB/Schema/tests/gtest_table_info.cpp index 982f9e0bfa5..5d622c3e240 100644 --- a/dbms/src/TiDB/Schema/tests/gtest_table_info.cpp +++ b/dbms/src/TiDB/Schema/tests/gtest_table_info.cpp @@ -151,7 +151,6 @@ struct StmtCase EXPECT_EQ(json1, json2) << "Table info unescaped serde mismatch:\n" + json1 + "\n" + json2; // generate create statement with db_info and table_info - table_info.engine_type = TiDB::StorageEngine::DT; String stmt = createTableStmt( db_info.keyspace_id, db_info.id,