mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-17 21:24:28 +00:00
use arbitrary relative path in *MergeTree
This commit is contained in:
parent
80c9b2ec1c
commit
ec7de6d137
@ -99,6 +99,7 @@ namespace ErrorCodes
|
||||
MergeTreeData::MergeTreeData(
|
||||
const String & database_,
|
||||
const String & table_,
|
||||
const String & relative_data_path_,
|
||||
const ColumnsDescription & columns_,
|
||||
const IndicesDescription & indices_,
|
||||
const ConstraintsDescription & constraints_,
|
||||
@ -122,6 +123,7 @@ MergeTreeData::MergeTreeData(
|
||||
, require_part_metadata(require_part_metadata_)
|
||||
, database_name(database_)
|
||||
, table_name(table_)
|
||||
, relative_data_path(relative_data_path_)
|
||||
, broken_part_callback(broken_part_callback_)
|
||||
, log_name(database_name + "." + table_name)
|
||||
, log(&Logger::get(log_name))
|
||||
@ -1195,7 +1197,7 @@ void MergeTreeData::rename(
|
||||
|
||||
for (const auto & disk : disks)
|
||||
{
|
||||
auto full_path = disk->getClickHouseDataPath() + old_file_db_name + '/' + old_file_table_name + '/';
|
||||
auto full_path = disk->getPath() + relative_data_path;
|
||||
auto new_db_path = disk->getClickHouseDataPath() + new_file_db_name + '/';
|
||||
|
||||
Poco::File db_file{new_db_path};
|
||||
@ -1210,6 +1212,7 @@ void MergeTreeData::rename(
|
||||
|
||||
database_name = new_database_name;
|
||||
table_name = new_table_name;
|
||||
relative_data_path = "data/" + old_file_db_name + '/' + old_file_table_name + '/';
|
||||
}
|
||||
|
||||
void MergeTreeData::dropAllData()
|
||||
@ -3250,7 +3253,7 @@ MergeTreeData::MutableDataPartPtr MergeTreeData::cloneAndLoadDataPart(const Merg
|
||||
|
||||
String MergeTreeData::getFullPathOnDisk(const DiskSpace::DiskPtr & disk) const
|
||||
{
|
||||
return disk->getClickHouseDataPath() + escapeForFileName(database_name) + '/' + escapeForFileName(table_name) + '/';
|
||||
return disk->getPath() + relative_data_path;
|
||||
}
|
||||
|
||||
|
||||
|
@ -332,6 +332,7 @@ public:
|
||||
/// require_part_metadata - should checksums.txt and columns.txt exist in the part directory.
|
||||
/// attach - whether the existing table is attached or the new table is created.
|
||||
MergeTreeData(const String & database_, const String & table_,
|
||||
const String & relative_data_path_,
|
||||
const ColumnsDescription & columns_,
|
||||
const IndicesDescription & indices_,
|
||||
const ConstraintsDescription & constraints_,
|
||||
@ -760,6 +761,7 @@ protected:
|
||||
|
||||
String database_name;
|
||||
String table_name;
|
||||
String relative_data_path;
|
||||
|
||||
|
||||
/// Current column sizes in compressed and uncompressed form.
|
||||
|
@ -639,14 +639,14 @@ static StoragePtr create(const StorageFactory::Arguments & args)
|
||||
|
||||
if (replicated)
|
||||
return StorageReplicatedMergeTree::create(
|
||||
zookeeper_path, replica_name, args.attach, args.database_name, args.table_name,
|
||||
zookeeper_path, replica_name, args.attach, args.database_name, args.table_name, args.relative_data_path,
|
||||
args.columns, indices_description, args.constraints,
|
||||
args.context, date_column_name, partition_by_ast, order_by_ast, primary_key_ast,
|
||||
sample_by_ast, ttl_table_ast, merging_params, std::move(storage_settings),
|
||||
args.has_force_restore_data_flag);
|
||||
else
|
||||
return StorageMergeTree::create(
|
||||
args.database_name, args.table_name, args.columns, indices_description,
|
||||
args.database_name, args.table_name, args.relative_data_path, args.columns, indices_description,
|
||||
args.constraints, args.attach, args.context, date_column_name, partition_by_ast, order_by_ast,
|
||||
primary_key_ast, sample_by_ast, ttl_table_ast, merging_params, std::move(storage_settings),
|
||||
args.has_force_restore_data_flag);
|
||||
|
@ -54,6 +54,7 @@ namespace ActionLocks
|
||||
StorageMergeTree::StorageMergeTree(
|
||||
const String & database_name_,
|
||||
const String & table_name_,
|
||||
const String & relative_data_path_,
|
||||
const ColumnsDescription & columns_,
|
||||
const IndicesDescription & indices_,
|
||||
const ConstraintsDescription & constraints_,
|
||||
@ -68,7 +69,7 @@ StorageMergeTree::StorageMergeTree(
|
||||
const MergingParams & merging_params_,
|
||||
std::unique_ptr<MergeTreeSettings> storage_settings_,
|
||||
bool has_force_restore_data_flag)
|
||||
: MergeTreeData(database_name_, table_name_,
|
||||
: MergeTreeData(database_name_, table_name_, relative_data_path_,
|
||||
columns_, indices_, constraints_,
|
||||
context_, date_column_name, partition_by_ast_, order_by_ast_, primary_key_ast_,
|
||||
sample_by_ast_, ttl_table_ast_, merging_params_,
|
||||
|
@ -147,6 +147,7 @@ protected:
|
||||
StorageMergeTree(
|
||||
const String & database_name_,
|
||||
const String & table_name_,
|
||||
const String & relative_data_path_,
|
||||
const ColumnsDescription & columns_,
|
||||
const IndicesDescription & indices_,
|
||||
const ConstraintsDescription & constraints_,
|
||||
|
@ -192,6 +192,7 @@ StorageReplicatedMergeTree::StorageReplicatedMergeTree(
|
||||
bool attach,
|
||||
const String & database_name_,
|
||||
const String & table_name_,
|
||||
const String & relative_data_path_,
|
||||
const ColumnsDescription & columns_,
|
||||
const IndicesDescription & indices_,
|
||||
const ConstraintsDescription & constraints_,
|
||||
@ -205,7 +206,7 @@ StorageReplicatedMergeTree::StorageReplicatedMergeTree(
|
||||
const MergingParams & merging_params_,
|
||||
std::unique_ptr<MergeTreeSettings> settings_,
|
||||
bool has_force_restore_data_flag)
|
||||
: MergeTreeData(database_name_, table_name_,
|
||||
: MergeTreeData(database_name_, table_name_, relative_data_path_,
|
||||
columns_, indices_, constraints_,
|
||||
context_, date_column_name, partition_by_ast_, order_by_ast_, primary_key_ast_,
|
||||
sample_by_ast_, ttl_table_ast_, merging_params_,
|
||||
|
@ -531,6 +531,7 @@ protected:
|
||||
const String & replica_name_,
|
||||
bool attach,
|
||||
const String & database_name_, const String & name_,
|
||||
const String & relative_data_path_,
|
||||
const ColumnsDescription & columns_,
|
||||
const IndicesDescription & indices_,
|
||||
const ConstraintsDescription & constraints_,
|
||||
|
Loading…
Reference in New Issue
Block a user