Add archer import and allow date-mode bulk delete
archer import replays a sealed archive into an existing table: shard selection (`--select`), SHA-256 pre-verification, idempotent modes (`ignore`/`insert`/`replace`), and both LOAD DATA and batched-INSERT engines. It reads manifest.jsonl strictly so corruption is reported instead of skipped, and supports --dry-run, --allow-partial, and per-shard workers. --bulk-delete no longer rejects --shard-by date. Range deletion now derives its bounds from the chunk's actual keys (date scanners rewrite LastKey into a resumption cursor) and keeps safe-auto-increment semantics by excluding the current max key. A startup warning documents the monotonic-shard-column assumption. Also splits CLI/format/sharding/progress/safety reference docs out of the README, and adds the corresponding OpenSpec change artifacts. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
bc4a6b504f
commit
366d61ca25
49 files changed
+5099
-342
No files matched your search
@@ -0,0 +1,32 @@
|
||||
## Why
|
||||
|
||||
日期分片按 `(分片列, 唯一键)` 排序,日期序与主键序可能不一致。早期设计为规避“区间跨日期误删尚未归档的数据”,直接在启动校验阶段禁止了 `--shard-by date` 与 `--bulk-delete` 的组合。
|
||||
|
||||
对于业务上能保证“日期随主键递增、无回填、无 NULL/零日期”的表,这个限制堵死了一条本可安全使用的高吞吐删除路径。本次改动按“显式承担该前提”的方式放开限制,同时修正两处在放开后会暴露的问题:区间边界取错,以及默认 `--safe-auto-increment` 会让区间删除静默退回 IN 列表。
|
||||
|
||||
## What Changes
|
||||
|
||||
- 允许 `--shard-by date` 与 `--bulk-delete` 同时使用;启动时打印前提警告。
|
||||
- 区间删除的边界改为 chunk 实际读取行的裸唯一键首尾,不再使用日期扫描器为续跑改写的 `(分片列, 键...)` 复合游标。
|
||||
- 修正 `--safe-auto-increment` 与 `--bulk-delete` 的交互:区间删除不再退回 IN 列表,而是在 SQL 中显式排除当前最大自增键。
|
||||
- 同步 `archive-core` 与 `cli-contract` 的行为契约,以及 README 的安全说明。
|
||||
|
||||
**Non-goals:**
|
||||
|
||||
- 不在运行期验证“日期随主键递增、无回填”这一不变量。
|
||||
- 不自动识别或隔离迟到/回填数据。
|
||||
- 不改变 chunk 即事务、提交顺序、checkpoint 等既有语义。
|
||||
|
||||
## Capabilities
|
||||
|
||||
### Modified Capabilities
|
||||
|
||||
- `archive-core`:日期模式下允许区间删除,明确其安全前提;区间边界取 chunk 裸键首尾;`--safe-auto-increment` 在区间删除中以排除最大键的方式生效。
|
||||
- `cli-contract`:参数依赖与互斥规则中移除“`--bulk-delete` 在日期模式下禁止”。
|
||||
|
||||
## Impact
|
||||
|
||||
- 代码:`internal/cli/validate.go`(删除日期模式校验)、`internal/purge/purge.go`(区间边界与最大键排除)、`internal/app/app.go`(日期模式启动警告)。
|
||||
- 测试:新增 `internal/purge/purge_test.go` 单元测试;新增 `TestIntegrationDateBulkDelete` 集成测试。
|
||||
- 文档:`README.md`、`openspec/specs/{archive-core,cli-contract}/spec.md`。
|
||||
- 兼容性:此前被拒绝的配置现在可以启动;未使用 `--bulk-delete` 的任务行为不变。
|
||||
Reference in new issue
Block a user