# Prometheus Schema 自动对齐与统一扫描路径｜Greptime 双周精选 - No. 80

Source: https://greptime.cn/blogs/2026-04-06-greptimedb-biweekly-report

## 内容概述

*开发周期：2026-03-24 - 2026-04-06*

近期主要更新：

- Prometheus remote write 批模式自动对齐不同 metrics 的 schema
- 导出大数据集时改成流式分块处理，不再将全部数据加载到内存
- 主键预过滤在读取数据列前跳过无关的主键

建议旧版本用户升级到最新版本。

## 贡献者

过去两周，共有 **15 位贡献者**合并了 **43 个 PR**。 其中 **3 位独立贡献者**贡献了 **3 个 PR**。
欢迎新贡献者：**[@ynachi](https://github.com/ynachi)**、**[@cuiweixie](https://github.com/cuiweixie)**、**[@Boudewijn26](https://github.com/Boudewijn26)**！

本期活跃独立贡献者：

> - **[@ynachi](https://github.com/ynachi)** *[db#7882](https://github.com/GreptimeTeam/greptimedb/pull/7882)*
> - **[@Boudewijn26](https://github.com/Boudewijn26)** *[db#7857](https://github.com/GreptimeTeam/greptimedb/pull/7857)*
> - **[@cuiweixie](https://github.com/cuiweixie)** *[db#7866](https://github.com/GreptimeTeam/greptimedb/pull/7866)*
## PR 亮点

### [db#7877](https://github.com/GreptimeTeam/greptimedb/pull/7877) feat: auto-align Prometheus schemas in pending rows batching

Prometheus 写入时自动解决 schema 冲突，在行批处理阶段将逻辑表 schema 对齐到物理表。减少了冗余的表操作，4 个 region 配置下性能提升约 2 倍。

### [db#7901](https://github.com/GreptimeTeam/greptimedb/pull/7901) feat: always use flat scan path for both format

之前 GreptimeDB 的 mito2 引擎针对不同查询模式使用两套扫描路径。现在统一成单一扫描路径，消除了双路径的复杂性。

### [db#7902](https://github.com/GreptimeTeam/greptimedb/pull/7902) refactor(metric-engine): Refactor PendingRowsBatcher for better testability and benchmarking

Metric Engine 里的 `PendingRowsBatcher` 改成了用 `Arc<Error>` 在批处理等待者之间共享错误实例，不再复制错误字符串。`flush_batch_physical` 等内部函数现在可以用于外部性能测试，新增了 Criterion benchmarks 来测试不同负载下的物理批处理刷新性能。

### [db#7841](https://github.com/GreptimeTeam/greptimedb/pull/7841) feat: implement export-v2 chunked data export flow

新的 `export-v2` 功能改成分块导出，不再把整个数据集加载到内存。大表导出时不会遇到内存限制了。

### [db#7862](https://github.com/GreptimeTeam/greptimedb/pull/7862) feat: implement prefilter framework and primary key prefilter

之前 mito2 读 parquet 文件时，会先处理所有列再应用主键过滤。新的预过滤框架先只读主键列计算行选择，然后在读取完整投影时应用这些选择，减少不必要的数据处理。


## Good First Issue

### [Issue#7585](https://github.com/GreptimeTeam/greptimedb/issues/7585) Revoke KV write access outside metasrv leader

MetaKvBackend 目前向非 leader 组件（frontend、flownode、datanode）暴露了完整的写入 API，违反了 leader-only 写入的假设。需要在 catalog client 层引入只读封装，在 meta-client store 禁用写入调用，并在 metasrv store service 端强制 leader-only 写入检查。

关键词：Metasrv, Refactor

难度：Medium

### [Issue#7544](https://github.com/GreptimeTeam/greptimedb/issues/7544) Allow ALTER TABLE to modify the skip_wal option dynamically

支持 `ALTER TABLE SET` 语句，让用户在建表后修改 `skip_wal` 选项。这样可以在运行时开启或关闭 WAL。

关键词：SQL parser, Storage, ALTER TABLE

难度：Medium
