Skip to content

Commit

Permalink
Remove unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
JaySon-Huang committed Nov 23, 2023
1 parent 781dfd4 commit 86e899a
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 344 deletions.
1 change: 0 additions & 1 deletion dbms/src/Storages/tests/gtest_filter_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#include <Storages/DeltaMerge/Index/RSResult.h>
#include <Storages/KVStore/TMTContext.h>
#include <TestUtils/TiFlashTestBasic.h>
#include <TiDB/Schema/SchemaBuilder-internal.h>
#include <TiDB/Schema/SchemaNameMapper.h>
#include <common/logger_useful.h>

Expand Down
1 change: 0 additions & 1 deletion dbms/src/Storages/tests/gtests_parse_push_down_filter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#include <Storages/StorageDeltaMerge.h>
#include <TestUtils/FunctionTestUtils.h>
#include <TestUtils/TiFlashTestBasic.h>
#include <TiDB/Schema/SchemaBuilder-internal.h>
#include <common/logger_useful.h>

#include <regex>
Expand Down
148 changes: 0 additions & 148 deletions dbms/src/TiDB/Schema/SchemaBuilder-internal.h

This file was deleted.

48 changes: 30 additions & 18 deletions dbms/src/TiDB/Schema/SchemaBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
#include <Storages/KVStore/TMTContext.h>
#include <Storages/MutableSupport.h>
#include <TiDB/Decode/TypeMapping.h>
#include <TiDB/Schema/SchemaBuilder-internal.h>
#include <TiDB/Schema/SchemaBuilder.h>
#include <TiDB/Schema/SchemaNameMapper.h>
#include <TiDB/Schema/TiDB.h>
Expand Down Expand Up @@ -367,7 +366,10 @@ void SchemaBuilder<Getter, NameMapper>::applySetTiFlashReplica(DatabaseID databa
auto storage = tmt_context.getStorages().get(keyspace_id, table_info->id);
if (unlikely(storage == nullptr))
{
LOG_ERROR(log, "table is not exist in TiFlash, applySetTiFlashReplica is ignored, table_id={}", table_id);
LOG_ERROR(
log,
"Storage instance is not exist in TiFlash, applySetTiFlashReplica is ignored, table_id={}",
table_id);
return;
}

Expand Down Expand Up @@ -492,7 +494,10 @@ void SchemaBuilder<Getter, NameMapper>::applyPartitionDiff(DatabaseID database_i
auto storage = tmt_context.getStorages().get(keyspace_id, table_info->id);
if (storage == nullptr)
{
LOG_ERROR(log, "table is not exist in TiFlash, table_id={}", table_id);
LOG_ERROR(
log,
"logical_table storage instance is not exist in TiFlash, applyPartitionDiff is ignored, table_id={}",
table_id);
return;
}

Expand Down Expand Up @@ -608,7 +613,10 @@ void SchemaBuilder<Getter, NameMapper>::applyRenameTable(DatabaseID database_id,
auto storage = tmt_context.getStorages().get(keyspace_id, table_id);
if (storage == nullptr)
{
LOG_WARNING(log, "table is not exist in TiFlash, applyRenameTable is ignored, table_id={}", table_id);
LOG_WARNING(
log,
"Storage instance is not exist in TiFlash, applyRenameTable is ignored, table_id={}",
table_id);
return;
}

Expand All @@ -633,7 +641,8 @@ void SchemaBuilder<Getter, NameMapper>::applyRenameLogicalTable(
{
LOG_ERROR(
log,
"table is not exist in TiFlash, applyRenamePhysicalTable is ignored, physical_table_id={}",
"Storage instance is not exist in TiFlash, applyRenamePhysicalTable is ignored, "
"physical_table_id={}",
part_def.id);
return;
}
Expand Down Expand Up @@ -1165,24 +1174,27 @@ void SchemaBuilder<Getter, NameMapper>::syncAllSchema()
for (const auto & db : all_schemas)
{
auto task = [this, db, &created_db_set, &created_db_set_mutex] {
do
{
std::shared_lock<std::shared_mutex> shared_lock(shared_mutex_for_databases);
if (databases.find(db->id) == databases.end())
{
shared_lock.unlock();
applyCreateSchema(db);
std::shared_lock<std::shared_mutex> shared_lock(shared_mutex_for_databases);
if (databases.find(db->id) != databases.end())
{
std::unique_lock<std::mutex> created_db_set_lock(created_db_set_mutex);
created_db_set.emplace(name_mapper.mapDatabaseName(*db));
break;
}

LOG_INFO(
log,
"Database {} created during sync all schemas, database_id={}",
name_mapper.debugDatabaseName(*db),
db->id);
} // release lock on `databases`
applyCreateSchema(db);
{
std::unique_lock<std::mutex> created_db_set_lock(created_db_set_mutex);
created_db_set.emplace(name_mapper.mapDatabaseName(*db));
}
}

LOG_INFO(
log,
"Database {} created during sync all schemas, database_id={}",
name_mapper.debugDatabaseName(*db),
db->id);
} while (false);

std::vector<TableInfoPtr> tables = getter.listTables(db->id);
for (auto & table : tables)
Expand Down
Loading

0 comments on commit 86e899a

Please sign in to comment.