# v0.4.2 Release Notes

> v0.4.1 -> v0.4.2

## Summary

Trigger AOF compaction inline on writes when the inflation ratio (AOF lines / live keys) reaches 2x, with a minimum live-key threshold to avoid wasteful rewrites on small databases.
<details>
<summary>翻譯</summary>
在寫入路徑中依膨脹比（AOF 行數 / 活躍 key 數）達到 2 倍時自動觸發 compaction，並設定最小活躍 key 門檻避免小型資料庫進行無意義的重寫。
</details>

## Changes

### PERF
- Track AOF line count per database and trigger compaction inline in `addToAOF` when `aofLines >= live * 2` and `live >= 1024`, bounding AOF growth for long-running processes without requiring restart
- Return line count from `replayAOF` to initialize the counter on lazy DB load
- Reset `aofLines` to the post-compaction line count so the inflation baseline adapts as the working set grows

<details>
<summary>翻譯</summary>

- 每個 database 追蹤 AOF 行數，在 `addToAOF` 中於 `aofLines >= live * 2` 且 `live >= 1024` 時直接觸發 compaction，讓長時間運行的 process 不需重啟即可控制 AOF 成長
- `replayAOF` 回傳行數，用於 lazy DB 載入時初始化計數器
- Compaction 完成後將 `aofLines` 重設為壓縮後的行數，讓膨脹比的基準隨工作集自適應調整

</details>

***

## Files Changed

| File | Status | Tag |
|------|--------|-----|
| `core/store/aof.go` | Modified | PERF |
| `core/store/store.go` | Modified | PERF |

***

Generated by [SKILL](https://github.com/pardnchiu/skill-version-generate)
