mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 08:32:02 +00:00
Reconnect after client errors
This commit is contained in:
parent
8663d04b7f
commit
ec8ff21526
@ -680,6 +680,12 @@ private:
|
||||
|
||||
std::cerr << std::endl;
|
||||
|
||||
client_exception.reset(new Exception(e));
|
||||
}
|
||||
|
||||
if (client_exception)
|
||||
{
|
||||
/// client_exception may have been set above or elsewhere.
|
||||
/// Client-side exception during query execution can result in the loss of
|
||||
/// sync in the connection protocol.
|
||||
/// So we reconnect and allow to enter the next query.
|
||||
@ -937,7 +943,7 @@ private:
|
||||
if (client_exception)
|
||||
{
|
||||
fmt::print(stderr,
|
||||
"Error on processing query '{}':\n{}",
|
||||
"Error on processing query '{}':\n{}\n",
|
||||
full_query, client_exception->message());
|
||||
}
|
||||
|
||||
|
@ -649,7 +649,7 @@ def main(args):
|
||||
def is_test_from_dir(suite_dir, case):
|
||||
case_file = os.path.join(suite_dir, case)
|
||||
(name, ext) = os.path.splitext(case)
|
||||
return os.path.isfile(case_file) and (ext == '.sql' or ext == '.sh' or ext == '.py')
|
||||
return os.path.isfile(case_file) and (ext == '.sql' or ext == '.sh' or ext == '.py' or ext == '.expect' or os.access(case_file, os. X_OK))
|
||||
|
||||
def sute_key_func(item):
|
||||
if args.order == 'random':
|
||||
|
@ -42,5 +42,10 @@ OPTIMIZE TABLE values_01564 DEDUPLICATE BY; -- { clientError 62 }
|
||||
OPTIMIZE TABLE values_01564 DEDUPLICATE BY a EXCEPT a; -- { clientError 62 }
|
||||
select 'a' || distinct one || 'c' from system.one; -- { clientError 62 }
|
||||
|
||||
-- a failing insert and then a normal insert (#https://github.com/ClickHouse/ClickHouse/issues/19353)
|
||||
CREATE TABLE t0 (c0 String, c1 Int32) ENGINE = Memory() ;
|
||||
INSERT INTO t0(c0, c1) VALUES ("1",1) ; -- { clientError 47 }
|
||||
INSERT INTO t0(c0, c1) VALUES ('1', 1) ;
|
||||
|
||||
-- the return code must be zero after the final query has failed with expected error
|
||||
insert into values_01564 values (11); -- { serverError 469 }
|
||||
|
39
tests/queries/0_stateless/01565_reconnect_after_client_error.expect
Executable file
39
tests/queries/0_stateless/01565_reconnect_after_client_error.expect
Executable file
@ -0,0 +1,39 @@
|
||||
#!/usr/bin/expect -f
|
||||
|
||||
# This is a separate test, because we want to test the interactive mode.
|
||||
# https://github.com/ClickHouse/ClickHouse/issues/19353
|
||||
|
||||
log_user 0
|
||||
set timeout 5
|
||||
match_max 100000
|
||||
|
||||
# A default timeout action is to fail
|
||||
expect_after {
|
||||
timeout {
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
|
||||
set basedir [file dirname $argv0]
|
||||
spawn bash -c "source $basedir/../shell_config.sh ; \$CLICKHOUSE_CLIENT_BINARY \$CLICKHOUSE_CLIENT_OPT -mn"
|
||||
expect "\n:) "
|
||||
|
||||
send -- "DROP TABLE IF EXISTS t01565;\n"
|
||||
expect "\nOk."
|
||||
expect "\n:)"
|
||||
|
||||
send -- "CREATE TABLE t01565 (c0 String, c1 Int32) ENGINE = Memory() ;\n"
|
||||
expect "\nOk."
|
||||
expect "\n:) "
|
||||
|
||||
send -- "INSERT INTO t01565(c0, c1) VALUES (\"1\",1) ;\n"
|
||||
expect "\nConnected"
|
||||
expect "\n:) "
|
||||
|
||||
send -- "INSERT INTO t01565(c0, c1) VALUES ('1', 1) ;\n"
|
||||
expect "\nOk."
|
||||
expect "\n:) "
|
||||
|
||||
# Ctrl+D
|
||||
send -- "\4"
|
||||
expect eof
|
Loading…
Reference in New Issue
Block a user