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>
* 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>
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>
* 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>
* 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>
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>
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>
* 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>
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>
* 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>
* 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>
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>
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>
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>
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>
* 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>
* 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>
* 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>
* 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>
* 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>
* 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>
* 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>
* 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>
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>
* 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>
* 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>
* 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>
- 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>
* 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>
* 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>
* 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>
* 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>