947 Commits

Author SHA1 Message Date
Yingwen
d34d4c1aba fix(mito): collect index apply metrics in pruner verbose mode (#8290)
Signed-off-by: evenyag <realevenyag@gmail.com>
2026-06-12 11:29:18 +00:00
Weny Xu
1ca29c3481 feat: support create region requirements (#8281)
* feat: support create region requirements

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

* feat: require object storage for repartition creates

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

* chore: upgrade proto

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

---------

Signed-off-by: WenyXu <wenymedia@gmail.com>
2026-06-12 11:12:41 +00:00
Ning Sun
ba89ef40f4 feat: add field_id for internal fields (#8284)
* feat: add field_id for internal fields

* test: address file size change after including field ids

* fix: address review comments
2026-06-12 03:10:24 +00:00
Ning Sun
827b904189 feat: flush hook extension point (#8145)
* feat: introduce flush and compaction hook

* feat: update hook definitions

* chore: fmt

* fix: address review comments

* feat: remove primary key collection

* fix: revert changes on flatsource

* feat: load plugins for metasrv http builder

* chore: resolve compilation issue

* feat: load manifest version from compaction task

* feat: use region_hook to cover all possible cases

* chore: fmt

* refactor: improve lock

* fix: provide plugins for open region of remote compactor; catch manifest update in exit staging

* fix: avoid lock when calling hook

* fix: add backfill hook change calling
2026-06-12 01:53:54 +00:00
discord9
2febea6ec3 test: add rebuild index coverage (#8175)
* test: basic rebuild index test

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

* test: address rebuild index review comments

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

* test: update build index restart expected output

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

---------

Signed-off-by: discord9 <discord9@163.com>
2026-06-11 14:03:24 +00:00
discord9
3608c90b2e feat: pass snapshot read bounds over flight (#8279)
Signed-off-by: discord9 <discord9@163.com>
2026-06-11 12:05:02 +00:00
LFC
d76ecf67bd refactor: skip prefilter for expr with functions (#8280)
Signed-off-by: luofucong <luofc@foxmail.com>
2026-06-11 09:48:12 +00:00
Yingwen
340f22f301 chore: load page index in opener (#8269)
Signed-off-by: evenyag <realevenyag@gmail.com>
2026-06-11 09:09:18 +00:00
Lanqing Yang
565899e482 perf(mito): cached-size single-pass WAL entry encoder (#8254)
prost has no size caching, so WalEntry::encode_to_vec recomputes the
encoded_len of every nested message for each length delimiter. In the deep
WAL tree (WalEntry/Mutation/Rows/Row/Value) a leaf Value's length is
recomputed once per ancestor level (~5x).

Add WalEntryEncoder: one size pass caches every message body length into a
flat vector (pre-order), one encode pass writes bytes reading the cached
lengths back via a cursor, so each length is computed exactly once. Leaf
messages (Value, ColumnSchema, WriteHint, BulkWalEntry) delegate their body
encoding to prost but have their single computed length cached.

Output is byte-for-byte identical to encode_to_vec (asserted in tests
covering delete op_type, null values, empty entry, encoder reuse), which is
required for WAL replay compatibility. Wired into WalWriter::add_entry,
reused per write batch.

This compensates for prost lacking a cached_size mechanism and can be
removed if such caching lands upstream.

Signed-off-by: lyang24 <lanqingy93@gmail.com>
2026-06-11 08:50:36 +00:00
LFC
92a915b5a0 feat: json2 field access pushdown to parquet (#8267)
* feat: json2 field access pushdown to parquet

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

* resolve PR comments

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

* resolve PR comments

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

---------

Signed-off-by: luofucong <luofc@foxmail.com>
2026-06-11 02:10:30 +00:00
dennis zhuang
ca21c9f048 fix!: correct information_schema index metadata (#8275)
fix: correct information_schema index metadata

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
2026-06-11 01:36:23 +00:00
LFC
270dce5ed7 feat: decouple region edit and compaction (#8272)
* feat: decouple region edit and compaction

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

* make `schedule_compaction_after_edit` default to `true`

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

* resolve PR comments

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

---------

Signed-off-by: luofucong <luofc@foxmail.com>
2026-06-10 09:56:11 +00:00
Weny Xu
05c4588f90 feat: support remote WAL logical pruning (#8259)
* feat: support logical deletion for remote WAL pruning

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

* fix: trigger remote WAL flush for lagging prunable regions

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

* chore: use from_mins

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

* fix: fix unit tests

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

---------

Signed-off-by: WenyXu <wenymedia@gmail.com>
2026-06-10 04:40:51 +00:00
Lei, HUANG
e74a73638d feat: separate datanode query and ingestion runtimes (#8246)
* feat: add datanode runtime options

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

* feat: add datanode runtime handles

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

* refactor: wire datanode runtimes into region server

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

* feat: route datanode ingestion to ingestion runtime

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

* feat: add datanode query runtime stream bridge

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

* feat: route datanode reads to query runtime

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

* feat: add datanode global runtimes

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

* refactor: use common datanode runtimes

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

* feat: run mito scan tasks on query runtime

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

* refactor: split datanode runtime options

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

* fix: clippy

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

* fix: share global fallback for datanode runtimes

Use the global runtime as the fallback for datanode query and ingestion
runtimes when datanode-specific pools are not initialized. This avoids
creating unused datanode worker pools in non-datanode services.

Files:
- `src/common/runtime/src/global.rs`

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

* fix: docs

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

* fix: forward query runtime stream metrics

Forward inner stream metrics through the datanode query runtime bridge so
`EXPLAIN ANALYZE` can report plan metrics after stream polling moves to the
query runtime.

Files:
- `src/datanode/src/query_stream.rs`
- `src/datanode/src/region_server.rs`

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

* fix: route metric batch puts to ingest runtime

Run the optimized metric batch put path on the datanode ingest runtime so
metric ingestion does not bypass runtime isolation.

Files:
- `src/datanode/src/region_server.rs`

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

* fix: abort query producer on stream drop

Abort the datanode query runtime producer when the returned read stream is
dropped so cancelled clients do not leave query work running in the
background.

Files:
- `src/datanode/src/query_stream.rs`
- `src/datanode/src/region_server.rs`

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

* refactor: simplify query stream bridge setup

Create the inner read stream before spawning the datanode query runtime
producer so setup does not use an extra task and initialization channel.

Files:
- `src/datanode/src/region_server.rs`

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

* feat/runtime-priority:
 ### Update Datanode Runtime Options and Region Server Logic

 - **`global.rs`**: Adjusted `datanode_ingest_rt_size` to utilize all available CPUs for improved performance.
 - **`region_server.rs`**: Simplified the collection of `put_requests` and optimized the `put_regions_batch` call for better efficiency.

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

* feat/runtime-priority:
 ### Remove Redundant Checks and Simplify Code

 - **`global.rs`**: Removed the assertion check for already initialized global runtimes to streamline the initialization process.
 - **`region_server.rs`**: Simplified the extraction of `Put` requests by removing unnecessary cloning and restructuring the iterator logic.

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

* fix: remove redundant spawn_datanode_query in RegionServer::handle_read

The outer `spawn_datanode_query` wrapped `handle_read_inner` on the
same runtime, creating a nested spawn that consumed query runtime
threads unnecessarily under concurrent read load. The gRPC handler
already provides runtime isolation, so the inner call is sufficient.

- `src/datanode/src/region_server.rs` — inline `handle_read_inner`
  directly instead of spawning onto the datanode query runtime

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

* fix: resolve test mismatch and redundant spawn in handle_remote_read

- `src/common/runtime/src/global.rs` — update test assertion to match
  default `datanode_ingest_rt_size` of `cpus` instead of `1`
- `src/datanode/src/region_server.rs` — inline `handle_remote_read_inner`
  directly instead of spawning onto the datanode query runtime

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

* refactor: rename datanode runtimes

Summary:
- Rename datanode runtime APIs from `datanode_query` and `datanode_ingest` to `query` and `ingest`.
- Rename runtime config keys from `datanode_query_rt_size` and `datanode_ingest_rt_size` to `query_rt_size` and `ingest_rt_size`.
- Update config docs, example config, and config-loading coverage.

Files:
- `src/common/runtime/src/global.rs`
- `src/common/runtime/src/lib.rs`
- `src/cmd/tests/load_config_test.rs`
- `src/datanode/src/region_server.rs`
- `src/mito2/src/read/pruner.rs`
- `src/mito2/src/read/range_cache.rs`
- `src/mito2/src/read/scan_region.rs`
- `src/mito2/src/read/series_scan.rs`
- `config/datanode.example.toml`
- `config/config.md`

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

* refactor: consolidate runtime options

Summary:
- Embed datanode runtime sizes in shared `RuntimeOptions` and remove the extra `GreptimeOptions` runtime type parameter.
- Use the unified `RuntimeOptions` for datanode global and datanode-specific runtime initialization.
- Update datanode runtime config coverage and ingest runtime default documentation.

Files:
- `src/common/runtime/src/global.rs`
- `src/common/runtime/src/lib.rs`
- `src/cmd/src/options.rs`
- `src/cmd/src/datanode.rs`
- `src/cmd/src/datanode/builder.rs`
- `src/cmd/tests/load_config_test.rs`
- `config/datanode.example.toml`
- `config/config.md`

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

* feat: guard against double initialization of datanode runtimes

Add an assertion in `init_datanode_runtimes` to panic when global runtimes
are already initialized, preventing silent overwrites.

- `src/common/runtime/src/global.rs` — assert guard in `init_datanode_runtimes`
  and test `test_set_datanode_runtimes_panics_after_global_runtimes_initialized`

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

---------

Signed-off-by: Lei, HUANG <mrsatangel@gmail.com>
2026-06-09 08:21:50 +00:00
Yingwen
1451a51ea0 feat: add tools for development (#8260)
* feat(cmd): add dev-tools binary with parquetbench command

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

* chore: add feature gate dev-tools

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

* feat(dev-tools): print output column count in parquetbench

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

* feat(dev-tools): print output schema in parquetbench

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

* refactor(cmd): move parquetbench into datanode CLI, drop dev-tools binary

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

* fix(dev-tools): validate pprof-after-warmup requires >=2 iterations

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

* fix(dev-tools): use absolute path instead of super:: import in parquetbench

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

* fix(dev-tools): base parquetbench throughput on scanned row-group bytes

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

---------

Signed-off-by: evenyag <realevenyag@gmail.com>
2026-06-09 08:12:21 +00:00
jeremyhi
1e53b1a157 fix(config): align scan memory limit default with code (#8228)
* fix(config): align scan memory limit default with code

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

* fix: by AI comments

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

---------

Signed-off-by: jeremyhi <fengjiachun@gmail.com>
2026-06-08 14:01:48 +00:00
Yingwen
f580c42a1f perf: read primary key as binary if it overflows the dictionary (#8187)
* perf(mito2): read __primary_key as binary when chunk exceeds dict page limit

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

* fix(mito2): handle binary __primary_key column in prefilter

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

* fix(mito2): align prefilter binary PK test with eval_pk_group_mask

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

* chore: address review comments

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

---------

Signed-off-by: evenyag <realevenyag@gmail.com>
2026-06-05 08:19:35 +00:00
Ruihang Xia
a6cb4d2083 feat: look up cache with range calculation (#8123)
* feat: loop up cache with range calculation

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

* copy fragements

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

* release dashmap reference

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

* fix bugs

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

* remove dashmap

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

* remove keys

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

* clean up

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

---------

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
2026-06-04 07:41:49 +00:00
Weny Xu
3bd915865a fix: improve remote WAL replay checkpoint handling (#8225)
* fix: correct topic_latest_entry_id

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

* fix: use pruned wal id for replay checkpoint

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

* feat: persist remote wal checkpoints periodically

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

* test: cover remote wal topic latest entry id

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

* chore: apply suggestions

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

* fix: merge pruned wal id for migration checkpoint

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

---------

Signed-off-by: WenyXu <wenymedia@gmail.com>
2026-06-04 06:10:38 +00:00
Lei, HUANG
da9d314fa4 fix: align bulk insert schema handling (#8222)
* fix: align bulk insert schema handling

Carry `aligned_schema_version` through bulk insert requests so datanode can recheck stale schemas only when needed. Use the physical data region schema version for metric logical bulk inserts, while external bulk insert callers leave alignment unknown.

Related files:
- `Cargo.toml`
- `Cargo.lock`
- `src/store-api/src/region_request.rs`
- `src/metric-engine/src/engine/bulk_insert.rs`
- `src/mito2/src/request.rs`
- `src/mito2/src/worker/handle_bulk_insert.rs`
- `src/mito2/src/worker/handle_write.rs`
- `src/operator/src/bulk_insert.rs`
- `src/servers/src/pending_rows_batcher.rs`
- `src/mito2/src/engine/edit_region_test.rs`

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

* test: cover bulk insert missing columns

Add Flight bulk insert coverage for batches that omit nullable columns and verify the database fills the missing values with nulls.

Related files:
- `tests-integration/src/grpc/flight.rs`

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

* chore: update proto to main branch commit

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

* fix: align physical metric bulk insert schema

Pass the physical schema version through metric bulk insert requests so
physical and logical region writes share the same schema alignment behavior.

Files:
- \`src/metric-engine/src/engine/bulk_insert.rs\` — updates \`bulk_insert_physical_region\` and reuses \`physical_schema_version\` for bulk insert schema alignment.

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

* chore: add some doc

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

---------

Signed-off-by: Lei, HUANG <mrsatangel@gmail.com>
2026-06-04 02:55:09 +00:00
Weny Xu
935ef9a361 feat: check open region requirements (#8194)
* feat: check open region capabilities

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

* test: allow file region migration tests

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

* refactor: refine open region requirements

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

* refactor: use fs scheme constant

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

* test: cover open region requirement predicate

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

* fix: check file engine open requirements

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

---------

Signed-off-by: WenyXu <wenymedia@gmail.com>
2026-06-02 06:43:23 +00:00
LFC
7f6400e460 refactor: optimize compaction's pick time (#8197)
refactor: optimize compaction's pick

Signed-off-by: luofucong <luofc@foxmail.com>
2026-06-02 03:14:17 +00:00
LFC
33ffa41ac2 refactor: use last compaction scheduled time instead of finished time (#8190)
* refactor: use last compaction scheduled time instead of finished time

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

* add some logs for debugging

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

---------

Signed-off-by: luofucong <luofc@foxmail.com>
2026-06-01 07:45:38 +00:00
Weny Xu
1a2d046351 fix(mito): count owned SSTs in region stats (#8191)
* fix(mito): count owned SSTs in region stats

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

* fix(mito): use origin region for index metadata

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

* chore: apply suggestions

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

* chore: apply suggestions

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

---------

Signed-off-by: WenyXu <wenymedia@gmail.com>
2026-05-28 10:04:39 +00:00
Lei, HUANG
9a4e5e8457 chore: expose region info inspection table (#8178)
* chore/region-sync-diff: add region info inspection core

- `store-api`: add `RegionInfoEntry` schema and plan builder in `src/store-api/src/region_info.rs` and export it from `src/store-api/src/lib.rs`
- `mito2`: collect region runtime metadata with `MitoEngine::all_region_infos` and `RegionRoleState::as_str` in `src/mito2/src/engine.rs`, `src/mito2/src/region.rs`, `src/mito2/src/engine/basic_test.rs`, `src/mito2/Cargo.toml`, and `Cargo.lock`
- `datanode`: expose the reserved `InspectRegionInfo` provider in `src/datanode/src/region_server/catalog.rs`

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

* chore/region-sync-diff: expose region info schema table

- `information_schema.region_info`: add frontend table wiring in `src/catalog/src/system_schema/information_schema.rs`, `src/catalog/src/system_schema/information_schema/region_info.rs`, `src/catalog/src/system_schema/information_schema/table_names.rs`, and `src/common/catalog/src/consts.rs`
- `region_group` removal: drop `region_group` from `src/store-api/src/region_info.rs`, `src/mito2/src/region.rs`, and `src/mito2/src/engine/basic_test.rs`
- `SQLness coverage`: add standalone coverage in `tests/cases/standalone/common/information_schema/region_info.sql` and `tests/cases/standalone/common/information_schema/region_info.result`

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

* chore/region-sync-diff: restore region group info

- `region_info` schema: restore `region_group` alongside `region_sequence` in `src/store-api/src/region_info.rs`, `src/mito2/src/region.rs`, `src/mito2/src/engine/basic_test.rs`, and `tests/cases/standalone/common/information_schema/region_info.result`
- `MitoEngine::all_region_infos`: remove redundant iterator conversion in `src/mito2/src/engine.rs`

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

* fix: sqlness

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

* fix: sqlness

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

* chore/region-sync-diff: clarify region sequence columns

- `region_info` schema: rename `sequence` to `committed_sequence` and add nullable `flushed_sequence` in `src/store-api/src/region_info.rs` and `src/mito2/src/region.rs`
- `region_info` coverage: update sequence assertions and expected metadata in `src/mito2/src/engine/basic_test.rs`, `tests/cases/standalone/common/information_schema/region_info.sql`, `tests/cases/standalone/common/information_schema/region_info.result`, and `tests/cases/standalone/common/system/information_schema.result`

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

* chore/region-sync-diff: report region options errors

- `region_info` output: preserve `region_options` serialization failures as JSON error objects in `src/mito2/src/region.rs`

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

---------

Signed-off-by: Lei, HUANG <mrsatangel@gmail.com>
2026-05-28 09:52:37 +00:00
discord9
eccd97b5c7 feat(flow): support incremental read checkpoints (#8179)
* feat: flownode inc mode

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

* chore: rename fallback reason

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

* fix: harden flow incremental checkpoints

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

* fix: address flow watermark lint

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

* fix: address flow clippy

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

* refactor: clarify incremental plan preparation

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

* refactor: per review

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

* refactor: per review

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

* test: more sqlness test

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

* refactor: per review

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

---------

Signed-off-by: discord9 <discord9@163.com>
2026-05-28 09:31:46 +00:00
LFC
bf7e3551fe test: add jsonbench tests (#8165)
Signed-off-by: luofucong <luofc@foxmail.com>
2026-05-27 08:34:06 +00:00
Yingwen
a23ff4d589 perf(mito): split record batches on equal timestamps (#8163)
* perf(mito): split record batches on equal timestamps

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

* test(mito): cover equal-timestamp runs at batch boundaries

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

---------

Signed-off-by: evenyag <realevenyag@gmail.com>
2026-05-26 08:19:52 +00:00
Yingwen
6193e8760b feat: initial implementation for range cache with time filters (#8130)
* feat: initial implementation for range cache time filters

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

* refactor: tighten Lt implied time range bound

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

* docs: tighten range cache key comment

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

* fix: skip range cache unit asserts on empty implied range

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

---------

Signed-off-by: evenyag <realevenyag@gmail.com>
2026-05-26 07:03:31 +00:00
fys
8d3ebde652 fix(mito2): schema-safe skipping index pruning (#8122)
* fix: schema-safe skipping index pruning

* fix: cargo clippy

* fix: sqlness test

* remove default plan in BloomFilterIndexApplier

* fix comment of plan_for_sst

* add fast path for default_plan

* minor refactor

* some rename

* fix: cr by ai
2026-05-25 11:45:42 +00:00
Yingwen
e1e75b3ffe feat: implement a cache for the prefilter (#8102)
* feat: cache parquet prefilter results

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

* chore: set result cache size

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

* refactor: rename is_stable to is_immutable and reject ScalarVariable

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

* chore: typo

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

* refactor: use capacity() for prefilter key memory accounting

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

* feat: per filter cache

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

* refactor: support other variants in MaybeFilter

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

* refactor: split compute_projection_mask

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

* refactor: build_prefilter_masks takes PrefilterEntry

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

---------

Signed-off-by: evenyag <realevenyag@gmail.com>
2026-05-25 03:10:12 +00:00
LFC
4668dd43bd feat: merge files to add in one region edit (#8141)
Signed-off-by: luofucong <luofc@foxmail.com>
2026-05-21 10:55:10 +00:00
Weny Xu
13fe5bc8a3 fix: skip sst cache preload for staging manifest (#8147)
Signed-off-by: WenyXu <wenymedia@gmail.com>
2026-05-21 08:55:17 +00:00
Weny Xu
15fc148e40 refactor: clarify region flush reasons (#8146)
* refactor: clarify region flush reasons

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

* chore: apply suggestions from CR

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

---------

Signed-off-by: WenyXu <wenymedia@gmail.com>
2026-05-21 07:35:46 +00:00
LFC
59b738d7f2 feat: compact json2 data (#8103)
Signed-off-by: luofucong <luofc@foxmail.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
2026-05-21 07:14:32 +00:00
Ruihang Xia
ab3cadb4b5 feat: use and cache page index from sst meta (#8139)
* feat: cache sst meta with policy aware

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

* load page index when necessary

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

---------

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
2026-05-21 06:06:44 +00:00
Lei, HUANG
1e987e66c8 fix: skip flush when closing follower region (#8143)
* fix/flush-on-close: Guard close flush by region state

- `close flush`: skip pending-data flush for non-flushable regions in `src/mito2/src/worker/handle_close.rs`
- `flushable region`: surface `FlushableRegionState` errors from `RegionMap::flushable_region` in `src/mito2/src/error.rs`, `src/mito2/src/region.rs`, and `src/mito2/src/worker/handle_flush.rs`

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

* fix/flush-on-close: Cover follower close with pending data

- `regression test`: cover closing a Noop WAL follower region with pending memtable data in `src/mito2/src/engine/skip_wal_test.rs`

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

* fix: comments and logs

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

---------

Signed-off-by: Lei, HUANG <mrsatangel@gmail.com>
2026-05-21 03:51:14 +00:00
LFC
a6dc55a71c feat: show sst primary key range in information_schema (#8137)
Signed-off-by: luofucong <luofc@foxmail.com>
2026-05-20 12:50:18 +00:00
LFC
6f0c04ad82 chore: pub some functions (#8133)
Signed-off-by: luofucong <luofc@foxmail.com>
2026-05-19 10:00:40 +00:00
Lei, HUANG
0a2400cbb9 fix: optimize sorted run picking (#8128)
* fix/optimize-pick: Optimize sorted run picking

- `find_sorted_runs`: prune inactive run candidates and keep `find_sorted_runs_original` for testing in `src/mito2/src/compaction/run.rs`
- `bench_compaction_picker`: compare old and new sorted-run picking with PK-aware workloads in `src/mito2/benches/bench_compaction_picker.rs`
- `features`: expose `testing` for benchmark-only helpers in `src/mito2/Cargo.toml`

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

* fix/optimize-pick: Remove redundant overlap guard

- `find_sorted_runs`: simplify active candidate overlap checks in `src/mito2/src/compaction/run.rs`

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

* fix: apply review comment

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

---------

Signed-off-by: Lei, HUANG <mrsatangel@gmail.com>
2026-05-19 05:16:11 +00:00
Ruihang Xia
3cbd15c1a9 refactor: remove async file reader adapter layer (#8120)
Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
2026-05-15 12:58:31 +00:00
Yingwen
7840aa1bb4 refactor(mito2)!: remove PartitionTreeMemtable (#8080)
* feat: switch partition tree to bulk

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

* chore: keep partition tree memtable for migration test

Restore PartitionTreeMemtable construction when memtable.type=partition_tree
is explicit, and move the sparse-encoding bulk override into the default
(no explicit memtable.type) arm so phase 2's memtable.type=bulk wins on
reopen. Rewrite test_reopen_time_series_sparse_memtable_with_bulk to use a
metric-engine-shaped schema and sparse-encoded rows with WriteHint::Sparse,
so the test actually exercises a PartitionTreeMemtable in phase 1 and
verifies WAL replay into the new BulkMemtable on reopen without flushing.

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

* chore: drop partition tree memtable from runtime

Re-apply the unconditional sparse-encoding override in
`MemtableBuilderProvider::builder_for_options` and route the
`MemtableOptions::PartitionTree` arm to `BulkMemtable` with a deprecation
warning. After this change, `PartitionTreeMemtableBuilder` is no longer
reachable from the engine runtime; benchmarks still reference the type.

Remove `test_reopen_time_series_sparse_memtable_with_bulk` and the
`put_sparse_rows` helper added in the previous commit — that test only
existed to validate the PartitionTree -> Bulk reopen migration and is
unnecessary now that the override is in place.

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

* refactor(mito2): move timestamp_array_to_i64_slice into read module

Relocate the timestamp_array_to_i64_slice helper from
memtable/partition_tree/data.rs to the read module so that the read
path no longer depends on the partition_tree internals. All call sites
(both inside and outside the partition_tree module) now import from
crate::read.

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

* refactor(mito2): use TimeSeriesMemtableBuilder in time_partition tests

The time_partition tests use the memtable builder purely as a generic
backend for the TimePartitions write/scan paths; nothing in them is
specific to the partition-tree memtable. Switch the seven affected
tests to TimeSeriesMemtableBuilder so the tests no longer depend on
PartitionTreeMemtableBuilder.

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

* chore(mito2): delete PartitionTreeMemtable implementation

The runtime already falls back to BulkMemtable for the PartitionTree
variant. Drop the now-unreachable implementation, its metrics, the
partition_tree benchmarks, the metric-engine Unsupported fallback in
bulk_insert.rs, and the test helpers that only existed for the deleted
module.

MemtableOptions::PartitionTree, its parsing, the runtime fallback, the
store-api MEMTABLE_PARTITION_TREE_* constants, and the SQL fixtures
remain so existing region options keep round-tripping.

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

* refactor(mito-codec): drop skip_partition_column parameter

PartitionTreeMemtable was the only caller passing
skip_partition_column=true; every other caller passes false. Now that
the partition_tree module is gone, the parameter is uniformly false
and the guard branch is dead. Drop the parameter from the trait method
and both impls, remove the guard and the is_partition_column helper,
and update the four remaining call sites in mito2 plus the bench.

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

* chore(mito2): remove unused MemtableConfig enum

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

* chore: fmt code

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

* refactor: remove unused variant

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

* test: update test_config_api

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

* fix: remove unused memtable test helpers

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

* chore: address review comment

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

* fix: support bulk memtable options

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

* fix: sanitize config

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

* feat: remove partition tree options from region options

Move primary_key_encoding to the top level

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

* test: make ssts test datetime replaced text stable

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

* test: update sqlness result

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

* chore: validate_enum_options consider bulk memtable

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

* refactor: pass region id when parsing region options

Replace the `TryFrom<&HashMap>` impl for `RegionOptions` with
`try_from_options(region_id, options_map)` so the legacy partition_tree
fallback can log the affected region. The fallback now also overrides
the SST format to flat in addition to clearing the memtable type.

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

* fix: align sst_format with bulk memtable on parse and open

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

---------

Signed-off-by: evenyag <realevenyag@gmail.com>
2026-05-15 11:49:27 +00:00
Lei, HUANG
fcb77fd025 fix(mito): allow compaction publish during editing (#8097)
* fix(mito): allow compaction publish during editing

Allow compaction manifest updates while a region is in the transient editing state, and restrict direct region edits to add-only requests so compaction cannot race with external file removals.

Files:
- `src/mito2/src/compaction/compactor.rs`
- `src/mito2/src/engine.rs`
- `src/mito2/src/engine/edit_region_test.rs`
- `src/mito2/src/region.rs`

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

* Allow remove-only region edits

- `edit_region`: restore direct `RegionEdit` validation for non-empty `files_to_add` or `files_to_remove` in `src/mito2/src/engine.rs`
- `compaction`: document why compaction can publish during `Editing` while remove-capable sync-region edits are follower-only in `src/mito2/src/region.rs`
- `tests`: update region-edit validation coverage and remove obsolete rejection coverage in `src/mito2/src/engine.rs` and `src/mito2/src/engine/edit_region_test.rs`

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

* fix: logs

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

* fix/editing-with-compaction: Document compaction staging behavior

- `compaction`: clarify why `update_manifest_for_compaction` writes to the normal manifest path in `src/mito2/src/region.rs`
- `staging`: document that staging SSTs stay outside normal region version control until staging exits in `src/mito2/src/region.rs`

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

---------

Signed-off-by: Lei, HUANG <mrsatangel@gmail.com>
2026-05-15 03:13:13 +00:00
Ruihang Xia
3b3f5d628d feat: bump datafusion to 53 (#8107)
* feat: bump datafusion to 53

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

* use updated datafusion-orc

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

* maintain topk in part sort

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

* docs: clarify part_sort range detection and Null threshold semantics

* fix limit 0

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

---------

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
Co-authored-by: discord9 <discord9@163.com>
2026-05-14 08:33:31 +00:00
Yingwen
5e468190a5 fix(mito2): drop unsound time-filter cache-key stripping (#8105)
* fix(mito2): drop unsound time-filter cache-key stripping

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

* chore: update comments and test

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

---------

Signed-off-by: evenyag <realevenyag@gmail.com>
2026-05-13 10:43:22 +00:00
QuakeWang
73c267e641 fix(mito): ignore compaction override in enum option validation (#8094)
* fix(mito): ignore compaction override in enum option validation

Signed-off-by: QuakeWang <wangfuzheng0814@foxmail.com>

* test: cover compaction override without compaction type

Signed-off-by: QuakeWang <wangfuzheng0814@foxmail.com>

* fix(mito): short-circuit enum option validation

Signed-off-by: QuakeWang <wangfuzheng0814@foxmail.com>

---------

Signed-off-by: QuakeWang <wangfuzheng0814@foxmail.com>
2026-05-12 14:20:05 +00:00
fys
7d330cc4e6 fix(mito2): schema-safe inverted index pruning (#8089)
* fix(mito2): skip inverted index on per-SST type mismatch to avoid false negatives

* restore INDEX_APPLY_MEMORY_USAGE

* fix: cr

* fix: cr
2026-05-12 09:37:11 +00:00
LFC
abf4623440 refactor: store the schema of flat source (#8091)
* refactor: store the schema of flat source

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

* resolve PR comments

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

* fix ci

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

---------

Signed-off-by: luofucong <luofc@foxmail.com>
2026-05-11 10:22:40 +00:00
LFC
7a285c2890 feat: concretize json type from query (#8081)
* feat: concretize json type from query

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

* resolve PR comments

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

* add more tests

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

---------

Signed-off-by: luofucong <luofc@foxmail.com>
2026-05-09 07:27:40 +00:00
Lei, HUANG
98033b6421 fix(mito): queue writes during region edit (#8079)
* fix(mito): queue writes during region edit

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

* refactor(mito): wrap bulk insert worker request

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

* fix(mito): fail queued requests on region close

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

* docs: add comment for the design considerations

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

* chore: remove redundant check for flushable region

skip ci

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

* fix: clippy

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

---------

Signed-off-by: Lei, HUANG <mrsatangel@gmail.com>
2026-05-08 13:08:35 +00:00