mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-20 08:40:50 +00:00
Fixed missing file name escaping in FREEZE command
This commit is contained in:
parent
21db9157f7
commit
9b8fc9a899
@ -3355,7 +3355,11 @@ void MergeTreeData::freezePartitionsByMatcher(MatcherFn matcher, const String &
|
|||||||
LOG_DEBUG(log, "Freezing part " << part->name << " snapshot will be placed at " + backup_path);
|
LOG_DEBUG(log, "Freezing part " << part->name << " snapshot will be placed at " + backup_path);
|
||||||
|
|
||||||
String part_absolute_path = Poco::Path(part->getFullPath()).absolute().toString();
|
String part_absolute_path = Poco::Path(part->getFullPath()).absolute().toString();
|
||||||
String backup_part_absolute_path = backup_path + "data/" + getDatabaseName() + "/" + getTableName() + "/" + part->relative_path;
|
String backup_part_absolute_path = backup_path
|
||||||
|
+ "data/"
|
||||||
|
+ escapeForFileName(getDatabaseName()) + "/"
|
||||||
|
+ escapeForFileName(getTableName()) + "/"
|
||||||
|
+ part->relative_path;
|
||||||
localBackup(part_absolute_path, backup_part_absolute_path);
|
localBackup(part_absolute_path, backup_part_absolute_path);
|
||||||
part->is_frozen.store(true, std::memory_order_relaxed);
|
part->is_frozen.store(true, std::memory_order_relaxed);
|
||||||
++parts_processed;
|
++parts_processed;
|
||||||
|
28
dbms/tests/integration/test_filesystem_layout/test.py
Normal file
28
dbms/tests/integration/test_filesystem_layout/test.py
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
import pytest
|
||||||
|
|
||||||
|
from helpers.cluster import ClickHouseCluster
|
||||||
|
|
||||||
|
cluster = ClickHouseCluster(__file__)
|
||||||
|
node = cluster.add_instance("node")
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture(scope="module")
|
||||||
|
def started_cluster():
|
||||||
|
try:
|
||||||
|
cluster.start()
|
||||||
|
yield cluster
|
||||||
|
finally:
|
||||||
|
cluster.shutdown()
|
||||||
|
|
||||||
|
|
||||||
|
def test_file_path_escaping(started_cluster):
|
||||||
|
node.query('''
|
||||||
|
CREATE TABLE test.`T.a_b,l-e!` (`~Id` UInt32)
|
||||||
|
ENGINE = MergeTree() PARTITION BY `~Id` ORDER BY `~Id`;
|
||||||
|
''')
|
||||||
|
node.query('''INSERT INTO test.`T.a_b,l-e!` VALUES (1);''')
|
||||||
|
node.query('''ALTER TABLE test.`T.a_b,l-e!` FREEZE;''')
|
||||||
|
|
||||||
|
node.exec_in_container(["bash", "-c", "test -f /var/lib/clickhouse/data/test/T%2Ea_b%2Cl%2De%21/1_1_1_0/%7EId.bin"])
|
||||||
|
node.exec_in_container(["bash", "-c", "test -f /var/lib/clickhouse/shadow/1/data/test/T%2Ea_b%2Cl%2De%21/1_1_1_0/%7EId.bin"])
|
||||||
|
|
Loading…
Reference in New Issue
Block a user