mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-27 10:02:01 +00:00
fix alter table ttl error when this table has light weight delete mask file (_row_exists.bin)
After applying light weight delete to MergeTree table, a delete mask file (_row_exists.bin) will appears in the wide part directory. Then we execute "ALTER TABLE xxxxxx MODIFY TTL xxxx" to this table, clickhouse will report error in log message: "NOT_FOUND_COLUMN_IN_BLOCK, Not found column _row_exists in block". The root cause of this bug is that: in MutationsInterpreter::prepare(), when constructing the select columns, it does not include the system columns, but only physic columns (not include _row_exists.bin). however the output block of the execute pipeline contains _row_exists column, then error occurs. this bug is severe, because mutate TTL will continuously to execute, never end. the only workaround is to truncate the whole table. the fix is to return all columns including row_exists when executing alter table TTL query
This commit is contained in:
parent
c1f6555b32
commit
c98e52e9ee
@ -656,6 +656,12 @@ ASTPtr MutationsInterpreter::prepare(bool dry_run)
|
||||
}
|
||||
else if (command.type == MutationCommand::MATERIALIZE_TTL)
|
||||
{
|
||||
if (auto part_storage = dynamic_pointer_cast<DB::StorageFromMergeTreeDataPart>(storage))
|
||||
{
|
||||
if (part_storage->hasLightweightDeletedMask())
|
||||
return_all_columns = true;
|
||||
}
|
||||
|
||||
mutation_kind.set(MutationKind::MUTATE_OTHER);
|
||||
if (materialize_ttl_recalculate_only)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user