Files
greptimedb/docs/formats
discord9 9948a163c1 refactor(mito2): drop the unreachable samples builder and the unused prepared-series contract (#10430)
* refactor(mito2): drop the unreachable per-SST samples builder

Production only ever constructs the columnar samples format: SeriesFormats::from_config is
reached from with_format with experimental_series_index_format, where Legacy yields no
samples backend and Columnar yields ColumnarSamplesFormat. The other SamplesFormat impl is
cfg(test). So the per-SST branch of the maintenance task could never run, and build_samples
had no caller but its own test.

The daily columnar body is now unconditional, and the former branch position holds an
explicit UnsupportedOperation error so an unknown backend fails loudly instead of building
nothing. The two fake-format lifecycle tests were duplicates of
real_samples_reconcile_reopen_and_retire, which drives the same build/reuse/reopen/
catalog-failure/purge scenario against the real format; the abort test moved to
build_sample_windows, and a new test pins the refusal.

The compatibility fixtures are untouched and still pass.

Signed-off-by: discord9 <discord9@163.com>

* test(mito2): cover retirement after a successful samples rebuild

format_skeleton_build_reopen_and_retire was the only test of the retirement that follows a
successful rebuild; real_samples_reconcile_reopen_and_retire covered the failed-publish path
only. Removing the samples loop's mark_deleted() from publish_index_version left every other
series_index and series_scan test green, which is what made the gap invisible.

The real-format test now also rebuilds a day by deleting one of its objects, checks that the
superseded generation is no longer in the published snapshot, that nothing is purged while the
old snapshot and its handle are alive, and that its objects are purged once they are dropped.
With mark_deleted() commented out, all four cases fail on that last assertion.

Signed-off-by: discord9 <discord9@163.com>

* test(mito2): pin the purge to the last reader handle, not the snapshot

Dropping the published snapshot was allowed to release a superseded generation as long as
one of its handles was still held elsewhere, which no test covered: the retirement assertions
only checked that nothing was purged while the snapshot lived, then dropped every handle at
once.

The test now holds a reader handle on every generation the superseded snapshot published
before releasing it, so that release must purge nothing, and asserts that between the two
drops. A rebuild replaces several generations of a source group at once, so holding only the
one the test tracks would let its siblings be released legitimately and the assertion would
fail for a reason unrelated to the lifecycle under test.

A mutation that purges on snapshot drop -- ignoring live reader handles -- fails this new
assertion in all four cases and none of the later ones.

Signed-off-by: discord9 <discord9@163.com>

---------

Signed-off-by: discord9 <discord9@163.com>
2026-11-16 17:38:58 +08:00
..