Commit Graph
6893 Commits
Author SHA1 Message Date
discord9 05d5eedb67 feat(query): lower a piece cursor payload into the region scan request
Signed-off-by: discord9 <discord9@163.com>
2026-12-04 20:23:57 +08:00
discord9 fde998d880 merge main: follow the removed shared-compaction publication into the piece-read tests
Accept main's removal of the shared table-compaction machinery: the orphan publication test goes with it, and an adoption now vouches for the source's flush bytes through an internal import, the lane that keeps the proof a not-yet-visible object states.

Signed-off-by: discord9 <discord9@163.com>
2026-12-04 20:23:19 +08:00
Yingwen 3a1d0d110f perf(mito2): cache decoded series indexes and prefetch discovery (#10836)
* perf(mito2): cache decoded series index blocks and prefetch discovery

Port decoded columns, bounded projection fills, and caller-side cache fills from 58562b0, c41dd0c, 5f9a1c6, and 9c171c1. Overlap the first batch of the next covered index as in ddbb64a.

Signed-off-by: evenyag <realevenyag@gmail.com>

* fix(mito2): account decoded cache fills in scan metrics

Signed-off-by: evenyag <realevenyag@gmail.com>

* test(mito2): verify decoded cache hits skip scan accounting

Signed-off-by: evenyag <realevenyag@gmail.com>

* fix(mito2): pass scan metrics to the decoded projection loader

Signed-off-by: evenyag <realevenyag@gmail.com>

* perf(mito2): share the index result cache with decoded series indexes

Signed-off-by: evenyag <realevenyag@gmail.com>

* refactor(mito2): bind series load metrics in the index result cache

Signed-off-by: evenyag <realevenyag@gmail.com>

---------

Signed-off-by: evenyag <realevenyag@gmail.com>
2026-12-04 10:32:11 +00:00
Lei, HUANG 4b205bc0f0 refactor(mito2): remove shared SST compaction (#10934)
refactor(mito2)!: remove shared SST compaction

Remove the cross-region shared SST compaction mechanism from OSS:

- Delete the table-compaction publication kernel, the multi-region
  compaction executor, and the dedicated upload/metadata budgets.
- Restore L0/L1-only SST storage and remove shared-level handling from
  pickers, compaction, COPY, purging, and manifest edits.
- Restore GC behavior from before shared SST: no protection hook lookup,
  no post-scan publication recheck, and dropped-region unknown objects are
  reclaimed immediately.
- Remove the prototype manifest task-state guard and move the ordinary
  L0/L1 manifest fixtures to tests/compatibility/manifest/region_edit/.

Ordinary region compaction, ADMIN COMPACT_TABLE, COPY, repartition file
references, and the generic SST write guard remain unchanged.

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>
2026-12-04 10:03:54 +00:00
dennis zhuang 39c6d4fd89 fix(mito2): keep the staging session when dropping a staging region fails (#10932)
Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
2026-12-04 09:53:18 +00:00
LFC 9a8df3b73a feat(mito): render scan details in tree explain plans (#10926)
* feat(mito): render scan details in tree explain plans

Signed-off-by: luofucong <luofc@foxmail.com>

* remove some obsolete todos

Signed-off-by: luofucong <luofc@foxmail.com>

---------

Signed-off-by: luofucong <luofc@foxmail.com>
2026-12-04 08:59:15 +00:00
discord9 c2e7262068 refactor(flow): add the generic admin flow route (#10609)
* feat(flow): route backfill admin to owning flownode

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

* fix(flow): harden routed backfill admin

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

* feat(flow): route flow admin calls through one shared request

Replace the per-function backfill/backfill_status handlers, operator methods and FlowRequest bodies with one admin(catalog, flow, function, args) route. The owning flownode dispatches the function name to its batching execution factory and answers with flow_admin_result.

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

* fix(flow): carry the routed flow id through admin execution

Populate AdminFlow.flow_id from the frontend-resolved id and reject a backend name resolution that no longer matches it. Update the admin route tests.

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

* refactor(flow): dispatch flow admin through a registry

Move ADMIN flow_* dispatch out of BatchingExecutionFactory. A deployment installs FlowAdminRegistry; the flownode resolves the requested function there and handlers own their arguments. The registry rejects duplicates and centralizes unknown-function errors.

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

* chore: refresh Cargo.lock for routed flow admin

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

* test(operator): gate the flow backfill numeric test on enterprise

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

* test(operator): gate backfill test imports on enterprise

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

* feat(flow): route flow audit through the admin registry

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

* chore(ci): refresh compatibility release window

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

* fix(flow): reject truncated flow-admin targets

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

* refactor(flow): keep the generic admin route out of enterprise functions

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

* refactor(flow): carry nullable admin arguments as optional text

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

* refactor(flow): keep the served function names readable by the registry's consumer

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

* refactor(operator): reject statement modifiers on ADMIN function calls

`ADMIN fn(...)` executes a bare call, but the parser accepts modifiers on
any function call and they were silently dropped: `FILTER`, `DISTINCT`/`ALL`,
in-argument `ORDER BY`/`LIMIT`/`WITHIN GROUP`, `IGNORE`/`RESPECT NULLS`, `OVER`,
parametric arguments and ODBC `{fn ...}` syntax.

Collect every modifier field that exists on `sqlparser::ast::Function` and
reject the statement with `BuildAdminFunctionArgs` before the function lookup,
so the answer does not depend on whether the function exists.

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

* refactor(flow): drop the unused query-context field from FlowAdminRequest

Only one consumer ever read `ctx`, and it checked nothing but presence: the
route does not authenticate or authorize, so the field could only ever be a
protocol-shape check dressed up as a trust boundary. Remove it rather than
keep a field whose doc has to disclaim what it looks like it promises.

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

* refactor(flow): drop registry docs that restate the code

Three doc comments translated what the signature or the error branch
already said: the registry keys handlers by name, try_new fails on a
repeated name, dispatch refuses an unserved name with Unsupported.

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

* refactor(flow): second deslopify pass over the admin route docs

An independent audit reviewed every added doc and comment; this pass
keeps what a caller cannot learn from the signature and drops what
merely translates the code.

- restore the two failure-contract docs the first pass over-deleted:
  try_new refusing a repeated handler name, dispatch refusing an
  unserved name with Unsupported
- drop the remaining restating docs and test comments; keep the
  partition/peer, fence and NULL-position explanations
- inline dispatch_flow_admin and FlowAdminRegistry::names (one consumer
  each); the refusal message keeps its text
- drop the uses_odbc_syntax modifier check: the ADMIN parser reads the
  object name first, so {fn ...} never reaches it
- fix the modifier doc's claim that the parser accepts modifiers on any
  function call; which ones depend on the dialect

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

* revert(flow): restore FlowAdminRegistry::names

The deletion test missed a consumer: the enterprise flownode test
asserts the installed function set through names(). Restoring it;
dispatch's refusal message uses it again too.

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

* chore: pin greptime-proto to its merged main head

proto #361 squash-merged as 67dcc5ef; be611f6 is its pre-merge branch
commit and is not reachable from main, so the check-git-deps gate needs
the merged rev. Same content, no code change.

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

---------

Signed-off-by: discord9 <discord9@163.com>
2026-12-04 07:44:09 +00:00
dayan02dev 2e537f347c fix: return an error instead of panicking on an invalid DECIMAL precision or scale (#10736)
* test: cover out-of-range decimal precision and scale

Signed-off-by: dayan02dev <pawarudayan92@gmail.com>

* fix: return an error for out-of-range decimal precision and scale

Signed-off-by: dayan02dev <pawarudayan92@gmail.com>

* test: cover invalid decimals in gRPC column types and nested arrow types

Signed-off-by: dayan02dev <pawarudayan92@gmail.com>

* fix: reject invalid decimals in gRPC column types and nested arrow types

Signed-off-by: dayan02dev <pawarudayan92@gmail.com>

* test: cover invalid decimals nested in gRPC column types

Signed-off-by: dayan02dev <pawarudayan92@gmail.com>

* fix: reject invalid decimals nested in gRPC column types

Signed-off-by: dayan02dev <pawarudayan92@gmail.com>

* test: cover invalid decimals in gRPC modify column type

Signed-off-by: dayan02dev <pawarudayan92@gmail.com>

* fix: reject invalid decimals in gRPC modify column type

Signed-off-by: dayan02dev <pawarudayan92@gmail.com>

* revert: move the gRPC column type checks to a separate PR

Restore src/api and src/common/grpc-expr to main, undoing the gRPC parts of
5f16c3853, 6b12a8507, d3dc705ac, dd0b6b456, 63d1ca7ce and e925e84c5.
The gRPC conversion becomes a fallible TryFrom in its own PR, as asked in review.

Signed-off-by: dayan02dev <pawarudayan92@gmail.com>

---------

Signed-off-by: dayan02dev <pawarudayan92@gmail.com>
2026-12-04 07:06:54 +00:00
Yingwen 251e931e92 perf(promql): locate duplicate grid points with an adjacent scan (#10827)
* perf(promql): locate duplicate grid points with an adjacent scan

Signed-off-by: evenyag <realevenyag@gmail.com>

* test(promql): check duplicate detection through result sorting

Signed-off-by: evenyag <realevenyag@gmail.com>

* refactor(test): simplify vector match regression fixtures

Signed-off-by: evenyag <realevenyag@gmail.com>

---------

Signed-off-by: evenyag <realevenyag@gmail.com>
2026-12-04 05:06:48 +00:00
Yingwen 3749c0a595 perf(mito2): reuse discovery keys when reading sample blocks (#10847)
* perf(mito2): reuse discovery keys when reading sample blocks

Signed-off-by: evenyag <realevenyag@gmail.com>

* test(mito2): read the discovered TSID from the exact key

Signed-off-by: evenyag <realevenyag@gmail.com>

---------

Signed-off-by: evenyag <realevenyag@gmail.com>
2026-12-04 04:47:17 +00:00
Yingwen 77476c143b perf(promql): batch remaining windows of complete float series (#10829)
* perf(promql): batch remaining windows of complete float series

Signed-off-by: evenyag <realevenyag@gmail.com>

* fix(promql): import raw timestamps from the raw series module

Signed-off-by: evenyag <realevenyag@gmail.com>

* refactor(promql): rely on complete window batch eligibility

Signed-off-by: evenyag <realevenyag@gmail.com>

---------

Signed-off-by: evenyag <realevenyag@gmail.com>
2026-12-04 04:34:02 +00:00
Yingwen 5dfc835800 perf(mito2): index dense read-ahead windows by ordered offsets (#10831)
* perf(mito2): index dense read-ahead windows by ordered offsets

Signed-off-by: evenyag <realevenyag@gmail.com>

* refactor(mito2): borrow the read-ahead cursor mutably

Signed-off-by: evenyag <realevenyag@gmail.com>

* perf(mito2): keep the ordered read-ahead change focused

Signed-off-by: evenyag <realevenyag@gmail.com>

---------

Signed-off-by: evenyag <realevenyag@gmail.com>
2026-12-04 04:33:03 +00:00
Yingwen 027bf719e4 perf(mito2): add byte-shuffled Zstd encoding for dense Float64 samples (#10817)
perf(mito2): byte-shuffle dense Float64 samples

Port the Zstd byte-shuffle codec and selection from evenyag/greptimedb@c311335279.

Signed-off-by: evenyag <realevenyag@gmail.com>
2026-12-04 04:16:44 +00:00
Yingwen bafe2cf764 perf(mito2): reuse SST timestamp clipping in prepared scans (#10819)
perf(mito2): reuse Narthex SST timestamp clipping

Port evenyag/greptimedb commit 4ed3285d1e4092d43333bd97ff06bb530a66a06e. Preserve the residual range when a bound overflows or the stored time unit differs from the scan unit.

Signed-off-by: evenyag <realevenyag@gmail.com>
2026-12-04 04:04:44 +00:00
jeremyhi 1370c67741 fix(mito2): track a memtable SST before it is created (#10912)
A flush or tail replay that writes a memtable source registered the SSTs
with its uncommitted files only after the write returned. A cancellation
that aborted the write after an object existed, in the write cache or in
the object store, left that object untracked, so the job's clean-up never
deleted it. Pass the uncommitted files as the write guard, so each file is
tracked before it is created, as the encoded parts and compactions already
do.

Signed-off-by: jeremyhi <fengjiachun@gmail.com>
2026-12-04 03:31:30 +00:00
Weny Xu 78673705f3 feat(http): support TLS for HTTP servers (#10775)
* feat(http): support TLS for HTTP servers

Signed-off-by: WenyXu <wenymedia@gmail.com>

* fix(http): enable HTTP/2 explicitly for Axum

Signed-off-by: WenyXu <wenymedia@gmail.com>

* test(http): include TLS defaults in config API snapshot

Signed-off-by: WenyXu <wenymedia@gmail.com>

* fix: run HTTP TLS handshakes on separate tasks

Signed-off-by: WenyXu <wenymedia@gmail.com>

---------

Signed-off-by: WenyXu <wenymedia@gmail.com>
2026-12-03 20:20:48 +00:00
LFC ed1b558225 fix(query): scope JSON2 type hints to individual scans (#10893)
* fix(query): scope JSON2 type hints to individual scans

Signed-off-by: luofucong <luofc@foxmail.com>

* fix(query): pass the JSON2 predicate directly to any

Signed-off-by: luofucong <luofc@foxmail.com>

---------

Signed-off-by: luofucong <luofc@foxmail.com>
2026-12-03 18:24:45 +00:00
Aum 1255493659 feat: merge metadata COUNT rows into the partial COUNT over a residual scan (#10447)
* feat(query): merge metadata count and residual aggregate states

Signed-off-by: aumnertic <aumnertic@gmail.com>

* test(query): clone config options for metadata count parallelization

Signed-off-by: aumnertic <aumnertic@gmail.com>

* test(table): replace deprecated with_new_children in metadata aggr test

Signed-off-by: aumnertic <aumnertic@gmail.com>

* refactor(table,query): rename PartialStatAggrExec and drop rule Default

Signed-off-by: aumnertic <aumnertic@gmail.com>

---------

Signed-off-by: aumnertic <aumnertic@gmail.com>
2026-12-03 18:24:18 +00:00
Yingwen 7ce79aa265 perf(query): push matching labels into native PromQL scans (#10834)
* perf(query): push matching labels into native PromQL scans

Port evenyag/greptimedb@e3a26033ab.

Signed-off-by: evenyag <realevenyag@gmail.com>

* fix(query): guard PromQL matching-label propagation

Signed-off-by: evenyag <realevenyag@gmail.com>

* test(query): cover native PromQL matching filter pushdown

Signed-off-by: evenyag <realevenyag@gmail.com>

---------

Signed-off-by: evenyag <realevenyag@gmail.com>
2026-12-03 15:58:05 +00:00
dennis zhuang 2d4c29b5ec test(promql): drop tests that repeat other coverage and table-drive the rest (#10855)
* test(promql): drop native compile tests the executor tests already cover

Executing a compiled tree for bool/filter comparisons, negation and sum
aggregates repeated the kernel tests in promql::native::execute, while the
compile-side binding is pinned by the compile tests. Fold single-row
duplicates into the existing tables and add a helper for the repeated
compile_selectors call.

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

* test(promql): drop planner tests repeated by sqlness and fold copies into tables

Subquery window execution cases already pinned by subquery.sql and
subquery_at_modifier.sql are removed; the remaining cases form one table.
scatter_time_filter_many_evaluation_points only planned what
scatter_time_filter.sql executes. Tests that differed only in data are
merged into table-driven tests.

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

* test(promql): keep split and empty input in the compiled sum over rate test

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

* test(promql): split a bare-selector sum series and check the final histogram binary column type

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

---------

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
2026-12-03 15:49:25 +00:00
Yingwen 38621747e1 perf(mito2): reuse Arrow operation buffers in dense Narthex reads (#10818)
perf(mito2): share constant dense operation arrays

Port the shared Put and Delete buffers from evenyag/greptimedb@b1244acbe2.

Signed-off-by: evenyag <realevenyag@gmail.com>
2026-12-03 15:39:33 +00:00
dennis zhuang cb5de908f7 fix(frontend): honor disabled auto-create in Prometheus write batching (#10857)
With logical-table batching enabled for Prometheus remote write, the
batcher's schema alterer created the physical metric table, missing
logical tables and new tag columns even when `auto_create_table = false`
or the `auto_create_table=false` hint was set. The ordinary insert path
and OTLP batching (`can_batch_metric_rows`) both reject such writes.

Route requests whose context disables auto-create to the ordinary insert
path, like OTLP does, by asking the schema alterer in
`accepts_bulk_destinations`.

The frontend kept its own copy of the operator's
`create_physical_table_on_demand`; reuse the operator function instead.
The copy also set `sst_format = 'flat'` on the physical table. The metric
engine already forces flat format on data regions, so that option only
changed the stored table options, not the storage format.

The batcher is only built when `prom_store.with_metric_engine` is true and
always passed `true` to the schema alterer, so drop that flag and the
unreachable mito-table branch.

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
2026-12-03 13:59:12 +00:00
dennis zhuang 7aaed2b5a5 fix(promql): move the start of a native delta histogram with its reported time (#10849)
* fix(promql): move the start of a native delta histogram with its reported time

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

* fix(promql): move delta histogram starts only in root rows

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

* perf(promql): reuse one delta-start buffer per series

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

---------

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
2026-12-03 13:58:39 +00:00
jeremyhi 57124063a4 fix(mito2): reopen a stale Follower candidate whose rows the manifest covers during handover (#10863)
* fix(mito2): reopen a stale Follower candidate whose rows the manifest covers during handover

Signed-off-by: jeremyhi <fengjiachun@gmail.com>

* fix(mito2): check a takeover's version before replacing a region with rows

Also cover the skip_wal and node id refusals and the recovered row values in tests.

Signed-off-by: jeremyhi <fengjiachun@gmail.com>

* refactor(mito2): assert that a handover hands over an empty memtable

Signed-off-by: jeremyhi <fengjiachun@gmail.com>

* fix(mito2): preload caches of a region reopened for a handover only once it is kept

Signed-off-by: jeremyhi <fengjiachun@gmail.com>

* docs(mito2): correct the catchup reopen and cache preload comments

Signed-off-by: jeremyhi <fengjiachun@gmail.com>

* fix(mito2): log a takeover refused for a manifest past its version

Also compare the recovered rows in tests independently of scan order.

Signed-off-by: jeremyhi <fengjiachun@gmail.com>

* refactor(mito2): log each handover refusal cause and notify the reopen once

Signed-off-by: jeremyhi <fengjiachun@gmail.com>

* fix(mito2): log a reopen refused for a pending reload

Also scope the reopen docs to regions with rows and cover a remote tail above
this node's rows and a takeover behind a covering version in tests.

Signed-off-by: jeremyhi <fengjiachun@gmail.com>

* test(mito2): hand over a Follower whose replay start is past its last entry

Signed-off-by: jeremyhi <fengjiachun@gmail.com>

* fix(mito2): log a takeover reopened at another version

Also cover a handover whose rows only the flushed entry id covers, and settle
the cache and flush fixtures before their assertions.

Signed-off-by: jeremyhi <fengjiachun@gmail.com>

* refactor(mito2): log which cause refused a handover

Also state the takeover version condition in the guide, correct the PastCovering
case doc and rewrap two long comment lines.

Signed-off-by: jeremyhi <fengjiachun@gmail.com>

---------

Signed-off-by: jeremyhi <fengjiachun@gmail.com>
2026-12-03 13:14:52 +00:00
discord9 f12851eae0 refactor(mito2): keep memtable sequence filtering region scoped
Remove per-piece cursor evaluation from bulk and time-series memtables. Their rows use the region's sequence numbers, so the existing region-level sequence range is sufficient. Keep creator-aware exact reads for SSTs and preserve creator cursor inputs through ScanInput::with_sources.

Signed-off-by: discord9 <discord9@163.com>
2026-12-03 20:59:08 +08:00
discord9 d93fbf2e6a fix(mito2): attribute rows only after the partition filter, and refuse an empty shard map
Three defects the reviewer reproduced on a shared SST:

- Cursor attribution saw every row of the batch, including rows the region
  partition filter had already excluded, so a sibling's unowned row refused
  the whole read. Attribution now runs only on rows that survived the filter;
  an owned row no piece selects still refuses.

- A piece whose identity parsed back as no expression took a fallback that
  returned Ok(None) and dropped the region partition filter, letting a
  sibling region's rows through. The fallback now collapses the candidates
  to the agreed sequence range and keeps the filter, so a whole-domain piece
  and an empty identity deliver the same rows.

- `creator_cursor_shards = Some(empty)` bypassed the no-shard refusal under
  `read_row_sequence`. A map whose every vector is empty now refuses with the
  same reason.

Signed-off-by: discord9 <discord9@163.com>
2026-12-03 19:55:10 +08:00
discord9 a1d59042a0 feat(store-api,mito2): read exact row sequence ranges by cursor piece
Signed-off-by: discord9 <discord9@163.com>
2026-12-03 19:55:10 +08:00
discord9 163141a1a4 test(mito2): cover the row-sequence proof of flush and compaction outputs
Covers flush keeping or stamping the allocator's numbers, compaction
keeping them only when every input does, a region edit dropping the proof,
a staging-manifest import keeping it, and a region copy clearing it.

Also lets the purger delete a retired compaction output first, fixing a
delete race in the publication test.

Signed-off-by: discord9 <discord9@163.com>
2026-12-03 19:53:39 +08:00
discord9 4b7825bf38 feat(mito2): keep or drop a file's row-sequence proof at manifest admission
A copy to another region clears the proof (the target has its own sequence
domain), an edit that drops a file's rows clears it, and a version update
that replaces an object keeps the newer index generation while carrying the
proof forward. A legacy manifest without the field reads as `None`.

Signed-off-by: discord9 <discord9@163.com>
2026-12-03 19:53:39 +08:00
dennis zhuang f622bb1cba refactor(mito2): drive set_role by a transition table (#10851)
* refactor(mito2): drive set_role by a transition table

Replace the three per-role branches of ManifestContext::set_role with a
pure next_state(current, role) table applied by one fetch_update, and pin
the table in a unit test. The doc that drifted from the code is replaced.

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

* fix(mito2): drop the staging partition info when a region becomes a follower

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

* fix(mito2): drop staging partition info published after a demotion

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

* refactor(mito2): spell out role transitions and pin the demotion test ordering

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

---------

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
2026-12-03 10:48:14 +00:00
jeremyhi 10893e0412 feat: report a downgraded region's last entry once durable and roll back for skip-WAL rows (#10765)
* feat: report a downgraded region's last entry once durable and roll back for skip-WAL rows

A downgrade of a region whose manifest is published conditionally (writes
require a lease and the WAL is the object store WAL) no longer flushes
unless the memtable holds rows that are not in the WAL; the next leader
recovers the rest from the source's WAL. A change to Follower reports the
last entry id only once the WAL is durable through it.

A downgrade reply now carries `has_skip_wal_writes` when the region may
still hold rows outside the WAL after the downgrade; the metasrv then
rolls the migration back instead of retrying or taking the region over,
and aborts with that reason. An empty memtable left marked by a failed
write no longer reports such rows.

Signed-off-by: jeremyhi <jiachun_feng@proton.me>

* fix: flush a downgrading region that skips the WAL and tighten tests

A handover of a region whose options skip the WAL records no tail of its
source, so a downgrade now flushes such a region even when its memtable
holds only rows logged before the option changed.

Tests cover that case, the metadata region's rows on the Noop WAL, a
Follower change that waits without holding the worker and again on a
region that is already a Follower, a flagged reply after an unflagged
one in the same batch, the failure of a write that installs no row, and
the abort reason of a failed candidate upgrade. Docs scope the meaning
of a false `has_skip_wal_writes` and of the metadata region's flush.

Signed-off-by: jeremyhi <jiachun_feng@proton.me>

* fix: report logged rows of a region that skips the WAL and bound an abandoned downgrade

A region whose options skip the WAL is handed over without a tail of its
source, so its unflushed rows count as rows the next leader cannot
recover from the WAL: `MitoRegion::has_skip_wal_writes` reports them and
decides the downgrade's flush, so a follower that cannot flush them rolls
the migration back.

The datanode bounds each region's downgrade, the flush and the change to
Follower together, by its flush timeout and replies with a retryable
error past it. The task that waits for the WAL to be durable stops
waiting once nobody waits for its reply, and a role change builds the
durability barrier only for a Follower.

Tests cover a follower whose options were made to skip the WAL, with and
without rows, a downgrade timeout that releases the region, and a
rollback of two requested regions; the abort reason of a failed
candidate upgrade is compared exactly.

Signed-off-by: jeremyhi <jiachun_feng@proton.me>

* fix: refuse a handover to a candidate with stale skip-WAL options

A candidate whose options skip the WAL commits an empty handover, which
records no tail of its source. An ALTER during the migration reaches only
the routed source, so a candidate can still skip the WAL while the source
logs rows it does not flush. Such a handover now fails, committing
nothing, when the source has unflushed WAL entries; the error is not
retryable, since only closing the candidate after the rollback fixes its
options.

The datanode waits for a shared downgrade flush without its own timer,
under the downgrade's single bound. Docs describe the rollback reason as
rows the candidate may not recover from the WAL, and when a false flag
can be trusted. Tests cover the refused handover and its recovery once
the options match, a flagged reply carrying an error, and a downgrade
timeout that waits until the durability wait is admitted.

Signed-off-by: jeremyhi <jiachun_feng@proton.me>

* test: split the abandoned downgrade test and cover a deadline used up by the last attempt

The datanode test of a timed-out downgrade no longer waits for the
durability wait to be admitted, which raced the deadline; a Mito test
drops the reply of a Follower change once its wait is admitted and
checks that the region is released. A metasrv test covers a last
downgrade attempt whose mailbox expiry uses up the procedure's time:
the candidate upgrade then rolls the migration back without sending
anything. The rollback test keeps a flagged success and a flagged error.

Docs describe the skip-WAL predicate as rows the next leader may not
recover, scope the durability comment to a Follower change, note that
the metasrv must also understand the flag, and say why a refused
handover is not retried.

Signed-off-by: jeremyhi <jiachun_feng@proton.me>

* test: scope the mock leader to the downgrade deadline test

Signed-off-by: jeremyhi <jiachun_feng@proton.me>

* refactor: report only skip-WAL rows now that a handover records the source's tail

A handover or takeover now records the source's tail even when the
candidate's options skip the WAL, so the rows a region logged before its
options turned skip_wal on are recovered from that tail. The downgrade
flush and the flag therefore count only rows written without the WAL:
every other row in the memtable is in the WAL up to the reported last
entry, which the Follower change still waits to be durable whatever the
region's options.

Tests run the source through the graceful downgrade: rows logged before
the option, with and without an earlier flush, reach a candidate by a
handover or by a takeover after the report was lost; a candidate that a
rolled-back migration left awaiting its Leader lease recovers the rows
the source logged since; a downgrade under enqueued acknowledgement
waits for those rows to be durable; and rows written while the WAL was
skipped stay reported after the option is turned off again.

Signed-off-by: jeremyhi <jiachun_feng@proton.me>

* fix: release the region before the durability wait and tighten downgrade tests

The task that changes a region to Follower finishes the work that needs
the region, including the fencing notification, before it waits for
the last entry to become durable, so a pending wait holds only the last
entry id, the barrier and the reply.

Tests check that a downgrade of an object store WAL region without
write leases still flushes, that each setup role change succeeds, and
that an abandoned wait is dropped, observed through the log store it
holds. Docs state the durability barrier per provider.

Signed-off-by: jeremyhi <jiachun_feng@proton.me>

* test: cover a mixed downgrade flush, the flag on a timed-out downgrade and its abort reason

A downgrade's flush of logged and skip-WAL rows persists both, as a
reopen without WAL replay shows. A downgrade that times out still
reports the skip-WAL rows its region holds. The last downgrade attempt
that uses up the deadline aborts as a failed candidate upgrade. The
timeout reply is built in a match that rustfmt formats.

Signed-off-by: jeremyhi <jiachun_feng@proton.me>

* docs: scope the downgrade flush skip and the reply fixture wording

Signed-off-by: jeremyhi <jiachun_feng@proton.me>

* test: let the only downgrade attempt use up the deadline

Signed-off-by: jeremyhi <jiachun_feng@proton.me>

* fix: reply to a role change before the fencing notice unless a Follower waits for its WAL

Only a successful change to Follower notifies, releases the region and waits for its WAL before it replies; every other outcome replies first, as before. Log the entry the wait is for and an abandoned wait, and describe the deadline test's lease as ending with the procedure's time.

Signed-off-by: jeremyhi <jiachun_feng@proton.me>

* test: drop the retry interval the single-attempt deadline test never waits

Signed-off-by: jeremyhi <jiachun_feng@proton.me>

* fix: reply to a Leader change before its sweep, and check the partial-flush handover's bound

A successful change to Leader replies before it schedules the HDFS temp-file sweep, as before. The partial-flush handover case asserts that the source's flushed entry id is the first batch's last entry, strictly between zero and the final entry. The region server's skip-WAL accessor is crate-visible.

Signed-off-by: jeremyhi <jiachun_feng@proton.me>

* docs: say which logged rows a handover and a takeover recover after a downgrade skips its flush

Signed-off-by: jeremyhi <jiachun_feng@proton.me>

* fix: skip a retried downgrade's flush of a metric metadata region that is already a Follower

A downgrade whose change to Follower timed out after the metadata region became a Follower is retried with a Downgrading flush, which failed on the metadata region because a Follower is not flushable, so every retry failed. The flush now skips that region; its handover still fails while it holds entries its manifest does not cover. Drop tests that decide no condition this change adds, and tighten doc wording.

Signed-off-by: jeremyhi <jiachun_feng@proton.me>

* fix: flush a metric metadata Follower that still holds rows on a retried downgrade

Skip the retried downgrade's flush of the metadata region only when it is a Follower whose memtables are empty; one that still holds rows gets the flush, which fails as before. Restore the check that a flagged downgrade reply decodes into the pre-field layout.

Signed-off-by: jeremyhi <jiachun_feng@proton.me>

* test: check the reason first and fence the pair in the dirty metadata Follower test

Read the metadata region's role and memtables only for a Downgrading flush. The dirty metadata Follower test sets the pair to DowngradingLeader through the metric engine, as the downgrade handler does, and checks that the flush fails on the Follower.

Signed-off-by: jeremyhi <jiachun_feng@proton.me>

* test: check that only a downgrade's flush skips a flushed metadata Follower

The clean retry first sends a flush without a reason, which still fails on the metadata Follower, then the downgrade's flush, which skips it. A shared helper changes a role and asserts that it succeeded.

Signed-off-by: jeremyhi <jiachun_feng@proton.me>

* style: address review nits on the downgrade reply and flush test

Name the role states through SettableRegionRoleState instead of importing its variants, order the derives of DowngradeRegionReply as elsewhere in the file, and drop the comment that restates the role helper.

Signed-off-by: jeremyhi <jiachun_feng@proton.me>

---------

Signed-off-by: jeremyhi <jiachun_feng@proton.me>
2026-12-03 10:36:04 +00:00
discord9 a7216f7422 feat(mito2): state on each SST whether it keeps its source rows' own sequences (#10822)
* feat(mito2): state whether an SST keeps its source rows' own sequences

A compaction may replace a file's per-row `__sequence` column with one
file-level constant. Whether that happened is a fact the write side already
knows, so state it on the file: `RowSequenceProvenance::Original` on
`FileMeta`, produced by a flush whose writer keeps the allocator's numbers
and by a compaction only when every input of the merge keeps its own.

Nothing reads the field yet; the per-piece exact read that consumes it
lands on top.

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

* feat(mito2): keep or drop a file's row-sequence proof at manifest admission

A copy to another region clears the proof (the target has its own sequence
domain), an edit that drops a file's rows clears it, and a version update
that replaces an object keeps the newer index generation while carrying the
proof forward. A legacy manifest without the field reads as `None`.

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

* test(mito2): cover the row-sequence proof of flush and compaction outputs

Covers flush keeping or stamping the allocator's numbers, compaction
keeping them only when every input does, a region edit dropping the proof,
a staging-manifest import keeping it, and a region copy clearing it.

Also lets the purger delete a retired compaction output first, fixing a
delete race in the publication test.

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

---------

Signed-off-by: discord9 <discord9@163.com>
2026-12-03 10:18:44 +00:00
Weny Xu 807421ca39 perf(sketch): pick up upstream weighted KLL updates (#10888)
Signed-off-by: WenyXu <wenymedia@gmail.com>
2026-12-03 08:44:55 +00:00
Ning Sun ecabaf2760 fix: drop protobuf 2.x from the dependency graph (RUSTSEC-2024-0437) (#10821)
* fix: drop protobuf 2.x from the dependency graph (RUSTSEC-2024-0437)

Every 2.x release of the `protobuf` crate is affected by RUSTSEC-2024-0437
(uncontrolled recursion when parsing unknown fields), patched only in
>= 3.7.2. Three independent paths kept protobuf 2.28.0 in Cargo.lock:

- `raft-engine 0.4.2` hard-depends on `protobuf = "2"`: its entry type
  (`MessageExt::Entry`), `put_message`, `get_message` and `scan_messages`
  are bounded on `protobuf::Message` and decode with `parse_from_bytes`.
  It also pins `prometheus 0.13`, which pulls protobuf 2 through its
  default `protobuf` feature. Patch it with the GreptimeTeam fork
  (GreptimeTeam/raft-engine, branch v0.4.2-prost-0.14: tag 0.4.2 plus one
  commit) that switches the bound to `prost::Message` and bumps
  prometheus to 0.14. The library change is ~20 lines; the rest of the
  fork diff replaces the protobuf-2 based `raft`/`kvproto` test types.
- `log-store` generated `logstore.proto` with `protoc-rust 2.28` and
  linked `protobuf = "2"` for that code. Generate the bindings with
  `prost-build` instead (same PROTOC/PATH/vendored protoc selection) and
  drop the runtime dependency. The wire format is unchanged: prost emits
  byte-identical proto3 for these messages, pinned by `wire_compat_tests`
  against bytes captured from the rust-protobuf 2.28 encoder, so raft
  logs and namespace records written by older binaries stay readable and
  a rollback keeps working.
- `common-runtime` pulled `tokio-metrics-collector 0.2.3` (prometheus
  0.13.4) under `cfg(tokio_unstable)`; bump it to 0.3 (prometheus 0.14,
  tokio-metrics 0.4).

Cargo.lock now carries a single `protobuf` (3.7.2, via pprof and
prometheus 0.14) and a single `prometheus` (0.14.0); `protoc-rust`,
`protobuf-codegen`, `protoc` and `prometheus 0.13.4` are gone.

Validation: raft-engine fork 107 unit tests; `cargo nextest run -p
log-store` 310 passed; compatibility suite in both directions
(`basic_table` v1.3.2 -> current and `downgrade_compatibility` current ->
v1.2.1, distributed topology); `cargo build --workspace`; clippy on the
touched crates; `common-runtime` with `--cfg tokio_unstable`.

Signed-off-by: Ning Sun <sunning@greptime.com>

* fix(log-store): drop the redundant cargo-shear ignore for prost

cargo-shear now detects the dependency through the wire-compat tests, so the
`[package.metadata.cargo-shear]` ignored entry became redundant
(shear/redundant_ignore).

Signed-off-by: Ning Sun <sunning@greptime.com>

* test(log-store): pin the WAL entry decoder's tolerance to non-canonical input

Fields in any order, explicit proto3 defaults and unknown fields decode, so
raft log entries written by a different conforming encoder stay readable.

Signed-off-by: Ning Sun <sunning@greptime.com>

* style(log-store): drop the trailing blank line in Cargo.toml

Signed-off-by: Ning Sun <sunning@greptime.com>

---------

Signed-off-by: Ning Sun <sunning@greptime.com>
2026-12-03 08:09:35 +00:00
Yingwen 63b6823da6 perf(mito2): apply safe sequence overrides to Narthex SSTs (#10833)
* perf(mito2): apply safe sequence overrides to Narthex SSTs

Signed-off-by: evenyag <realevenyag@gmail.com>

* fix(mito2): apply sequence overrides to Narthex IPC pages

Signed-off-by: evenyag <realevenyag@gmail.com>

* refactor(mito2): share flat SST sequence replacement

Signed-off-by: evenyag <realevenyag@gmail.com>

* test(mito2): simplify Narthex flush sequence cases

Signed-off-by: evenyag <realevenyag@gmail.com>

* fix(mito2): align Narthex flush sequence metadata with Parquet

Signed-off-by: evenyag <realevenyag@gmail.com>

---------

Signed-off-by: evenyag <realevenyag@gmail.com>
2026-12-03 07:59:02 +00:00
dennis zhuang cfef881330 fix!: drop unused MySQL/PG runtime_size and fix PG Describe column names (#10859)
* chore!: remove unused mysql and postgres runtime_size options

`mysql.runtime_size` and `postgres.runtime_size` have not been read since
#4436. Remove them from the option structs, example configs and generated
config docs.

BREAKING CHANGE: `mysql.runtime_size` and `postgres.runtime_size` are no
longer part of the frontend/standalone configuration. Existing config files
that still set them load unchanged, since the option structs do not deny
unknown fields; the keys are ignored as before. The serialized config
(e.g. the `/config` HTTP API) no longer lists them.

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

* fix(servers)!: describe SHOW statements with their execution schema

The PostgreSQL extended-protocol Describe hand-wrote result columns for
several SHOW statements, and the names did not match what execution
returns. pgwire does not resend RowDescription on Execute, so clients
reading columns by name saw the wrong names:

- SHOW CREATE TABLE/DATABASE/VIEW/FLOW were described as `name` and
  `create_statement`; execution returns e.g. `Table` and `Create Table`.
- SHOW TRIGGERS was described as `name`; execution returns `Triggers`.
- SHOW VARIABLES for a query option was described upper-cased; execution
  keeps the option's spelling.

Describe SHOW CREATE from the static schemas execution uses, route SHOW
TRIGGERS through the same dataframe path as SHOW FLOWS, and share the
SHOW VARIABLES column-name rule with execution.

BREAKING CHANGE: extended-protocol PostgreSQL clients now see the same
column names for these statements as MySQL and simple-protocol clients.

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

---------

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
2026-12-03 06:12:57 +00:00
dennis zhuang 2ef0036d1a refactor(frontend): share query registration and timeout handling (#10848)
* refactor(frontend): share query registration and timeout handling

Route the SQL, prepared-plan, EXPLAIN ANALYZE stream, PromQL and exemplar
paths through one slow-query timer builder and one process-list
registration helper, merge the statement and plan timeout wrappers, and
share the cancellation and stream-ticket handoff between the SQL and
prepared-plan paths.

Add tests for channel-dependent timeouts on both SQL and prepared
insert-select, KILL on the prepared path, and PromQL slow-query recording.

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

* refactor(frontend): inline timeout wrappers and drop a low-value test

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

* perf(frontend): build the slow query statement only when slow query logging is on

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

---------

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
2026-12-03 05:21:19 +00:00
dennis zhuangandWenyXu 69623e000b refactor(tests-integration): drop duplicated harness code and tests (#10856)
* refactor(tests-integration): extract datanode RPC transport

Signed-off-by: WenyXu <wenymedia@gmail.com>

* refactor(tests-integration): share cluster startup orchestration

Signed-off-by: WenyXu <wenymedia@gmail.com>

* refactor(tests-integration): share migration and repartition scenarios

Signed-off-by: WenyXu <wenymedia@gmail.com>

* refactor(tests-integration): clarify shared cluster helper APIs

Signed-off-by: WenyXu <wenymedia@gmail.com>

* test(repartition): check partition metadata as soon as ALTER returns

The synchronous ALTER waits for its procedure and invalidates the local frontend cache before returning. Query the same frontend immediately to exercise that guarantee.

Signed-off-by: WenyXu <wenymedia@gmail.com>

* fix(tests-integration): bound datanode registration by a configurable timeout

Signed-off-by: WenyXu <wenymedia@gmail.com>

* refactor(tests-integration): build slow-query and histogram PG/MySQL servers through the shared helpers

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

* refactor(tests-integration): drop instance tests covered by sqlness and table-drive COPY and external table cases

test_execute_insert_by_select and test_execute_query are covered by insert_select.sql and sum.sql, which assert the same rows and error messages in both modes; test_execute_insert and test_execute_create only checked affected rows. The four cloud COPY tests share one body, and the parquet and CSV external table fixtures hold the same rows.

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

* refactor(tests-integration): share the Kafka cluster setup of region migration tests

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

* refactor(tests-integration): fold the OTel Arrow exemplar tests into one and share the metrics payload

test_otel_arrow_exemplars_without_metric_engine and test_exemplar_otel_arrow_skips_non_metric_source checked the same skip; the surviving test now also verifies decoding and a following histogram batch in both deployments.

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

* refactor(tests-integration): share the GC garbage setup and checks across GC trigger tests

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

* refactor(tests-integration): share submitted procedure lookup across event tests

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

* fix(tests-integration): box the metasrv startup future to fit the default test stack

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

* refactor(tests-integration): require a boxed metasrv future and tidy cluster docs

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

---------

Signed-off-by: WenyXu <wenymedia@gmail.com>
Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
Co-authored-by: WenyXu <wenymedia@gmail.com>
2026-12-03 05:18:08 +00:00
dennis zhuang aa742b6565 refactor(frontend): drop dead trace reconcile error messages (#10858)
* refactor(frontend): drop unused OTLP trace reconcile error text

choose_trace_reconcile_decision built InvalidParameter errors whose
message was never read: schema planning turns any error into a batch
exclusion, and per-chunk reconciliation replaces it with the
column-specific enrich_trace_reconcile_error. Return the existing
TraceCoerceError instead.

Also remove the test-only TraceRequestSchema::remove_batches, which
modelled exclusion differently from production
(exclude_trace_v1_schema_observations rebuilds the schema and is tested
directly), and reword two comments that carried a private marker.

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

* docs(frontend): describe what a stale trace aux cache key suppresses

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

---------

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
2026-12-03 05:13:50 +00:00
Yingwen 236febdd2a refactor(mito-codec): remove sparse key size compatibility bypass (#10871)
Apply the 16 MiB limit when sparse keys are re-encoded and use the standard codec in reconstruction paths.

Signed-off-by: evenyag <realevenyag@gmail.com>
2026-12-03 04:36:04 +00:00
discord9 4a1c8340a0 test(frontend): cover TTL rollup cache and perf (#10799)
* test(frontend): cover TTL rollup cache and perf

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

* test(integration): drop the rollup cache reset token

#10570 removed RollupCacheOptions::reset_token: the reset is the debug
endpoint behind the existing auth, and no test here read the token. The
field made tests-integration fail to compile against the current cache.

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

* test(frontend): follow the promql_rollup_cache rename

Adapt the rollup cache E2E tests and the perf harness to the parent's
promql_rollup_cache rename, including the rendered [promql_rollup_cache]
configuration table: a case that rendered [rollup_cache] would have measured
two uncached frontends while presenting itself as a cache measurement.

The parent's twenty-step chunk floor also changes the geometry the tests and
the case describe, so the E2E data window moves to 20..65 minutes to still hold
a whole canonical chunk, and the perf case comment now states the three
100-minute chunks and thirteen direct points. Every asserted value and every
latency threshold is unchanged.

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

* perf(test): render only the rollup cache fields a case sets

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

* test(integration): drop the redundant rollup cache expiry test

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

* docs(test): trim rollup cache perf prose

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

---------

Signed-off-by: discord9 <discord9@163.com>
2026-12-03 03:58:41 +00:00
dennis zhuang de1414bf77 refactor(servers): share numeric and type-mismatch handling in PostgreSQL parameter conversion (#10844)
* test(servers): pin PostgreSQL parameter conversion for every client type

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

* refactor(servers): share numeric, list and type-mismatch handling in PostgreSQL parameter conversion

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

* test(servers): fold PostgreSQL parameter tests into one compact table

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

* test(servers): restore the INT8 array parameter case and assert the SQLSTATE

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

---------

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
2026-12-03 02:56:39 +00:00
dennis zhuang 442188319c test(promql): make planner test assertions able to fail (#10846)
* test(promql): make planner test assertions able to fail

- Replace 14 #[should_panic] planner tests that passed on any outcome
  (empty plan name, mismatched output type) with full plan assertions.
- Assert the published value column's type instead of finding a column
  by that type and re-checking it; drop the observer assertions in
  http.rs that re-check the name the observer already filtered on.
- Tighten a `contains("false")` check to `Boolean(false)`.
- Format the plan in panic messages that used literal braces in expect().
- Align test names and docs with what they assert for label rewrites
  and native histogram aggregates.

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

* test(promql): keep expect with plain messages and drop observer name checks

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

---------

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
2026-12-03 02:33:57 +00:00
dennis zhuang 3a99741c29 refactor(query): remove dead code, duplicate tests and stale comments in dist_plan (#10845)
- Make TransformedCommutative's transformer non-optional and drop
  StepTransformAction and partial_commutative_transformer.
- Remove the unused original_column_for and the test-only copy of
  remove_if_dropped_registry.
- Drop an ignored test and tests duplicated by stronger ones; fold the
  ScheduledTimeExtension-without-time case into the now() test.
- Keep the MergeSortExec opacity rationale once and drop change-history
  comments.

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
2026-12-02 18:28:29 +00:00
Yingwen a6ca1de729 feat(mito2)!: add short-series IPC storage for Narthex (#10814)
* feat(mito2): store short Narthex series in Arrow IPC pages

Signed-off-by: evenyag <realevenyag@gmail.com>

* refactor(mito2): share inline tails across Narthex sample layouts

Signed-off-by: evenyag <realevenyag@gmail.com>

* refactor(mito2): key sample tails by region file ID

Signed-off-by: evenyag <realevenyag@gmail.com>

* refactor(mito2): narrow IPC scope and consolidate artifact metadata

Signed-off-by: evenyag <realevenyag@gmail.com>

* refactor(mito2): read sample sizes from the SST inventory

Signed-off-by: evenyag <realevenyag@gmail.com>

* refactor(mito2): keep memory sample tails with their bytes

Signed-off-by: evenyag <realevenyag@gmail.com>

* fix(mito2): use crate-qualified imports in sample IPC codec

Signed-off-by: evenyag <realevenyag@gmail.com>

* fix(mito2): compile sample key helper only in unit tests

Signed-off-by: evenyag <realevenyag@gmail.com>

* fix(mito2): bound Narthex IPC pages and reads

Signed-off-by: evenyag <realevenyag@gmail.com>

* fix(mito-codec)!: cap sparse primary keys at 16 MiB

BREAKING CHANGE: Newly encoded sparse primary keys omit the first label that exceeds the key budget and all following labels. Oversized pre-encoded keys are rejected at write admission.

Signed-off-by: evenyag <realevenyag@gmail.com>

---------

Signed-off-by: evenyag <realevenyag@gmail.com>
2026-12-02 18:28:16 +00:00
discord9 6d38bd32d0 refactor(promql): drop a dead split gate and narrow two sub-millisecond histogram refusals (#10813)
* refactor(promql): drop a dead split gate and narrow two sub-millisecond histogram refusals

- Remove `split_aggregate_folds_float_state_only`. The refused shape
  (histogram root over a cut that exports float state) is unreachable:
  the compiler binds `BoundAggregate.field_kind` from the aggregate's
  direct input, only `Sum`/`Avg × Histogram` yields a histogram state,
  and a successful split cuts exactly one aggregate, so a float cut
  can never sit under a histogram root.
- Move `histogram_over_a_sub_millisecond_time_index` from selector
  preparation to the Window node. The old check refused every native
  histogram read over a microsecond/nanosecond time index, including
  pure instant queries (`avg(h)`, `count(h)`, `h @ 5`) that the Instant
  node answers correctly. It now refuses only a Window whose direct
  input is a raw histogram sample stream: raw ingest keeps no window
  time beside a histogram payload, which `RangeEvaluator::ingest` needs.
  Keyed on the units bound into the tree, so it covers mito raw scans
  and file-engine row sources alike.
- Rename `range_modifier_over_a_sub_millisecond_time_index` to
  `experimental_range_modifier_over_a_sub_millisecond_time_index`: it
  refuses `anchored`/`smoothed` windows, not `@`/`offset`, which are
  applied on raw ticks before payloads are formed.

Add planner tests for the narrowed gate: `avg(h)` over a microsecond
histogram is admitted; `count_over_time(h[5m])` is still refused.

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

* test(promql): execute a microsecond native histogram avg against the existing plan

The planner test only checks that `avg(h)` over a microsecond native
histogram column is admitted; the shape moved from a planning-time
decline to native execution, and nothing executed it. Add it to the
sub-millisecond execution parity test: two series, two steps, the
answer's `count`/`sum` asserted against hand-computed means for both
routes, and the native run verified to carry a fused node.

On main the query is refused with `histogram_over_a_sub_millisecond_time_index`
(the old selector-stage gate), so the case is red there.

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

---------

Signed-off-by: discord9 <discord9@163.com>
2026-12-02 18:28:12 +00:00
discord9 47f526e9bf feat(promql): narrow a __field__ scan, and declare the kind a broadcast answers (#10655)
* feat(promql): answer __field__ selectors and same-metric `or` groups natively

Let the native route plan three shapes it used to hand back:

- `__field__` selection (`m{__field__="f"}`) on mito raw scans, metric
  logical scans and file-engine row sources: the scan is narrowed to the
  selected fields (`field_first_projection`) so `RawSeriesSource` still
  sees exactly the canonical frame, text columns are refused as value
  kinds, and a matcher naming a column the selection drops is refused
  (`row_matchers_need_a_dropped_column`) instead of degrading to a
  literal `"" = …` that silently answers nothing.
- `or` groups within one metric (`m{host="a" or host="b"}`) as one scan
  with one `Filter`: `AlternativeFilters` merges the groups' conjuncts,
  groups that select different fields or tables are refused, and
  `discovers_metric_name` learns the alternative groups so the
  authorization layer and the planner agree on what a selector
  discovers.
- A scalar operand in a composed binary (`(hist * on(job) floats) * 2`):
  `native_scalar_operand` binds a scalar side that the composed path
  previously required to be a frame.

`field_columns_selected_by` is extracted in `planner.rs` so the legacy
and native routes select the same columns; as a side effect the legacy
route's value-column order for a multi-field `__field__` selection goes
from HashSet order to table order.

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

* refactor(promql): share the scalar-binary binder and refuse a histogram over a dynamic scalar

- Fold the composed path's `bind_evaluated_broadcast` into a single
  `bind_scalar_binary` shared with `binary_operation`'s scalar tail;
  both carry the same modifier refusal and `broadcast(...)` call.
- In `try_plan_native_composed_binary`, decline a histogram frame met
  by a *dynamic* scalar (`(hist * on(job) floats) / time()`) with
  `histogram_over_a_dynamic_scalar`: the runtime refuses non-float
  samples on that branch instead of dropping them. A constant scalar
  (`* 2`) keeps planning natively. The refusal can go once the
  histogram-aware dynamic kernel lands separately.
- Adapt the tests to the rebased base (#10701): a decline is now an
  error carrying its cause, so the `plan_or_refusal` sites assert
  `native_decline_reason(..)` and the integration rows that used to
  unwrap a declined output assert the cause.

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

* refactor(promql): say a refusal is an error and drop the dead pre-or matcher loop

Review follow-ups:

- `histogram_over_a_dynamic_scalar` refused because the dynamic-scalar
  kernel on main errors on a non-float sample (#10812), not because
  Prometheus lacks a per-point histogram scale — it has one (`h / time()`).
  Comment and the three test docs now say so and reference #10812.
- Since #10701 a decline is a planning error with its cause; nothing
  falls back to the existing plan. Reword the doc comments and test
  docs that still described a fallback.
- `native_promql_or_matchers_narrow_the_scan` asserted the existing
  plan's rows for `{host="a" or host="b"}`, which answers `c`: the
  parser moves the pre-`or` matchers into the first group and
  `matchers_to_expr` reads `matchers.matchers` only, so the existing
  plan applies none of them. That is the existing plan's bug, filed
  separately; the test no longer states it as an expectation and keeps
  only the route check.
- `AlternativeFilters::of_selector` looped over `selector.matchers.matchers`
  before the group loop; with any `or` that list is empty, and if it
  were not the loop would silently drop every non-selection matcher.
  Removed.

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

---------

Signed-off-by: discord9 <discord9@163.com>
2026-12-02 18:27:50 +00:00
dennis zhuang cd3406a0db refactor(promql): read evaluated and raw repartition chains with one loop (#10841)
Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
2026-12-02 15:20:21 +00:00
dennis zhuang 42e96e5bd9 fix(servers): spell Prometheus infinities as +Inf and keep Jaeger tags per trace (#10823)
* fix(servers): spell infinite Prometheus samples as +Inf and keep Jaeger process tags per trace

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

* perf(servers): serialize non-finite Prometheus samples from static strings

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

---------

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
2026-12-02 13:06:18 +00:00
dennis zhuang 99784fe803 fix(mito2): count written bytes of single-part bulk inserts (#10824)
* fix(mito2): count written bytes of single-part bulk inserts

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

* test(mito2): assert the exact written bytes of a single-part bulk insert

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

---------

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
2026-12-02 13:05:43 +00:00