-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
Allow KILL QUERY for backups #58804
Merged
vitlibar
merged 6 commits into
ClickHouse:master
from
vitlibar:allow-kill-query-for-backups
Jan 20, 2024
Merged
Allow KILL QUERY for backups #58804
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
3d7a17a
Allow KILL QUERY to cancel backups/restores.
vitlibar 185f6cc
Add tests for cancelling backup/restore queries.
vitlibar 085833a
Use special statuses BACKUP_CANCELLED and RESTORE_CANCELLED in system…
vitlibar c15edeb
Use the same row in system.processes and the same query_id for both a…
vitlibar 4c6d3e7
Add server settings "shutdown_wait_backups_and_restores" (default=true)
vitlibar 1a1b089
Rename function checkQueryNotCancelled() and add check for thread_group.
vitlibar File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,9 @@ class IDatabase; | |
using DatabasePtr = std::shared_ptr<IDatabase>; | ||
struct StorageID; | ||
enum class AccessEntityType; | ||
class QueryStatus; | ||
using QueryStatusPtr = std::shared_ptr<QueryStatus>; | ||
|
||
|
||
/// Collects backup entries for all databases and tables which should be put to a backup. | ||
class BackupEntriesCollector : private boost::noncopyable | ||
|
@@ -97,11 +100,15 @@ class BackupEntriesCollector : private boost::noncopyable | |
|
||
Strings setStage(const String & new_stage, const String & message = ""); | ||
|
||
/// Throws an exception if the BACKUP query was cancelled. | ||
void checkQueryNotCancelled() const; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's rename to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I renamed it to |
||
|
||
const ASTBackupQuery::Elements backup_query_elements; | ||
const BackupSettings backup_settings; | ||
std::shared_ptr<IBackupCoordination> backup_coordination; | ||
const ReadSettings read_settings; | ||
ContextPtr context; | ||
QueryStatusPtr process_list_element; | ||
|
||
/// The time a BACKUP ON CLUSTER or RESTORE ON CLUSTER command will wait until all the nodes receive the BACKUP (or RESTORE) query and start working. | ||
/// This setting is similar to `distributed_ddl_task_timeout`. | ||
|
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it should be done before checking if
storage
is a null pointer?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm calling
checkQueryNotCancelled()
before doing anything time-consuming. Checking a pointer for null is not time-consuming.