mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 23:52:03 +00:00
Merge pull request #38322 from ClickHouse/ban_projections_in_a_right_way
Ban projections for zero-copy replication in a right way
This commit is contained in:
commit
ae2feacbd1
@ -280,14 +280,6 @@ MergeTreeData::MergeTreeData(
|
||||
/// Creating directories, if not exist.
|
||||
for (const auto & disk : getDisks())
|
||||
{
|
||||
/// TODO: implement it the main issue in DataPartsExchange (not able to send directories metadata)
|
||||
if (supportsReplication() && settings->allow_remote_fs_zero_copy_replication
|
||||
&& disk->supportZeroCopyReplication() && metadata_.hasProjections())
|
||||
{
|
||||
throw Exception(ErrorCodes::NOT_IMPLEMENTED, "Projections are not supported when zero-copy replication is enabled for table. "
|
||||
"Currently disk '{}' supports zero copy replication", disk->getName());
|
||||
}
|
||||
|
||||
if (disk->isBroken())
|
||||
continue;
|
||||
|
||||
|
@ -33,6 +33,7 @@ namespace ErrorCodes
|
||||
extern const int UNKNOWN_STORAGE;
|
||||
extern const int NO_REPLICA_NAME_GIVEN;
|
||||
extern const int CANNOT_EXTRACT_TABLE_STRUCTURE;
|
||||
extern const int NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
@ -673,6 +674,20 @@ static StoragePtr create(const StorageFactory::Arguments & args)
|
||||
throw Exception("Wrong number of engine arguments.", ErrorCodes::BAD_ARGUMENTS);
|
||||
|
||||
if (replicated)
|
||||
{
|
||||
auto storage_policy = args.getContext()->getStoragePolicy(storage_settings->storage_policy);
|
||||
|
||||
for (const auto & disk : storage_policy->getDisks())
|
||||
{
|
||||
/// TODO: implement it the main issue in DataPartsExchange (not able to send directories metadata)
|
||||
if (storage_settings->allow_remote_fs_zero_copy_replication
|
||||
&& disk->supportZeroCopyReplication() && metadata.hasProjections())
|
||||
{
|
||||
throw Exception(ErrorCodes::NOT_IMPLEMENTED, "Projections are not supported when zero-copy replication is enabled for table. "
|
||||
"Currently disk '{}' supports zero copy replication", disk->getName());
|
||||
}
|
||||
}
|
||||
|
||||
return std::make_shared<StorageReplicatedMergeTree>(
|
||||
zookeeper_path,
|
||||
replica_name,
|
||||
@ -686,6 +701,7 @@ static StoragePtr create(const StorageFactory::Arguments & args)
|
||||
std::move(storage_settings),
|
||||
args.has_force_restore_data_flag,
|
||||
renaming_restrictions);
|
||||
}
|
||||
else
|
||||
return std::make_shared<StorageMergeTree>(
|
||||
args.table_id,
|
||||
|
Loading…
Reference in New Issue
Block a user