mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-08 00:26:37 +08:00
feat(log): drop empty old-month PG partitions during cleanup
系统垃圾清理任务删除过期日志后,顺带清理旧月份空分区表: PostgreSQL 按月分区的访问日志表(节点/用户)在数据删除后若该月 分区已无数据,则自动删除对应分区表,避免历史分区表无限累积。 - 仅删除「当前月之前」且为空的月份分区,当月/未来月及仍有数据的分区保留 - ClickHouse/SQLite 为 no-op(CH 分区随数据删除自动消失) - 修复既有集成测试 pg_inherits 查询(inhrelid → inhparent) - 新增单元测试与 PG 集成测试
This commit is contained in:
@@ -48,6 +48,9 @@ type AccessLogStore interface {
|
||||
// EnsurePartitions 幂等预建 PG 分区(按月),覆盖 [from, to] 月份;CH/SQLite 为 no-op。
|
||||
// 目标为 PG 的迁移在复制前调用,避免历史数据写入报 "no partition of relation found"。
|
||||
EnsurePartitions(ctx context.Context, from, to time.Time) error
|
||||
// DropEmptyPartitions 幂等清理 PG 空分区表:删除 before 月份之前、且无任何数据的按月分区;
|
||||
// CH/SQLite 为 no-op(CH 分区随数据删除自动消失、SQLite 无分区)。
|
||||
DropEmptyPartitions(ctx context.Context, before time.Time) error
|
||||
}
|
||||
|
||||
// ObservabilityStore 可观测 4 表(metric snapshots / edge health / frps / frpc)。
|
||||
|
||||
Reference in New Issue
Block a user