Commit Graph
6716 Commits
Author SHA1 Message Date
WenyXu e9f5d441fc feat(mito2): allow disabling ingestion SST cache preloading
Add an opt-out for ingestion Parquet and Puffin preloading, enabled by default. Preserve import and staging behavior and cover publication with cache warming enabled and disabled.

Signed-off-by: WenyXu <wenymedia@gmail.com>
2026-11-23 03:19:15 +00:00
WenyXu 1bfdf3c135 feat(cache): configure metadata cache capacities for bulk workloads
Allow per-cache entry limits through experimental environment settings while retaining existing TTL and invalidation behavior. Expose the registered table route cache so bulk metadata reads share its coordinated loads.

Signed-off-by: WenyXu <wenymedia@gmail.com>
2026-11-23 03:19:15 +00:00
WenyXu 849fe174f1 perf(partition): cache routing results by physical table snapshot
Share bounded Moka routing results across requests using full partition-key tuples. Fence cached results with snapshot identity and avoid retaining obsolete partition snapshots.

Cover snapshot replacement, table isolation, disabled capacity and oversized keys; include an optimized routing benchmark.

Signed-off-by: WenyXu <wenymedia@gmail.com>
2026-11-20 16:50:35 +00:00
WenyXu 2746e9aef1 chore(poc): align proto and planner tests with upstream
Signed-off-by: WenyXu <wenymedia@gmail.com>
2026-11-20 09:37:34 +00:00
WenyXu 56684eb521 fix(metric-engine): clean up residual source metadata after sync retries
Signed-off-by: WenyXu <wenymedia@gmail.com>
(cherry picked from commit 8e2f789db3)
2026-11-20 09:21:10 +00:00
WenyXu 0dd7315ba1 fix(repartition): retry metadata sync when copied files disappear
Signed-off-by: WenyXu <wenymedia@gmail.com>
(cherry picked from commit 5303b5d34d)
2026-11-20 09:21:10 +00:00
WenyXu 8d7ad1edb6 fix(metric-engine): clean up imported SSTs when metadata transform fails
Signed-off-by: WenyXu <wenymedia@gmail.com>
(cherry picked from commit 9fad887f75)
2026-11-20 09:21:10 +00:00
WenyXu 167ce1a202 refactor(repartition): release source compaction pauses by region
Signed-off-by: WenyXu <wenymedia@gmail.com>
(cherry picked from commit dc6faab429)
2026-11-20 09:21:10 +00:00
WenyXu 928dd472d8 refactor(repartition): share metadata compaction pauses per source region
Signed-off-by: WenyXu <wenymedia@gmail.com>
(cherry picked from commit b8cfed023b)
2026-11-20 09:21:10 +00:00
WenyXu 10f7d0c80c fix(repartition): pause source metadata compaction while syncing targets
Signed-off-by: WenyXu <wenymedia@gmail.com>
(cherry picked from commit 5e83bfeed6)
2026-11-20 09:21:10 +00:00
WenyXu 62f252743f fix(metric-engine): remove residual source metadata on sync retry
Signed-off-by: WenyXu <wenymedia@gmail.com>
(cherry picked from commit e98ac0430c)
2026-11-20 09:21:10 +00:00
WenyXu c4fcd596cc test(mito2): verify pause initiates local compaction cancellation
Signed-off-by: WenyXu <wenymedia@gmail.com>
(cherry picked from commit 8c2f925aae)
2026-11-20 09:21:10 +00:00
WenyXu ba9b16a864 docs(mito2): clarify compaction admission after a pause
Signed-off-by: WenyXu <wenymedia@gmail.com>
(cherry picked from commit 7ed0b06282)
2026-11-20 09:21:10 +00:00
WenyXu 9de268d832 test(mito2): cover concurrent compaction pause waiters on cancellation and failure
Signed-off-by: WenyXu <wenymedia@gmail.com>
(cherry picked from commit 461d2492df)
2026-11-20 09:21:10 +00:00
WenyXu 5a592e8c2e fix(metric-engine): identify compaction pause failures during metadata sync
Signed-off-by: WenyXu <wenymedia@gmail.com>
(cherry picked from commit e9e54c50ef)
2026-11-20 09:21:10 +00:00
WenyXu 2728510a6a fix(metric-engine): pause target compaction during metadata sync
Signed-off-by: WenyXu <wenymedia@gmail.com>
(cherry picked from commit 78e040cb93)
2026-11-20 09:21:10 +00:00
WenyXu 386db08838 feat(mito2): account scoped bulk SST ingestion as write load
Signed-off-by: WenyXu <wenymedia@gmail.com>
2026-11-20 09:19:15 +00:00
WenyXu 3a8ffea9a5 chore: adapt PoC dependencies and test utilities after rebase
Signed-off-by: WenyXu <wenymedia@gmail.com>
2026-11-20 09:18:42 +00:00
WenyXu 1f4b7919f9 feat(sketch): report shared samples and directory probes
Carry additive sampling counters through region RPC and validate unique payload accounting with overlapping proposal and validation samples. Document directory-only probes separately from the payload file limit and allow directory-proven empty buckets in a census.

