-
Notifications
You must be signed in to change notification settings - Fork 12
Accept table function as destination for part export #1320
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
base: antalya-25.8
Are you sure you want to change the base?
Changes from all commits
0c7f7c7
41d6ed2
911fade
8c98d73
d613c80
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,6 +6,7 @@ | |
| #include <QueryPipeline/QueryPipeline.h> | ||
| #include <optional> | ||
| #include <Core/Settings.h> | ||
| #include <Storages/IStorage.h> | ||
|
|
||
| namespace DB | ||
| { | ||
|
|
@@ -43,14 +44,14 @@ struct MergeTreePartExportManifest | |
| }; | ||
|
|
||
| MergeTreePartExportManifest( | ||
| const StorageID & destination_storage_id_, | ||
| const StoragePtr destination_storage_ptr_, | ||
| const DataPartPtr & data_part_, | ||
| const String & transaction_id_, | ||
| FileAlreadyExistsPolicy file_already_exists_policy_, | ||
| const Settings & settings_, | ||
| const StorageMetadataPtr & metadata_snapshot_, | ||
| std::function<void(CompletionCallbackResult)> completion_callback_ = {}) | ||
| : destination_storage_id(destination_storage_id_), | ||
| : destination_storage_ptr(destination_storage_ptr_), | ||
| data_part(data_part_), | ||
| transaction_id(transaction_id_), | ||
| file_already_exists_policy(file_already_exists_policy_), | ||
|
|
@@ -59,7 +60,7 @@ struct MergeTreePartExportManifest | |
| completion_callback(completion_callback_), | ||
| create_time(time(nullptr)) {} | ||
|
|
||
| StorageID destination_storage_id; | ||
| StoragePtr destination_storage_ptr; | ||
| DataPartPtr data_part; | ||
| /// Used for killing the export. | ||
| String transaction_id; | ||
|
|
@@ -78,20 +79,12 @@ struct MergeTreePartExportManifest | |
|
|
||
| bool operator<(const MergeTreePartExportManifest & rhs) const | ||
| { | ||
| // Lexicographic comparison: first compare destination storage, then part name | ||
| auto lhs_storage = destination_storage_id.getQualifiedName(); | ||
| auto rhs_storage = rhs.destination_storage_id.getQualifiedName(); | ||
|
|
||
| if (lhs_storage != rhs_storage) | ||
| return lhs_storage < rhs_storage; | ||
|
|
||
| return data_part->name < rhs.data_part->name; | ||
| } | ||
|
Comment on lines
80
to
83
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.
Because Useful? React with 👍 / 👎. |
||
|
|
||
| bool operator==(const MergeTreePartExportManifest & rhs) const | ||
| { | ||
| return destination_storage_id.getQualifiedName() == rhs.destination_storage_id.getQualifiedName() | ||
| && data_part->name == rhs.data_part->name; | ||
| return data_part->name == rhs.data_part->name; | ||
| } | ||
| }; | ||
|
|
||
|
|
||
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.
The export task now uses the captured
destination_storage_ptrdirectly without rechecking whether the destination table still exists or is dropped/detached. If the destination table is dropped after the ALTER EXPORT is queued but before this background task executes,destination_storage->import(...)will still run and can write data for a table that no longer exists (or has been recreated with a different definition). Previously the task re-resolved the destination from the catalog and aborted on UNKNOWN_TABLE; consider re-looking it up or at least checkingis_dropped/locking before proceeding.Useful? React with 👍 / 👎.
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.
This is an interesting one. This is kind of an existing problem, not exclusive to this PR.
Plain object storage tables don't have state, and there is no trigger / event for when these tables are dropped. At the same time, it is safe (in terms of thread and memory safety) to write to S3 even after the table has been dropped.
Being that said, I think we have a few options:
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.
In any case, I don't think this is a major issue. We probably have bigger fish to fry