mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 23:21:59 +00:00
Fix bug with segmentation fault in ATTACH PART query
This commit is contained in:
parent
ddf171e9df
commit
4e83f65089
@ -2967,6 +2967,8 @@ MergeTreeData::MutableDataPartsVector MergeTreeData::tryLoadPartsToAttach(const
|
||||
String part_id = partition->as<ASTLiteral &>().value.safeGet<String>();
|
||||
validateDetachedPartName(part_id);
|
||||
renamed_parts.addPart(part_id, "attaching_" + part_id);
|
||||
if (MergeTreePartInfo::tryParsePartName(part_id, nullptr, format_version))
|
||||
name_to_disk[part_id] = getDiskForPart(part_id, source_dir);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -0,0 +1,3 @@
|
||||
1000
|
||||
0
|
||||
1000
|
22
dbms/tests/queries/0_stateless/01015_attach_part.sql
Normal file
22
dbms/tests/queries/0_stateless/01015_attach_part.sql
Normal file
@ -0,0 +1,22 @@
|
||||
DROP TABLE IF EXISTS table_01;
|
||||
|
||||
CREATE TABLE table_01 (
|
||||
date Date,
|
||||
n Int32
|
||||
) ENGINE = MergeTree()
|
||||
PARTITION BY date
|
||||
ORDER BY date;
|
||||
|
||||
INSERT INTO table_01 SELECT toDate('2019-10-01'), number FROM system.numbers LIMIT 1000;
|
||||
|
||||
SELECT COUNT() FROM table_01;
|
||||
|
||||
ALTER TABLE table_01 DETACH PARTITION ID '20191001';
|
||||
|
||||
SELECT COUNT() FROM table_01;
|
||||
|
||||
ALTER TABLE table_01 ATTACH PART '20191001_1_1_0';
|
||||
|
||||
SELECT COUNT() FROM table_01;
|
||||
|
||||
DROP TABLE IF EXISTS table_01;
|
Loading…
Reference in New Issue
Block a user