mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-11-26 20:54:08 +00:00
* perf(mito2): split seq scan ranges of files with disjoint primary keys Seq scan merged every SST whose time range overlapped another into one partition range. Compaction outputs split by max_output_file_size cover the same time range with disjoint primary keys, so a compacted window was read and deduplicated by a single partition. Ranges are now merged only when both their time ranges and their primary key ranges overlap. Memtables and files without key statistics still overlap every key. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * perf(mito2): index open seq scan groups by primary key Grouping compared each range with every open group, so n files with disjoint keys in one time window took n(n-1) checks. Open groups now sit in a BTreeMap keyed by their min primary key; their key ranges are disjoint, so one range lookup finds every group to merge. Groups that ended before the current range are closed when a lookup reaches them. Per-series scans keep grouping ranges by time only. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * perf(mito2): merge the smaller seq scan range into the larger one A range that joined many groups, such as a memtable overlapping many files with disjoint keys, was appended to each group in turn and copied its growing index lists every time. Merges now append the smaller range to the larger one, so each index is copied O(log n) times. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * docs(mito2): clarify the seq scan grouping invariant and lookup cutoff State that grouping keeps every version of a (primary key, timestamp) pair together, instead of "ranges in different groups never share a key", which read as if one key could not appear in two groups. Explain why the reverse BTreeMap walk can stop early: disjoint key ranges order their upper bounds the same as their lower bounds. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * fix(mito2): split seq scan ranges by primary key only without a distribution TimeWindowed scans advertise (ts, primary key) ordering. Key-disjoint ranges that partition assignment reorders inside one partition would not keep it, so scans with any distribution keep grouping ranges by time. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * docs(mito2): state that SeqScan does not keep the TimeWindowed ordering today Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * fix(mito2): locate the primary key column by its top-level path A nested field such as a JSON child named __primary_key has the same leaf name and comes first, so the bounds and the primary key projection could read the wrong column. Closes #10582 Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * refactor(mito2): rename files_time_range_pruned to files_manifest_pruned Signed-off-by: Dennis Zhuang <killme2008@gmail.com> --------- Signed-off-by: Dennis Zhuang <killme2008@gmail.com>