Fix recovering replicated databases with long moving metadata file#85177
Merged
tuanpach merged 2 commits intoClickHouse:masterfrom Aug 15, 2025
Merged
Conversation
Contributor
|
Workflow [PR], commit [4e17c72] Summary: ❌
|
cfbaabd to
4ce8c5a
Compare
jkartseva
reviewed
Aug 11, 2025
src/Interpreters/DatabaseCatalog.cpp
Outdated
| if (!is_database_guard) | ||
| { | ||
| static constexpr int MAX_TRY = 10; | ||
| static constexpr int INTERVAL_MS = 100; |
Member
There was a problem hiding this comment.
nit: base/base/sleep.h :void sleepForMilliseconds(uint64_t milliseconds); parameter is unsigned
…meout. - Moves the moving file before checking if the table loading tasks are finished
710e533 to
4e17c72
Compare
Merged
via the queue into
ClickHouse:master
with commit Aug 15, 2025
cf137c2
119 of 122 checks passed
1 task
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.
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix recovering replicated databases when moving the metadata file takes a long time.
When creating a Replicated DB, at this point, the DB is considered started because the loading tasks are finished.
The DDLWorker can process the DDLs. If there is a create table DDL, it needs to acquire the table
ddl_guardhere. Theddl_guardrequires the shared db mutex here.If moving the metadata file takes a long time, the DB
ddl_guardis still on hold. When DDLWorker is creating a table, it cannot acquire the DB shared mutex and throws an exception:This PR:
Documentation entry for user-facing changes