Commit Graph
6609 Commits
Author SHA1 Message Date
discord9 f6c2c72192 feat(flow): remove the streaming executor and the dual-engine router
The legacy per-request Flow runtime is gone, leaving the batching scheduler as
the only execution profile. A flow whose SQL has no time window therefore needs
an explicit `EVAL INTERVAL`; without one it used to run as a request-local
streaming query and is now rejected with that hint.

Persisted flows whose options say `flow_type: streaming` are still listed and
droppable, but creating or recovering one fails with a "drop and recreate"
error, so no old definition can silently run on a scheduler that no longer
exists. `FlowType::Streaming` and `get_flow_type_from_options` stay for
deserializing old metadata and old procedure data, and the reserved `flow_type`
key keeps being written so the metadata shape does not change.

Instant-TTL sources are rejected for every flow: the batching scheduler cannot
read them, and there is no second profile to fall back to.

The full-row mirror RPC is deliberately kept. It is not a streaming leftover:
it is the only path that tells batching that a SQL `INSERT INTO` changed a
source table, since bulk/COPY and the HTTP batcher use the timestamp-only path.
`BatchingEngine::handle_inserts_inner` filters requests per task by source
table name, so forwarding all of them replaces the removed routing table.

Dead code that only the streaming runtime reached is removed as well: the
stateless query and its memtable source, the relation/repr row model, the
single-attempt frontend insert, and the `InsertIntoFlow` error variant. Those
were invisible to the compiler because the crate allows dead code.

Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com>
2026-11-12 14:42:24 +08:00
dennis zhuang 62dad907d0 fix: redact credential table options in user-visible output (#10346)
information_schema.tables.create_options (and SHOW TABLE STATUS) printed
object store credentials of external tables verbatim, and SHOW CREATE TABLE
masked only access_key_id and secret_access_key. Mask all four credential
keys in both paths, and sort extra options in create_options by key.

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
2026-11-12 05:49:19 +00:00
fengyue-xve f8d8fe1071 fix: honor the pipeline version header and URL parameter in Elasticsearch _bulk (#9452)
* fix: honor the pipeline version header and URL parameter in Elasticsearch _bulk

The Elasticsearch _bulk handlers read only pipeline_name and msg_field and
hardcoded the pipeline version to None, so the x-greptime-pipeline-version
header and the version URL parameter were silently ignored and the latest
version was always used.

Resolve the version from the version query parameter, falling back to the
x-greptime-pipeline-version header, and pass it to
PipelineDefinition::from_name; an unparsable version now fails the request
instead of being ignored. Without either source the latest version is used,
as before.

Signed-off-by: fengyue-xve <1759519137@qq.com>

* fix(elasticsearch): reject invalid pipeline version headers and use HTTP item status

Signed-off-by: fengyue-xve <1759519137@qq.com>

---------

Signed-off-by: fengyue-xve <1759519137@qq.com>
2026-11-12 01:11:21 +00:00
Silvio 6dbff8a081 fix(log-store): close raft-engine engines on shutdown (#9518)
* fix(log-store): close raft-engine engines on shutdown

raft-engine preallocates the active log file and only trims that tail when the
Engine is dropped. GreptimeDB never dropped its engines before exiting, so every
start after a clean shutdown truncated the tail as a broken batch and logged
"Truncating log file due to broken batch".

RaftEngineBackend::close and RaftEngineLogStore::stop now release the engine;
standalone closes the metadata backend last, and the datanode stops the
raft-engine WAL after the region server.

Signed-off-by: Silvio <62994417+AbstractBike@users.noreply.github.com>

* refactor: address review on raft-engine shutdown

- Add ClosableKvBackend to common-meta; the standalone metadata backend creator
  returns one and Instance closes it explicitly instead of downcasting to
  RaftEngineBackend, so wrappers forward the close.
- Record a failed metadata backend close as a shutdown error.
- Sync and drop the engine on a blocking thread.
- Only check tail trimming when raft-engine preallocated, and check reopening
  after close/stop on every platform.

Signed-off-by: Silvio <62994417+AbstractBike@users.noreply.github.com>

* fix: release raft-engine engines on every shutdown path

- Stop the raft-engine WAL when the datanode build fails after opening it.
- Purge and sync tasks hold the engine weakly, so dropping the last backend or
  log store reference (as the CLI tools do) closes the engine.
- Fix needless borrows reported by clippy.

Signed-off-by: Silvio <62994417+AbstractBike@users.noreply.github.com>

* fix: drop unused ClosableKvBackend import

Signed-off-by: Silvio <62994417+AbstractBike@users.noreply.github.com>

* fix: cancel log store readers on stop; address review

- RaftEngineLogStore tracks the tasks feeding read streams and cancels and
  joins them on stop, so a retained, unconsumed stream no longer keeps the
  engine open past shutdown.
- Tests: stop with a retained read stream; datanode shutdown with a failing
  region engine and after a normal shutdown reopens the raft-engine WAL;
  standalone stop with failing steps reopens the metadata directory.
- entries_to_batch no longer takes self; rename opened to get_open_engine,
  log_files_len to log_files_size and PREALLOCATED_LEN to
  PREALLOCATION_THRESHOLD; mod declarations before imports; rename the
  standalone shutdown closure to record_shutdown_error.

Model: claude-opus-5-5
Tokens: 15.8k input, 148k output, 2.9M cache write, 103M cache read
Signed-off-by: Silvio <62994417+AbstractBike@users.noreply.github.com>

* fix: update Cargo.lock for tokio-util's rt feature

The rt feature makes tokio-util depend on futures-util, which the lock file
has to record for `cargo check --locked`.

Model: claude-opus-5-5
Tokens: 15.9k input, 162k output, 3.0M cache write, 124M cache read
Signed-off-by: Silvio <62994417+AbstractBike@users.noreply.github.com>

* refactor: close the raft-engine WAL by ownership instead of a lock

Per review, RaftEngineLogStore holds the engine as a plain Arc<Engine> again:

- MitoEngine drops its Wal raw entry reader once its workers are stopped,
  so it no longer holds the log store after stop.
- RaftEngineLogStore::close(self) stops the tasks and readers and closes the
  engine. Datanode::shutdown takes the log store after stopping the region
  server and closes it if it holds the last reference; otherwise it logs a
  warning and only stops it.
- A failed build stops the region server it created before closing the log
  store, so the engines release it there too.

Model: claude-opus-5-5
Effort: medium
Tokens: 78, 19161, 107293, 4916570 del commit
Cost: 2.23 USD del commit
Session: 82696960-1984-4432-bcf1-33bfece8b526
Signed-off-by: Silvio <62994417+AbstractBike@users.noreply.github.com>

* test: drop the index argument from LogStore::read in the raft-engine tests

#9563 removed it from the trait.

Model: claude-opus-5-5
Effort: medium
Tokens: 16, 3715, 6600, 1706794 del commit
Cost: 0.47 USD del commit
Session: 82696960-1984-4432-bcf1-33bfece8b526
Signed-off-by: Silvio <62994417+AbstractBike@users.noreply.github.com>

* fix: end a cancelled WAL read with an error; test a written region

- A raft-engine read cancelled by stop now ends its stream with an
  IllegalState error instead of an end of stream, so a replay cannot take a
  truncated WAL as fully read. The reader flags the cancel instead of sending
  the error, since it is usually blocked on a full channel at that point.
- Datanode test: a raft-engine datanode with a created region and writes
  shuts down cleanly and its WAL reopens, which fails if anything still
  holds the log store.
- Move the doc comment of is_stopped back onto it.

Model: claude-opus-5-5
Effort: medium
Tokens: 42, 10316, 407027, 4108529 del commit
Cost: 4.28 USD del commit
Session: 82696960-1984-4432-bcf1-33bfece8b526
Signed-off-by: Silvio <62994417+AbstractBike@users.noreply.github.com>

* fix(log-store): drop the no-op sync before closing the raft-engine engine

Per review: on raft-engine 0.4.2 `Engine::sync` writes an empty batch, and
`Engine::write` returns before the fsync, so the sync in `close_engine` read
as a final flush that never ran. The active log file is trimmed and synced
by `LogFileWriter::close` when the last reference is dropped, so
`close_engine` now only drops it on a blocking thread.

Model: claude-opus-5-5
Effort: xhigh
Tokens: 120, 33613, 182918, 7511982 del commit
Cost: 3.64 USD del commit
Session: 57ca77a8-f6fe-4fa2-a55a-dda31e5c541f
Signed-off-by: Silvio <62994417+AbstractBike@users.noreply.github.com>

---------

Signed-off-by: Silvio <62994417+AbstractBike@users.noreply.github.com>
2026-11-12 01:09:42 +00:00
Weny Xu 15fd97e369 fix(meta-srv): stop failing over regions that are still opening (#10290)
* chore: update proto for opening region heartbeats

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

* fix: reset failure detectors during background region initialization

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

* fix: preserve detector history for opening regions

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

* chore: update opening region proto revision

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

* chore: update opening region proto to merged main

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

---------

Signed-off-by: WenyXu <wenymedia@gmail.com>
2026-11-11 12:57:10 +00:00
discord9 90d0c00a82 fix(promql): resolve the OR right operand's time-index column from its schema (#10335)
`or` inferred the qualifier of an operand plan from its first field
(`schema.qualified_field(0)`). A binary operation with an explicit matching
modifier derives its result labels from the left operand when the match
reduces the label set, so its projected plan carries two qualifiers: the
labels are `lhs.<label>` while the time index keeps the context table's
qualifier (`rhs.<greptime_timestamp>`). Prefixing the time index with the
first field's qualifier then referenced a column that does not exist, and
planning failed with

  Internal error during building DataFusion plan: No field named
  lhs.greptime_timestamp. Did you mean 'rhs.greptime_timestamp'?

for e.g. `sum by (l) (f(a) / ignoring(x) group_left() f(b))` used as the
right operand of `or on (l)`. `f(a) / ignoring(x) f(b)` triggers it as
well, so this is not specific to a group modifier. Without a matching
modifier every projected column takes the right operand's qualifier, which
is why plain `a / b` never hit this.

Resolve the time index against the actual operand schema: keep the
preferred qualifier when it really holds the column (uniform schemas, so no
plan changes), otherwise take the qualifier of the column found by name and
let DataFusion report ambiguity instead of guessing.

Signed-off-by: discord9 <discord9@163.com>
2026-11-11 10:06:12 +00:00
jeremyhi d1e5a2df8f fix(mito2): check the lease before manifest commits and reload regions after conflicts (#10311)
* fix(mito2): check the lease before manifest commits and reload regions after conflicts

In conditional manifest mode, refuse a commit whose Leader deadline has
passed before its PUT, and fence a region whose commit hits a manifest
version conflict, then reload it in the background and swap the new
instance in.

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

* fix(mito2): release the flush status when the WAL release after a flush fails

handle_flush_finished failed the flush's waiters and returned when the WAL
release after a committed flush failed, but left the flush registered in the
flush scheduler, so every later flush of the region, and the reload of a
fenced region, waited behind it forever. Handle the failure as a failed
flush, which removes the registration and answers the pending requests.

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

* test(mito2): cover staging saves after the deadline and a fence during catchup

Add a listener hook before a catchup reopens the region, and test that a
fence landing there makes the catchup answer RegionBusy without replacing
the instance. Also test that entering staging after the Leader deadline
saves no staging manifest.

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

* docs(mito2): note that set_region_role does not check the reload mark

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

---------

Signed-off-by: jeremyhi <fengjiachun@gmail.com>
2026-11-11 06:44:06 +00:00
Lei, HUANG c8e0d29df2 feat(mito2): publish table compaction results conditionally (#10310)
* feat(mito2): publish table compaction results conditionally

Publish one region from a live input snapshot using an ordinary file-only edit. Permit repeated submissions and partial success without manifest task state, while preserving sequence, GC protection and uncertain-write recovery.

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>

* refactor(mito2): write table compaction outputs to level 0

Route split outputs into the ordinary L0 pipeline so window merges and semantic folding stay with region compaction. Update publication validation and tests accordingly.

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>

* fix(mito2): release verified footers before manifest publication

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>

* refactor(mito2): compare typed table compaction options

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>

* test(mito2): cover table compaction output validation failures

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>

* docs(mito2): clarify series count verification limits

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>

* fix(mito2): reject index declarations without output index objects

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>

* docs(mito2): document table compaction outputs as L0

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>

* docs(mito2): map the table compaction publication module

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>

---------

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>
2026-11-11 05:42:51 +00:00
dennis zhuang ddc16bafe8 fix(datatypes): render jsonb stored as JSON text without panics or wrong values (#10197)
* fix(datatypes): decode jsonb before rendering it as text

jsonb_to_string serialized the bytes through RawJsonb's Serialize impl,
which panics with an out-of-range slice index on JSON text such as
"hello world" or "        null" (stored by COPY FROM and MySQL text
parameters) and on truncated jsonb. Its text fallback was also stricter than
the extended parser reads used before.

Decode with jsonb::from_slice, as reads did before #10112, then write the
value out with serde_json escaping for keys and strings.

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

* perf(datatypes): keep streaming jsonb serialization in jsonb_to_string

Decoding into a jsonb::Value tree allocates per array, object and key on
every JSON cell returned over PostgreSQL and MySQL. Go back to serializing
the raw bytes with RawJsonb's Serialize impl, and bump jsonb to a rev whose
Serialize returns an error instead of panicking on out-of-range payloads
(GreptimeTeam/jsonb#2). Bytes that fail to serialize are parsed as JSON
text with the extended parser, as jsonb::from_slice does.

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

* test(datatypes): pin text values that used to read back as false

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

* chore: bump jsonb to reject scalar headers with non-zero length bits

JSON text over ~2 MB could still pass the payload bounds check and read back as a wrong value (GreptimeTeam/jsonb#2).

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

* fix(datatypes): report the text parse error when JSON bytes are neither jsonb nor text

Also pin jsonb_to_serde_json on JSON text scalars that used to decode as false.

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

* chore: pin jsonb to the merged commit on main

GreptimeTeam/jsonb#2 reached main through GreptimeTeam/jsonb#3.

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

---------

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
2026-11-11 03:46:56 +00:00
discord9 97c8136c3c chore(deps): bump datafusion to ae04160b (#10320)
* chore(deps): bump datafusion to ae04160b

Move all 16 `[patch.crates-io]` DataFusion pins from `cc5534492` to
`ae04160b`, the merge commit of GreptimeTeam/datafusion#42.

That fork commit backports six upstream apache/datafusion fixes:

- #26452 timestamp-to-time casts no longer drive statistics pruning
- #24675 memory-limited NLJ fallback refuses left-emission joins with a
  multi-partition probe side instead of emitting wrong unmatched rows
- #24891 RepartitionExec spill-pool deadlock with two open files
- #25076 null-aware anti join no longer emits rows after a sibling probe
  partition saw NULL
- #25339 correlated NOT IN with a non-equality correlation
- #26578 null-aware anti join drops build rows with a dictionary NULL key

The first three are faithful backports. The last three are re-implementations:
upstream restructured `hash_join/stream.rs` before writing them, so the patches
do not apply to this fork's older copy of that file. `#25339` covers the
single-equi-key plus residual-filter shape; multi-key correlated `NOT IN` still
fails at planning as before.

`Cargo.lock` is regenerated (35 `datafusion*` packages).

No runtime acceptance has been run against this pin; see the PR description for
the three checks worth doing before shipping.

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

* fix(common-query): pass the pruning bitmap to HashTableLookupExpr::new

#39 added a fifth parameter to `HashTableLookupExpr::new`; the dynamic-filter
payload round-trip test still constructed it with four arguments, which breaks
`--all-targets` builds even though the library itself compiles.

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

* chore(deps): bump datafusion to 70f84c5b

Move the pins from `ae04160b` to `70f84c5b`, the head of
`greptimedb-55.1-thin-fork` after GreptimeTeam/datafusion#37 was merged on top of
#39/#41/#42.

`ae04160b` did not contain #37, so the reverse-cast constraint propagation
guard was lost and `tests/cases/distributed/optimizer/partition_pruning_cast`
failed: the filter `CAST(k AS BIGINT) = 1` made the planner treat the float
column `k` as a singleton and drop the requested `ORDER BY k DESC`.

The new pin carries both the reverse-cast guard and the six release backports,
so the regression is covered again.

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

---------

Signed-off-by: discord9 <discord9@163.com>
2026-11-10 18:17:24 +00:00
Weny Xu d061e08717 feat: flush regions under object store WAL retention pressure (#10309)
* feat(store-api): expose advisory WAL flush candidates

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

* feat(log-store): select regions blocking WAL object reclamation

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

* feat(mito): schedule region flushes under WAL retention pressure

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

* test(mito): cover WAL pressure reclamation and recovery

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

* fix(log-store): prioritize oldest WAL reclamation blockers

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

* test(mito): deterministically exhaust range cache admission budget

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

---------

Signed-off-by: WenyXu <wenymedia@gmail.com>
2026-11-10 16:06:17 +00:00
Weny Xu 54b6bd5b44 feat(mito2): support extension index providers and input reuse (#10297)
* feat(mito2): register extension index providers

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

* feat(mito2): support index input reuse and extension budgets

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

---------

Signed-off-by: WenyXu <wenymedia@gmail.com>
2026-11-10 14:02:48 +00:00
jeremyhi 77cb39b5d1 feat(mito2): record pending WAL tails in region manifests (#10308)
* feat(mito2): record pending WAL tails in the region manifest

Adds `pending_tails` and `handoff_floors` to the region manifest and its
checkpoint, and an optional `pending_tails` / `handoff_floor` pair to
`RegionEdit`. An edit without them leaves the records unchanged. A floor is
dropped once the flushed entry id reaches it; a tail stays until a commit
removes it. Neither is written when empty, so manifests without them encode
as before.

Opening a region replays its WAL after this node's tails and floor, and WAL
releases at open and after a flush stay below this node's tails. Nothing
writes these records yet, so every region behaves as before.

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

* feat(mito2): hold back reads and region changes while WAL tails are pending

A region with pending WAL tails is missing data that only those tails hold.
Until they are recovered, scans and memtable and SST stats fail with the
retryable `RegionPendingTails` error. Truncate, entering staging, a
repartition flush, a close-time flush on request, and ALTERs other than
adding nullable columns without a default or changing options are rejected
before they change any region state. Compaction pauses. A full-listing GC
pass skips the region while it has pending tails, or while a newer manifest
may exist or the manifest listing fails.

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

* docs(mito2): name the WAL releases that keep pending tails

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

* fix(mito2): reject no-op ALTERs of restricted kinds while WAL tails are pending

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

* test(mito2): check that reopening restores the pending-tail read gate

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

* test(mito2): pin what the pending-tail fixtures and rejections promise

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

* refactor(mito2): name the replay start in the open log and share the pending-tail check

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

* docs(mito2): state the per-node order of pending tails and who keeps later writes out of them

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

* test(mito2): check that a cancelled compaction starts nothing while WAL tails are pending

When a compaction cancelled by task id finishes, the queued manual request goes through handle_pending_compaction_request, whose pending-tails check replies Ok(0). The reply is read with try_recv so that a dispatched request fails the test at once instead of hanging it.

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

* fix(mito2): drop the pending compaction task state when WAL tails skip it

Skipping a pending manual compaction while WAL tails are pending replied Ok(0) but left its task state in place, so task inspection kept listing it as queued and cancelling it by id still succeeded. Clear the pending task state and publish before replying.

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

---------

Signed-off-by: jeremyhi <fengjiachun@gmail.com>
2026-11-10 12:21:17 +00:00
Weny Xu e2e980fe39 feat(mito2): add column sketch options and index metadata (#10295)
Signed-off-by: WenyXu <wenymedia@gmail.com>
2026-11-10 09:55:20 +00:00
jeremyhi 9eb027f738 test: disable the event recorder in tests that count WAL writes (#10316)
The object store WAL restart test and the skip-WAL tests built on
MockInstanceImpl assume only the tables they create write to the WAL.
The event recorder also writes greptime_private.events into the same
WAL, so when it flushes during the test (the first tick of its interval
lands after the first DDL event on Windows), the extra region keeps WAL
objects from being collected or shows up in the WAL snapshot.

Record no events in these tests.

Signed-off-by: jeremyhi <fengjiachun@gmail.com>
2026-11-10 09:29:35 +00:00
shuiyisong ee1fc7782f feat(prometheus): query persisted metric exemplars (#9924)
* feat(prometheus): add exemplar queries and lifecycle coverage

Expose /v1/prometheus/api/v1/query_exemplars with exact time bounds and series selectors. Resolve and authorize source selectors before scanning exemplar storage, enforce query limits and cancellation, preserve exact observation identity, and return warnings for malformed stored rows.

Includes HTTP and authorization tests, pre-created-table and concurrent-DDL coverage, OTLP Arrow ingestion checks, and cross-protocol lifecycle tests across memory, WAL, SST, compaction and reopen. The query-dependent ingestion tests live here so every lower layer builds independently. Add metric-exemplar usage and retention guidance.

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

* fix(exemplar): preserve query labels with source identities

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

* fix(exemplar): floor bounds and add audit hooks

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

* • fix(exemplar): include aggregation parameter selectors

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

* fix(prometheus): avoid v1 exemplar quota stalls

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

* fix: docs

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

* fix: align exemplar query timestamps with Prometheus

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

* chore: remove unnecessory doc

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

---------

Signed-off-by: shuiyisong <xixing.sys@gmail.com>
2026-11-10 08:11:49 +00:00
shuiyisong 09c0291575 fix: restrict JSON retries to invalid UTF-8 errors (#10302)
* fix: restrict JSON retries to invalid UTF-8 errors

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

* test: isolate UTF-8 retry counter assertions

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

---------

Signed-off-by: shuiyisong <xixing.sys@gmail.com>
2026-11-10 07:42:27 +00:00
Weny Xu 65dc999180 feat: support cancelling compaction tasks by task ID (#10229)
* feat: add ADMIN compaction task cancellation

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

* fix: reject metadata region compaction cancellation before routing

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

* chore: pin greptime-proto to merged cancellation commit

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

---------

Signed-off-by: WenyXu <wenymedia@gmail.com>
2026-11-10 07:38:08 +00:00
Weny Xu 77a7d998bb perf(puffin): reuse reader metadata and scoped cache keys (#10294)
perf(puffin): reuse reader metadata and blob lookup

Signed-off-by: WenyXu <wenymedia@gmail.com>
2026-11-10 07:20:24 +00:00
Weny Xu d2be2980c2 refactor(mito2): unify builtin index planning and execution (#10293)
* refactor(mito2): separate index target resolution from creation

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

* refactor(mito2): unify builtin index planning and execution

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

---------

Signed-off-by: WenyXu <wenymedia@gmail.com>
2026-11-10 07:01:07 +00:00
Lei, HUANG f5c1020f5f feat(mito2): add shared SST storage and reclamation foundations (#10256)
* feat(mito2): add shared SST storage and reclamation foundations

Add shared-level isolation, receipt replay and recovery, migration support, and fail-closed file protection. Keep coordinator submission and verified publication in the next stack layer.

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>

* refactor(mito2): isolate table compaction manifest semantics

Keep atomic manifest extension envelopes and lifecycle safety in the common engine. Gate table-specific receipts and remap admission with enterprise, preserving their wire format and rejecting unsupported state before replay or GC.

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>

* refactor(mito2): remove manifest-backed compaction task state

Keep file-only edits, shared-reference admission and GC safety. Task retries no longer require persisted receipts or task epochs; reject unpublished prototype task-state records rather than silently dropping them.

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>

* fix(mito2): guard staging manifests and reclaim shared range indexes

Reject prototype task state when decoding staging blobs, matching checkpoint and delta decoding. Delete the region-scoped range index when a shared SST reference is retired, while leaving the shared object to global GC. Document the level-2 merge-split rationale and bind the delta guard's action tag with a test.

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>

* refactor(mito2): simplify GC deletion and lingering rules

Require unknown files in a directory without a manifest to pass the lingering window before deletion, so an unpublished table-compaction output cannot be reclaimed out from under an active attempt. Replace the per-batch deletion loop with a single publication recheck taken before remote deletion, and drop the batching constant, the deferred-deletion accounting, and their test.

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>

* fix(mito2): keep regions open after manifest validation rejection

Classify InvalidRequest from pre-write applicability checks as definitely not persisted. Cover both shared-removal and unsupported-level rejections without stopping the manifest manager, while keeping ambiguous storage errors conservative.

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>

* fix(mito2): reject ambiguous shared SST reclassification

Reject edits that both add a shared SST and remove the same file ID before admission and under the manifest lock. Keep ordinary edit semantics and verify add-only L0 reclassification survives reopen without diverging from the live Version.

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>

* test(mito2): define truncate semantics for shared SST references

Keep explicit truncation applicable to shared references and document the distinction from physical reclamation. Exercise full and time-range truncation with real shared SSTs, an old query, another referencing region, and reopen.

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>

* fix(mito2): define shared copy results and reject metadata imports

Document copied_file_ids as installed logical references, including no-op retries. Reject shared SSTs in metadata-region copies before copying any objects or changing the target, and cover shared, mixed and repeated copy behavior.

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>

* style(mito2): unify shared SST level references and bounds docs

Use module-qualified shared-level constants consistently and document MAX_LEVEL as an exclusive bound for SST version operations. No runtime behavior changes.

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>

* refactor(mito2): move the shared SST level to a max sentinel

Use the u8 maximum as the shared classification so future ordinary levels can never collide with it, and map wire levels to fixed storage slots instead of indexing by value. Shared metadata, admission and filters keep their semantics; unallocated levels stay rejected.

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>

* fix(mito2): keep dropped-region tombstones while files are deferred

Young unknown objects and hook-protected candidates on a dropped region must report needs_retry so the meta tombstone survives until they are actually reclaimed; reporting success would let the procedure drop the tombstone and orphan the retained objects. Cover both deferral paths plus the eventual clear.

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>

* fix(mito2): reject adopting an existing L1 SST as shared

Adopting a shared reference is L0-only: the manifest would replace an existing L1 entry while the live version keeps both handles, duplicating rows until reopen. Reject the edit at admission before any state change and cover the rejection with a real SST.

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>

---------

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>
2026-11-10 06:39:15 +00:00
Ning Sun 7cd2a3050e fix: pgwire update 0.42.2 (#10300) 2026-11-10 02:57:50 +00:00
dennis zhuang 16123d806b perf(query): push column projections through MergeScan (#10221)
* perf(query): push column projections through MergeScan

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

* fix(query): retain empty projections and refresh sqlness plans

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

* test(query): update TSID join plans after projection pushdown

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

---------

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
2026-11-09 22:14:09 +00:00
jeremyhi 8da533c35f fix(mito2): keep rows written during staging in the WAL (#10253)
* fix(mito2): keep rows written during staging in the WAL

A flush during staging committed its SSTs to the staging manifest, then
dropped the memtable and released the WAL. If staging did not end
successfully those rows were gone. A flush that committed after staging
had ended lost its rows even though staging succeeded.

Staging regions no longer flush. They are skipped by memory-pressure,
periodic and region-limit flushes, and their writes are rejected instead
of queued at twice the region limit or when the node's staging memtables
reach half of the engine's flush limit. A manual or repartition flush on
a staging region with data gets a retryable error; the migration
pre-flush and the WAL prune flush reply success without flushing. Closing
a staging region leaves staging first, so skip-WAL rows are flushed to
the normal manifest.

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

* fix(mito2): keep accounting and closing staging regions during staged edits

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

* fix(mito2): track staged edits without relying on the partition info

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

* test(mito2): synchronize staging close tests with worker admission

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

* test(mito2): observe the manifest lock wait when closing staging regions

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

* fix(mito2): detect staged edits through the staging partition info

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

* docs(mito2): record that staging regions must not flush

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

* fix(mito2): do not restore staging after a close abandons the edit

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

* fix(mito2): reject region edits during a close-time flush

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

* style(mito2): format the staging tests

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

* fix(mito2): reject staging edits once staging is abandoned

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

* fix(mito2): bind apply-staging edits to their partition expression

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

* docs(mito2): note that staging regions pin their topic's prune point

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

---------

Signed-off-by: jeremyhi <fengjiachun@gmail.com>
2026-11-09 16:38:59 +00:00
sunanddennis zhuang 4c4c8a58fd feat: update dashboard to v0.14.5 (#10270)
Co-authored-by: dennis zhuang <killme2008@gmail.com>
2026-11-09 16:36:54 +00:00
Arpit JainandClaude 402e4a97fc fix(time): avoid i32 overflow when converting an out-of-range date (#10299)
Signed-off-by: Arpit Jain <arpitjain099@gmail.com>
Co-authored-by: Claude <noreply@anthropic.com>
2026-11-09 16:34:48 +00:00
Weny Xu 73698114de feat(log-store): add a read-only object store WAL reader (#10269)
* refactor(log-store): extract shared WAL reading helpers

Move object indexing, chain traversal, history checks, segment prefetching and object I/O out of the writable store. Preserve local recovery and read policies.

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

* refactor(log-store): separate read-only WAL object access

Introduce WalObjectRead as the read capability shared by indexing and prefetching. Keep writes and startup listing on WalObjectIo, and adapt writable-store test doubles without changing their behavior.

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

* feat(log-store): add a read-only object store WAL reader

Validate source identity with NodeWalPrefix and share readers by source. Read known-last-entry or listed ranges using fresh listings and bounded footer concurrency, without holding the cache lock across I/O.

Evict indexes outside the current listing, keep release extraction in startup recovery, and cover bounds, history, cache lifetime, prefix validation and concurrent reads.

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

* fix(log-store): coalesce remote WAL footer loads with shared cache

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

* fix(log-store): report missing source WAL history separately

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

* test(log-store): cover remote WAL chain and listing boundaries

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

* test(log-store): wait for asynchronous WAL index release

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

* test(mito2): align WAL recovery assertions with shared history messages

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

---------

Signed-off-by: WenyXu <wenymedia@gmail.com>
2026-11-09 16:14:20 +00:00
jeremyhi 50a2c4d378 fix(mito2): publish manifest deltas by conditional create under a lease (#10234)
* fix(mito2): publish manifest deltas by conditional create under a lease

A late old leader and the region's new holder can commit the same manifest
version. For a region whose writes require a lease and whose WAL is the object
store WAL, the manifest now behaves as follows. Every other region keeps its
behaviour and issues no extra request.

- Each delta has one fixed name, `{version:020}.json.gz`, written by a
  conditional create. Without `compress_manifest` the delta is written at gzip
  level 0, so that all writers share the name.
- On an existing object, the writer reads it from storage: identical content is
  a retry of a write that landed, anything else is a retryable
  `ManifestVersionConflict` that keeps the output files.
- The version advances only after a successful save.
- Recovery loads the highest checkpoint found by LIST and uses the checkpoint
  pointer only for its checksum, because a stale writer's checkpoint task can
  leave the pointer at an older version.
- Checkpoint cleanup frees names, so a late create can still succeed on a
  deleted name. A commit whose save returns after the region's Leader deadline
  lists the checkpoints once: a checkpoint at or above its version, or a LIST
  error, is a conflict; otherwise it applies but starts no checkpoint. A commit
  within the deadline does one conditional PUT and no LIST.

`RegionManifestManager::update` becomes the one commit entry and takes
`allow_checkpoint` and `must_verify` as required parameters. A backend that does
not declare conditional create is refused at open.

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

* fix(mito2): treat every LIST error as a conflict when verifying a commit

The listing helper turned a NotFound from lister creation into an empty result,
so the check after a late commit could read a failed LIST as proof that no
checkpoint covers the version. List the checkpoints directly, so that any LIST
error reaches the caller. Recovery still treats a missing directory as having no
checkpoint.

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

* fix(mito2): keep the LIST failure in manifest conflicts and follow the style guide

A failed LIST during commit verification was reported as "OpenDAL operator
failed", because the conflict reason used the display of the wrapper error.
Report the root cause through `output_msg` and assert it in the test.

Align the change with docs/style-guide.md: name boolean methods `is_*`, name
the listing helper `list_highest_checkpoint` and move it after the public
methods, qualify `encode_gzip_stored` through its module, and name the mode
setter after the field it sets, which is now `pub(crate)`. Move the shared test
helpers to `crate::test_util` and `manifest/tests/utils.rs` so that the manifest
test modules stay private.

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

* fix(mito2): order the manifest test helpers public before private

Move the private `NotFoundReader` and `CheckpointTaskBlocker::block_write`
below the public items next to them, and document
`fail_manifest_delta_reads_layer`.

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

* fix(mito2): fail recovery when a listed checkpoint disappears

Recovery treated a checkpoint that LIST found but that cleanup removed before
the read as no checkpoint at all. It then replayed from the first version over
deltas that were already deleted, and could report an empty region or build a
manifest from the surviving tail. Return a retryable version conflict instead.

Record the size of the stored object when a retry finds an identical delta, as
the other writer may have encoded it differently. Reopen the region in the test
of a commit that crosses its deadline, and reduce the AGENTS.md entry to the
invariant.

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

* fix(mito2): verify conditional commits from callers without a deadline

Restore `RegionManifestManager::update(action_list, is_staging)`. Without a
Leader deadline a caller cannot show that its commit returned in time, so a
normal commit under conditional publication is now always verified on this
path and starts no checkpoint.

Only `ManifestContext::update_locked` has a deadline, so the variant that takes
`allow_checkpoint` and `must_verify` becomes `update_with_verification` and is
crate private. `sst-replace` and the existing tests return to the two-argument
call.

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

* fix(mito2): name the verifying manifest update in the hook docs

`ManifestContext::update_locked` now calls `update_with_verification`, and the
public `update` also calls it, so neither doc can call `update_locked` the sole
caller of `RegionManifestManager::update`.

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

* fix(mito2): keep the conditional publication rule in region options

Move the rule that decides which regions publish manifests conditionally
to RegionOptions, so the manifest options only hold the result. Report a
checkpoint that vanished after LIST with its own error instead of a
version conflict, and keep the stored gzip encoder with the other
CompressionType helpers.

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

---------

Signed-off-by: jeremyhi <fengjiachun@gmail.com>
2026-11-09 11:59:33 +00:00
jeremyhi 297a343fd4 fix(query): use current partition columns in prepared plans (#10244)
A prepared statement keeps its logical plan, and that plan holds the
table as it was at prepare time. The analyzer reads the partition
columns from that table while the regions to scan come from the current
route. After a table's partition columns change, the analyzer can
consider a query safe to push down, so each region runs the whole query
and the frontend concatenates their results. The same happens to the
source of a prepared INSERT ... SELECT, which then stores wrong values.

Before executing a kept plan, compare each scanned table's partition
columns with the current table found by id. Scans of a table whose
columns changed get the current table when the schema is unchanged.
Otherwise they keep their schema, because a scan's projection holds
indices into it, and report the current columns as absent from it, so
the query keeps merging on the frontend.

Signed-off-by: jeremyhi <fengjiachun@gmail.com>
2026-11-09 11:08:47 +00:00
Yingwen 361f3595db fix(promql): bound scatter time filter expression depth (#10272)
Signed-off-by: evenyag <realevenyag@gmail.com>
2026-11-09 09:03:25 +00:00
shuiyisong 0cb70d4f84 fix: tolerate invalid UTF-8 in JSON log ingestion (#10245)
* fix: tolerate invalid UTF-8 in JSON ingestion

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

* fix: tolerate invalid UTF-8 in NDJSON ingestion

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

* chore: upgrade simd json

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

* feat: add server default for ignore_errors

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

---------

Signed-off-by: shuiyisong <xixing.sys@gmail.com>
2026-11-09 06:26:57 +00:00
dennis zhuang c844d44721 perf(mito2): reuse static manifest checks across row groups (#10220)
* perf(mito2): reuse static manifest checks for cached readers

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

* test(mito2): drop redundant pruner test and release entry lock early

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

* perf(mito2): cache static manifest keep verdicts directly

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

---------

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
2026-11-09 04:39:43 +00:00
Weny Xu 4e5b60b869 refactor: rename flushed_parquet_bytes to ingested_parquet_bytes (#10258)
Signed-off-by: WenyXu <wenymedia@gmail.com>
2026-11-09 04:25:42 +00:00
Weny Xu 8bdb7d5509 feat: add information_schema.compaction_tasks (#10173)
Expose live compaction tasks through the datanode inspection path with
node pruning, lazy projected batches, and residual SQL filtering. Reuse
inspection request and plan helpers across compaction and SST tables.

Cover routing, projection, predicates, and lifecycle behavior in datanode,
standalone and distributed integration, and SQL tests. Use the production
information extension in the standalone test fixture.

Signed-off-by: WenyXu <wenymedia@gmail.com>
2026-11-09 03:17:48 +00:00
fys c4cd76c607 perf: narrow remote read scans using time hints (#10180)
Signed-off-by: fys <fengys1996@gmail.com>
2026-11-09 03:12:22 +00:00
dennis zhuang 5d88d283e5 fix(mito2): avoid reporting reader filter metrics twice (#10222)
* perf(mito2): cache fixed-label reader metric counters

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

* fix(mito2): report reader filter metrics only once

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

---------

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
v1.4.0-nightly-20261109
2026-11-09 02:37:57 +00:00
Weny Xu 2fefad6a9e feat(meta): configure drain parallelism and strategy over HTTP (#10218)
* feat(meta): configure drain parallelism and strategy over HTTP

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

* feat(meta): configure drain timeout with human-readable durations

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

* fix(meta): reject overflowing drain deadlines

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

---------

Signed-off-by: WenyXu <wenymedia@gmail.com>
2026-11-07 04:49:42 +00:00
Weny Xu 4688fa4be8 fix(meta-srv): invalidate leader cache on transaction errors (#10219)
Signed-off-by: WenyXu <wenymedia@gmail.com>
2026-11-06 18:19:54 +00:00
Weny Xu c85a92ac57 ci: add Prometheus and align Traces benchmark artifact auditing (#10188)
* ci: add Prometheus to the long-range metrics benchmark

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

* ci: validate Prometheus with the File/S3 benchmark runtime

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

* fix(ci): allow recorded partial Traces query results in artifact audit

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

---------

Signed-off-by: WenyXu <wenymedia@gmail.com>
2026-11-06 18:19:49 +00:00
fys 3051cb41db feat(json2): support fulltext indexes on JSON paths (#10064)
* feat(json2): support fulltext indexes on JSON paths

Signed-off-by: fys <fengys1996@gmail.com>

* chore: use rebased proto for JSON path fulltext

Signed-off-by: fys <fengys1996@gmail.com>

* refactor: reuse index target memory estimate for fulltext cache

Signed-off-by: fys <fengys1996@gmail.com>

* fix: filter disabled fulltext options for column targets

Signed-off-by: fys <fengys1996@gmail.com>

* docs: clarify fulltext intermediate path uniqueness

Signed-off-by: fys <fengys1996@gmail.com>

* refactor: name index targets consistently

Signed-off-by: fys <fengys1996@gmail.com>

* fix(mito2): apply JSON fulltext indexes per compatible target

Signed-off-by: fys <fengys1996@gmail.com>

* fix(mito2): skip invalid JSON fulltext index targets

Signed-off-by: fys <fengys1996@gmail.com>

* fix(mito2): require enabled fulltext indexes for column targets

Signed-off-by: fys <fengys1996@gmail.com>

* refactor: simplify JSON fulltext index construction and pruning

Signed-off-by: fys <fengys1996@gmail.com>

* refactor(mito2): unify fulltext target compatibility and creator APIs

Signed-off-by: fys <fengys1996@gmail.com>

* perf(function): preserve string layouts when evaluating matches

Signed-off-by: fys <fengys1996@gmail.com>

* refactor(mito2): centralize fulltext predicate extraction errors

Signed-off-by: fys <fengys1996@gmail.com>

* refactor: remove enable flag from JSON fulltext proto options

Signed-off-by: fys <fengys1996@gmail.com>

* refactor: clarify JSON fulltext index helpers and imports

Signed-off-by: fys <fengys1996@gmail.com>

* fix: allow rebuilt fulltext indexes on ordinary columns

Signed-off-by: fys <fengys1996@gmail.com>

* test: spell out false positive rate in fulltext tests

Signed-off-by: fys <fengys1996@gmail.com>

* chore: update greptime-proto to upstream merged revision

Signed-off-by: fys <fengys1996@gmail.com>

* fix(mito2): initialize fulltext option in multi-region tests

Signed-off-by: fys <fengys1996@gmail.com>

---------

Signed-off-by: fys <fengys1996@gmail.com>
2026-11-06 10:33:10 +00:00
Weny Xu 453e9aa42e feat(meta-srv): expose leader cache backend (#10217)
Signed-off-by: WenyXu <wenymedia@gmail.com>
2026-11-06 09:02:17 +00:00
Lei, HUANG a0d798129a feat(mito2): schedule compaction units fairly across regions (#9947)
* feat(mito2): schedule compaction units fairly across regions

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>

* refactor(mito2): simplify compaction admission cost and ready queues

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>

* refactor(mito2): derive compaction coordinator capacity from its executor

CompactionCoordinator::new accepted the executor concurrency and the
admission capacity as independent values, so the two could drift and admit
work that re-queues behind contenders in the executor's FIFO.

Add CompactionCoordinator::new_local(concurrency), which builds the
LocalScheduler and the capacity from one value, and use it in WorkerGroup.
Tests keep the explicit constructor for injected executors.

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>

* fix(mito2): keep inflight compaction accounting unwind safe

The local unit job incremented the inflight gauge, awaited the task and then
decremented it. A panic escaping the task, or a started job future dropped
before completion, skipped the decrement and leaked the gauge permanently.

Own the gauge through an RAII guard created after the increment so every exit
path decrements exactly once. Cover the unwind path with an isolated gauge.

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>

* test(mito2): pin backlog weight cap and minimum positive cost

The admission policy halves the charge of a region that has more than one
ready unit and charges at least one half-byte. Neither property had a test
that failed when the weight was constant, uncapped, or the minimum charge was
removed.

Add two scripted capacity-1 admission-order regressions: one for the capped
backlog weight with merge-sized units, and one for zero-byte expiration units
that must still accrue service.

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>

* test(mito2): pin the idle service floor against stale credit

A region that goes idle kept its low service value, so it could run a long
burst on wake and starve the regions that served during its sleep. The only
reentry tests left the virtual-time floor below that stale value, so removing
the clamp changed no assertion.

Add a capacity-1 admission-order regression where a busy region advances
virtual time past the sleeping region's service before it returns with a
three-unit batch.

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>

* docs(mito2): document compaction admission accounting state

The coordinator's state types carried no explanation of the ordering key, the
service unit, or the coupling between service and virtual time, and the
admission tick reused the crate's write-sequence term without saying so.

Document the coordinator fields, the shared state, and each region queue field
so the ordering contract can be reviewed without reverse-engineering the unit
and the floor update.

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>

* docs(mito2): document ReadyUnit ownership and completion ordering

ReadyUnit's fields and constructor were undocumented, and the invariant that
matters lived only in the executor trait and in AdmittedUnit's drop: the
completion must never observe the job's live input leases.

Document the fields and constructor, including that completion runs after the
job is dropped on admission, withdrawal, rejection, panic and shutdown paths.

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>

* chore(mito2): lowercase compaction admission metric help text

The three new compaction admission metrics used sentence case inside a block
whose other help strings are lowercase, so the exported /metrics output was
inconsistent. Lowercase the help text only; names, labels and buckets are
unchanged.

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>

* test(mito2): align compaction test harness concurrency

SchedulerEnv's default compaction scheduler was a single-runner LocalScheduler
while the coordinator used the configured max_background_compactions as its
admission capacity, a pairing production does not have. Up to capacity-1 units
could be counted as running while permanently queued on one runner.

Derive the default compaction executor from the configured concurrency, keep
injected executors, and document that VecScheduler only collects jobs and
cannot serve drain or shutdown assertions.

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>

* docs(mito2): describe the widened max_background_compactions scope

The setting now also bounds engine-wide admission of local compaction units
and the number of independent units one automatic per-region pick may prepare,
while manual compaction keeps its request parallelism. Only the pool size was
documented, so raising the value silently widened both.

Extend the field doc and both example TOML comments, then regenerate
config/config.md with make config-docs.

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>

* fix(mito2): make the inflight accounting regression testable

The inflight test wrapped both its gauge assertion and the fixture panic in
one catch_unwind and only checked that a panic happened, so a broken counter
assertion could be mistaken for the expected unwind. It also exercised a copy
of the accounting scope instead of the job wrapper.

Run the production job through InflightCompaction::run so tests and callers
share one accounting scope, assert the gauge outside the catch boundary, and
verify the expected panic payload. Cover completion, unwind, an unpolled drop
and a started drop.

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>

* test(mito2): verify compaction capacity through execution

The harness capacity test only read CompactionCoordinator::capacity(), so it
still passed when the default executor was a single-runner LocalScheduler or
when the injected executor was ignored. Remove that test-only getter and drive
real units instead: one and four configured runners must each start exactly
that many units, hold the rest, and drain; a separate case proves units reach
an injected executor.

Three scheduler tests also assumed a follow-up submission while the previous
batch still held its admission slot. The harness never runs or releases those
units, so they passed only on hosts whose CPU-derived capacity exceeded one.
Pin their capacity to two so they no longer depend on the host.

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>

* docs(mito2): clarify the max_background_compactions unit budget

The field described the same limit as the number of independent units one
automatic pick may prepare. In fact it bounds the merge-output budget: merged
groups share inputs, and expired SSTs may add one expiration-only unit outside
that budget while still consuming a slot in the same admission limit.

Correct the rustdoc and both example TOMLs, then regenerate config/config.md
with make config-docs.

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>

* docs(mito2): describe ready unit ownership directly

Explain that submission consumes the unit and prevents repeated admission, instead of referring to a nonexistent grant-message protocol.

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>

* docs(mito2): link the compaction admission wait metric

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>

* docs(mito2): allow admission capacity to equal runner count

State the non-strict capacity bound used by new_local, rather than implying that one executor slot must remain unused.

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>

* docs(mito2): use descriptive wording for region retirement

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>

* test(mito2): cover queued compaction cancellation and DDL handoff

Keep a prepared unit outside the executor behind another region's sole admission slot. Verify its actual Released notification completes the waiter as cancelled, releases inputs, and hands off truncate or enter-staging instead of failing the DDL.

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>

* test(mito2): cover parallel automatic follow-up planning

Keep two out-of-range windows eligible after a manual pick and assert that the automatic continuation prepares both with the configured parallelism. This detects a regression back to a single-output follow-up budget.

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>

* docs(mito2): clarify completion handling for rejected submissions

Document that accepted units dispatch completion after releasing job resources, while submission to a closed coordinator drops both futures unpolled and leaves error bookkeeping to the caller. Keep the existing notification behavior unchanged.

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>

* test(mito2): observe rejected compaction units through release notifications

Upstream now asserts release accounting right after admission, assuming the
executor rejects a unit synchronously. Engine-wide admission queues units in
the coordinator instead, so a rejection surfaces as the asynchronous
`CompactionUnitNotification::Released` notification. Drive those notifications
through the worker path before asserting, and drop a duplicated inflight
accounting helper left behind by the conflict resolution.

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>

* style(mito2): format rejected compaction release matching

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>

---------

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>
2026-11-06 08:31:21 +00:00
Weny Xu 1e2a1f71c2 fix(mito2): suppress redundant leader conversion warnings (#10213)
Signed-off-by: WenyXu <wenymedia@gmail.com>
2026-11-06 07:48:43 +00:00
fys f19fb374de feat(flow): support optional timezone in frontend SQL requests (#10210)
Signed-off-by: fys <fengys1996@gmail.com>
2026-11-06 07:15:28 +00:00
Weny Xu 1692c9f812 feat(mito2): expose live compaction task state (#10172)
* feat(mito2): expose live compaction task state

Expose active and pending compaction tasks through shared region state,
including live phases, request and effective options, progress, and time
ranges. Prune metadata predicates before reading task state without
queueing worker requests or retaining completed-task history.

Share projected inspection batch and plan construction with SST entries,
and cover task lifecycle, admission, pruning, and worker-independent reads.

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

* fix(mito2): share compaction unit state across publications

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

---------

Signed-off-by: WenyXu <wenymedia@gmail.com>
2026-11-06 06:20:39 +00:00
Yingwen ae422ef465 fix: prioritize region ALTER over queued edits (#10193)
* fix: prioritize region ALTER over queued edits

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

* test: use valid edits in ALTER priority regression

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

* refactor: make region edit dispatch outcomes explicit

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

* fix: reject queued alters and edits when dropping regions

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

* test: cover queued ALTER handoff before region edits

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

---------

Signed-off-by: evenyag <realevenyag@gmail.com>
2026-11-06 06:01:31 +00:00
Weny Xu bba6818c38 fix(ci): honor configured region in metric snapshot benchmark (#10157)
* fix(ci): honor configured region in metric snapshot benchmark

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

* docs(ci): clarify AWS runner region configuration

Include the documentation changes from #10158 alongside the region fix.

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

---------

Signed-off-by: WenyXu <wenymedia@gmail.com>
Signed-off-by: Weny Xu <wenymedia@gmail.com>
2026-11-06 04:06:14 +00:00
dennis zhuang 2714687ab7 feat(otlp): add v1 schema for auto-created OTLP log tables (#10207)
* feat(otlp): add v1 schema for auto-created OTLP log tables

New tables created by direct OTLP logs ingestion get a v1 built-in schema:
service_name tag from resource service.name ahead of scope_name in the
primary key, a skipping index on trace_id, and event_name and
observed_timestamp fields. The table is marked with
table_data_model=greptime_log_v1. Existing tables without the marker keep
the legacy schema.

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

* refactor(otlp): share resource service.name parsing between logs and traces

Log tables now derive service_name with the same rules as trace spans, so
both signals agree on the value used to correlate them. The integration test
writes twice to cover the existing v1 table path.

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

---------

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
2026-11-06 02:40:23 +00:00
Andrew Mains c9acb55a56 fix(meta-srv): acquire remote WAL read lock once before upgrade retries (#10205)
UpgradeCandidateRegion acquired RemoteWalLock::Read for each topic on every
retry attempt while keeping the guards from earlier attempts. If a
WalPruneProcedure queued RemoteWalLock::Write on the same topic during the first
attempt, the retry's second read acquire waited behind the writer (the lock is a
fair tokio RwLock), and the writer waited on the first read guard. The region
migration and the WAL prune then hung until metasrv restarted.

Acquire the read guards once before the retry loop and hold them until the
function returns.

Fixes #10204
2026-11-06 02:30:08 +00:00
Weny Xu 5bcb576b49 ci: compare GreptimeDB File and S3 in observability benchmarks (#10187)
* ci: compare GreptimeDB File and S3 in observability benchmarks

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

* ci: separate File and S3 benchmark steps and verify report artifacts

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

---------

Signed-off-by: WenyXu <wenymedia@gmail.com>
2026-11-05 18:19:56 +00:00