-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Cleanup ExternalSorter metrics (#5885) #6364
Conversation
/// count of spills during the execution of the operator | ||
spill_count: Count, | ||
|
||
/// total spilled bytes during the execution of the operator | ||
spilled_bytes: Count, | ||
|
||
/// current memory usage for the operator | ||
mem_used: Gauge, |
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.
These were only used by ExternalSorter and so I figure aren't really Baseline
93b24f0
to
09a798a
Compare
/// multiple in-mem sort metrics and final merge-sort metrics from `SortPreservingMergeStream`. | ||
/// Therefore, We need a separation of metrics for which are final metrics (for output_rows accumulation), | ||
/// and which are intermediate metrics that we only account for elapsed_compute time. | ||
pub struct CompositeMetricsSet { |
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.
BaselineMetrics::intermediate replaces the need for this
|
||
/// Wraps a [`BaselineMetrics`] and records memory usage on a [`MemoryReservation`] | ||
#[derive(Debug)] | ||
pub struct MemTrackingMetrics { |
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 think this construction may date from an earlier iteration of the memory tracking, as it stands now it makes little sense.
The memory reported by the mem_used metric will be a somewhat arbitrary value based on the last value at the point the plan finished. Additionally there isn't any way to use the MemoryReservation in a fallible manner. It felt easier to just separate the concerns of reporting plan metrics from tracking runtime memory usage.
09a798a
to
eafefe4
Compare
@@ -56,6 +55,27 @@ use tempfile::NamedTempFile; | |||
use tokio::sync::mpsc::{Receiver, Sender}; | |||
use tokio::task; | |||
|
|||
struct ExternalSorterMetrics { |
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 agree it is much nicer to put sorting metrics on the sorter rather than BaselineMetrics
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.
My benchmark run shows no changes in performance, as expected
|
)" This reverts commit cf81117.
)" This reverts commit cf81117.
)" This reverts commit cf81117.
)" This reverts commit cf81117.
Which issue does this PR close?
Part of #5885
Part of #5108
Rationale for this change
In preparation for improving the memory accounting in ExternalSorter / SortPreservingMerge I first wanted to sanitise what already existed. I will call out the various changes in the PR
What changes are included in this PR?
Are these changes tested?
Are there any user-facing changes?
mem_used, spill_count and spilled_bytes are no longer included in BaselineMetrics (as they were only used by ExternalSorter)
CompositeMetricsSet and MemTrackingMetrics have been removed