ClickHouse / ClickHouse/ClickHouse

distributed_ddl/ReplicatedMergeTree ALTER inconsistency

Open
#78,588 0 comments 1 reaction 0 assignees View on GitHub
comp-ddl external unexpected behaviour
Dominant language
C++
Stars
49.9k
Forks
9k
Avg merge
21h 32m
Merged PRs (30d)
515

Description

### Company or project name

Aliexpress, VK

### Describe the unexpected behaviour

ALTER TABLE atomicdb.replicated_table ON cluster anycluster ADD column anycolumn anytype;

SELECT exception_text FROM system.distributed_ddl_queue where query='...';
```
┌─exception_text───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Code: 15. DB::Exception: Cannot add column `anycolumn`: column with this name already exists. (DUPLICATE_COLUMN) (version 24.6.2.17 (official build)) │
└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
```

### How to reproduce

CREATE TABLE ... Engine=ReplicatedMergeTree(...);

do some "ON CLUSTER ADD COLUMN" alters

### Expected behavior

Respect replicated tables parameters, or remote_servers configuration, for Engine=ReplicatedMergeTree tables.
ON CLUSTER should add column to 1 replica per shard, then report success or wait for replication delay.

### Error message and/or stacktrace

_No response_

### Additional context

ALTER can be executed with "IF NOT EXISTS" modifier, but what about ON CLUSTER column materialization? should it be executed replication factor times?
plz implement a fix or a setting controls this behavior.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.