in order to restore partition do not write empty inmemory part

This commit is contained in:
Sema Checherinda 2022-09-27 18:59:06 +02:00
parent 00e7b4e195
commit a4d1adf945
4 changed files with 2 additions and 49 deletions

View File

@ -7292,7 +7292,7 @@ MergeTreeData::MutableDataPartPtr MergeTreeData::createEmptyPart(
auto new_data_part = createPart(
new_part_name,
choosePartType(0, block.rows()),
choosePartTypeOnDisk(0, block.rows()),
new_part_info,
new_data_part_storage
);

View File

@ -1,47 +0,0 @@
-- Tags: no-fasttest
SET allow_experimental_object_type = 1;
DROP TABLE IF EXISTS table_in_memory_with_json;
CREATE TABLE table_in_memory_with_json
(
id UInt64,
value UInt64,
data Object('JSON')
)
ENGINE = MergeTree
PARTITION BY id
ORDER BY value
SETTINGS min_bytes_for_wide_part=1000, min_bytes_for_compact_part=900;
SELECT 'init state';
INSERT INTO table_in_memory_with_json
FORMAT JSONEachRow {"id": 0, "value": 1, "data" : {"k1": 1}}, {"id": 0, "value": 2, "data" : {"k1": 2}}, {"id": 1, "value": 3, "data" : {"k1": 3}}, {"id": 1, "value": 4, "data" : {"k1": 4}}, {"id": 2, "value": 5, "data" : {"k1": 5}}, {"id": 2, "value": 6, "data" : {"k1": 6}};
SELECT id, data, toTypeName(data) FROM table_in_memory_with_json ORDER BY id;
SELECT count() FROM table_in_memory_with_json;
SELECT name, part_type, rows, active from system.parts
WHERE table='table_in_memory_with_json' AND database=currentDatabase();
SELECT 'drop part 0';
ALTER TABLE table_in_memory_with_json DROP PARTITION 0;
SELECT count() FROM table_in_memory_with_json;
SELECT name, part_type, rows, active from system.parts
WHERE table='table_in_memory_with_json' AND database=currentDatabase();
SELECT 'detach table';
DETACH TABLE table_in_memory_with_json;
SELECT name, part_type, rows, active from system.parts
WHERE table='table_in_memory_with_json' AND database=currentDatabase();
SELECT 'attach table';
ATTACH TABLE table_in_memory_with_json;
SELECT count() FROM table_in_memory;
SELECT name, part_type, rows, active from system.parts
WHERE table='table_in_memory_with_json' AND database=currentDatabase();

View File

@ -5,7 +5,7 @@ init state
2_3_3_0 InMemory 10 1
drop part 0
20
0_1_1_0 InMemory 0 0
0_1_1_1 Compact 0 0
1_2_2_0 InMemory 10 1
2_3_3_0 InMemory 10 1
detach table