Skip to content

Commit d5b2057

Browse files
authored
Merge pull request ClickHouse#78910 from PedroTadim/next-update
Next BuzzHouse update
2 parents 0e1a0a5 + 24d30b4 commit d5b2057

18 files changed

+2600
-2183
lines changed

programs/client/FuzzLoop.cpp

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ namespace ErrorCodes
4242
extern const int NOT_IMPLEMENTED;
4343
extern const int SYNTAX_ERROR;
4444
extern const int TOO_DEEP_RECURSION;
45+
extern const int TIMEOUT_EXCEEDED;
46+
extern const int SOCKET_TIMEOUT;
4547
extern const int BUZZHOUSE;
4648
}
4749

@@ -499,8 +501,16 @@ bool Client::processBuzzHouseQuery(const String & full_query)
499501
// Query completed with error, keep the previous starting AST.
500502
// Also discard the exception that we now know to be non-fatal,
501503
// so that it doesn't influence the exit code.
504+
const auto * exception = server_exception ? server_exception.get() : (client_exception ? client_exception.get() : nullptr);
505+
const bool throw_timeout_error = fuzz_config->fail_on_timeout && exception
506+
&& (exception->code() == ErrorCodes::TIMEOUT_EXCEEDED || exception->code() == ErrorCodes::SOCKET_TIMEOUT);
507+
502508
server_exception.reset();
503509
client_exception.reset();
510+
if (throw_timeout_error)
511+
{
512+
throw Exception(ErrorCodes::BUZZHOUSE, "BuzzHouse exception on timeout");
513+
}
504514
}
505515
return server_up;
506516
}
@@ -665,12 +675,16 @@ bool Client::buzzHouse()
665675
}
666676
else if (settings_oracle && nopt < (correctness_oracle + settings_oracle + 1))
667677
{
668-
/// Test running query with different settings
678+
/// Test running query with different settings, but some times, call system commands
669679
qo.generateFirstSetting(rg, sq1);
670-
BuzzHouse::SQLQueryToString(full_query, sq1);
671-
outf << full_query << std::endl;
672-
server_up &= processBuzzHouseQuery(full_query);
673-
qo.setIntermediateStepSuccess(!have_error);
680+
if (sq1.has_explain())
681+
{
682+
/// Run query only when something was generated
683+
BuzzHouse::SQLQueryToString(full_query, sq1);
684+
outf << full_query << std::endl;
685+
server_up &= processBuzzHouseQuery(full_query);
686+
qo.setIntermediateStepSuccess(!have_error);
687+
}
674688

675689
sq2.Clear();
676690
full_query2.resize(0);
@@ -682,7 +696,7 @@ bool Client::buzzHouse()
682696

683697
sq3.Clear();
684698
full_query.resize(0);
685-
qo.generateSecondSetting(sq1, sq3);
699+
qo.generateSecondSetting(rg, gen, sq1, sq3);
686700
BuzzHouse::SQLQueryToString(full_query, sq3);
687701
outf << full_query << std::endl;
688702
server_up &= processBuzzHouseQuery(full_query);

0 commit comments

Comments
 (0)