Merge pull request #68645 from zghong/fix-invalid-char-in-replica_name

Fix invalid characters in replica_name
This commit is contained in:
Nikolay Degterinsky 2024-08-22 15:42:39 +00:00 committed by GitHub
commit 1547dd2bde
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -538,6 +538,9 @@ static StoragePtr create(const StorageFactory::Arguments & args)
if (replica_name.empty())
throw Exception(ErrorCodes::NO_REPLICA_NAME_GIVEN, "No replica name in config{}", verbose_help_message);
// '\t' and '\n' will interrupt parsing 'source replica' in ReplicatedMergeTreeLogEntryData::readText
if (replica_name.find('\t') != String::npos || replica_name.find('\n') != String::npos)
throw Exception(ErrorCodes::BAD_ARGUMENTS, "Replica name must not contain '\\t' or '\\n'");
arg_cnt = engine_args.size(); /// Update `arg_cnt` here because extractZooKeeperPathAndReplicaNameFromEngineArgs() could add arguments.
arg_num = 2; /// zookeeper_path and replica_name together are always two arguments.