forked from ClickHouse/ClickHouse
-
Notifications
You must be signed in to change notification settings - Fork 9
improve observability a bit, simplify sink #1017
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
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
3cbe981
improve observability a bit, simplify sink
arthurpassos 3698055
add docs to the import api
arthurpassos 9d9dbe8
add memory consumption tracking
arthurpassos e6f3ab7
fix
arthurpassos 8d3f65b
Update src/Storages/IStorage.h
arthurpassos 2ac019c
add profile events and persist some settings in the manifest
arthurpassos bab19e3
fix settingshistory
arthurpassos e8c2076
store checksum of the part
arthurpassos 7f7085b
adapt tests
arthurpassos cf638d3
adapt tests
arthurpassos 947f7d7
add adjustOnBackgroundTaskEnd for export
arthurpassos 5376495
add missing increment
arthurpassos 437e67c
Merge branch 'antalya-25.6.5' into simple_export_part
arthurpassos File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| #include <Storages/MergeTree/ExportList.h> | ||
|
|
||
| namespace DB | ||
| { | ||
|
|
||
| ExportsListElement::ExportsListElement( | ||
| const StorageID & source_table_id_, | ||
| const StorageID & destination_table_id_, | ||
| UInt64 part_size_, | ||
| const String & part_name_, | ||
| const String & target_file_name_, | ||
| UInt64 total_rows_to_read_, | ||
| UInt64 total_size_bytes_compressed_, | ||
| UInt64 total_size_bytes_uncompressed_, | ||
| time_t create_time_, | ||
| const ContextPtr & context) | ||
| : source_table_id(source_table_id_) | ||
| , destination_table_id(destination_table_id_) | ||
| , part_size(part_size_) | ||
| , part_name(part_name_) | ||
| , destination_file_path(target_file_name_) | ||
| , total_rows_to_read(total_rows_to_read_) | ||
| , total_size_bytes_compressed(total_size_bytes_compressed_) | ||
| , total_size_bytes_uncompressed(total_size_bytes_uncompressed_) | ||
| , create_time(create_time_) | ||
| { | ||
| thread_group = ThreadGroup::createForBackgroundProcess(context); | ||
| } | ||
|
|
||
| ExportsListElement::~ExportsListElement() | ||
| { | ||
| background_memory_tracker.adjustOnBackgroundTaskEnd(&thread_group->memory_tracker); | ||
| } | ||
|
|
||
| ExportInfo ExportsListElement::getInfo() const | ||
| { | ||
| ExportInfo res; | ||
| res.source_database = source_table_id.database_name; | ||
| res.source_table = source_table_id.table_name; | ||
| res.destination_database = destination_table_id.database_name; | ||
| res.destination_table = destination_table_id.table_name; | ||
| res.part_name = part_name; | ||
| res.destination_file_path = destination_file_path; | ||
| res.rows_read = rows_read; | ||
| res.total_rows_to_read = total_rows_to_read; | ||
| res.total_size_bytes_compressed = total_size_bytes_compressed; | ||
| res.total_size_bytes_uncompressed = total_size_bytes_uncompressed; | ||
| res.bytes_read_uncompressed = bytes_read_uncompressed; | ||
| res.memory_usage = getMemoryUsage(); | ||
| res.peak_memory_usage = getPeakMemoryUsage(); | ||
| res.create_time = create_time; | ||
| res.elapsed = elapsed; | ||
| return res; | ||
| } | ||
|
|
||
| UInt64 ExportsListElement::getMemoryUsage() const | ||
| { | ||
| return thread_group->memory_tracker.get(); | ||
| } | ||
|
|
||
| UInt64 ExportsListElement::getPeakMemoryUsage() const | ||
| { | ||
| return thread_group->memory_tracker.getPeak(); | ||
| } | ||
|
|
||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| #pragma once | ||
|
|
||
| #include <Storages/MergeTree/BackgroundProcessList.h> | ||
| #include <Interpreters/StorageID.h> | ||
| #include <Common/Stopwatch.h> | ||
| #include <Common/CurrentMetrics.h> | ||
| #include <Common/ThreadStatus.h> | ||
| #include <Poco/URI.h> | ||
| #include <boost/noncopyable.hpp> | ||
|
|
||
| namespace CurrentMetrics | ||
| { | ||
| extern const Metric Export; | ||
| } | ||
|
|
||
| namespace DB | ||
| { | ||
|
|
||
| struct ExportInfo | ||
| { | ||
| String source_database; | ||
| String source_table; | ||
| String destination_database; | ||
| String destination_table; | ||
| String part_name; | ||
| String destination_file_path; | ||
| UInt64 rows_read; | ||
| UInt64 total_rows_to_read; | ||
| UInt64 total_size_bytes_compressed; | ||
| UInt64 total_size_bytes_uncompressed; | ||
| UInt64 bytes_read_uncompressed; | ||
| UInt64 memory_usage; | ||
| UInt64 peak_memory_usage; | ||
| time_t create_time = 0; | ||
| Float64 elapsed; | ||
| }; | ||
|
|
||
| struct ExportsListElement : private boost::noncopyable | ||
| { | ||
| const StorageID source_table_id; | ||
| const StorageID destination_table_id; | ||
| const UInt64 part_size; | ||
| const String part_name; | ||
| const String destination_file_path; | ||
| UInt64 rows_read {0}; | ||
| UInt64 total_rows_to_read {0}; | ||
| UInt64 total_size_bytes_compressed {0}; | ||
| UInt64 total_size_bytes_uncompressed {0}; | ||
| UInt64 bytes_read_uncompressed {0}; | ||
| time_t create_time {0}; | ||
| Float64 elapsed {0}; | ||
|
|
||
| Stopwatch watch; | ||
| ThreadGroupPtr thread_group; | ||
|
|
||
| ExportsListElement( | ||
| const StorageID & source_table_id_, | ||
| const StorageID & destination_table_id_, | ||
| UInt64 part_size_, | ||
| const String & part_name_, | ||
| const String & destination_file_path_, | ||
| UInt64 total_rows_to_read_, | ||
| UInt64 total_size_bytes_compressed_, | ||
| UInt64 total_size_bytes_uncompressed_, | ||
| time_t create_time_, | ||
| const ContextPtr & context); | ||
|
|
||
| ~ExportsListElement(); | ||
|
|
||
| ExportInfo getInfo() const; | ||
|
|
||
| UInt64 getMemoryUsage() const; | ||
| UInt64 getPeakMemoryUsage() const; | ||
| }; | ||
|
|
||
|
|
||
| class ExportsList final : public BackgroundProcessList<ExportsListElement, ExportInfo> | ||
| { | ||
| private: | ||
| using Parent = BackgroundProcessList<ExportsListElement, ExportInfo>; | ||
|
|
||
| public: | ||
| ExportsList() | ||
| : Parent(CurrentMetrics::Export) | ||
| {} | ||
| }; | ||
|
|
||
| using ExportsListEntry = BackgroundProcessListEntry<ExportsListElement, ExportInfo>; | ||
|
|
||
| } |
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.
i would probably add few counters to profile events smth like
PartsExports (counter of successfull exports)
PartsExportFailures (counter of exports with exception)
PartsExportDuplicated (when target exists)
PartsExportBytes (sum of the bytes written by exports)
PartsExportTotalMilliseconds (overall time of exports)
(Names - if you will have better ideas - feel free :) )
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.
Added these except for
PartsExportBytesbecause I still don't have the writing stats integrated.