-
Notifications
You must be signed in to change notification settings - Fork 409
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
Make performance of TPCH q15 stable #4570
Merged
Merged
Changes from 2 commits
Commits
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 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 |
---|---|---|
|
@@ -522,7 +522,14 @@ void Aggregator::prepareAggregateInstructions(Columns columns, AggregateColumns | |
} | ||
} | ||
|
||
bool Aggregator::executeOnBlock(const Block & block, AggregatedDataVariants & result, const FileProviderPtr & file_provider, ColumnRawPtrs & key_columns, AggregateColumns & aggregate_columns, bool & no_more_keys) | ||
bool Aggregator::executeOnBlock( | ||
const Block & block, | ||
AggregatedDataVariants & result, | ||
const FileProviderPtr & file_provider, | ||
ColumnRawPtrs & key_columns, | ||
AggregateColumns & aggregate_columns, | ||
Int64 & local_delta_memory, | ||
bool & no_more_keys) | ||
{ | ||
if (isCancelled()) | ||
return true; | ||
|
@@ -600,7 +607,13 @@ bool Aggregator::executeOnBlock(const Block & block, AggregatedDataVariants & re | |
size_t result_size = result.sizeWithoutOverflowRow(); | ||
Int64 current_memory_usage = 0; | ||
if (current_memory_tracker) | ||
{ | ||
current_memory_usage = current_memory_tracker->get(); | ||
auto updated_local_delta_memory = CurrentMemoryTracker::getLocalDeltaMemory(); | ||
auto local_delta_memory_diff = updated_local_delta_memory - local_delta_memory; | ||
current_memory_usage += (local_memory_usage.fetch_add(local_delta_memory_diff) + local_delta_memory_diff); | ||
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. local_delta_memory_diff is added twice? 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. No, |
||
local_delta_memory = updated_local_delta_memory; | ||
} | ||
|
||
auto result_size_bytes = current_memory_usage - memory_usage_before_aggregation; /// Here all the results in the sum are taken into account, from different threads. | ||
|
||
|
@@ -815,14 +828,14 @@ void Aggregator::execute(const BlockInputStreamPtr & stream, AggregatedDataVaria | |
src_rows += block.rows(); | ||
src_bytes += block.bytes(); | ||
|
||
if (!executeOnBlock(block, result, file_provider, key_columns, aggregate_columns, no_more_keys)) | ||
if (!executeOnBlock(block, result, file_provider, key_columns, aggregate_columns, params.local_delta_memory, no_more_keys)) | ||
break; | ||
} | ||
|
||
/// If there was no data, and we aggregate without keys, and we must return single row with the result of empty aggregation. | ||
/// To do this, we pass a block with zero rows to aggregate. | ||
if (result.empty() && params.keys_size == 0 && !params.empty_result_for_aggregation_by_empty_set) | ||
executeOnBlock(stream->getHeader(), result, file_provider, key_columns, aggregate_columns, no_more_keys); | ||
executeOnBlock(stream->getHeader(), result, file_provider, key_columns, aggregate_columns, params.local_delta_memory, no_more_keys); | ||
|
||
double elapsed_seconds = watch.elapsedSeconds(); | ||
size_t rows = result.sizeWithoutOverflowRow(); | ||
|
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
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.
local_delta
is thread-local, so different threads will see different deltas, is that what you expect?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.
https://github.com/pingcap/tiflash/pull/4570/files#diff-773c77885e15377996db622e99646f024c4815893a7d44878db9bc05bbc4bf6fR612
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.
Yes