Add tid and logTrace function#15803
Merged
alexey-milovidov merged 5 commits intoClickHouse:masterfrom Oct 10, 2020
Merged
Conversation
| @@ -0,0 +1 @@ | |||
| SELECT logTrace('message') | |||
Member
There was a problem hiding this comment.
How to test: we can do SYSTEM FLUSH LOGS and find this message in system.text_log.
src/Functions/tid.cpp
Outdated
|
|
||
| void executeImpl(Block & block, const ColumnNumbers &, size_t result, size_t) const override | ||
| { | ||
| UInt64 current_tid = std::hash<std::thread::id>{}(std::this_thread::get_id()); |
Member
There was a problem hiding this comment.
No, I mean base/common/getThreadId.h - it returns OS thread id similar to pid.
src/Functions/tid.cpp
Outdated
| { | ||
| UInt64 current_tid = std::hash<std::thread::id>{}(std::this_thread::get_id()); | ||
|
|
||
| block.getByPosition(result).column = DataTypeUInt64().createColumnConst(1, current_tid); |
Member
There was a problem hiding this comment.
But it shouldn't be of size 1... It should be of size input_rows_count.
src/Functions/logTrace.cpp
Outdated
| static auto * log = &Poco::Logger::get("logTrace"); | ||
| LOG_TRACE(log, message); | ||
|
|
||
| block.getByPosition(result).column = DataTypeUInt8().createColumnConst(1, 0); |
Member
There was a problem hiding this comment.
Also, it shouldn't have size 1.
src/Functions/logTrace.cpp
Outdated
| throw Exception( | ||
| "First argument for function " + getName() + " must be Constant string", ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT); | ||
|
|
||
| static auto * log = &Poco::Logger::get("logTrace"); |
Member
There was a problem hiding this comment.
Let's name logger "FunctionLogTrace", so the users will know that the message is emitted from here.
Member
There was a problem hiding this comment.
Ok. Also you can just set CLICKHOUSE_CLIENT_SERVER_LOGS_LEVEL before loading shell_config.
alexey-milovidov
approved these changes
Oct 10, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I hereby agree to the terms of the CLA available at: https://yandex.ru/legal/cla/?lang=en
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Add
tidandlogTracefunction. This closes #9434.Detailed description / Documentation draft:
...
By adding documentation, you'll allow users to try your new feature immediately, not when someone else will have time to document it later. Documentation is necessary for all features that affect user experience in any way. You can add brief documentation draft above, or add documentation right into your patch as Markdown files in docs folder.
If you are doing this for the first time, it's recommended to read the lightweight Contributing to ClickHouse Documentation guide first.
Information about CI checks: https://clickhouse.tech/docs/en/development/continuous-integration/