# Append-only 模式上线：轻松存储重复数据 | Greptime 双周精选

Source: https://greptime.cn/blogs/2024-04-10-biweekly

## 内容概述

作为一个成长中的开源项目，GreptimeDB 的进展离不开来自全球的社区贡献者们，感谢各位！

最近的内容更新如下：

- 正式添加了对 append 模式的支持。用户可以在建表时通过设置 append 模式（`append_mode = true`）来创建 Append-only 的表。Append-only 的表不会对写入的数据进行去重，因此可以更方便地存储重复的数据。

- 支持使用 VictoriaMetrics Remote Write 协议写入 GreptimeDB。

- PromQL 支持跨 Schema 查询，为 PromQL 解析器添加特殊匹配器 `__schema__`，用于选择表所在的 Schema。这允许用户在 PromQL 中进行跨 Schema 查询。

## 社区贡献者名单

在过去的两周里，GreptimeDB 共合并了 54 个 PR，其中有 5 位独立贡献者，累计 8 个 PR 被成功合并，还有很多待合并的 PR。

祝贺以下各位在过去 2 周内成为我们活跃的贡献者：

- @[dimbtp](https://github.com/dimbtp)（[#3627](https://github.com/GreptimeTeam/greptimedb/pull/3627))

- @[J0HN50N133](https://github.com/J0HN50N133)（[#3602](https://github.com/GreptimeTeam/greptimedb/pull/3602))

- @[CookiePieWw](https://github.com/CookiePieWw)（[#3682](https://github.com/GreptimeTeam/greptimedb/pull/3682) [#3675](https://github.com/GreptimeTeam/greptimedb/pull/3675) [#3626](https://github.com/GreptimeTeam/greptimedb/pull/3626))

- @[DiamondMofeng](https://github.com/DiamondMofeng)（[#3668](https://github.com/GreptimeTeam/greptimedb/pull/3668))

- @[etolbakov](https://github.com/etolbakov)（[#3620](https://github.com/GreptimeTeam/greptimedb/pull/3620) [#3507](https://github.com/GreptimeTeam/greptimedb/pull/3507))

- @[irenjj](https://github.com/irenjj) ([#3638](https://github.com/GreptimeTeam/greptimedb/pull/3638))

🎉 热烈欢迎 @[CookiePieWw](https://github.com/CookiePieWw) 作为新的贡献者加入社区并成功合并了首个 PR，还有更多来自其他独立贡献者的 PR 正在等待合并。

<img src="/zh/blogs/2024-04-10-biweekly/image1.png" alt="Contributor of GreptimeDB" style="width: 80%; margin: 0 auto"/>

同时衷心感谢我们所有的成员和贡献者！是你们的付出让我们的项目得以成功，也是你们让 GreptimeDB 成为一个更优质的产品。让我们一起努力，建立一个更棒的社区！

## PR 亮点

### [#3558](https://github.com/GreptimeTeam/greptimedb/pull/3558) [#3598](https://github.com/GreptimeTeam/greptimedb/pull/3598) [#3624](https://github.com/GreptimeTeam/greptimedb/pull/3598) 添加了对 Append-only 表的支持

- 用户可以在建表时通过设置 append 模式（`create table ... engine=mito with('append_mode'='true');`）来创建 Append-only 模式的表；

- Append-only 表只支持插入，不支持删除和更新；

- Append-only 表的插入数据不会去重，因此可以更方便地存储重复的数据。

### [#3635](https://github.com/GreptimeTeam/greptimedb/pull/3635) 更正 Compaction 失败时的错误处理逻辑

修复了一个变量名写错导致的 BUG。

### [#3604](https://github.com/GreptimeTeam/greptimedb/pull/3604) 支持 Grafana 的 `2+2` 和 `/status/buildinfo` 请求

支持 Grafana v9.0 的 `2+2` 和 `/status/buildinfo` 请求，消除了将 GreptimeDB 添加为 Grafana 中的 Prometheus 数据源时的报错信息。

### [#3641](https://github.com/GreptimeTeam/greptimedb/pull/3641) 添加 VictoriaMetrics 的 Remote Write 支持

该 PR 增强了 Greptime 对 VictoriaMetrics 的支持，使得用户可以通过 VictoriaMetrics 的 Remote Write 协议的方式将数据写入数据库。

### [db#3602](https://github.com/GreptimeTeam/greptimedb/pull/3602) 支持多种 PostgreSQL 的日期输出格式

增强了 Greptime 对 PostgreSQL 的支持，用户可以使用更多的日期格式。

### [db#3620](https://github.com/GreptimeTeam/greptimedb/pull/3620) `to_timezone` 支持 Unix 时间戳数值类型输入

之前 `to_timezone` 只支持 TIMESTAMP 和 VARCHAR 输入，该 PR 添加了对 Unix 时间戳数值类型（BIGINT）的支持。

## Good First Issue

### [db#2618 为 为 `KvBackend Trait` 的实现添加测试](https://github.com/GreptimeTeam/greptimedb/issues/2618) 

为 `KvBackend` 实现添加行为测试，以确保所有实现具有相同的行为。

关键词：测试

难度：中等

### [db#3511 在 COPY FROM 语句中支持指定时间范围，从而避免导入不需要的数据](https://github.com/GreptimeTeam/greptimedb/issues/3511)

COPY FROM 语句常常用于从备份文件中恢复表的数据，如果能够支持过滤指定时间范围，可以避免导入不需要的数据，加快数据恢复的速度。

关键词：备份/恢复、过滤、时间戳

难度：中等

### [db#3597 从 `orc-rs` 迁移到 `datafusion-orc` ](https://github.com/GreptimeTeam/greptimedb/issues/3597) 

Crate `orc-rs` 已不再维护，需要将相关依赖迁移到替代 crate `datafusion-orc` 上。

关键词：更新依赖

难度：中等

## 关于 Greptime

[Greptime 格睿科技](https://greptime.cn/)专注于为可观测、物联网及车联网等领域提供实时、高效的数据存储和分析服务，帮助客户挖掘数据的深层价值。目前基于云原生的时序数据库 [GreptimeDB](https://github.com/GreptimeTeam/greptimedb) 已经衍生出多款适合不同用户的解决方案，更多信息或 demo 展示请联系下方小助手（微信号：greptime）。

欢迎对开源感兴趣的朋友们参与贡献和讨论，从带有 good first issue 标签的 issue 开始你的开源之旅吧～期待在开源社群里遇见你！添加小助手微信即可加入“技术交流群”与志同道合的朋友们面对面交流哦~

Star us on GitHub Now: https://github.com/GreptimeTeam/greptimedb

官网：https://greptime.cn/

文档：https://docs.greptime.cn/

Twitter: https://twitter.com/Greptime

Slack: https://greptime.com/slack

LinkedIn: https://www.linkedin.com/company/greptime/
