Files
dennis zhuang 0813fc3527 fix(mito2): size old SSTs from size statistics and move the downgrade target to v1.2.0 (#10585)
* test(compat): downgrade to v1.2.1 instead of v1.1.4

SSTs written since #10528 can have inverted-index segments that cross row
group boundaries. Readers older than v1.2.0 do not split such segments and
return fewer rows, so v1.1.x is no longer a supported downgrade target.

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>

* fix(cmd): record the decoded row group size of a replacement SST

sst_replace set max_row_group_decoded_size to 0 for the replacement file.
Compute it from the replacement footer with the helper writers use, which
is now public in mito2.

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>

* fix(mito2): derive decoded value bytes from size statistics for old SSTs

SSTs written before #10528 have no greptime:max_row_group_value_bytes or
greptime:max_row_value_width footer keys, so a row group of repeated large
dictionary-encoded values was sized by its encoded bytes on the first
compaction and read after upgrade.

When the keys are absent, sum the unencoded_byte_array_data_bytes size
statistic of each row group's byte array column chunks instead, skipping
columns that readers decode as Arrow dictionaries like the writer does.
Parquet writers record the statistic whenever column statistics are
enabled, which mito did by default with parquet >= 53 (v0.12.0).

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>

* fix(mito2): count only top-level var-len columns in the size statistics fallback

The fallback summed every non-dictionary byte array leaf, including leaves
nested in structs such as JSON2 columns, which the footer keys do not
count. New files without var-len values write no keys, so they took the
fallback and got a larger decoded size than before.

Count only leaves that are top-level string or binary columns, which
matches var_len_value_bytes and leaves key-less new files unchanged. Drop
the early exit, which dictionary primary keys defeated anyway.

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>

* perf(mito2): index the Arrow schema by root column in the size statistics fallback

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>

* test(compat): look up an inverted index segment that crosses a row group boundary after downgrade

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>

* test(compat): also downgrade to v1.2.0, the oldest reader that splits index segments

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>

* fix(mito2): treat unparseable footer size keys as absent

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>

* docs(compat): state the v1.2.0 downgrade floor

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>

---------

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
2026-11-25 08:48:16 +00:00
..