Files
greptimedb/mito2/compaction/twcs/index.html
T

19 lines
14 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `twcs` mod in crate `mito2`."><title>mito2::compaction::twcs - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../../static.files/rustdoc-1ed95124.css"><meta name="rustdoc-vars" data-root-path="../../../" data-static-root-path="../../../static.files/" data-current-crate="mito2" data-themes="" data-resource-suffix="" data-rustdoc-version="1.98.1 (48a229cea 2026-09-01)" data-channel="1.98.1" data-search-js="search-9944d736.js" data-stringdex-js="stringdex-2da4960a.js" data-settings-js="settings-170eb4bf.js" ><script src="../../../static.files/storage-41dd4d93.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../../static.files/main-417ebf0a.js"></script><noscript><link rel="stylesheet" href="../../../static.files/noscript-f7c3ffd8.css"></noscript><link rel="alternate icon" type="image/png" href="../../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../../static.files/favicon-044be391.svg"></head><body class="rustdoc mod"><a class="skip-main-content" href="#main-content">Skip to main content</a><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Module twcs</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../mito2/index.html">mito2</a><span class="version">1.4.0-alpha.0</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module twcs</a></h2><h3><a href="#modules">Module Items</a></h3><ul class="block"><li><a href="#modules" title="Modules">Modules</a></li><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#enums" title="Enums">Enums</a></li><li><a href="#constants" title="Constants">Constants</a></li><li><a href="#statics" title="Statics">Statics</a></li><li><a href="#functions" title="Functions">Functions</a></li><li><a href="#types" title="Type Aliases">Type Aliases</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="../index.html">In mito2::<wbr>compaction</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content" tabindex="-1"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../../index.html">mito2</a>::<wbr><a href="../index.html">compaction</a></div><h1>Module <span>twcs</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../../src/mito2/compaction/twcs.rs.html#15-4574">Source</a> </span></div><h2 id="modules" class="section-header">Modules<a href="#modules" class="anchor">§</a></h2><dl class="item-table"><dt><a class="mod" href="units/index.html" title="mod mito2::compaction::twcs::units">units</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dd>Unit-based compaction picks for one TWCS window.</dd></dl><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><dl class="item-table"><dt><a class="struct" href="struct.Candidate.html" title="struct mito2::compaction::twcs::Candidate">Candidate</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dd>Metrics of a candidate compaction input, accumulated one file at a time.</dd><dt><a class="struct" href="struct.CandidateScore.html" title="struct mito2::compaction::twcs::CandidateScore">Candidate<wbr>Score</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dd>Score of a candidate compaction input. Higher is better: first by the predicted
net file count reduction, then by the number of files participating in an
overlap, then by smaller input bytes.</dd><dt><a class="struct" href="struct.OrderedFile.html" title="struct mito2::compaction::twcs::OrderedFile">Ordered<wbr>File</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dt><a class="struct" href="struct.TwcsPicker.html" title="struct mito2::compaction::twcs::TwcsPicker">Twcs<wbr>Picker</a></dt><dd><code>TwcsPicker</code> picks files of which the max timestamp are in the same time window as compaction
candidates.</dd><dt><a class="struct" href="struct.Window.html" title="struct mito2::compaction::twcs::Window">Window</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dt><a class="struct" href="struct.WindowOutputContext.html" title="struct mito2::compaction::twcs::WindowOutputContext">Window<wbr>Output<wbr>Context</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dt><a class="struct" href="struct.WindowPick.html" title="struct mito2::compaction::twcs::WindowPick">Window<wbr>Pick</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dd>Compaction inputs picked for one window.</dd></dl><h2 id="enums" class="section-header">Enums<a href="#enums" class="anchor">§</a></h2><dl class="item-table"><dt><a class="enum" href="enum.PickClass.html" title="enum mito2::compaction::twcs::PickClass">Pick<wbr>Class</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dd>Scheduling priority of a window’s pick. Earlier classes are scheduled first,
and newer windows first within a class.</dd></dl><h2 id="constants" class="section-header">Constants<a href="#constants" class="anchor">§</a></h2><dl class="item-table"><dt><a class="constant" href="constant.CLOSED_MERGE_INPUT_FACTOR.html" title="constant mito2::compaction::twcs::CLOSED_MERGE_INPUT_FACTOR">CLOSED_<wbr>MERGE_<wbr>INPUT_<wbr>FACTOR</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dd>A closed merge in an inactive window may take this many times
<a href="static.MAX_INPUT_FILES.html" title="static mito2::compaction::twcs::MAX_INPUT_FILES"><code>MAX_INPUT_FILES</code></a>. Resolving overlaps across a whole window needs all of
its overlapping files at once, and each byte is rewritten once per window.</dd><dt><a class="constant" href="constant.DEFAULT_MAX_INPUT_FILES.html" title="constant mito2::compaction::twcs::DEFAULT_MAX_INPUT_FILES">DEFAULT_<wbr>MAX_<wbr>INPUT_<wbr>FILES</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dd>Default maximum number of input SST files in one compaction input.</dd><dt><a class="constant" href="constant.LEVEL_COMPACTED.html" title="constant mito2::compaction::twcs::LEVEL_COMPACTED">LEVEL_<wbr>COMPACTED</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dt><a class="constant" href="constant.MAX_INPUT_FILES_ENV.html" title="constant mito2::compaction::twcs::MAX_INPUT_FILES_ENV">MAX_<wbr>INPUT_<wbr>FILES_<wbr>ENV</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dt><a class="constant" href="constant.MAX_L1_L0_ROW_RATIO.html" title="constant mito2::compaction::twcs::MAX_L1_L0_ROW_RATIO">MAX_<wbr>L1_<wbr>L0_<wbr>ROW_<wbr>RATIO</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dd>A mixed L0/L1 compaction may rewrite at most this many L1 rows per L0 row.</dd></dl><h2 id="statics" class="section-header">Statics<a href="#statics" class="anchor">§</a></h2><dl class="item-table"><dt><a class="static" href="static.MAX_INPUT_FILES.html" title="static mito2::compaction::twcs::MAX_INPUT_FILES">MAX_<wbr>INPUT_<wbr>FILES</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dd>Maximum number of input SST files in one compaction input.
Configurable via <a href="constant.MAX_INPUT_FILES_ENV.html" title="constant mito2::compaction::twcs::MAX_INPUT_FILES_ENV"><code>MAX_INPUT_FILES_ENV</code></a>.</dd></dl><h2 id="functions" class="section-header">Functions<a href="#functions" class="anchor">§</a></h2><dl class="item-table"><dt><a class="fn" href="fn.assign_to_windows.html" title="fn mito2::compaction::twcs::assign_to_windows">assign_<wbr>to_<wbr>windows</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dd>Assigns files to windows with predefined window size (in seconds) by their max timestamps.</dd><dt><a class="fn" href="fn.find_active_window_by_sequence.html" title="fn mito2::compaction::twcs::find_active_window_by_sequence">find_<wbr>active_<wbr>window_<wbr>by_<wbr>sequence</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dd>Finds the active window from the file with the highest sequence number.</dd><dt><a class="fn" href="fn.find_latest_window_in_seconds.html" title="fn mito2::compaction::twcs::find_latest_window_in_seconds">find_<wbr>latest_<wbr>window_<wbr>in_<wbr>seconds</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dd>Finds the latest active writing window among all files.
Returns <code>None</code> when there are no files.</dd><dt><a class="fn" href="fn.is_balanced_candidate.html" title="fn mito2::compaction::twcs::is_balanced_candidate">is_<wbr>balanced_<wbr>candidate</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dt><a class="fn" href="fn.is_quiet_window.html" title="fn mito2::compaction::twcs::is_quiet_window">is_<wbr>quiet_<wbr>window</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dd>Whether the region has written at least as many rows as <code>files</code> hold, and at
least one row, since the newest of them was written. Sequences are assigned
per row and compaction keeps the inputs’ maximum, so this needs no state.
Files written before row counts were recorded have zero rows, so a window
holding them is not quiet.</dd><dt><a class="fn" href="fn.is_settling_window.html" title="fn mito2::compaction::twcs::is_settling_window">is_<wbr>settling_<wbr>window</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dd>Whether <code>window</code> is the one right before <code>active_window</code>, where late data
still lands.</dd><dt><a class="fn" href="fn.log_pick_result.html" title="fn mito2::compaction::twcs::log_pick_result">log_<wbr>pick_<wbr>result</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dt><a class="fn" href="fn.ordered_files.html" title="fn mito2::compaction::twcs::ordered_files">ordered_<wbr>files</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dd>Flattens sorted runs into files ordered by <code>(start asc, end desc)</code>, breaking ties
by run and position to keep the order deterministic.</dd><dt><a class="fn" href="fn.parse_max_input_files.html" title="fn mito2::compaction::twcs::parse_max_input_files">parse_<wbr>max_<wbr>input_<wbr>files</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dt><a class="fn" href="fn.pick_candidate_files.html" title="fn mito2::compaction::twcs::pick_candidate_files">pick_<wbr>candidate_<wbr>files</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dt><a class="fn" href="fn.pick_count_first.html" title="fn mito2::compaction::twcs::pick_count_first">pick_<wbr>count_<wbr>first</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dd>Picks a contiguous (in global time order) interval of files to compact.</dd><dt><a class="fn" href="fn.pick_count_first_where.html" title="fn mito2::compaction::twcs::pick_count_first_where">pick_<wbr>count_<wbr>first_<wbr>where</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dt><a class="fn" href="fn.pick_inactive_l0.html" title="fn mito2::compaction::twcs::pick_inactive_l0">pick_<wbr>inactive_<wbr>l0</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dd>Absorbs L0 files of an inactive window, in order of preference:</dd><dt><a class="fn" href="fn.pick_mixed_within_budget.html" title="fn mito2::compaction::twcs::pick_mixed_within_budget">pick_<wbr>mixed_<wbr>within_<wbr>budget</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dd>Mixed-level fallback for inactive windows: bypasses the balance checks but
bounds the total rewrite to the output file budget.</dd><dt><a class="fn" href="fn.pick_unbalanced_count_first.html" title="fn mito2::compaction::twcs::pick_unbalanced_count_first">pick_<wbr>unbalanced_<wbr>count_<wbr>first</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dd>Last-resort pick for inactive windows with no balance requirement at all.
Callers must only pass single-level (L0) files so the rewrite stays bounded
by their bytes.</dd><dt><a class="fn" href="fn.selected_overlaps_unselected.html" title="fn mito2::compaction::twcs::selected_overlaps_unselected">selected_<wbr>overlaps_<wbr>unselected</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dt><a class="fn" href="fn.time_window_intersects_range.html" title="fn mito2::compaction::twcs::time_window_intersects_range">time_<wbr>window_<wbr>intersects_<wbr>range</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dt><a class="fn" href="fn.time_window_start.html" title="fn mito2::compaction::twcs::time_window_start">time_<wbr>window_<wbr>start</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dd>Uses the same half-open windows as memtables, including timestamps in the first
second after a boundary. An unrepresentable window start is clamped to <code>i64::MIN</code>.</dd><dt><a class="fn" href="fn.window_has_overlap.html" title="fn mito2::compaction::twcs::window_has_overlap">window_<wbr>has_<wbr>overlap</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt></dl><h2 id="types" class="section-header">Type Aliases<a href="#types" class="anchor">§</a></h2><dl class="item-table"><dt><a class="type" href="type.CandidatePicker.html" title="type mito2::compaction::twcs::CandidatePicker">Candidate<wbr>Picker</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt></dl></section></div></main></body></html>