mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-11-14 06:46:56 +00:00
perf(mito2): compare raw series keys without copying them
The ordered-key guard built a Buffer for every record before checking whether a previous package key existed to compare against. Read the slices instead, so the common case allocates nothing. Signed-off-by: discord9 <discord9@163.com>
This commit is contained in:
@@ -324,16 +324,15 @@ pub(crate) fn make_stream(
|
||||
held = Some(record);
|
||||
break;
|
||||
}
|
||||
if ordering == SeriesOrdering::KeyThenTime {
|
||||
let first_key = primary_key_at_row(&record.batch, 0).map(Buffer::from);
|
||||
if let (Some(previous), Some(first)) = (last_package_key.as_ref(), first_key)
|
||||
&& first.as_slice() <= previous.as_slice()
|
||||
{
|
||||
upstream_error = Some(InvalidRecordBatchSnafu {
|
||||
reason: "legacy series primary keys are not strictly increasing".to_string(),
|
||||
}.build());
|
||||
break;
|
||||
}
|
||||
if ordering == SeriesOrdering::KeyThenTime
|
||||
&& let Some(previous) = last_package_key.as_ref()
|
||||
&& let Some(first) = primary_key_at_row(&record.batch, 0)
|
||||
&& first <= previous.as_slice()
|
||||
{
|
||||
upstream_error = Some(InvalidRecordBatchSnafu {
|
||||
reason: "legacy series primary keys are not strictly increasing".to_string(),
|
||||
}.build());
|
||||
break;
|
||||
}
|
||||
buffered_rows += record.batch.num_rows();
|
||||
if record.ends_package
|
||||
|
||||
Reference in New Issue
Block a user