mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-12-04 00:15:29 +00:00
b46be9e640242dae5aa4d4b76dd45ab90e7e86ad
5647
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
b46be9e640 |
feat(meta-srv): add follower migration hooks for the migrate RPC and datanode drain (#10770)
* feat(meta-srv): support plugin-backed follower migration Signed-off-by: WenyXu <wenymedia@gmail.com> * feat(meta-srv): drain followers through migration factory trait Signed-off-by: WenyXu <wenymedia@gmail.com> * refactor(meta-srv): isolate and batch follower migration Signed-off-by: WenyXu <wenymedia@gmail.com> * refactor(meta-srv): filter drain candidates by region role Signed-off-by: WenyXu <wenymedia@gmail.com> * fix(meta-srv): guard migration route checks and retry drain placement Acquire migration guards before validating source and destination peers and pass them to the follower procedure. Drain retries when another source is migrating the region and reselects an automatic target that has become occupied. Signed-off-by: WenyXu <wenymedia@gmail.com> * fix(meta-srv): skip running migrations and count drained regions by role Signed-off-by: WenyXu <wenymedia@gmail.com> * fix(meta-srv): revisit busy regions and isolate drain batch failures Signed-off-by: WenyXu <wenymedia@gmail.com> * fix(meta-srv): bound drain retries for busy regions Signed-off-by: WenyXu <wenymedia@gmail.com> * fix(meta-srv): reconcile drain failures by supported region role Signed-off-by: WenyXu <wenymedia@gmail.com> --------- Signed-off-by: WenyXu <wenymedia@gmail.com> |
||
|
|
c0dc0cb55b |
perf(query): prune iceberg_hash buckets across timestamp ranges (#10766)
perf(query): retain hash pruning when partition bounds cannot normalize Use scan-local iceberg_hash equalities to exclude routes even when another partition dimension prevents constraint normalization. Preserve NULL and unmatched-write destinations, and cover the fallback in a mixed timestamp/hash SQLNESS case. Signed-off-by: Lei, HUANG <ratuthomm@gmail.com> |
||
|
|
0be5ae25e5 |
refactor: extract shared sketch states (#10773)
Signed-off-by: WenyXu <wenymedia@gmail.com> |
||
|
|
ba53f68f0c |
perf(mito): share SST caches with Narthex series and samples (#10659)
* perf(mito): share SST caches with Narthex series and samples Signed-off-by: evenyag <realevenyag@gmail.com> * fix(mito): address Narthex cache review findings Signed-off-by: evenyag <realevenyag@gmail.com> * fix(mito): scope sample pages to their physical owner and exercise cold reads Signed-off-by: evenyag <realevenyag@gmail.com> * fix(mito): account for cached predicate memory and preserve manifest refills Signed-off-by: evenyag <realevenyag@gmail.com> * test(mito): exercise shared preload imports when enabled Signed-off-by: evenyag <realevenyag@gmail.com> * refactor(mito): group local Narthex cache files by artifact UUID Signed-off-by: evenyag <realevenyag@gmail.com> * fix(mito): remove empty local artifact directories after eviction Signed-off-by: evenyag <realevenyag@gmail.com> * refactor(mito): flatten the local artifact directory name Signed-off-by: evenyag <realevenyag@gmail.com> * refactor(mito): drop cleanup for earlier Narthex cache layouts Signed-off-by: evenyag <realevenyag@gmail.com> * fix(mito): leave UUID-only Narthex cache cleanup to eviction Signed-off-by: evenyag <realevenyag@gmail.com> * fix(mito): use single-range slices in cache tests Signed-off-by: evenyag <realevenyag@gmail.com> --------- Signed-off-by: evenyag <realevenyag@gmail.com> |
||
|
|
dca65604a9 |
feat(promql): answer an append-mode table, and any k for limitk (#10650)
* feat(promql): answer append-mode tables and any k for limitk The append-mode collapse compares raw ticks, so two distinct ticks inside one millisecond both survive and a same-tick tie keeps the last write. limitk picks its members by a hash of the label set with the label set as tie-break, so the membership no longer follows the order the inputs arrive in. Signed-off-by: discord9 <discord9@163.com> * test(promql): compare the golden limit cases by membership, not by pick Signed-off-by: discord9 <discord9@163.com> --------- Signed-off-by: discord9 <discord9@163.com> |
||
|
|
7f367720f6 |
feat(mito2): take a region over from a source that reported no entry (#10761)
* feat(mito2): take a region over from a source that reported no entry On a region whose manifest is published conditionally, a catchup that makes the region writable and names its source but no reported entry (a takeover) hands the region over without replaying, as a handover does. The engine prepares the takeovers of a batch: it reads the latest manifest version of each, asks for one heartbeat, and lists the WAL of each source once for a bound. The log store hands the region over while the catchup waits for a lease of the migration's candidate from a heartbeat sent after the version read. Under the manifest lock the lease and the version are checked again, and the commit records this node's handoff floor and, if the bound is above where the manifest recovers the source's WAL from, a listed tail up to the bound. The region worker applies the edit and promotes the region. A region that skips the WAL commits an empty edit after the same wait. A takeover of a region that awaits its Leader lease is caught up again as on main, and commits only after the prepared version while the latest lease is the candidate's. RegionCatchupRequest gains candidate_lease_id, passed from the upgrade instruction to the data region. The datanode sends a requested heartbeat a millisecond after the request; one already due sooner is kept and another follows it, and the scheduled time is kept during its reconnect backoff. Signed-off-by: jeremyhi <fengjiachun@gmail.com> * fix(mito2): keep the status of a failed source WAL listing A takeover whose listing of the source's WAL fails now reports that listing's status and retry hint: the error is shared across the takeovers of a batch as an Arc<BoxedError> instead of a message and a status, so a transient failure stays retryable and an empty WAL is not. Document what the candidate-lease wait returns, how the worker answers a takeover it was or was not prepared for, and what an abandoned hand-off leaves. Cover a manifest that moves during the candidate-lease wait and a takeover whose reopen fails. Signed-off-by: jeremyhi <fengjiachun@gmail.com> * docs(mito2): clarify takeover preparation error doc Signed-off-by: jeremyhi <fengjiachun@gmail.com> --------- Signed-off-by: jeremyhi <fengjiachun@gmail.com> |
||
|
|
64943b35b6 |
feat(promql): read second, microsecond and nanosecond time indexes natively (#10671)
* feat(promql): read second, microsecond and nanosecond time indexes natively The native route declined every selector over a time index that is not in milliseconds. The existing plan wraps such a scan in a cast projection, so the decline surfaced as selector_plan_is_not_a_table_scan, and the region's raw series preflight refused the unit as well. The raw series path now hands ticks over in the stored unit, and each raw input of the native tree records that unit. Evaluation keeps the existing plan's semantics: windows and lookbacks are decided on the stored ticks, a kernel reads the time truncated toward zero to milliseconds after the offset, and samples less than a millisecond apart remain distinct samples. Since every bound is a whole millisecond, deciding membership on ceil(tick) in milliseconds is exact, so the evaluators keep a window time beside the payload only for microsecond and nanosecond inputs. Scan filters are built in the stored unit. Histogram fields and range modifiers over a sub-millisecond time index still decline. The append-mode decline is kept and renamed to append_mode_table. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * fix(promql): decline a discovered selector over mixed time index units Logical metrics on different physical tables can store their time index in different units, while the union a nameless selector reads is one native input bound to one unit. The union took the first source's unit and read the other sources' ticks in it, so a series stored in microseconds next to one in milliseconds dropped out of its windows. Such a selector now declines. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * fix(promql): keep a window open until its last millisecond has been read A sample finer than a millisecond is placed in the window ending at the millisecond above it. A chunk that ends on such a sample has not read the rest of that millisecond, so treating that millisecond as settled closed the window before a later sample in the same millisecond arrived in the next chunk. Settle only up to the millisecond the last sample lies in, rounded down. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * fix(promql): select only an exact sample under a zero lookback A zero lookback admits only a sample exactly at the instant. The window time of a sample less than a millisecond before the instant rounds up to the instant, so the native selection picked it where the existing route returns nothing. Compare the stored tick with the instant when the lookback is zero, on the grid and anchored paths. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * fix(promql): version the FusedSeries envelope for input time units Move BoundInput::time_unit out of the positional tree encoding and append the input leaves' units after the v1 payload as envelope v2. A v1 payload from an older build still decodes, with millisecond inputs. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * test(promql): answer two selectors over different time units, and pin the mixed-unit decline reason Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * test(promql): drop the retired series scan v2 switch from the mixed-unit case Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * test(promql): expect the v2 FusedSeries envelope in the native prefix test Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * test(promql): adapt the time-unit tests to upstream instant and discovery changes Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * test(promql): name the mixed-unit discovery refusal as unsupported A native input carries one time unit, so discovery across physical tables with different time index units is refused. Answering needs a per-source rescale that changes the RawSeriesSource wire format; tracked in #10767. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> --------- Signed-off-by: Dennis Zhuang <killme2008@gmail.com> |
||
|
|
f824004131 |
feat(promql): segment native histogram folds above a split (#10675)
* fix(promql): declare float columns for a float function over a split histogram sum `histogram_count(sum(h))` and `histogram_quantile(0.9, sum(rate(h[2m])))` over native histograms failed to plan on the native route: the split counted the statement's value columns by the type of the exported state (a histogram), while the columns carry the root's kind (Float), so it counted zero and returned a plan error. Count value columns of either value type; the layout declares one kind for all of them. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * feat(promql): segment native histogram folds the split declines A single-input histogram tree whose fold the split could not carry - `sum(sum by (job) (h))`, `count(sum(h))`, `topk(1, sum by (job) (h))`, `sort`, `scalar` or `absent` over a fold, or a fold over a collapsing `label_replace` - declined to the legacy plan. Segmenting it is correct for histograms as it is for floats: the per-series prefix is cut into its own segment and the fold runs once over every segment's frames, so the gate is removed. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * test(promql): assert the outer histogram fold runs natively above a split Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * test(promql): assert the histogram fold reads frames from several partitions Signed-off-by: Dennis Zhuang <killme2008@gmail.com> --------- Signed-off-by: Dennis Zhuang <killme2008@gmail.com> |
||
|
|
d5fe65df3a |
feat(promql): run native PromQL over file-engine tables (#10680)
* feat(promql): run native PromQL over file-engine tables File-engine tables have no raw series scanner, so the native route declined them and they fell back to the legacy planner. Read such a table through a new RowSeriesSource node: an ordinary scan, filtered by the selector's matchers and time range, hash-partitioned by tags and sorted by (tags, time index, fields), then cut into explicit-label raw series chunks with Float64 values. The node declares its input distribution and ordering, so the physical optimizer inserts the repartition and a spillable SortExec. It stays above the merge scan, so it runs on the frontend in both standalone and distributed mode. Rows sharing labels and a timestamp keep one sample, as Prometheus storage does: the row whose field values sort lowest (nulls last). Non-string tags and histogram fields keep the existing plan. The cluster test builder can now pass the local file sandbox to datanodes and install frontend-only plugins, so the distributed case is covered. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * feat(promql): read file-engine tags as Prometheus label values A row source now reads every tag column as text with NULL read as '', so a NULL and an empty tag are one series from the start and an empty value carries no label, as in Prometheus. Rows of that series at one timestamp keep one sample by the existing rule. Matchers apply to the text form above the scan, so an integer tag matches "200" but not "0200". This drops the row_source_tag_is_not_a_string decline. The legacy planner fails on such a table with "Unsupported tag column type: Int64". Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * feat(promql): read native histogram fields from file-engine tables A row source passes a native histogram field on as histogram samples, converted with the same histogram_samples_from_arrow the mito raw scan uses, instead of casting every field to Float64. This drops the row_source_reads_floats_only decline, so the fixture of the sqlness case promql/delta_exponential_histogram runs natively; the integration test mirrors its statements and answers. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * feat(promql): read second-precision file-engine time indexes natively The existing scan plan already promotes a second-precision time index to milliseconds through a projection, which is exact. A row source now reads that projection instead of declining, and pushes the time range into the scan only when the scan's time index is in milliseconds. Microsecond and nanosecond time indexes still keep the existing plan. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * fix(promql): decline file-engine tables with a `__name__` tag column A row source dropped a tag column named `__name__` from its labels, sort key and partition key, so rows that differed only in that column merged into one series and lost samples. Mito's raw scan refuses such a tag. Decline it at planning time instead, and make RowSeriesSource reject the tag rather than filter it out. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * fix(promql): dedupe file-engine samples per field A row source reduced rows sharing labels and a timestamp to one whole row picked by the first field, so a NULL in another field of that row dropped the value a discarded row held there. Each field is its own value series: at a duplicated timestamp every field now keeps its own lowest non-null value (NaN above numbers, histograms by struct order). The sort key drops the fields, and the rows of the last timestamp of a batch are held back until the next batch, so every duplicated timestamp is reduced within one batch. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * fix(promql): rank NaN of either sign above numbers and bound the held-back run in RowSeriesSource Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * fix(tests): install frontend plugins only when set so rebuilt clusters don't share them Signed-off-by: Dennis Zhuang <killme2008@gmail.com> --------- Signed-off-by: Dennis Zhuang <killme2008@gmail.com> |
||
|
|
f2fb51d420 |
feat: read the object store WAL release bound of a region from its manifest (#10730)
* feat: read the object store WAL release bound of a region from its manifest A node may keep object store WAL entries of a region it no longer writes, for example after the region closed before its release record was written. Releasing them needs the latest manifest of the region: entries in a pending tail of the node are still needed. - `MitoEngine::wal_release_bound` reads the latest manifest of a region from the object store, the way an open with the given request would, and caps the given entry id at the pending tails of this node. It returns `None` when no manifest exists there. - `MetricEngine::wal_release_bound` picks the data or the metadata region of a physical region, and `RegionServer::wal_release_bound` builds the open request from the table metadata for the region's id in group 0 and dispatches on the engine. - `RegionServer::has_initializing_regions` tells whether the start-up open in the background still has a region that is neither registered nor failed to register. - Under conditional publication, recovering a manifest fails with a retryable error when the deltas after the replay start are not consecutive: another writer can save a checkpoint and delete the deltas it covers between the two listings, which leaves a suffix. Signed-off-by: jeremyhi <fengjiachun@gmail.com> * refactor: tighten the WAL release bound checks and tests - Assert in debug builds that the region is not writable here, and refuse a region info without the region's WAL options. - State the caller obligation: the bound keeps only this node's pending tails, so a takeover by another node must have recorded the entries the region still needs. - Describe in the gap check why recovery requires consecutive deltas under conditional publication only, and record it in mito2/AGENTS.md. - Cover the mito arm, the group checks, the option sanitizing, a gap in the middle of the deltas and the in-progress start-up open in tests, and share the manifest delta writer and the `tail` helper through `mito2::test_util`. Nothing in this repository calls these methods yet. A caller releases the returned bound with `LogStore::release_entries`, and uses `has_initializing_regions` to wait until the start-up open has settled. Signed-off-by: jeremyhi <fengjiachun@gmail.com> * refactor: dispatch the WAL release bound through RegionEngine - Add `RegionEngine::wal_release_bound`, whose default reports that the engine has no such bound, and implement it for the mito and metric engines. `RegionServer::wal_release_bound` now calls the engine registered under the table's engine name instead of downcasting. - Rename `region_open_request` to `build_region_open_request`, and fill the start-up checkpoints and follower flags in the existing vectors. - State that callers bound how many bound reads run concurrently. - Cover a legacy history that skips a version, nonzero region sequences, an engine without a bound and the metric group check by its status code, and run the writable-region panic test only with debug assertions. Signed-off-by: jeremyhi <fengjiachun@gmail.com> * docs: state the caller conditions of the WAL release bound contract - Say on `RegionEngine::wal_release_bound` that the bound keeps only what the persisted state records as still needed, so the caller uses it only after this node stopped writing the region, and bounds how many calls run concurrently. - Test that an unreadable manifest fails the bound, derive the skipped version of the legacy history test from the region, and stop normalizing the table dir twice. Signed-off-by: jeremyhi <fengjiachun@gmail.com> * refactor: keep one public entry point for the WAL release bound - Make `MitoEngine::wal_release_bound` crate-private, so the metric engine reaches it through `RegionEngine::wal_release_bound` like every other caller. - Describe the trait's `request` and `region_id` and the bound in the store-api layer's terms, point the datanode and metric docs at the trait, and state when the gap check's reasoning holds. - Match the exact error of an unreadable manifest in its test. Signed-off-by: jeremyhi <fengjiachun@gmail.com> * fix: retry conditional manifest opens when the checkpoint advances Signed-off-by: jeremyhi <fengjiachun@gmail.com> * fix: propagate checkpoint list errors after observing a manifest Signed-off-by: jeremyhi <fengjiachun@gmail.com> * fix: distinguish absent manifests from interrupted conditional scans Signed-off-by: jeremyhi <fengjiachun@gmail.com> * fix: recover legacy manifest gaps and require a node ID for WAL bounds Signed-off-by: jeremyhi <fengjiachun@gmail.com> --------- Signed-off-by: jeremyhi <fengjiachun@gmail.com> |
||
|
|
710c81ef2b |
fix(function): handle mask 0 and panic in ipv4_to_cidr/ipv6_to_cidr (#10733)
* fix(function): handle mask 0 and panic in ipv4_to_cidr/ipv6_to_cidr Fixes #10732 Signed-off-by: Boaz Shuster <boaz.shuster.github@gmail.com> * fix(function): invalid IPs return NULL in ipv4_to_cidr/ipv6_to_cidr Fixes #10732 Signed-off-by: Boaz Shuster <boaz.shuster.github@gmail.com> --------- Signed-off-by: Boaz Shuster <boaz.shuster.github@gmail.com> Co-authored-by: Boaz Shuster <boaz.shuster.github@gmail.com> |
||
|
|
88e98e60ed |
feat(promql): answer timestamp() over multi-field tables natively (#10670)
* feat(promql): answer timestamp() over multi-field tables natively The native compiler refused `timestamp()` over an input with more than one value field, so these statements fell back to the existing planner. A row of a multi-field table is one sample: the existing planner reports one `value` column holding the row's time wherever any field has a value. The native route now does the same. `timestamp` over several fields declares a single field, and both the selector form (sample time) and the evaluated form (evaluation time) report the time where any field of the row holds a value. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * fix(promql): read a native instant's stale marker from the first field only Signed-off-by: Dennis Zhuang <killme2008@gmail.com> --------- Signed-off-by: Dennis Zhuang <killme2008@gmail.com> |
||
|
|
426e3030da |
feat(promql): answer aliased TQL statements natively (#10669)
* feat(promql): answer aliased TQL statements natively `TQL EVAL ... AS name` (also used by CREATE FLOW) wraps the expression in an alias extension that the native compiler rejected, so these statements always fell back with `no_kernel_for_the_statement_shape`. The native route now offers the aliased expression and projects its rows into the layout the existing planner publishes: the value column under the alias, the labels, then the time index, with no metric name column. Labels follow the existing planner's order: a `by(...)` list keeps the order it names, `without(...)` sorts the rest, and a binary operation follows its vector operand. An alias over more than one value column fails with the same error the existing planner reports. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * fix(promql): take the aliased label order from the existing planner The alias layout guessed the existing planner's label order from the root's shape, which is wrong for `topk by(...)` (keeps its input's order), `count_values` (appends its label after the grouping), and any call or unary wrapper around a `by(...)` aggregate. The order is a by-product of planning the expression (`ctx.tag_columns`), so plan the aliased expression on the existing path with the native route off and project the native answer into that layout. A native answer whose label set differs from it declines, and the multi-value error now comes from the same field count the existing planner checks. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * fix(promql): fall back when a native output column name collides Signed-off-by: Dennis Zhuang <killme2008@gmail.com> --------- Signed-off-by: Dennis Zhuang <killme2008@gmail.com> |
||
|
|
ef1d505c2e |
fix(operator): reconcile inserts with auto-created tables (#10718)
* test: cover writes that need columns missing from the target table Each case writes columns that the table it reaches does not have: - a gRPC write to a new mito table whose CREATE loses to a concurrent writer, held after the DDL executor's existence check; - the same for a logical metric table, where the winner uses a nanosecond physical table and the losing write selected a millisecond one; - one gRPC batch with three entries for one new logical table and overlapping new tags; - one gRPC batch with two entries that need different new tags on an existing logical table; - an Elasticsearch _bulk request whose third document adds a field. Signed-off-by: dayan02dev <pawarudayan92@gmail.com> * fix(operator): check every auto-create request against the created table create_or_alter_tables_on_demand planned one CREATE for each request whose table was missing, and never checked the requests against the table that existed after the CREATE: - repeated entries for a new table in one batch sent one CREATE each. The later ones returned the first table without their columns, and repeated logical table names allocated several table IDs; - a CREATE that lost to a concurrent writer returned its own schema with the winner's table ID, so rows were converted against columns the region does not have; - a logical CREATE that lost returned the winner's table, but only tables found during planning were altered. Now the first request for a missing table defines its CREATE. A mito table is read back from the catalog after the CREATE, as logical tables already are, and every request for it is checked against that table. Missing columns go into one AddColumns per table, including tables found during planning, because an ALTER LOGICAL TABLES procedure reads each table once. Rows for a new logical table keep their timestamps until the table that exists is known, and are converted once. Signed-off-by: dayan02dev <pawarudayan92@gmail.com> --------- Signed-off-by: dayan02dev <pawarudayan92@gmail.com> Co-authored-by: dennis zhuang <killme2008@gmail.com> |
||
|
|
187facb58f |
feat(promql): let TQL discover metrics on the native route (#10674)
* feat(promql): let TQL discover metrics on the native route TQL statements never prepared a metric discovery scope, so the native route declined nameless and regex `__name__` selectors in TQL (`metric_discovery_unavailable`) and the legacy planner then rejected them, while the same query worked over the Prometheus HTTP API. SQL statement authorization now prepares the scope for the PromQL a statement evaluates (TQL EVAL/EXPLAIN/ANALYZE and TQL CTEs), keeping each discovered table that the statement's own permission request may read, and resolves the statement's table targets from the named tables plus that scope, as the HTTP path does. The returned context is the one the statement is planned with. A TQL CTE that discovers metrics publishes the native answer's columns: the legacy planner refuses such selectors, so there is no legacy schema to publish over it. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * test(frontend): pin TQL discovery to the statement's own permission request Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * refactor(query): plan a metric-discovering TQL relation natively once Signed-off-by: Dennis Zhuang <killme2008@gmail.com> --------- Signed-off-by: Dennis Zhuang <killme2008@gmail.com> |
||
|
|
007f9dea40 |
feat(promql): rate delta-marked native histograms natively (#10676)
* fix(promql): declare float columns for a float function over a split histogram sum `histogram_count(sum(h))` and `histogram_quantile(0.9, sum(rate(h[2m])))` over native histograms failed to plan on the native route: the split counted the statement's value columns by the type of the exported state (a histogram), while the columns carry the root's kind (Float), so it counted zero and returned a plan error. Count value columns of either value type; the layout declares one kind for all of them. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * feat(promql): pick OTLP delta math per series in native rate and increase rate and increase over a table that carries otlp_aggregation_temporality declined with delta_temporality_under_rate_or_increase. The existing plan picks the math per series: a series marked "delta" holds increments, so increase is the Kahan sum of the window and rate is that sum over the range in seconds, while every other series keeps the counter math. A range evaluator of rate or increase over raw input now checks each series' labels when it starts and evaluates a delta series with the sum kernel, outside the batch path. A rate or increase that reads its window directly is admitted; one that reads it through another expression, a histogram field, or a range modifier still declines. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * test(promql): cover offset and @ for native delta rate and increase Pins the delta sum against the existing plan when the window is moved by `offset` or anchored by `@`, and puts the misplaced doc comments of `kernel` and `root_subquery` back on their functions. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * feat(promql): rate delta-marked native histograms natively `rate` and `increase` over a native histogram whose series carries the OTLP delta temporality marker declined to the legacy plan. The legacy plan sums the window only for float samples and rates a native histogram as a counter whatever its marker says, so the native window already answers the same thing: the delta kernel only ever reads floats. The decline now applies to float selectors only, both for a call that reads the selector through another expression and for a range modifier. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * test(promql): cover OTLP delta exponential histograms under native rate The earlier case wrote counter-hinted histograms through remote write. OTLP ingest stores a delta point as a gauge-hinted histogram whose start timestamp is the previous point's end; rate and increase over that shape now run natively and agree with the existing plan. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * fix(promql): sum delta-marked evaluated series under native rate and increase A float derived from a delta-marked native histogram, such as `increase(histogram_count(h)[2m:1m])`, keeps the OTLP temporality marker. The existing plan picks the delta math off that marker and sums the window, but the native window over an evaluated series always used counter math, so the two routes disagreed (40 vs 55 in the new case). Pick the delta kernel for an evaluated series the same way as for a raw one. Histogram windows still go through the histogram rules, which ignore the marker on both routes. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * refactor(query): drop the unreachable range-modifier delta decline The native planner declined `rate`/`increase` over a delta-marked raw input when its window carried an anchored or smoothed modifier. Nothing in the query crate builds a `RangeModifier`, and promql-parser 0.10.0 does not parse either modifier, so the branch never ran. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * test(promql): pin absolute values for native OTLP delta histogram rates The OTLP delta histogram test only compared the native route with the existing plan. Also assert the values the Prometheus formulas give for `histogram_count(increase(h[2m]))` (30 and 55) and for the subquery over `histogram_count` (55). Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * refactor(promql): decide batch eligibility for a delta window in one check Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * feat(query): run delta-marked float subqueries under native rate and increase `increase(m[2m:1m])` and `rate(m[3m:1m])` over a delta-marked float series declined to the existing plan, because the native window over an evaluated series used counter math. That window now picks the delta math from the marker its series keeps, as the existing plan does, so the decline and the `under_rate_or_increase` flag the selector walk carried for it are removed. The OTLP delta corpus test asserts both queries run natively, match the existing plan, and sum the window's deltas (divided by the range for `rate`). Signed-off-by: Dennis Zhuang <killme2008@gmail.com> --------- Signed-off-by: Dennis Zhuang <killme2008@gmail.com> |
||
|
|
b4f8bc2263 |
feat(promql): split rankings and rewrites above a fold, refuse an empty count_values destination (#10720)
* fix(promql): answer rankings above a fold, topk splits and label rewrites
topk and bottomk above a global aggregate used to be refused and silently
answered by the legacy path; they now split into a producer over raw samples
and a final fold that ranks the merged state. A label rewrite no longer loses
the operand, an empty discovery is answered instead of refused, and
count_values("") keeps its empty label instead of panicking.
Signed-off-by: discord9 <discord9@163.com>
* fix(promql): reject an empty count_values destination on both routes
Prometheus rejects an empty label name at evaluation, and our legacy planner
accepted it, so the two routes disagreed. The destination is now checked on
the existing path too, with the same message the kernel already emits.
Signed-off-by: discord9 <discord9@163.com>
* test(promql): drop the admission case an integer field no longer declines
The route answers integer fields as Float64 since #10668, so the matrix
asserting they stay out of it describes a contract the base no longer has;
native_fused_numeric_fields_answer_float64 covers the same shapes.
Signed-off-by: discord9 <discord9@163.com>
---------
Signed-off-by: discord9 <discord9@163.com>
|
||
|
|
cba465ee76 |
feat(query): prune iceberg_hash partitions on literal equality (#10735)
* feat(query): derive region constraints for iceberg_hash equality Signed-off-by: Lei, HUANG <ratuthomm@gmail.com> * test(query): cover iceberg_hash pruning fallbacks Signed-off-by: Lei, HUANG <ratuthomm@gmail.com> * docs(query): document the planning-time repartition window A staging route disables hash inference for the whole table at planning time. Region reads carry no partition version, so a later repartition can invalidate the selected IDs. Signed-off-by: Lei, HUANG <ratuthomm@gmail.com> * test(query): verify unmatched hash writes use the region zero fallback Exercise the write router with a gap that DDL rejects but the metadata loader accepts. Verify that the unmatched literal and the NULL routing input reach different Regions and that pruning keeps both. Clarify that the DROP DEFAULT SQL case checks row visibility on a fully covered layout. Signed-off-by: Lei, HUANG <ratuthomm@gmail.com> * docs(query): clarify the public constraint pruning entry point Keep the existing signature for callers that only have partition constraints. The distributed planner supplies scan-local predicates separately for hash inference. Signed-off-by: Lei, HUANG <ratuthomm@gmail.com> * docs(query): explain why hash pruning collects scan-local filters The ordinary constraint collector walks through projections and limits. Hash inference must discard outer predicates at those boundaries to preserve column and row selection semantics. Signed-off-by: Lei, HUANG <ratuthomm@gmail.com> * docs(query): trace atomic expression ordering to the collider Name the constructor and OR expansion that preserve source order for the partition point and contiguous groups in matching_regions. Signed-off-by: Lei, HUANG <ratuthomm@gmail.com> --------- Signed-off-by: Lei, HUANG <ratuthomm@gmail.com> |
||
|
|
2d92c3cd4a |
test(mito2): pin narthex finality, order and append dedup (#10702)
* test(mito2): pin narthex finality, order and append dedup Signed-off-by: discord9 <discord9@163.com> * test(mito2): build the series window the index merge now takes write_series takes a WindowSequence instead of a flat reader, so the test derives the window from the flushed inputs. Signed-off-by: discord9 <discord9@163.com> * test(mito2): seed the series index the way a build may publish it Publishing through a region edit is refused unless the binary is pinned for native maintenance, so the tests write the manifest entry and apply it to the region version directly. Signed-off-by: discord9 <discord9@163.com> * test(mito2): drop the sentence about a source the helper no longer builds Signed-off-by: discord9 <discord9@163.com> --------- Signed-off-by: discord9 <discord9@163.com> |
||
|
|
92915691b5 |
perf(mito-codec): write dense string fields directly into the key buffer (#10728)
Signed-off-by: g4lb <galevgi@gmail.com> |
||
|
|
024b6334f6 |
fix(flow): preserve time index column names in batching queries (#10751)
* fix(flow): preserve time index column names in batching queries Use the time index name from the schema verbatim when building window and retention filters and projecting recovery timestamps. Parsing the name as SQL could bind a lowercase sibling or split a literal dot. Signed-off-by: QuakeWang <wangfuzheng0814@foxmail.com> * test(flow): move time index regressions alongside date_bin cases Signed-off-by: QuakeWang <wangfuzheng0814@foxmail.com> --------- Signed-off-by: QuakeWang <wangfuzheng0814@foxmail.com> |
||
|
|
dc683ebe14 |
feat(auth): make table permission checks schema-aware and guard flow … (#10708)
feat(auth): make table permission checks schema-aware and guard flow sink creation Signed-off-by: shuiyisong <xixing.sys@gmail.com> |
||
|
|
c573f9e87c |
feat(promql): answer integer fields natively as Float64 (#10668)
* feat(promql): answer integer fields natively as Float64 The native PromQL route declined statements whose legacy plan publishes an integer field's own type (bare selectors, sum over integers, count, count_values) with `field_keeps_its_own_type`. In Prometheus every sample is a float64, and the raw series scan already casts numeric fields to Float64, so the native route now answers these shapes with Float64 values instead of declining. Integer samples are cast before any fold, so a sum of integers beyond 2^53 follows float64 arithmetic, as Prometheus does. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * test(promql): check the existing plan sums the large integers exactly Signed-off-by: Dennis Zhuang <killme2008@gmail.com> --------- Signed-off-by: Dennis Zhuang <killme2008@gmail.com> |
||
|
|
6ffb0ec793 |
feat: answer scalar COUNT on Mito from SST metadata (#9891)
* feat: answer scalar COUNT on Mito from SST metadata Behind `experimental_metadata_aggr` (off by default), ScanHintRule marks an ungrouped scalar COUNT directly over a Mito scan. Mito then proves the scan's row count without reading SST data. Every file intersecting the query time range must be covered by the static predicates and have a known manifest row count. In deduplicating regions it must also share no (time, primary key) point with another file or a memtable, and its `__op_type` Parquet statistics must show no deletions. The statistics are read through the SST metadata caches, only for files that pass the manifest checks. RegionScanExec publishes the proven count as exact statistics, which lets DataFusion replace the scan with a literal. Other scans are unchanged. Overlaps are found with one time sweep over a segment tree of compressed primary key bounds, in O(N log N). The pairwise check remains as the test oracle and benchmark baseline. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: aumnertic <aumnertic@gmail.com> * test(mito): cover metadata COUNT and address core review Signed-off-by: aumnertic <aumnertic@gmail.com> * test(mito): match metadata aggregate fixture region IDs Signed-off-by: aumnertic <aumnertic@gmail.com> * fix(mito2): prove SST row counts before publishing exact statistics Signed-off-by: aumnertic <aumnertic@gmail.com> * test(mito2): add SQLness coverage for the SST footer marker Signed-off-by: aumnertic <aumnertic@gmail.com> * test(mito2): verify tightened partition bounds and source estimates Signed-off-by: aumnertic <aumnertic@gmail.com> * fix(mito2): keep lazy footer reads sendable Signed-off-by: aumnertic <aumnertic@gmail.com> * test(mito2): use valid sequence fences and SST owners Signed-off-by: aumnertic <aumnertic@gmail.com> * fix(mito2): validate SST key bounds before metadata count Signed-off-by: aumnertic <aumnertic@gmail.com> * fix(mito2): verify SST time bounds before metadata count Signed-off-by: aumnertic <aumnertic@gmail.com> * fix(mito2): own SST inputs to asynchronous bound checks Signed-off-by: aumnertic <aumnertic@gmail.com> * test(mito2): match displayed scan names in COUNT fallback Signed-off-by: aumnertic <aumnertic@gmail.com> * fix(mito2): keep SST replacements coherent with metadata counts Signed-off-by: aumnertic <aumnertic@gmail.com> * refactor(cmd): reuse the replacement SST reader during validation Signed-off-by: aumnertic <aumnertic@gmail.com> * test(mito2): verify listed SST sizes against object storage Signed-off-by: aumnertic <aumnertic@gmail.com> * fix(mito2): keep metadata count proofs within the SST read set Signed-off-by: aumnertic <aumnertic@gmail.com> * docs(mito2): use the actual scan memory limit key Signed-off-by: aumnertic <aumnertic@gmail.com> * fix(mito2): gate metadata counts on trusted SST dedup markers Record the provenance of engine-written dedup markers in the manifest. Clear it for external imports and preserve it during internal transfers. Require this proof for metadata counts over non-append multi-row SSTs. Keep the live file metadata consistent when an import supersedes a background publication, and cover checkpoint downgrade and reopen. Signed-off-by: aumnertic <aumnertic@gmail.com> --------- Signed-off-by: aumnertic <aumnertic@gmail.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
6c047d02b7 |
fix(promql): widen the regression intercept so a far horizon stops overflowing (#10724)
* fix(promql): widen the regression intercept so a far horizon stops overflowing predict_linear added the fold offset to the evaluation time in i64; both are legal and their sum is not, so a statement anchored far in the past was refused even though it answers an empty matrix elsewhere. The intercept is i128 now and the kernel adds there; the admission guard keeps only the fold offset, which is a per-sample shift that has nowhere to live outside i64. Signed-off-by: discord9 <discord9@163.com> * docs(promql): cut the window-overflow comments to the non-obvious why The added commentary restated code and existing invariants: native_tree_supported grew a second copy of its own refusal list plus a section on what the runtime still decides, and each test carried a paragraph narrating reasoning its name and assertion messages already state. Keep one sentence per non-obvious fact and narrow the stale predict_linear half of the admission list to what the predicate now refuses. Added comment lines: 122 -> 15. Signed-off-by: discord9 <discord9@163.com> --------- Signed-off-by: discord9 <discord9@163.com> |
||
|
|
89990fa715 |
fix(promql): preserve precision in native histogram range sums and av… (#10657)
* fix(promql): preserve precision in native histogram range sums and averages Signed-off-by: shuiyisong <xixing.sys@gmail.com> * test(promql): cover avg_over_time overflow before histogram downscale Signed-off-by: shuiyisong <xixing.sys@gmail.com> --------- Signed-off-by: shuiyisong <xixing.sys@gmail.com> |
||
|
|
4d8e55909a |
feat(promql): fold native histograms over multi-input trees natively (#10677)
* feat(promql): fold native histograms over multi-input trees natively A histogram statement reading more than one selector through raw sources declined as soon as it needed placement, so `sum(h1 + h2)`, `sum without (instance) (h1 or h2)` or `histogram_count(sum(h1 + h2))` ran their fold on the legacy plan. Such a tree is segmented like a float one: each operand's per-series prefix publishes frames, and the fold runs once above all of them with histogram state. A bare vector-vector pairing of histograms keeps the composed plan, one frame per operand. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * feat(promql): run histogram pairs over raw sources natively Drop the gate that sent a vector-vector histogram pairing to the composed binary route. Evaluated as one node over both raw sources, `h1 + h2`, `sum(h1 + h2) * 2` and their kin answer the same values, so the gate only fixed a plan shape. The tests that pinned that shape now assert the pairing and its answer instead, and two stale comments say what the kind walk and the segment gate actually do. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * test(promql): pin that a histogram pair reads both raw sources With the pairing gate restored, the composed route still roots a Binary with the same fills and columns, so the test passed either way. Assert that each operand is an instant selection over its own raw source, which only the single-node route builds. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> --------- Signed-off-by: Dennis Zhuang <killme2008@gmail.com> |
||
|
|
db03534e07 |
test(promql): share native test helpers and fixture parsing (#10749)
vector_match and select tests parsed the narthex-golden-vector fixtures with their own copies of the reference golden parser, and vector_match kept private copies of metric_of, labels_of, points_of, canonical_bits and close. Parse both fixture formats through grid_series::reference, share one float-field schema helper, and reuse golden::parse_metric in select. No production code changes. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> |
||
|
|
a8d50b4ee1 |
refactor(promql): walk native runtime children through one accessor (#10747)
Eight recursive passes over RuntimeNode each matched all twenty RuntimeOp variants to reach the same four child shapes. They now go through children()/children_mut(), and each pass keeps only its node-specific logic. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> |
||
|
|
7b60bb66e7 |
refactor(promql): define each duplicated native rule once (#10748)
- Go math.Max/Min: ScalarFunction::apply calls map's go_max/go_min.
- kahan_inc: the aggregate kernel uses functions::kahan_inc.
- Range function names: RangeFunction::name() and without_arguments()
replace the tables in display, range_eval/histogram, the native
compiler and the golden test.
- by/without to kernel grouping: Grouping::{labels, names, kernel}
replace the conversions in native aggregate, execute and plan.
Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
|
||
|
|
9fc061d125 |
feat(promql): apply OTLP delta math per series in native rate and increase (#10673)
* feat(promql): pick OTLP delta math per series in native rate and increase rate and increase over a table that carries otlp_aggregation_temporality declined with delta_temporality_under_rate_or_increase. The existing plan picks the math per series: a series marked "delta" holds increments, so increase is the Kahan sum of the window and rate is that sum over the range in seconds, while every other series keeps the counter math. A range evaluator of rate or increase over raw input now checks each series' labels when it starts and evaluates a delta series with the sum kernel, outside the batch path. A rate or increase that reads its window directly is admitted; one that reads it through another expression, a histogram field, or a range modifier still declines. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * test(promql): cover offset and @ for native delta rate and increase Pins the delta sum against the existing plan when the window is moved by `offset` or anchored by `@`, and puts the misplaced doc comments of `kernel` and `root_subquery` back on their functions. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * refactor(promql): decide batch eligibility for a delta window in one check Signed-off-by: Dennis Zhuang <killme2008@gmail.com> --------- Signed-off-by: Dennis Zhuang <killme2008@gmail.com> |
||
|
|
cd296475ba |
feat(mito2): group Narthex sample blocks within physical parts (#10712)
* feat(mito2): store Narthex samples in independently prunable groups Signed-off-by: evenyag <realevenyag@gmail.com> * fix(mito2): retain samples format version 1 Signed-off-by: evenyag <realevenyag@gmail.com> * style(mito2): format grouped samples test helpers Signed-off-by: evenyag <realevenyag@gmail.com> * perf(mito2): streamline grouped Narthex samples and frame exact keys Signed-off-by: evenyag <realevenyag@gmail.com> * refactor(mito2): validate key directory entry alignment Signed-off-by: evenyag <realevenyag@gmail.com> * perf(mito2): reuse continued keys and coalesce sample directory reads Signed-off-by: evenyag <realevenyag@gmail.com> * style(mito2): use crate-relative key page imports Signed-off-by: evenyag <realevenyag@gmail.com> * test(mito2): inline the raw key frame wire example Signed-off-by: evenyag <realevenyag@gmail.com> * docs(mito2): clarify grouped samples integrity and version policy Signed-off-by: evenyag <realevenyag@gmail.com> --------- Signed-off-by: evenyag <realevenyag@gmail.com> |
||
|
|
9b60ed4cc0 |
feat(index): align MG capacity with KLL and add indexed Puffin blob lookups (#10711)
* feat(index): configure frequent items and index Puffin footer keys Signed-off-by: WenyXu <wenymedia@gmail.com> * test(puffin): use fixed-size chunks in the window read benchmark Signed-off-by: WenyXu <wenymedia@gmail.com> --------- Signed-off-by: WenyXu <wenymedia@gmail.com> |
||
|
|
64b636e75c |
fix(mito2): hand a follower over while an earlier instance's tail replay runs (#10699)
* fix(mito2): hand a follower over while an earlier instance's tail replay runs The worker now records the instance each running tail replay replays. A running replay refuses a handover only if it replays the registered instance and has not reported its end, so a follower opened after a close no longer waits for the closed instance's replay; that replay's edit never applies to the new instance (`apply_tails_edit` checks the instance). One replay per region still runs at a time. Signed-off-by: jeremyhi <fengjiachun@gmail.com> * test(mito2): restore two engine-level handover assertions A handover whose request names no source fails before the log store hands anything over and commits nothing; with the source named, a retry hands the region over. A catchup again of a region that awaits its Leader lease, carrying a reported entry, records no handoff floor and no tail and replays this node's entries. Signed-off-by: jeremyhi <fengjiachun@gmail.com> * docs(mito2): clarify handover replay wording from review Signed-off-by: jeremyhi <fengjiachun@gmail.com> --------- Signed-off-by: jeremyhi <fengjiachun@gmail.com> |
||
|
|
a65e46855d |
fix(mito2): read committed compaction inputs during edit and alter (#10706)
Signed-off-by: WenyXu <wenymedia@gmail.com> |
||
|
|
86a81cc91d |
fix: pre-encode sparse primary keys for exemplar and SQL writes (#10625)
* fix: pre-encode sparse primary keys for exemplar and SQL writes Signed-off-by: shuiyisong <xixing.sys@gmail.com> * fix: preserve sparse write guards and WAL policy Signed-off-by: shuiyisong <xixing.sys@gmail.com> * perf: skip sparse key decoding on initial routing Signed-off-by: shuiyisong <xixing.sys@gmail.com> * fix: preserve sparse primary key order across upgrades and repartitioning Signed-off-by: shuiyisong <xixing.sys@gmail.com> * fix: reject exemplar writes without destination preflight Signed-off-by: shuiyisong <xixing.sys@gmail.com> * test: compact sparse partitions before merging Signed-off-by: shuiyisong <xixing.sys@gmail.com> * fix: clippy Signed-off-by: shuiyisong <xixing.sys@gmail.com> * test(compat): drop git-commit version constraint Signed-off-by: shuiyisong <xixing.sys@gmail.com> * refactor: simplify sparse write and exemplar paths Signed-off-by: shuiyisong <xixing.sys@gmail.com> * refactor: remove sparse key order check Signed-off-by: shuiyisong <xixing.sys@gmail.com> --------- Signed-off-by: shuiyisong <xixing.sys@gmail.com> |
||
|
|
8934000c9c |
fix(mito): keep delete markers in time series memtable last_non_null dedup (#10717)
Signed-off-by: Vishal Kotak <vishal.sanjiv.kotak@gmail.com> |
||
|
|
f8cec77262 |
fix(mito): keep deleted values out of flat last_non_null reads (#10726)
* test(mito): cover two puts older than a delete in flat last_non_null dedup test_flat_last_non_null_strategy_delete_middle now has a second put older than the delete at ts 3. Its field1 must not fill the null field1 of the newest put. This fails on main: the row reads back as (31, 33). The merge_mode sqlness case deletes a row written by two puts and rewrites it with a NULL field while another series sits in an SST. On main the NULL reads back as the value from before the delete. Signed-off-by: dayan02dev <pawarudayan92@gmail.com> * fix(mito): keep the delete barrier across flat last_non_null merges FlatLastNonNull::dedup_by_partitions returned only whether the last range has a delete. When the buffered row and the next batch formed a single range without a delete row, the barrier passed in from the previous batch was used for that merge but not returned, so the next put older than the delete filled the null fields again. Signed-off-by: dayan02dev <pawarudayan92@gmail.com> * docs(mito): note the inherited delete in flat last_non_null dedup comments Signed-off-by: dayan02dev <pawarudayan92@gmail.com> --------- Signed-off-by: dayan02dev <pawarudayan92@gmail.com> |
||
|
|
fe4c603ea8 |
refactor(mito2): retire Parquet series and range indexes (#10709)
* refactor(mito2): retire Parquet companion indexes and two-phase series scans Signed-off-by: evenyag <realevenyag@gmail.com> * refactor(mito2): read native series files with SST lifetime pins Signed-off-by: evenyag <realevenyag@gmail.com> * refactor(mito2): remove retired scan and cache plumbing Signed-off-by: evenyag <realevenyag@gmail.com> * refactor(mito2): finish isolating Narthex scan preparation Signed-off-by: evenyag <realevenyag@gmail.com> * test(mito2): verify retries while a failed range reader is pinned Signed-off-by: evenyag <realevenyag@gmail.com> * fix(mito2): import the set used by Narthex partition filters Signed-off-by: evenyag <realevenyag@gmail.com> * fix(mito2): remove stale series scan errors and lint failures Signed-off-by: evenyag <realevenyag@gmail.com> * refactor(mito2): centralize Narthex manifest paths Signed-off-by: evenyag <realevenyag@gmail.com> * fix(mito2): propagate per-series scan errors and account for buffered batches Signed-off-by: evenyag <realevenyag@gmail.com> * refactor(mito2): use Narthex names for series-index maintenance Signed-off-by: evenyag <realevenyag@gmail.com> * refactor(mito2): read Narthex samples through the owning SST handle Signed-off-by: evenyag <realevenyag@gmail.com> * refactor(mito2): keep the original Parquet series distributor Signed-off-by: evenyag <realevenyag@gmail.com> --------- Signed-off-by: evenyag <realevenyag@gmail.com> |
||
|
|
c7752a3ce6 |
feat(mito2): show SST levels in verbose analyze output (#10713)
* feat(mito2): show SST levels in verbose analyze output Signed-off-by: evenyag <realevenyag@gmail.com> * test: update verbose scan expectations for SST levels Signed-off-by: evenyag <realevenyag@gmail.com> --------- Signed-off-by: evenyag <realevenyag@gmail.com> |
||
|
|
9aebf3a821 |
fix(delete): route deletes using partition columns on value-partitioned tables (#10710)
fix(query,operator): retain partition columns when routing delete requests Preserve non-key partition columns across DataFusion DML delete projection and Deleter::trim_columns so RowSplitter evaluates partition expressions against the row's actual value rather than NULL, and cover trim_columns schema/row alignment in operator unit tests. Fixes #10705 Signed-off-by: Ömer <60585342+zaidrain06@users.noreply.github.com> |
||
|
|
2ce6a668c9 |
fix(mito): defer field filters for last_non_null scans (#10707)
Signed-off-by: evenyag <realevenyag@gmail.com> |
||
|
|
3be82bd956 |
fix: parse csv numbers from text for BIGINT UNSIGNED and with skip_bad_records in COPY FROM (#10643)
* fix: parse csv numbers from text for BIGINT UNSIGNED and with skip_bad_records COPY FROM a csv file read a BIGINT UNSIGNED column with the inferred type, so 9007199254740993e0 went through a Float64 and lost its last digit, or turned into NULL when the column was inferred as a string. With skip_bad_records the DECIMAL and BIGINT UNSIGNED columns were read by Arrow's csv reader. It dropped the digits of a decimal beyond the scale, returned 0.00 for some numbers in scientific notation, and rejected 0e0 and unsigned integers in scientific notation, so those records were skipped. Both csv paths now read such a column as a string and parse it from its text, like the json path does. Signed-off-by: Samarth Jaiswal <samarthjaiswal30@gmail.com> * fix: parse numbers for the table type with skip_bad_records The skip_bad_records reader takes its column types from the table. The columns to parse from text were still chosen by the inferred type, so a BIGINT UNSIGNED column inferred as a boolean from a first value of true went back to Arrow's reader, and a later 9007199254740993e0 was skipped. Choose them by the table type there. Signed-off-by: Samarth Jaiswal <samarthjaiswal30@gmail.com> --------- Signed-off-by: Samarth Jaiswal <samarthjaiswal30@gmail.com> |
||
|
|
cdd7f13354 |
test(metric-engine): pin cancelling an add-column request while the physical alter is pending (#10679)
Holds the physical alter of a dropped add-column request in Mito with an EventListener, so a request for another column deterministically reads the same metadata, allocates the same column id, and is rejected once the first alter lands. Asserts the InvalidArguments/NonRetryable outcome and that a manual retry allocates the next id. No production change. Closes #10377 Signed-off-by: Yvan Wang <131545713+BootstrapperSBL@users.noreply.github.com> |
||
|
|
3fae53f153 |
refactor(promql): trim native PromQL comments and redundant tests (#10704)
* refactor(promql): trim native PromQL comments and redundant tests Production code is unchanged: only comments change in non-test files. Comments that restated code, narrated history, or cross-referenced other comments are removed; comments that contradicted the code are corrected. Tests that drove the same branch as a surviving test or golden case are removed, and src/promql/AGENTS.md gains comment and test rules. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * test(promql): preserve recursive map validation coverage Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * test(promql): preserve empty-close and empty grouping coverage Signed-off-by: Dennis Zhuang <killme2008@gmail.com> --------- Signed-off-by: Dennis Zhuang <killme2008@gmail.com> |
||
|
|
3e4dc0b75e |
fix(mito2): keep a region open when a flush-on-close cannot flush it (#10689)
* fix(mito2): keep a region open when a flush-on-close cannot flush it A close with `flush_on_close` whose region holds rows in its memtable but cannot flush in its current state, for example a follower, used to skip the flush and close the region anyway. It now fails with the retryable `FlushableRegionState` error and leaves the region open, so the caller retries and the retry flushes once the region can. The close reads whether the region can flush once. Closes without `flush_on_close` are unchanged. A metric physical region is reported by its data region, which closes first, so once a close has closed the data region its metadata region keeps no lease. A retry that finds the data region closed and the metadata region a follower waives the requested flush of the metadata region. That close keeps the region's unflushed rows that are in a WAL; a region without a WAL loses them, as before this change. Signed-off-by: jeremyhi <fengjiachun@gmail.com> * docs: state what a refused flush-on-close leaves to the caller Signed-off-by: jeremyhi <fengjiachun@gmail.com> --------- Signed-off-by: jeremyhi <fengjiachun@gmail.com> |
||
|
|
15ca57ca20 |
fix(promql): publish legacy columns for native TQL in CTEs and flows (#10666)
* fix(promql): keep the native name column out of TQL CTEs and flows The native rows layout always appends a per-row `__name__` column. The Prometheus HTTP response reads it, but two SQL-visible consumers took it as part of the statement's columns: - A hybrid CTE published it after the existing planner's columns, so `WITH t (ts, val) AS (TQL EVAL ... metric)` failed with a column count mismatch on the native route. - A TQL flow matched it against the sink table and failed with "found 4 flow output columns and 3 sink table columns". A CTE now publishes exactly the existing planner's columns over the native plan. A TQL flow plans its query with the native route off, like CREATE VIEW does, because its output columns are the sink table's schema and the native route also names value columns differently. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * fix(flow): plan TQL flows on the native route with the existing columns The previous commit kept a TQL flow's sink schema stable by forcing the existing PromQL planner. Plan it like a TQL CTE instead: run natively and publish the existing planner's columns over the native plan. `LogicalPlanner::plan_relation` plans a statement whose columns are read by SQL. The CTE path and `sql_to_df_plan` both use it. The standalone test harness now starts the flow consistency check task, which `ADMIN FLUSH_FLOW` syncs with, so the flow test can run the flow and compare the sink table and rows with the existing route's. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * fix(promql): pair per-series columns by role when a TQL CTE or flow runs natively publish_legacy_schema paired the columns it could not match by name by type alone, so a series with two string labels left both label columns ambiguous and the statement fell back to the existing plan. Per-series outputs such as rate(), topk(), offset binaries and label_replace() over a table with more than one tag never ran natively in a CTE or a flow. Pair the time index by its marker, labels by name, and the remaining value columns in order, with the same casts as before. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * test: start the flow check task only in the flow test The standalone harness started the flow consistent-check task for every instance. The task runs on the global runtime and holds the flow engine, and nothing stopped it, so it outlived the instance and each rebuild started another one. The harness now exposes the flow engine, and the flow test that needs ADMIN FLUSH_FLOW starts the task and stops it. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * test(promql): check a two-field TQL CTE keeps each value column The native route pairs value columns with the existing ones by position. Two fields with different values make a swapped pair visible. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * style: format the two-field CTE test Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * fix(flow): key a TQL sink table on every label of the answer The sink table of a TQL flow took its primary key from the innermost aggregate when the plan had one. In `m / scalar(sum(m))` that aggregate groups by time alone, so the labels of `m` were created as DOUBLE fields, written as NULL, and every series collapsed into one row per timestamp. The native route has no such aggregate and keyed on the labels, so the two routes created different sinks for the same flow. Every string column of a PromQL answer is a label of its output series, so the sink now keys on all of them on both routes. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * fix(flow): keep writing a TQL sink that has the native __name__ column Before TQL flows were planned with `plan_relation`, a native TQL flow auto-created its sink from the native plan's own columns: the value named by that route, the labels, and `__name__` as a primary key column. The relation plan publishes neither, so such a flow failed sink validation and stopped writing. When the sink has a `__name__` column, plan the statement with `plan`, which is what these flows ran before. They keep writing the same columns and the same `__name__` values: the metric name for a selector, NULL where PromQL drops the name. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> --------- Signed-off-by: Dennis Zhuang <killme2008@gmail.com> |
||
|
|
c2a66803ff |
fix(mito2): read narthex tables partitioned on a non-tag column (#10665)
* fix(mito2): report one identity for a narthex series across regions Prepared narthex reads with explicit labels prefixed each series key with the region id. The prefix dates from when identity was the (table_id, tsid) hash and kept colliding series in different regions apart. Since #10330 the key is the exact sparse key, so the prefix protects nothing, but it still gives the fragments of one series in two regions different primary keys. SeriesRepartitionExec groups raw chunks by primary key, so those fragments never met in one owner: native PromQL returned duplicate series or failed with "input repeated an exact series identity" on a time-partitioned table. Use the exact key as the only candidate key and drop the separate merge key. The storage-api and raw chunk docs now require the identity to be the same in every region instead of allowing a region-qualified one. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * fix(mito2): filter narthex rows by a non-tag partition rule A narthex scan applied the region's partition rule to series-index rows during discovery. Those rows carry tags only, so a rule on any other column, such as `PARTITION ON COLUMNS (ts)`, failed to compile against them, and every read of such a region failed with "Failed to coerce partition expr against the schema", in SQL and PromQL alike. Keep series-level filtering for rules that reference tags only. Apply any other rule to sample rows, with the series' own values for the tags the rule references, since a file shared after repartition can hold rows of both partitions within one series. Compaction reads without the region predicate, so this filter is the only thing that keeps the other partition's rows out of its output. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * test(promql): check native reads of a time-partitioned narthex table Every series of a narthex table partitioned on the time index is split across two regions. Native PromQL over it, and SQL, must answer like the same rows held whole in one default-storage region, standalone and distributed. This covers both the partition rule on sample rows and the region-independent series identity that lets the frontend merge the fragments. The promql guide no longer claims that a series split across regions is not merged. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * fix(mito2): value __table_id from the series in a sample partition rule A partition rule that mixes `__table_id` with a non-tag column, which repartitioning a metric table can produce, is evaluated on sample rows. The filter looked `__table_id` up among the series' tag values, where the series index never puts it, so every read of such a region failed with "missing partition tag". Take it from the series' table ID instead. The time-partition test now also covers a tag + time rule and a `__table_id` + time rule. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * fix(promql): say which sample conflicts across regions and why A raw merge that finds two different samples of one series at one timestamp now names the series and the timestamp, and gives the likely cause: a table partitioned on a non-tag column, with the sample written on both sides of a partition bound, so each region kept one version. Behavior is unchanged; the query still fails. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> --------- Signed-off-by: Dennis Zhuang <killme2008@gmail.com> |
||
|
|
8c861ced8b |
fix(mito2): apply time predicates before last-row selection on narthex reads (#10664)
* fix(mito2): apply narthex time filters before row selection Narthex prepared reads applied every predicate conjunct after the merge, where a LastRow selector had already kept one row per series. A time predicate that is not a plain range (`ts != x`, `ts IN (..)`) then rejected the selected row and the series disappeared, while other formats return the newest matching row. Time-only conjuncts commute with dedup on (series, time), so run them on each sample source before the merge and keep the rest after it. Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * docs(mito2): note why hoisted time filters are never volatile Signed-off-by: Dennis Zhuang <killme2008@gmail.com> --------- Signed-off-by: Dennis Zhuang <killme2008@gmail.com> |
||
|
|
fea71143b2 |
test(perf): cover short series and enforce the native PromQL route (#10523)
* test(perf): add a short-series case and widen the native-eligible query matrix Signed-off-by: discord9 <discord9@163.com> * test(perf): register the short-series case in the heavy set `many_short_series` (100,000 series x 8 samples, 8 SSTs) is the same size class as the high-cardinality cases that already live in `HEAVY_CASES`: the per-series setup dominates, and the self-hosted runner has been lost on fixtures of this size before. Leaving it out of both lists meant nothing ran it; putting it in the routine set would charge every PR regression for it. Register it in `HEAVY_CASES` (so `/query-regression heavy` and the `heavy` workflow-dispatch token select it) and describe the case next to the other heavy ones in `tests/perf/README.md`. Signed-off-by: discord9 <discord9@163.com> * test(perf): fix the short-series case's comments and heavy selection The case measured shapes whose comments described other shapes: the plain grid does not cover the offset/pinned/host-filtered queries, `[10m:1m]` holds ten aligned inner points per left-open outer window (not eleven, so two outer points are twenty inner evaluations), and the #7913 subquery uses a five-minute inner step rather than a one-minute one. The README also said the short case rewrites `__name__`; it rewrites `dst`. Registering the case in `HEAVY_CASES` also left `test_heavy_selects_the_heavy_case_set` red, because its expectation still listed three paths; add the fourth and bring the README's heavy description in line with the four-case set. Signed-off-by: discord9 <discord9@163.com> * test(perf): fail a perf case that silently measures the legacy PromQL route The native PromQL route is off by default and declines a query it cannot take by returning `None`, which the planner turns into the legacy plan without a word. A perf case that means to time the native route therefore timed legacy whenever the hint was absent, and nothing in the report said so. A query now declares `require_native = true` on a `TQL ANALYZE ... FORMAT JSON` statement. The runner parses the statement with the SQL parser to keep a commented-out keyword or a look-alike `SELECT` from standing in for it, states `query.experimental_native_promql=true` in the request hints on both targets, and runs the same statement once per target before warmup. That response's `plan` cells are JSON plan trees; the assertion walks their `children` and reads only node `name` values, because a node's `param` carries the rest of its plan line, where a label value or a filter can spell anything. A name of `FusedSeries` or `FusedSeriesExec` (as a whole word) keeps the query; anything else records a `validation_errors` entry naming the case, query, and target, reports no benchmark measurement for it, and fails the run. Declaring the flag on any other statement is a configuration error reported before either target is contacted, because only that form answers the plan of the query being timed. The structured form is required because text plan lines can start with a label value: only the tree is evidence. Cases without the flag send the requests they sent before, which a test pins by comparing the built headers. Signed-off-by: discord9 <discord9@163.com> (cherry picked from commit 792d8cfbf05ca352d3a915cf40036a0219651970) * test(perf): reject a prom_http query that only looks like a TQL analyze `require_native` is checked against the statement text, so a `kind = "prom_http"` entry carrying a `TQL ANALYZE ... FORMAT JSON` string passed the pre-flight check and was then posted to the Prometheus range endpoint, which answers no plan tree: the run failed as a request error instead of the configuration error the docs promise. Reject the kind explicitly and cover that exact combination. Signed-off-by: discord9 <discord9@163.com> (cherry picked from commit 868b474027b58602174a8aedca316d9d5c54a08e) * test(perf): assert the native route in the new native cases The 19 short-series queries and the six queries added for the remote-write case's eligible table now declare `require_native` and are measured as `TQL ANALYZE VERBOSE FORMAT JSON`, so the runner proves from the JSON plan tree that each one ran on the fused-series route before its latency counts. The three selectors on the `TIMESTAMP(9)`/`append_mode` table keep plain `TQL ANALYZE VERBOSE` and no flag: that table can never route natively, so requiring the route there would fail the run by design. Signed-off-by: discord9 <discord9@163.com> * test(perf): fold two rate points per outer step in the subquery case At a one-minute inner step the first outer evaluation of `max_over_time(rate(m[5m])[10m:1m])` saw a single raw sample in its rate window and the second folded one valid rate point, so the subquery's fold was barely exercised. At thirty seconds both outer points fold two valid rate points, and the comment states the new arithmetic: twenty aligned inner points per outer one, forty inner evaluations in total. Signed-off-by: discord9 <discord9@163.com> --------- Signed-off-by: discord9 <discord9@163.com> |