Skip to content
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

Fix quadratic slowdown when ingesting data with uniform time #3088

Merged
merged 2 commits into from
Aug 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 21 additions & 11 deletions crates/re_arrow_store/src/store_write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -380,15 +380,21 @@ impl IndexedTable {
}
}

debug!(
kind = "insert",
timeline = %timeline.name(),
time = timeline.typ().format(time),
entity = %ent_path,
len_limit = config.indexed_bucket_num_rows,
len, len_overflow,
"couldn't split indexed bucket, proceeding to ignore limits"
let bucket_time_range = bucket.inner.read().time_range;

re_log::debug_once!(
"Failed to split bucket on timeline {}",
bucket.timeline.format_time_range(&bucket_time_range)
);

if bucket_time_range.min == bucket_time_range.max {
re_log::warn_once!(
"Found over {} rows with the same timepoint {:?}={} - perhaps you forgot to update or remove the timeline?",
config.indexed_bucket_num_rows,
bucket.timeline.name(),
bucket.timeline.typ().format(bucket_time_range.min)
);
}
}

trace!(
Expand Down Expand Up @@ -437,6 +443,13 @@ impl IndexedBucket {
} = &mut *inner;

// append time to primary column and update time range appropriately

if let Some(last_time) = col_time.last() {
if time.as_i64() < *last_time {
*is_sorted = false;
}
}

col_time.push(time.as_i64());
*time_range = TimeRange::new(time_range.min.min(time), time_range.max.max(time));
size_bytes_added += time.as_i64().total_size_bytes();
Expand Down Expand Up @@ -495,9 +508,6 @@ impl IndexedBucket {
}
}

// TODO(#433): re_datastore: properly handle already sorted data during insertion
*is_sorted = false;

*size_bytes += size_bytes_added;

#[cfg(debug_assertions)]
Expand Down