review suggestions

This commit is contained in:
Alexander Tokmakov 2020-11-11 16:27:54 +03:00
parent 7da5e92754
commit dbac7860b1
3 changed files with 7 additions and 9 deletions

View File

@ -422,6 +422,7 @@ void QueryFuzzer::fuzzMain(ASTPtr & ast)
std::cout << std::endl;
WriteBufferFromOStream ast_buf(std::cout, 4096);
formatAST(*ast, ast_buf, false /*highlight*/);
ast_buf.next();
std::cout << std::endl << std::endl;
}

View File

@ -136,8 +136,9 @@ void MemoryTracker::alloc(Int64 size)
const auto * description = description_ptr.load(std::memory_order_relaxed);
amount.fetch_sub(size, std::memory_order_relaxed);
throw DB::Exception(DB::ErrorCodes::MEMORY_LIMIT_EXCEEDED,
"Memory tracker {}: fault injected. Would use {} (attempt to allocate chunk of {} bytes), maximum: {}",
description ? description : "", formatReadableSizeWithBinarySuffix(will_be),
"Memory tracker{}{}: fault injected. Would use {} (attempt to allocate chunk of {} bytes), maximum: {}",
description ? " " : "", description ? description : "",
formatReadableSizeWithBinarySuffix(will_be),
size, formatReadableSizeWithBinarySuffix(current_hard_limit));
}
@ -164,8 +165,9 @@ void MemoryTracker::alloc(Int64 size)
const auto * description = description_ptr.load(std::memory_order_relaxed);
amount.fetch_sub(size, std::memory_order_relaxed);
throw DB::Exception(DB::ErrorCodes::MEMORY_LIMIT_EXCEEDED,
"Memory limit {} exceeded: would use {} (attempt to allocate chunk of {} bytes), maximum: {}",
description ? description : "", formatReadableSizeWithBinarySuffix(will_be),
"Memory limit{}{} exceeded: would use {} (attempt to allocate chunk of {} bytes), maximum: {}",
description ? " " : "", description ? description : "",
formatReadableSizeWithBinarySuffix(will_be),
size, formatReadableSizeWithBinarySuffix(current_hard_limit));
}

View File

@ -271,11 +271,6 @@ inline void writeString(const StringRef & ref, WriteBuffer & buf)
writeString(ref.data, ref.size, buf);
}
//inline void writeString(const std::string_view & view, WriteBuffer & buf)
//{
// writeString(view.data(), view.size(), buf);
//}
/** Writes a C-string without creating a temporary object. If the string is a literal, then `strlen` is executed at the compilation stage.
* Use when the string is a literal.