Update the generated Cargo lockfile for the proto revision; the resolver also reselects existing dependency edges without changing package versions.

Signed-off-by: WenyXu <wenymedia@gmail.com>
2026-11-20 09:17:49 +00:00
WenyXu 7880a1c225 feat: add single-snapshot sketch split RPC
Add bounded progressive split requests and validated outcomes, with engine and metric-engine forwarding and a dedicated client RPC. Keep ordinary sketch queries unchanged and validate controls before acquiring region snapshots.

Signed-off-by: WenyXu <wenymedia@gmail.com>
2026-11-20 09:17:49 +00:00
WenyXu 50c107b17e perf(mito2): short-circuit redundant compaction overlap checks
Signed-off-by: WenyXu <wenymedia@gmail.com>
2026-11-20 09:17:49 +00:00
WenyXu 5153ef9f1b chore(deps): pin rebased sketch proto branch
Signed-off-by: WenyXu <wenymedia@gmail.com>
2026-11-20 09:17:49 +00:00
WenyXu 3d821f8036 fix(mito2): adapt PoC integrations to upstream metadata sharing
Signed-off-by: WenyXu <wenymedia@gmail.com>
2026-11-20 09:17:49 +00:00
WenyXu e8cc18f8ce feat(puffin): batch uncompressed blob reads with a byte budget
Signed-off-by: WenyXu <wenymedia@gmail.com>
2026-11-20 09:17:49 +00:00
WenyXu 55b45d3678 fix: fence reads across repartition data handoff
Reject query planning during repartition handoff and keep new targets pending until all manifests have been applied. Carry planned partition versions to datanodes and validate the pinned scan snapshot, including retiring merge sources. Preserve retryable read errors and cover cached routes, transport, metric mapping, and scope changes.

Signed-off-by: WenyXu <wenymedia@gmail.com>
2026-11-20 09:17:49 +00:00
WenyXu 3b882f7c5c fix: defer reads from repartition targets until metadata is ready
Hide newly allocated targets until logical-region metadata synchronization completes. Refresh cached pending routes from authoritative metadata and stop staging entry when cache invalidation fails. Cover route persistence, allocation replay, rollback, stale caches, and failure paths.

Signed-off-by: WenyXu <wenymedia@gmail.com>
2026-11-20 09:16:09 +00:00
WenyXu 6bf4342b39 feat(sketch): expose deterministic file sampling over region RPC
Add optional file-sampling requests and unscaled sample diagnostics, validate limits, and preserve the fields through region RPC conversion. Pin the published proto revision in the standalone OSS workspace; retain Cargo-generated lockfile dependency-edge normalization.

