MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / buzzHouse

Method buzzHouse

programs/client/FuzzLoop.cpp:587–1186  ·  view source on GitHub ↗

Returns false when server is not available.

Source from the content-addressed store, hash-verified

585
586/// Returns false when server is not available.
587bool Client::buzzHouse()
588{
589 String full_query;
590 bool no_eof = true;
591 bool server_up = true;
592 bool no_timeout = true;
593 static const String & rerun_database = "--External database ";
594 static const RE2 rerun_database_re(R"((?i)^--External\s+database\s+(.*)$)");
595 static const String & rerun_table = "--External table ";
596 static const RE2 rerun_table_re(R"((?i)^--External\s+table\s+(.*)$)");
597 static const RE2 extern_re(
598 R"((?i)^--External\s+command\s+(?:(async)\s+)?with\s+seed\s+(\d+)\s+to\s+([^\s]+)\s+table\s+([0-9A-Fa-f]+)\s+([0-9A-Fa-f]+)\s*$)");
599
600 /// Set time to run, but what if a query runs for too long?
601 using clock = std::chrono::steady_clock;
602 const auto deadline = fuzz_config->time_to_run > 0
603 ? std::optional<clock::time_point>(clock::now() + std::chrono::minutes(fuzz_config->time_to_run))
604 : std::nullopt;
605 full_query.reserve(8192);
606 if (fuzz_config->read_log)
607 {
608 std::ifstream infile(fuzz_config->log_path);
609
610 while (server_up && (no_timeout = (!deadline || clock::now() < *deadline))
611 && (no_eof = static_cast<bool>(std::getline(infile, full_query))))
612 {
613 String async_flag;
614 String seed_str;
615 String engine;
616 String database;
617 String table;
618
619 if (full_query == restart_cmd)
620 {
621 server_up &= fuzzLoopReconnect();
622 }
623 else if (startsWith(full_query, rerun_database) && RE2::FullMatch(full_query, rerun_database_re, &database))
624 {
625 const auto x = external_integrations->reRunCreateDatabase(BuzzHouse::IntegrationCall::Dolor, database);
626
627 UNUSED(x);
628 }
629 else if (startsWith(full_query, rerun_table) && RE2::FullMatch(full_query, rerun_table_re, &table))
630 {
631 const auto x = external_integrations->reRunCreateTable(BuzzHouse::IntegrationCall::Dolor, table);
632
633 UNUSED(x);
634 }
635 else if (
636 startsWith(full_query, external_cmd)
637 && RE2::FullMatch(full_query, extern_re, &async_flag, &seed_str, &engine, &database, &table))
638 {
639 uint64_t seed = 0;
640 const auto * const first = seed_str.data();
641 const auto * const last = first + seed_str.size();
642 const auto x = std::from_chars(first, last, seed, 10);
643
644 if (x.ec != std::errc{} || x.ptr != last)

Callers

nothing calls this directly

Calls 15

runExternalCommandFunction · 0.85
markerHexDecodeFunction · 0.85
loadFuzzerServerSettingsFunction · 0.85
loadFuzzerTableSettingsFunction · 0.85
loadSystemTablesFunction · 0.85
SQLQueryToStringFunction · 0.85
markerHexEncodeFunction · 0.85
updateGeneratorMethod · 0.80

Tested by

no test coverage detected