From 712f13d3f9672149383525eb7200348a6adee887 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 21 Nov 2025 04:36:12 +0000 Subject: [PATCH 1/2] Initial plan From 304dab8dca30234f7c7f24e2e9bda6518d7bdbb7 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 21 Nov 2025 04:41:24 +0000 Subject: [PATCH 2/2] docs: add ALTER DATABASE compaction options support - Add compaction.twcs.time_window, max_output_file_size, and trigger_file_num to ALTER DATABASE documentation - Add examples for modifying and unsetting compaction options - Update both English and Chinese documentation - Add .gitignore entries for transpiled JavaScript files Co-authored-by: fengjiachun <3860496+fengjiachun@users.noreply.github.com> --- .gitignore | 6 ++++ docs/reference/sql/alter.md | 29 +++++++++++++++++++ .../current/reference/sql/alter.md | 29 +++++++++++++++++++ 3 files changed, 64 insertions(+) diff --git a/.gitignore b/.gitignore index e057ecda2a..6a936c0ea3 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,9 @@ build .temp_patch Claude.md + +# Transpiled JavaScript files (TypeScript sources are tracked) +docusaurus.config.js +sidebars.js +src/**/*.js +variables/*.js diff --git a/docs/reference/sql/alter.md b/docs/reference/sql/alter.md index 5b1676682e..7c5ee48cb1 100644 --- a/docs/reference/sql/alter.md +++ b/docs/reference/sql/alter.md @@ -32,6 +32,9 @@ Currently following options are supported: - If `ttl` was not previously set, defining a new `ttl` using `ALTER` will result in the deletion of data that exceeds the specified retention time. - If `ttl` was already set, modifying it via `ALTER` will enforce the updated retention time immediately, removing data that exceeds the new retention threshold. - If `ttl` was previously set and is unset using `ALTER`, new data will no longer be deleted. However, data that was previously deleted due to the retention policy cannot be restored. +- `compaction.twcs.time_window`: the time window parameter of TWCS compaction strategy. The value should be a [time duration string](/reference/time-durations.md). +- `compaction.twcs.max_output_file_size`: the maximum allowed output file size of TWCS compaction strategy. +- `compaction.twcs.trigger_file_num`: the number of files in a specific time window to trigger a compaction. ### Examples @@ -49,6 +52,32 @@ Remove the default retention time of data in the database: ALTER DATABASE db UNSET 'ttl'; ``` +#### Modify compaction options of database + +Change the compaction time window for the database: + +```sql +ALTER DATABASE db SET 'compaction.twcs.time_window'='2h'; +``` + +Change the maximum output file size for compaction: + +```sql +ALTER DATABASE db SET 'compaction.twcs.max_output_file_size'='500MB'; +``` + +Change the trigger file number for compaction: + +```sql +ALTER DATABASE db SET 'compaction.twcs.trigger_file_num'='8'; +``` + +Remove compaction options: + +```sql +ALTER DATABASE db UNSET 'compaction.twcs.time_window'; +``` + ## ALTER TABLE ### Syntax diff --git a/i18n/zh/docusaurus-plugin-content-docs/current/reference/sql/alter.md b/i18n/zh/docusaurus-plugin-content-docs/current/reference/sql/alter.md index c9a857a33a..8cc4563224 100644 --- a/i18n/zh/docusaurus-plugin-content-docs/current/reference/sql/alter.md +++ b/i18n/zh/docusaurus-plugin-content-docs/current/reference/sql/alter.md @@ -32,6 +32,9 @@ ALTER DATABASE db - 如果之前未设置 ttl,通过 `ALTER` 设置新的 ttl 后,超过保留时间的数据将被删除。 - 如果之前已设置过 ttl,通过 `ALTER` 修改 ttl 后,新的保留时间将立即生效,超过新保留时间的数据将被删除。 - 如果之前已设置过 ttl,通过 `ALTER` 取消 ttl 设置后,新增的数据将不会被删除,但已被删除的数据无法恢复。 +- `compaction.twcs.time_window`: TWCS 压缩策略的时间窗口参数。值应该是一个[时间长度字符串](/reference/time-durations.md)。 +- `compaction.twcs.max_output_file_size`: TWCS 压缩策略的最大允许输出文件大小。 +- `compaction.twcs.trigger_file_num`: 触发压缩的特定时间窗口中的文件数。 ### 示例 @@ -49,6 +52,32 @@ ALTER DATABASE db SET 'ttl'='1d'; ALTER DATABASE db UNSET 'ttl'; ``` +#### 修改数据库的压缩选项 + +修改数据库的压缩时间窗口: + +```sql +ALTER DATABASE db SET 'compaction.twcs.time_window'='2h'; +``` + +修改压缩的最大输出文件大小: + +```sql +ALTER DATABASE db SET 'compaction.twcs.max_output_file_size'='500MB'; +``` + +修改触发压缩的文件数: + +```sql +ALTER DATABASE db SET 'compaction.twcs.trigger_file_num'='8'; +``` + +取消压缩选项: + +```sql +ALTER DATABASE db UNSET 'compaction.twcs.time_window'; +``` + ## ALTER TABLE ## 语法