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:
alesapin 2022-06-23 11:52:30 +02:00 committed by GitHub
commit ae2feacbd1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 8 deletions

View File

@ -280,14 +280,6 @@ MergeTreeData::MergeTreeData(
/// Creating directories, if not exist. /// Creating directories, if not exist.
for (const auto & disk : getDisks()) 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()) if (disk->isBroken())
continue; continue;

View File

@ -33,6 +33,7 @@ namespace ErrorCodes
extern const int UNKNOWN_STORAGE; extern const int UNKNOWN_STORAGE;
extern const int NO_REPLICA_NAME_GIVEN; extern const int NO_REPLICA_NAME_GIVEN;
extern const int CANNOT_EXTRACT_TABLE_STRUCTURE; 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); throw Exception("Wrong number of engine arguments.", ErrorCodes::BAD_ARGUMENTS);
if (replicated) 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>( return std::make_shared<StorageReplicatedMergeTree>(
zookeeper_path, zookeeper_path,
replica_name, replica_name,
@ -686,6 +701,7 @@ static StoragePtr create(const StorageFactory::Arguments & args)
std::move(storage_settings), std::move(storage_settings),
args.has_force_restore_data_flag, args.has_force_restore_data_flag,
renaming_restrictions); renaming_restrictions);
}
else else
return std::make_shared<StorageMergeTree>( return std::make_shared<StorageMergeTree>(
args.table_id, args.table_id,