Signed-off-by: WenyXu <wenymedia@gmail.com>
2026-11-20 09:15:32 +00:00
WenyXu f8330c7588 feat(sketch): expose metric table sketches through region RPC
Signed-off-by: WenyXu <wenymedia@gmail.com>
2026-11-20 09:15:32 +00:00
WenyXu 7f6e5fe1c4 fix(metric): route sparse primary keys during partitioned ingestion
Signed-off-by: WenyXu <wenymedia@gmail.com>
2026-11-20 09:15:04 +00:00
WenyXu 53d043e372 feat(mito2): expose Region-bound sketch readers
Signed-off-by: WenyXu <wenymedia@gmail.com>
2026-11-20 09:14:21 +00:00
WenyXu 40126e961a feat(storage): define in-process sketch reader contracts
Signed-off-by: WenyXu <wenymedia@gmail.com>
2026-11-20 09:14:21 +00:00
shuiyisong 3d52f9f640 perf(auth): skip unnecessary catalog lookups for table permissions (#10539)
* perf(auth): skip unnecessary catalog lookups for table permissions

Signed-off-by: shuiyisong <xixing.sys@gmail.com>

* docs(auth): clarify what precheck Allow authorizes

Signed-off-by: shuiyisong <xixing.sys@gmail.com>

---------

Signed-off-by: shuiyisong <xixing.sys@gmail.com>
2026-11-20 07:36:45 +00:00
discord9 dd4845c38a perf(table): compile a regex predicate once per scan instead of once per batch (#10517)
* perf(table): compile a regex predicate once per scan instead of once per batch

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

* perf(recordbatch): borrow a regex cache once per array instead of per row

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

* perf(recordbatch): borrow a regex cache from a pool and defer its compilation

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

* perf(table): keep the regex rewrite off the pruning path

`prune_with_stats` folds a predicate into column statistics and never evaluates
it, so the precompiled-regex rewrite bought nothing there: the pruning
predicate builder replaces nodes it does not recognize with `true`, and the
rewrite ran per file (manifest pruning) and per batch (bulk memtable pruning).

Split the two conversions: `to_physical_expr` stays the evaluating entry point
and keeps `PrecompiledRegexExpr`; the new `to_pruning_physical_exprs` builds
what `create_physical_expr` builds, with the `DFSchema` built once per call
instead of once per expression.

Also pin the pool's concurrency property without a clock: eight cache guards
held and used at once, asserting eight acquisitions over one compilation.

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

---------

Signed-off-by: discord9 <discord9@163.com>
2026-11-20 06:39:47 +00:00
jeremyhi 5dec7b1986 feat(meta-srv): check pending WAL tails before a repartition starts (#10504)
* feat(meta-srv): check pending WAL tails of source regions before a repartition starts

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

* test(common-meta): freeze the region statistic encodings before the pending tails flag

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

* fix(meta-srv): clarify the repartition pending tails errors and pin the flag encoding

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

* fix(meta-srv): retry repartitions over pending WAL tails and pass sources without a report

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

* docs(meta-srv): note the retained leader report in the repartition pre-check

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

* fix(meta-srv): report pending repartition tails as region not ready and share is_false

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

* style(meta-srv): order the repartition pre-check test imports

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

---------

Signed-off-by: jeremyhi <fengjiachun@gmail.com>
2026-11-20 05:16:35 +00:00
Weny Xu 1ba656e345 perf(catalog): batch cached metadata reads for information schema scans (#10542)
* feat(meta): support cached batch lookups for flows and views

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

* feat(partition): batch-load cached routes for partition scans

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

* perf(meta): bound marker reads when listing dropped tables

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

* perf(catalog): stream information schema scans through metadata caches

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

* fix(catalog): gate the recycle bin metadata accessor

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

* fix(meta): coordinate schema, view, and flow cache updates

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

* perf(operator): bound concurrent flow lookups for multi-table writes

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

* refactor(meta): reuse cache key and batch value conversions

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

* refactor(catalog): extract metadata loaders from information schema scans

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

* fix(catalog): remove unused scan dependencies

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

* chore: align metadata cache visibility and API documentation

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

* refactor(meta): share physical routes across logical table lookups

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

* refactor(catalog): share metadata loaders across scan paths

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

* test: verify cache batch reads and information schema options

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

* test(sqlness): order information schema table rows before comparison

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

* fix(catalog): finish partition lookups before loading the next table batch

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

* fix(meta): load all source table flows on a cold lookup after create

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

---------

Signed-off-by: WenyXu <wenymedia@gmail.com>
2026-11-20 04:58:15 +00:00
discord9 4eca3194bb test(query): skip the far-future overflow test when SystemTime cannot represent it (#10545)
Windows SystemTime and 32-bit time_t targets cannot represent the 5e18 ms statement start, so checked_add returns None before the planner sees the query. Skip the high-level shape there; the platform-independent native_tree_supported_declines_the_instants_that_overflow test still covers the admission predicate.

Signed-off-by: discord9 <discord9@163.com>
2026-11-20 04:44:51 +00:00
Weny Xu 6458142398 fix(mito-codec): align sparse metric rows with physical region fields (#10543)
* fix(mito-codec): align sparse metric rows with physical region fields

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

* test(mito-codec): cover sparse rows in single-field regions

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

---------

Signed-off-by: WenyXu <wenymedia@gmail.com>
2026-11-20 04:12:28 +00:00
Weny Xu 47e066aad8 perf(metric-engine): stream metadata copies during repartition (#10535)
* fix(metric-engine): stream metadata copies during repartition

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

* fix(metric-engine): tune copy batches and report invalid source metadata

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

* refactor(metric-engine): express metadata copy payload limit with ReadableSize

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

* test(metric-engine): cover metadata batch limits and marker replay

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

* test(metric-engine): verify multi-batch metadata copies from SST

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

---------

Signed-off-by: WenyXu <wenymedia@gmail.com>
2026-11-20 04:07:31 +00:00
Weny Xu 7fa5dc5f54 perf(metric-engine): share logical column metadata by physical table (#10536)
* perf(metric-engine): share logical column metadata by physical table

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

* refactor(metric-engine): reuse physical schema lookups across DDL and reads

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

---------

Signed-off-by: WenyXu <wenymedia@gmail.com>
2026-11-20 04:05:36 +00:00
jeremyhi 006cae6283 fix(meta-srv): skip upgraded regions on retry and recheck routes in region migration (#10498)
* fix(meta-srv): retry only unready regions and recheck routes in region migration

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

* fix(meta-srv): check the whole batch before aborting a recovered migration

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

* test(meta-srv): cover the invalidation of a retried route switch

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

* test(meta-srv): share the moved-leader fixture and cover replies with errors

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

* fix(meta-srv): recover migrations without parsing the persisted state

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

* fix(meta-srv): keep promoting a target that holds a follower replica

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

* fix(meta-srv): broadcast the routes a migration rollback clears

The rollback that clears the Downgrading marks of a batch now broadcasts
the table cache invalidation, so clients that cached the marked routes
refresh them. Also call the infallible broadcast directly at the start
check, bind the pending regions before borrowing them, and document why
the upgrade failure test repeats its attempt.

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

* fix(meta-srv): broadcast cleared marks when a later table of a rollback fails

The rollback broadcasts the table cache invalidation whenever it cleared
a Downgrading mark, also when a later table of the batch then fails: a
retry finds those marks gone and would broadcast nothing.

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

---------

Signed-off-by: jeremyhi <fengjiachun@gmail.com>
2026-11-19 16:09:39 +00:00
dennis zhuang 27182bdd69 perf(query): fill TopK heaps early over filtered region scans (#10515)
* perf(query): let a TopK over a filtered scan publish its dynamic filter early

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

* perf(query): share the global TopK conditions and flush filters per batch

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

* test(query): pin unsplit filter output at batch size 1

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

* perf(query): balance rows when assigning ranges in time order

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

* perf(query): leave TopK on other sort keys unchanged

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

* perf(query): spread ranges of unknown size and test the scan wiring

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

* test(query): share TopK test helpers and merge assignment cases

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

* fix(query): leave fetch-limited filters alone under a TopK

A FilterExec with a fetch keeps the first rows that pass, so changing
when the TopK threshold arrives or the order ranges are read changes
which rows it keeps. Both rules now stop at such a filter.

Also use replace_children instead of the deprecated with_new_children,
and document the coalescer behavior that batch size 1 relies on.

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

* fix(query): rewrite only TopKs bounded by a SortPreservingMergeExec

A partitioned TopK keeps up to fetch rows per partition, which equals
the global result only because the merge above it takes the first rows
of all partitions. Match from that merge, through projections, and
require the TopK's fetch to cover the merge's, so a TopK whose
per-partition rows are part of the result is never rewritten.

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

* docs(query): state what the global TopK fetch cap does and does not bound

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

* perf(query): keep per-partition TopK heaps when no range can be skipped

With no more ranges than partitions each partition reads at most one
range, so the TopK threshold leaves no later range to skip and one heap
only adds a single consumer. filtered_scan_below_topk now requires more
ranges than partitions; both callers pass the partition count they plan
for.

The small sqlness tables in order_by and windowed_sort fall under the
guard, so a new windowed_sort case with six files covers the rewrite
end to end.

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

* test(perf): add a query regression case for time-index TopK over a selective filter

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

* test(sqlness): say what the one-heap windowed_sort case pins

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

---------

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
2026-11-19 15:55:49 +00:00
Weny Xu ce7153de26 fix(metasrv): reserve repartition region numbers before creating regions (#10524)
* fix(metasrv): reserve repartition region numbers before creating regions

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

* fix(metasrv): limit repartition changes to region number reservation

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

* refactor: share repartition allocation targets

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

* fix: reserve region numbers when resuming repartition after upgrade

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

* test: bound waits for repartition create requests

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

---------

Signed-off-by: WenyXu <wenymedia@gmail.com>
2026-11-19 15:42:30 +00:00
Weny Xu 66719b648f feat(meta): add shared batch lookups for table metadata caches (#10527)
* feat(meta): add shared batch lookups for table metadata caches

Signed-off-by: WenyXu <wenymedia@gmail.com>
(cherry picked from commit 3422005e77)
Signed-off-by: WenyXu <wenymedia@gmail.com>

* fix(meta): coalesce overlapping metadata batch loads

Queue a key for batch loading only when Moka polls its initializer. Drive the request-local queue alongside the reads so another batch can share an active load or take it over after cancellation.

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

* refactor(cache): extract request-local batching from paged reads

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

* refactor(meta): reuse common-cache batching for metadata reads

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

* fix(catalog): skip cache lookup for fully resolved batches

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

* test(cache): cover request-local batch delivery and cancellation

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

* test(meta): cover batch lookup fallback and clarify miss semantics

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

* fix: coordinate metadata cache publication with invalidation

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

---------

Signed-off-by: WenyXu <wenymedia@gmail.com>
2026-11-19 14:37:32 +00:00
jeremyhi 0ae7c1826b feat: add an admin function to discard pending WAL tails (#10477)
* feat: add an admin function that discards a datanode's pending WAL tails

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

* fix: refuse a tail discard over an unconfirmed manifest update and address review

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

* test: drop the integration test that repeats the admin function's region form

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

* fix: refuse a tail discard while a tail replay's update is uncertain

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

* build: pin greptime-proto to the branch that adds the pending tails truncate kind

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

* test: record the region id case of the discard_pending_tails sqlness test

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

* fix: track the uncertain replay update only without conditional publication and pin the truncate wire format

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

* test: simplify the truncate wire test

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

* test: cover the discard requests sent to regions and the metric data region

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

* test(mito2): pin the WAL history a discard relies on after a crash

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

* test(common-function): describe the mock pending tails discard

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

* fix(operator): report discard failures per region and clarify pending tails docs

Log each failed region of a by-table pending tails discard with its region id
and the tails the other regions discarded, derive the unsupported message from
the truncate kind, drop the unused feature parameter, document that a discard
raises the flushed entry id to the tail bound, and test discarding a kept tail
after a replay commit with an uncertain result.

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

* fix(operator): warn with the partial discard count and state the WAL history check precisely

Format request.rs, log the tails discarded by the regions that succeeded at
warn level when another region fails, state in the docs that an open checks WAL
history through the flushed entry id where the log store checks history and
that whoever adds a tail ensures it for every node that may lead the region,
and rename two tests after the outcomes they assert.

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

* docs(mito2): note that accepting missing WAL history opens a region past a discarded bound

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

* docs(mito2): rewrap the pending tails discard handler doc

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

* refactor(store-api): discard pending WAL tails with a dedicated region request

Carry the discard as RegionRequest::DiscardPendingTails, decoded from the
DiscardPendingTailsRequest body, instead of a truncate kind. Mito handles it as
a worker control request, so the truncate path no longer special-cases it;
the Metric Engine forwards it to a physical region's data region; the
frontend builds it for a region or for every region of a table, sharing the
table lookup with the discard of unflushed data. The wire fixture now pins the
new request body.

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

* refactor(metric-engine): give the pending tails discard its own error context

Report a failed discard as a pending tails discard rather than a truncate in
the Metric Engine, pin that Mito handles the discard as a worker control
request, state that physical_region_ids returns a logical table's physical
regions, and drop leftovers from the truncate kind in the tests.

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

* build: pin greptime-proto to the dedicated pending tails discard request

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

* build: pin greptime-proto to the merged pending tails discard request

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

---------

Signed-off-by: jeremyhi <fengjiachun@gmail.com>
2026-11-19 10:50:58 +00:00
dennis zhuang fcdae107e1 fix(auth): enforce COPY export read and database table permissions (#10375)
* fix(frontend): authorize expanded COPY DATABASE table targets

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

* test(frontend): cover authorized database copy paths

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

* fix(frontend): require read permission for COPY TO

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

* fix(auth): register the COPY TO permission action

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

* test(frontend): group database copy authorization coverage

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

* test(frontend): assert COPY read action targets

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

* fix(frontend): unify expanded COPY export authorization

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

* fix(frontend): defer database COPY target checks

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

* fix(frontend): avoid empty database COPY authorization

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

* test(frontend): check export authorization error status

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

* test(frontend): check database COPY prerequisite assertions

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

* test(frontend): use the registered COPY fixture name

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

* test(frontend): align physical COPY fixture registration

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

---------

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
2026-11-19 07:52:10 +00:00
Weny Xu 788df5849b fix(metric): route logical table writes by internal table id (#10366)
* fix(metric): pass logical table identity to partition evaluation

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

* test(metric): cover table-id repartition routing across storage formats

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

* fix(partition): validate logical routing inputs

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

* fix(metric): retain table ids for physical batch routing

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

* refactor(partition): simplify table-id routing paths

Separate context dispatch, routing input construction and column conversion
into private methods while preserving the scalar payload path. Reuse the
existing table-id constant and shared IPC decoding in tests.

Keep correctly routed requests intact when their partition version is
unchanged. Update existing retry coverage to use stale versions for rerouting
and verify unchanged bulk requests preserve alignment and ownership.

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

* fix(servers): validate table-id column row count

Report mismatched logical table identities before Arrow column construction, document batch and row ordering requirements, and remove the unreachable batch skip. Extend the existing conversion test and clarify the partition evaluation context contract.

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

---------

Signed-off-by: WenyXu <wenymedia@gmail.com>
2026-11-19 07:07:17 +00:00
Yingwen c7baa4115d feat(mito): track authoritative Narthex metadata and artifact lifetimes (#10507)
* feat(mito): model authoritative Narthex artifact inventories

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

* feat(mito): track authoritative series indexes through manifest replay and SST versions

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

* feat(mito): reclaim Narthex artifacts through file references and GC

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

* refactor(mito): append format to FileMeta

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

* refactor(mito): store canonical Narthex part sizes inline

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

* refactor(mito): put format last in SST metadata constructors

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

* refactor(mito): centralize region edit file change detection

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

* refactor(mito): represent Narthex parts as metadata records

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

* refactor(mito): defer Narthex coverage validation at publication

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

* refactor(mito): decouple series index removal from sample edits

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

* fix(mito): support Narthex region edits and simplify cleanup

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

---------

Signed-off-by: evenyag <realevenyag@gmail.com>
2026-11-19 06:37:29 +00:00
Weny Xu d21322e222 fix: chunk RDS batch operations within parameter limits (#10489)
* fix: chunk RDS batch operations within parameter limits

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

* fix: deduplicate MySQL batch reads and use a regular CI database

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

* fix: preserve consistency across RDS batch reads

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

* refactor: use sqlx begin_with for MySQL transactions

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

* fix: use read-only snapshots for RDS batch reads

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

---------

Signed-off-by: WenyXu <wenymedia@gmail.com>
2026-11-19 01:54:37 +00:00
916acb1267 fix(operator): apply metric ingest TTL hints to physical tables (#9057)
* fix(operator): apply metric ingest TTL to physical tables

Signed-off-by: Tyagiquamar <mohdquamartyagi@gmail.com>

* fix(operator): preserve instant TTL on logical tables and add remote write TTL hint integration test

Signed-off-by: Tyagiquamar <mohdquamartyagi@gmail.com>

* fix(operator): preserve instant TTL on logical tables and add remote write TTL hint integration test

Signed-off-by: Tyagiquamar <mohdquamartyagi@gmail.com>

* test(sqlness): regenerate logical table TTL expectation

Signed-off-by: Tyagiquamar <mohdquamartyagi@gmail.com>

* refactor(operator): centralize metric logical table TTL checks

Share retention-vs-instant TTL helpers between DDL validation, auto-create
option filling, and ingest rejection messages so batch and SQL paths stay aligned.

Signed-off-by: Tyagiquamar <Tyagiquamar@users.noreply.github.com>

* fix(operator): borrow physical table name for TTL hint error

Signed-off-by: Tyagiquamar <Tyagiquamar@users.noreply.github.com>

* test(sqlness): expect InvalidArguments for logical retention TTL

Align table_semantics with alter_table retention rejection and rustfmt
the TTL hint error helper call.

Signed-off-by: Tyagiquamar <Tyagiquamar@users.noreply.github.com>

* feat(operator): apply retention ttl hint only on physical table creation and ignore on subsequent writes

Signed-off-by: Mohd Quamar Tyagi <104281681+Tyagiquamar@users.noreply.github.com>

* fix(operator): legacy logical TTL on create and restore ddl.rs LF

Strip retention ttl from metric logical CREATE options with a warning so
import_v2 can replay older snapshots. Narrow alter TTL checks, reduce
helper visibility, and convert ddl.rs back to LF line endings.

Co-authored-by: Cursor <cursoragent@cursor.com>
Signed-off-by: Tyagiquamar <mohdquamartyagi@gmail.com>

* fix(cli): clippy in import_v2 legacy ttl test

Signed-off-by: Tyagiquamar <mohdquamartyagi@gmail.com>

* docs(operator): clarify logical metric ttl alter handling

Co-authored-by: Cursor <cursoragent@cursor.com>
Signed-off-by: Tyagiquamar <mohdquamartyagi@gmail.com>

* test(sqlness): add server-side coverage for legacy logical-table TTL

Replace the mock import_v2 unit test with sqlness cases verifying:
- SHOW CREATE TABLE omits database retention TTL on logical tables.
- Legacy logical CREATE TABLE with retention TTL strips the retention option from create_options.
- Explicit instant TTL remains preserved on logical tables.

Group TTL_KEY import in ddl.rs and verify create_options in HTTP test.

Signed-off-by: Tyagiquamar <mohdquamartyagi@gmail.com>

* refactor(operator): strip logical retention ttl in one place

Every logical-table create path ends in StatementExecutor::create_logical_tables,
so strip retention ttl there instead of in fill_table_options_for_create and
validate_logical_create. validate_logical_create no longer mutates its input.

Classify ttl by parsing it once: only a valid non-instant ttl counts as
retention. Invalid values now fail normal option validation instead of being
silently stripped on create or reported as retention on ALTER.

Drop unit tests covered by the sqlness and HTTP integration cases.

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

---------

Signed-off-by: Tyagiquamar <mohdquamartyagi@gmail.com>
Signed-off-by: Tyagiquamar <Tyagiquamar@users.noreply.github.com>
Signed-off-by: Mohd Quamar Tyagi <104281681+Tyagiquamar@users.noreply.github.com>
Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
Co-authored-by: Tyagiquamar <Tyagiquamar@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Dennis Zhuang <killme2008@gmail.com>
2026-11-18 23:46:22 +00:00
Floris Smit 9543ef06d7 perf(table): prune by time range for filters on date_bin of the time index (#10345)
* perf: prune by time range for filters on date_bin of the time index

A filter on a view's date_bin(...) bucket column reaches the region scan
as date_bin(stride, ts) <op> literal. The time range extractor only
understood ts <op> literal, so such scans read every file.

date_bin floors to the bucket start, so date_bin(ts) <= ts <
date_bin(ts) + stride for any fixed-width stride and origin. Derive a
conservative time range from that for >, >=, <, <=, = and BETWEEN.

Signed-off-by: Floris Smit <florissmit10@gmail.com>

* fix(table): keep rows that date_bin truncates on coarse time indexes

DataFusion computes the date_bin bucket start in nanoseconds and truncates
it to the column unit, so on a TIMESTAMP(0|3|6) column the returned bucket
can be up to one unit below the true start. Widen the derived upper bound
by one unit on such columns.

Keep date_bin filters unsupported in extract_time_range_strict: a range
derived from them is up to a bucket wider than the filter, so timestamps
synthesized at its bounds may not satisfy it.

Signed-off-by: Floris Smit <florissmit10@gmail.com>

---------

Signed-off-by: Floris Smit <florissmit10@gmail.com>
2026-11-18 18:07:10 +00:00