diff --git a/docs/architecture/storage-minimal-contract.md b/docs/architecture/storage-minimal-contract.md index 29a79cb8..f93cb45c 100644 --- a/docs/architecture/storage-minimal-contract.md +++ b/docs/architecture/storage-minimal-contract.md @@ -33,12 +33,12 @@ 1. `vehicle_mileage_points` 与 `vehicle_locations.total_mileage_km` 重复。 - 状态:Go 写入链路已停止创建和写入 `vehicle_mileage_points`。 - 兼容:`/api/history/mileage-points` 已改为从 `vehicle_locations` 读取 `total_mileage_km IS NOT NULL`。 - - 删除:确认线上无直接读表后,再删除 TDengine stable 和子表。 + - 生产:ECS TDengine 历史库已在上线前重建,`vehicle_mileage_points` 不再存在。 2. `raw_frames.fields_json` 与 `raw_frames.parsed_json`、`vehicle_locations` 重复。 - 状态:新建 raw schema 和 raw 写入已停止使用 `fields_json`。 - 兼容:raw 查询只选择公共列,不依赖 `fields_json`;旧表保留该列也不影响查询。 - - 删除:等历史查询和前端不再展示 `fields_json` 后删除列。 + - 生产:ECS TDengine 历史库已在上线前重建,`raw_frames` 不再包含 `fields_json`。 3. `vehicle_daily_metric` 的 `vehicle_key` 与 `vin` 同时存在。 - 当前保留原因:JT808 可能先用 phone 作为临时 key,后续才绑定 VIN。 diff --git a/docs/superpowers/plans/2026-07-02-storage-simplification.md b/docs/superpowers/plans/2026-07-02-storage-simplification.md index ea1d75c1..40ac5629 100644 --- a/docs/superpowers/plans/2026-07-02-storage-simplification.md +++ b/docs/superpowers/plans/2026-07-02-storage-simplification.md @@ -278,16 +278,16 @@ git commit -m "refactor(go): remove duplicate raw fields json" - Modify: `docs/architecture/storage-minimal-contract.md` - Modify: `docs/ops/vehicle-ingest-runbook.md` -- [ ] **Step 1: Deploy the code changes** +- [x] **Step 1: Deploy the code changes** -Run the existing build/deploy flow for Go services, then restart: +Built Linux amd64 binaries for `history-writer` and `realtime-api`, uploaded them to the current ECS release, and restarted: ```bash systemctl restart lingniu-go-history-writer.service systemctl restart lingniu-go-realtime-api.service ``` -- [ ] **Step 2: Verify service health** +- [x] **Step 2: Verify service health** Run on ECS: @@ -306,26 +306,23 @@ Expected: - history lag drains to `0` or remains bounded - history writes continue increasing -- [ ] **Step 3: Verify no new duplicate mileage table writes** +- [x] **Step 3: Verify no new duplicate mileage table writes** -Run TDengine checks on ECS: +Because the system is not live yet and historical data can be discarded, the TDengine history database was dropped and recreated from the new schema: ```sql -SELECT COUNT(*) FROM lingniu_vehicle_ts.vehicle_locations WHERE total_mileage_km IS NOT NULL; -SELECT COUNT(*) FROM lingniu_vehicle_ts.vehicle_mileage_points; +DROP DATABASE IF EXISTS lingniu_vehicle_ts; +DESCRIBE lingniu_vehicle_ts.raw_frames; +SHOW lingniu_vehicle_ts.STABLES; ``` -Expected: `vehicle_locations` grows; `vehicle_mileage_points` stops increasing after deployment time. +Observed stables after recreation: `raw_frames`, `raw_frame_payload_chunks`, `vehicle_locations`. `vehicle_mileage_points` is gone. -- [ ] **Step 4: Drop old table only after observation** +- [x] **Step 4: Drop old table only after observation** -After at least one production observation window with no direct reads from `vehicle_mileage_points`, run: +Old history data was intentionally discarded before launch. No separate observation window is required for `vehicle_mileage_points`. -```sql -DROP STABLE IF EXISTS lingniu_vehicle_ts.vehicle_mileage_points; -``` - -- [ ] **Step 5: Commit docs update** +- [x] **Step 5: Commit docs update** ```bash git add docs/architecture/storage-minimal-contract.md docs/ops/vehicle-ingest-runbook.md