mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 08:32:02 +00:00
small fixes
This commit is contained in:
parent
765aa4d4e3
commit
9d6730a846
@ -898,6 +898,40 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
void reportQueryError() const
|
||||
{
|
||||
// If we probably have progress bar, we should add additional
|
||||
// newline, otherwise exception may display concatenated with
|
||||
// the progress bar.
|
||||
if (need_render_progress)
|
||||
std::cerr << '\n';
|
||||
|
||||
if (server_exception)
|
||||
{
|
||||
std::string text = server_exception->displayText();
|
||||
auto embedded_stack_trace_pos = text.find("Stack trace");
|
||||
if (std::string::npos != embedded_stack_trace_pos
|
||||
&& !config().getBool("stacktrace", false))
|
||||
{
|
||||
text.resize(embedded_stack_trace_pos);
|
||||
}
|
||||
std::cerr << "Received exception from server (version "
|
||||
<< server_version << "):" << std::endl << "Code: "
|
||||
<< server_exception->code() << ". " << text << std::endl;
|
||||
}
|
||||
|
||||
if (client_exception)
|
||||
{
|
||||
fmt::print(stderr,
|
||||
"Error on processing query '{}':\n{}",
|
||||
full_query, client_exception->message());
|
||||
}
|
||||
|
||||
// A debug check -- at least some exception must be set, if the error
|
||||
// flag is set, and vice versa.
|
||||
assert(have_error == (client_exception || server_exception));
|
||||
}
|
||||
|
||||
bool processMultiQuery(const String & all_queries_text)
|
||||
{
|
||||
// It makes sense not to base any control flow on this, so that it is
|
||||
@ -1148,7 +1182,7 @@ private:
|
||||
|
||||
if (!test_hint.clientError() && !test_hint.serverError())
|
||||
{
|
||||
// No error was expected but it still ocurred. This is the
|
||||
// No error was expected but it still occurred. This is the
|
||||
// default case w/o test hint, doesn't need additional
|
||||
// diagnostics.
|
||||
error_matches_hint = false;
|
||||
@ -1185,32 +1219,7 @@ private:
|
||||
// Report error.
|
||||
if (have_error)
|
||||
{
|
||||
// If we probably have progress bar, we should add additional
|
||||
// newline, otherwise exception may display concatenated with
|
||||
// the progress bar.
|
||||
if (need_render_progress)
|
||||
std::cerr << '\n';
|
||||
|
||||
if (server_exception)
|
||||
{
|
||||
std::string text = server_exception->displayText();
|
||||
auto embedded_stack_trace_pos = text.find("Stack trace");
|
||||
if (std::string::npos != embedded_stack_trace_pos
|
||||
&& !config().getBool("stacktrace", false))
|
||||
{
|
||||
text.resize(embedded_stack_trace_pos);
|
||||
}
|
||||
std::cerr << "Received exception from server (version "
|
||||
<< server_version << "):" << std::endl << "Code: "
|
||||
<< server_exception->code() << ". " << text << std::endl;
|
||||
}
|
||||
|
||||
if (client_exception)
|
||||
{
|
||||
fmt::print(stderr,
|
||||
"Error on processing query '{}':\n{}",
|
||||
full_query, client_exception->message());
|
||||
}
|
||||
reportQueryError();
|
||||
}
|
||||
|
||||
// Stop processing queries if needed.
|
||||
@ -1414,6 +1423,11 @@ private:
|
||||
}
|
||||
|
||||
processParsedSingleQuery();
|
||||
|
||||
if (have_error)
|
||||
{
|
||||
reportQueryError();
|
||||
}
|
||||
}
|
||||
|
||||
// Parameters are in global variables:
|
||||
|
@ -11,12 +11,6 @@
|
||||
namespace DB
|
||||
{
|
||||
|
||||
namespace ErrorCodes
|
||||
{
|
||||
extern const int UNEXPECTED_ERROR_CODE;
|
||||
}
|
||||
|
||||
|
||||
/// Checks expected server and client error codes in testmode.
|
||||
/// To enable it add special comment after the query: "-- { serverError 60 }" or "-- { clientError 20 }".
|
||||
/// Also you can enable echoing all queries by writing "-- { echo }".
|
||||
|
@ -568,7 +568,7 @@ def main(args):
|
||||
if not check_server_started(args.client, args.server_check_retries):
|
||||
raise Exception(
|
||||
"Server is not responding. Cannot execute 'SELECT 1' query. \
|
||||
Note: if you are using unbundled mode, you also have to specify -c option.")
|
||||
Note: if you are using split build, you may have to specify -c option.")
|
||||
|
||||
build_flags = collect_build_flags(args.client)
|
||||
if args.antlr:
|
||||
@ -846,10 +846,10 @@ if __name__ == '__main__':
|
||||
parser.add_argument('--tmp', help='Path to tmp dir')
|
||||
|
||||
parser.add_argument('-b', '--binary', default='clickhouse',
|
||||
help='Path to clickhouse (if bundled, clickhouse-server otherwise) binary or name of binary in PATH')
|
||||
help='Path to clickhouse (if monolithic build, clickhouse-server otherwise) binary or name of binary in PATH')
|
||||
|
||||
parser.add_argument('-c', '--client',
|
||||
help='Path to clickhouse-client (if unbundled, useless otherwise) binary of name of binary in PATH')
|
||||
help='Path to clickhouse-client (if split build, useless otherwise) binary of name of binary in PATH')
|
||||
|
||||
parser.add_argument('--extract_from_config', help='extract-from-config program')
|
||||
parser.add_argument('--configclient', help='Client config (if you use not default ports)')
|
||||
@ -930,11 +930,11 @@ if __name__ == '__main__':
|
||||
if find_binary(args.binary + '-client'):
|
||||
args.client = args.binary + '-client'
|
||||
|
||||
print("Using " + args.client + " as client program (expecting unbundled mode)")
|
||||
print("Using " + args.client + " as client program (expecting split build)")
|
||||
elif find_binary(args.binary):
|
||||
args.client = args.binary + ' client'
|
||||
|
||||
print("Using " + args.client + " as client program (expecting bundled mode)")
|
||||
print("Using " + args.client + " as client program (expecting monolithic build)")
|
||||
else:
|
||||
print("No 'clickhouse' or 'clickhouse-client' client binary found", file=sys.stderr)
|
||||
parser.print_help()
|
||||
|
@ -23,3 +23,5 @@ select nonexistent column; -- { serverError 47 }
|
||||
insert into values_01564 values (1); select 1;
|
||||
select 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 }
|
||||
|
Loading…
Reference in New Issue
Block a user