mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-20 00:30:49 +00:00
remove debug logging
This commit is contained in:
parent
c84bad3259
commit
55ec1a17e7
@ -24,7 +24,6 @@
|
||||
#include "MatchGenerator.h"
|
||||
|
||||
#include <Common/Exception.h>
|
||||
#include <Common/logger_useful.h>
|
||||
#include <Common/thread_local_rng.h>
|
||||
#include <map>
|
||||
#include <functional>
|
||||
@ -330,13 +329,6 @@ private:
|
||||
|
||||
|
||||
public:
|
||||
explicit RandomStringPrepareWalker(bool logging)
|
||||
: logger(logging ? &Poco::Logger::get("GeneratorCombiner") : nullptr)
|
||||
{
|
||||
if (logger)
|
||||
LOG_DEBUG(logger, "GeneratorCombiner");
|
||||
}
|
||||
|
||||
std::function<String()> getGenerator()
|
||||
{
|
||||
if (root == nullptr)
|
||||
@ -374,16 +366,11 @@ private:
|
||||
|
||||
Regexp * ShortVisit(Regexp* /*re*/, Regexp * /*parent_arg*/) override
|
||||
{
|
||||
if (logger)
|
||||
LOG_DEBUG(logger, "ShortVisit");
|
||||
throw DB::Exception(DB::ErrorCodes::LOGICAL_ERROR, "ShortVisit should not be called");
|
||||
}
|
||||
|
||||
Regexp * PreVisit(Regexp * re, Regexp * parent_arg, bool* /*stop*/) override /*noexcept*/
|
||||
{
|
||||
if (logger)
|
||||
LOG_DEBUG(logger, "GeneratorCombiner PreVisit node {}", magic_enum::enum_name(re->op()));
|
||||
|
||||
if (parent_arg == nullptr)
|
||||
{
|
||||
chassert(root == nullptr);
|
||||
@ -397,10 +384,6 @@ private:
|
||||
Regexp * PostVisit(Regexp * re, Regexp * /*parent_arg*/, Regexp * pre_arg,
|
||||
Regexp ** child_args, int nchild_args) override /*noexcept*/
|
||||
{
|
||||
if (logger)
|
||||
LOG_DEBUG(logger, "GeneratorCombiner PostVisit node {}",
|
||||
magic_enum::enum_name(re->op()));
|
||||
|
||||
switch (re->op())
|
||||
{
|
||||
case kRegexpConcat: // Matches concatenation of sub_[0..nsub-1].
|
||||
@ -456,8 +439,6 @@ private:
|
||||
return pre_arg;
|
||||
}
|
||||
|
||||
Poco::Logger * logger = nullptr;
|
||||
|
||||
Regexp * root = nullptr;
|
||||
Generators generators;
|
||||
};
|
||||
@ -473,7 +454,7 @@ void RandomStringGeneratorByRegexp::RegexpPtrDeleter::operator() (re2::Regexp *
|
||||
re->Decref();
|
||||
}
|
||||
|
||||
RandomStringGeneratorByRegexp::RandomStringGeneratorByRegexp(const String & re_str, bool logging)
|
||||
RandomStringGeneratorByRegexp::RandomStringGeneratorByRegexp(const String & re_str)
|
||||
{
|
||||
re2::RE2::Options options;
|
||||
options.set_case_sensitive(true);
|
||||
@ -490,7 +471,7 @@ RandomStringGeneratorByRegexp::RandomStringGeneratorByRegexp(const String & re_s
|
||||
|
||||
regexp.reset(regexp->Simplify());
|
||||
|
||||
auto walker = re2::RandomStringPrepareWalker(logging);
|
||||
auto walker = re2::RandomStringPrepareWalker();
|
||||
walker.Walk(regexp.get(), {});
|
||||
generatorFunc = walker.getGenerator();
|
||||
|
||||
|
@ -14,7 +14,7 @@ namespace DB
|
||||
class RandomStringGeneratorByRegexp
|
||||
{
|
||||
public:
|
||||
RandomStringGeneratorByRegexp(const String & re_str, bool logging);
|
||||
explicit RandomStringGeneratorByRegexp(const String & re_str);
|
||||
String generate() const;
|
||||
|
||||
private:
|
||||
|
@ -11,7 +11,7 @@ class GeneratorWithTemplate : public DB::IObjectStorageKeysGenerator
|
||||
public:
|
||||
explicit GeneratorWithTemplate(String key_template_)
|
||||
: key_template(std::move(key_template_))
|
||||
, re_gen(key_template, /*logging*/ false)
|
||||
, re_gen(key_template)
|
||||
{
|
||||
}
|
||||
DB::ObjectStorageKey generate(const String &) const override
|
||||
|
@ -8,7 +8,7 @@
|
||||
void routine(String s)
|
||||
{
|
||||
std::cerr << "case '"<< s << "'";
|
||||
auto gen = DB::RandomStringGeneratorByRegexp(s, /*logging*/ true);
|
||||
auto gen = DB::RandomStringGeneratorByRegexp(s);
|
||||
[[maybe_unused]] auto res = gen.generate();
|
||||
std::cerr << " result '"<< res << "'" << std::endl;
|
||||
}
|
||||
@ -46,7 +46,7 @@ TEST(GenerateRandomString, Negative)
|
||||
TEST(GenerateRandomString, DifferentResult)
|
||||
{
|
||||
std::cerr << "100 different keys" << std::endl;
|
||||
auto gen = DB::RandomStringGeneratorByRegexp("prefix-[a-z]{3}-suffix/[0-9a-f]{20}", /*logging*/ true);
|
||||
auto gen = DB::RandomStringGeneratorByRegexp("prefix-[a-z]{3}-suffix/[0-9a-f]{20}");
|
||||
std::set<String> deduplicate;
|
||||
for (int i = 0; i < 100; ++i)
|
||||
ASSERT_TRUE(deduplicate.insert(gen.generate()).second);
|
||||
@ -56,7 +56,7 @@ TEST(GenerateRandomString, DifferentResult)
|
||||
TEST(GenerateRandomString, FullRange)
|
||||
{
|
||||
std::cerr << "all possible letters" << std::endl;
|
||||
auto gen = DB::RandomStringGeneratorByRegexp("[a-z]", /*logging*/ false);
|
||||
auto gen = DB::RandomStringGeneratorByRegexp("[a-z]");
|
||||
std::set<String> deduplicate;
|
||||
int count = 'z' - 'a' + 1;
|
||||
while (deduplicate.size() < count)
|
||||
|
Loading…
Reference in New Issue
Block a user