DDL creation of a distributed table with empty cluster '' returns exception but with wrong table created, restart will fail. #27832
Labels
potential bug
To be reviewed by developers and confirmed/rejected.
When I tried to create a distributed table with empty cluster '', the create statement failed with exception "Code: 170. DB::Exception: Received from localhost:9000. DB::Exception: Requested cluster '' not found.". However, show tables can see the WRONG table.
Later when CH restarted, unable to start due to unable to attach this wrong table.
The question is: When we try to startup the new created table during creation, if error happens, this new table should be dropped? OR we should add some special check on the cluster for Distributed engine to avoid this kind of error? OR we can just ignore this error during start up to allow CK server to start, not failed?
CH version: 21.7.3.14 (official build).
How to reproduce:
create table t_empty(a int) engine=Distributed('','','');
service clickhouse-server forcerestart
service clickhouse-server status
Now there is no clickhouse-server process.
##### output ###
node236 :) create table t_empty(a int) engine=Distributed('','','');
CREATE TABLE t_empty
(
a
int)
ENGINE = Distributed('', '', '')
Query id: c9eb24ea-f87d-4431-9bdc-18d21fbb5636
0 rows in set. Elapsed: 0.054 sec.
Received exception from server (version 21.7.3):
Code: 170. DB::Exception: Received from localhost:9000. DB::Exception: Requested cluster '' not found.
node236 :) show tables;
SHOW TABLES
Query id: 0d9e2398-26c5-46eb-baf2-a02111bc770e
┌─name────┐
│ people │
│ t_empty │
└─────────┘
2 rows in set. Elapsed: 0.001 sec.
node236 :) show create table t_empty;
SHOW CREATE TABLE t_empty
Query id: 8c489c90-dfe0-4392-9742-17a43a075c12
┌─statement───────────────────────────────────────────────────────────────────┐
│ CREATE TABLE default.t_empty
(
a
Int32)
ENGINE = Distributed('', '', '') │
└─────────────────────────────────────────────────────────────────────────────┘
==== clickhouse-server.err.log ===
backtrace for DDL
2021.08.19 12:12:03.150990 [ 19900 ] {c9eb24ea-f87d-4431-9bdc-18d21fbb5636} TCPHandler: Code: 170, e.displayText() = DB::Exception: Requested cluster '' n
ot found, Stack trace:
house
ryProcessingStage::Enum, bool) @ 0xfe208e3 in /usr/bin/clickhouse
backtrace for start up of CH
2021.08.19 12:22:47.254734 [ 25174 ] {} Application: Caught exception while loading metadata: Code: 170, e.displayText() = DB::Exception: Requested cluster '' not found: while loading database
default
from path /var/lib/clickhouse/metadata/default, Stack trace (when copying this message, always include the lines below):(version 21.7.3.14 (official build))
2021.08.19 12:22:48.260957 [ 25174 ] {} Application: DB::Exception: Requested cluster '' not found: while loading database
default
from path /var/lib/clickhouse/metadata/defaultThe text was updated successfully, but these errors were encountered: