Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename log when rename merge tree tables #39227

Merged
merged 1 commit into from
Jul 26, 2022

Conversation

amosbird
Copy link
Collaborator

Changelog category (leave one):

  • Bug Fix (user-visible misbehavior in official stable or prestable release)

Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):

Fix wrong table name in logs after RENAME TABLE. This fixes #38018

Information about CI checks: https://clickhouse.com/docs/en/development/continuous-integration/

@robot-ch-test-poll robot-ch-test-poll added the pr-bugfix Pull request with bugfix, not backported by default label Jul 14, 2022
{
IStorage::renameInMemory(new_table_id);
std::atomic_store(&log_name, std::make_shared<String>(new_table_id.getNameForLogs()));
log = &Poco::Logger::get(*log_name);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting. Maybe it should be a general approach for all tables?

P.S. I was thinking about more general logging than right now sometime before, i.e. move log into the IStorage, that way it will have the same format for all engines

@Avogar Avogar self-assigned this Jul 26, 2022
@Avogar Avogar merged commit c683cb2 into ClickHouse:master Jul 26, 2022
Poco::Logger * log;
/// log_name will change during table RENAME. Use atomic_shared_ptr to allow concurrent RW.
/// NOTE clang-14 doesn't have atomic_shared_ptr yet. Use std::atomic* operations for now.
std::shared_ptr<String> log_name;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe remove log_name and return getStorageID().getNameForLogs() from getLogName()?

@tavplubix
Copy link
Member

Also this PR does not update logger name in other places (see usages of getLogName()) and it makes things more confusing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-bugfix Pull request with bugfix, not backported by default
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wrong table name in logs after RENAME TABLE
5 participants