mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
Fix mutation of StorageMemory
fix fix
This commit is contained in:
parent
98e6c27a95
commit
d92b1f0e9a
@ -262,7 +262,14 @@ void StorageMemory::mutate(const MutationCommands & commands, ContextPtr context
|
||||
auto metadata_snapshot = getInMemoryMetadataPtr();
|
||||
auto storage = getStorageID();
|
||||
auto storage_ptr = DatabaseCatalog::instance().getTable(storage, context);
|
||||
auto interpreter = std::make_unique<MutationsInterpreter>(storage_ptr, metadata_snapshot, commands, context, true);
|
||||
|
||||
/// When max_threads > 1, the order of returning blocks is uncentain,
|
||||
/// which will lead to inconsistency after updateBlockData.
|
||||
auto new_context = Context::createCopy(context);
|
||||
new_context->setSetting("max_streams_to_max_threads_ratio", 1);
|
||||
new_context->setSetting("max_threads", 1);
|
||||
|
||||
auto interpreter = std::make_unique<MutationsInterpreter>(storage_ptr, metadata_snapshot, commands, new_context, true);
|
||||
auto in = interpreter->execute();
|
||||
|
||||
in->readPrefix();
|
||||
|
@ -0,0 +1,32 @@
|
||||
DROP TABLE IF EXISTS mem_test;
|
||||
|
||||
CREATE TABLE mem_test
|
||||
(
|
||||
`a` Int64,
|
||||
`b` Int64
|
||||
)
|
||||
ENGINE = Memory;
|
||||
|
||||
SET max_block_size = 3;
|
||||
|
||||
INSERT INTO mem_test SELECT
|
||||
number,
|
||||
number
|
||||
FROM numbers(100);
|
||||
|
||||
ALTER TABLE mem_test
|
||||
UPDATE a = 0 WHERE b = 99;
|
||||
ALTER TABLE mem_test
|
||||
UPDATE a = 0 WHERE b = 99;
|
||||
ALTER TABLE mem_test
|
||||
UPDATE a = 0 WHERE b = 99;
|
||||
ALTER TABLE mem_test
|
||||
UPDATE a = 0 WHERE b = 99;
|
||||
ALTER TABLE mem_test
|
||||
UPDATE a = 0 WHERE b = 99;
|
||||
|
||||
SELECT *
|
||||
FROM mem_test
|
||||
FORMAT Null;
|
||||
|
||||
DROP TABLE mem_test;
|
Loading…
Reference in New Issue
Block a user