Skip to content

Commit

Permalink
Cleanup code
Browse files Browse the repository at this point in the history
  • Loading branch information
JaySon-Huang committed Jul 23, 2024
1 parent 2d130e1 commit ce3d9e1
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 10 deletions.
12 changes: 4 additions & 8 deletions dbms/src/Storages/DeltaMerge/DeltaMergeStore.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include <Storages/KVStore/Decode/DecodingStorageSchemaSnapshot.h>
#include <Storages/KVStore/MultiRaft/Disagg/CheckpointIngestInfo.h>
#include <Storages/Page/PageStorage_fwd.h>
#include <Storages/TableNameMeta.h>
#include <TiDB/Schema/TiDB.h>

#include <queue>
Expand Down Expand Up @@ -277,15 +278,10 @@ class DeltaMergeStore : private boost::noncopyable

void setUpBackgroundTask(const DMContextPtr & dm_context);

struct TableMeta
{
String db_name;
String table_name;
};
TableMeta getTableMeta() const
TableNameMeta getTableMeta() const
{
auto meta = table_meta.lockShared();
return TableMeta{meta->db_name, meta->table_name};
return TableNameMeta{meta->db_name, meta->table_name};
}
String getIdent() const { return fmt::format("keyspace={} table_id={}", keyspace_id, physical_table_id); }

Expand Down Expand Up @@ -805,7 +801,7 @@ class DeltaMergeStore : private boost::noncopyable
Settings settings;
StoragePoolPtr storage_pool;

SharedMutexProtected<TableMeta> table_meta;
SharedMutexProtected<TableNameMeta> table_meta;

const KeyspaceID keyspace_id;
const TableID physical_table_id;
Expand Down
4 changes: 2 additions & 2 deletions dbms/src/Storages/IManageableStorage.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class IManageableStorage : public IStorage
/// Return true is data dir exist
virtual bool initStoreIfDataDirExist(ThreadPool * /*thread_pool*/) { throw Exception("Unsupported"); }

virtual ::TiDB::StorageEngine engineType() const = 0;
virtual TiDB::StorageEngine engineType() const = 0;

virtual String getDatabaseName() const = 0;

Expand Down Expand Up @@ -186,7 +186,7 @@ class IManageableStorage : public IStorage
throw Exception(
"Method getDecodingSchemaSnapshot is not supported by storage " + getName(),
ErrorCodes::NOT_IMPLEMENTED);
};
}

/// The `block_decoding_schema_epoch` is just an internal version for `DecodingStorageSchemaSnapshot`,
/// And it has no relation with the table schema version.
Expand Down
28 changes: 28 additions & 0 deletions dbms/src/Storages/TableNameMeta.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Copyright 2024 PingCAP, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#pragma once

#include <common/types.h>

namespace DB
{

struct TableNameMeta
{
String db_name;
String table_name;
};

} // namespace DB

0 comments on commit ce3d9e1

Please sign in to comment.