OS
[root@ck3 ~]# uname -ra
Linux ck3 3.10.0-957.el7.x86_64 #1 SMP Thu Nov 8 23:39:32 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
[root@ck3 ~]# cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core)
clickhouse version
ClickHouse server version 19.13.1.11 (official build).
In case the OS is abnormally closed (power off), after 14 hours we tried to launch the clickouse. Unable to launch, The information in the log is “Incorrect user”.
`2019.09.19 22:24:29.471300 [ 1 ] {}
`2019.09.19 22:24:29.360436 [ 1 ] {}
2019.09.19 22:24:29.360489 [ 1 ] {}
2019.09.19 22:24:29.362666 [ 1 ] {}
2019.09.19 22:24:29.362678 [ 1 ] {}
2019.09.19 22:24:29.362683 [ 1 ] {}
2019.09.19 22:24:29.362908 [ 1 ] {}
2019.09.19 22:24:29.363720 [ 1 ] {}
2019.09.19 22:24:29.364632 [ 1 ] {}
2019.09.19 22:24:29.364742 [ 1 ] {}
2019.09.19 22:24:29.364759 [ 1 ] {}
2019.09.19 22:24:29.365639 [ 1 ] {}
2019.09.19 22:24:29.366322 [ 5 ] {}
2019.09.19 22:24:29.366587 [ 5 ] {}
2019.09.19 22:24:29.369476 [ 5 ] {}
2019.09.19 22:24:29.369919 [ 5 ] {}
2019.09.19 22:24:29.370292 [ 5 ] {}
2019.09.19 22:24:29.383715 [ 5 ] {}
2019.09.19 22:24:29.383759 [ 5 ] {}
2019.09.19 22:24:29.395537 [ 5 ] {}
2019.09.19 22:24:29.396001 [ 5 ] {}
2019.09.19 22:24:29.409038 [ 1 ] {}
2019.09.19 22:24:29.409093 [ 13 ] {}
2019.09.19 22:24:29.410616 [ 13 ] {}
2019.09.19 22:24:29.410826 [ 13 ] {}
2019.09.19 22:24:29.410915 [ 13 ] {}
2019.09.19 22:24:29.411191 [ 13 ] {}
2019.09.19 22:24:29.412128 [ 14 ] {}
2019.09.19 22:24:29.412149 [ 14 ] {}
2019.09.19 22:24:29.412153 [ 14 ] {}
2019.09.19 22:24:29.412155 [ 14 ] {}
2019.09.19 22:24:29.412158 [ 14 ] {}
2019.09.19 22:24:29.412161 [ 14 ] {}
2019.09.19 22:24:29.412163 [ 14 ] {}
2019.09.19 22:24:29.412166 [ 14 ] {}
2019.09.19 22:24:29.412174 [ 14 ] {}
2019.09.19 22:24:29.412177 [ 14 ] {}
2019.09.19 22:24:29.412180 [ 14 ] {}
2019.09.19 22:24:29.412182 [ 14 ] {}
2019.09.19 22:24:29.412185 [ 14 ] {}
2019.09.19 22:24:29.412188 [ 14 ] {}
2019.09.19 22:24:29.413900 [ 24 ] {}
2019.09.19 22:24:29.414229 [ 15 ] {}
2019.09.19 22:24:29.420634 [ 24 ] {}
2019.09.19 22:24:29.421036 [ 24 ] {}
2019.09.19 22:24:29.421165 [ 24 ] {}
2019.09.19 22:24:29.434266 [ 26 ] {}
2019.09.19 22:24:29.471300 [ 1 ] {}
I'm also seeing this in 19.15.2.2, and am having a hard time working out what the issue is.
The exception happens when CH tries to attach a distributed table, and there is a directory that does not comply with the naming convention for distributed table's directories.
CREATE TABLE system.dt AS system.settings
ENGINE = Distributed(test_shard_localhost, system, settings)
Ok.
DETACH TABLE system.dt
Ok.
mkdir /var/lib/clickhouse/data/system/dt/a_dir
ATTACH TABLE system.dt
Received exception from server (version 19.15.3):
Code: 62. DB::Exception: Received from localhost:9000. DB::Exception: Incorrect user[:password]@host:port#default_database format a_dir.
The problem is that there is no reference to the table, and during a restart it is not possible to understand what exactly is wrong.
Yes, in the end I figured out there was a detached and format_version.txt in the distributed data folder, even though for a distributed table these shouldn't be there. Once I removed them everything booted fine, but it took a long time to identify the table at fault, I have to move the metadata, start the server, put the metadata back, and then attach a table one by one to find the offending table. It would be good if the offending table name was printed in the log!
Thanks for the @SaltTan and @jpiper.
Strongly agree with @jpiper's point of view.
Another test case
:) create table test (a Int8) Engine=MergeTree() order by tuple()
CREATE TABLE test
(
`a` Int8
)
ENGINE = MergeTree()
ORDER BY tuple()
Ok.
0 rows in set. Elapsed: 0.117 sec.
:) detach table test
DETACH TABLE test
Ok.
0 rows in set. Elapsed: 0.001 sec.
:) create table test AS system.settings ENGINE = Distributed(test_shard_localhost, system, settings)
CREATE TABLE test AS system.settings
ENGINE = Distributed(test_shard_localhost, system, settings)
Received exception from server (version 19.15.3):
Code: 62. DB::Exception: Received from localhost:9000. DB::Exception: Incorrect user[:password]@host:port#default_database format detached.
0 rows in set. Elapsed: 0.127 sec.
:) select count() from test
SELECT count()
FROM test
┌─count()─┐
│ 240 │
└─────────┘
1 rows in set. Elapsed: 0.046 sec.
This issue will be solved in fundamental fashion in https://github.com/ClickHouse/ClickHouse/issues/6787
But simpler solution is possible. We can check that directory already exists on CREATE TABLE and throw an exception.
Fixed in #7512
Most helpful comment
Yes, in the end I figured out there was a
detachedandformat_version.txtin the distributed data folder, even though for a distributed table these shouldn't be there. Once I removed them everything booted fine, but it took a long time to identify the table at fault, I have to move the metadata, start the server, put the metadata back, and then attach a table one by one to find the offending table. It would be good if the offending table name was printed in the log!