docs: record storage simplification deployment

This commit is contained in:
lingniu
2026-07-02 19:51:48 +08:00
parent 29cd044a57
commit abc1b9870a
2 changed files with 14 additions and 17 deletions

View File

@@ -33,12 +33,12 @@
1. `vehicle_mileage_points``vehicle_locations.total_mileage_km` 重复。 1. `vehicle_mileage_points``vehicle_locations.total_mileage_km` 重复。
- 状态Go 写入链路已停止创建和写入 `vehicle_mileage_points` - 状态Go 写入链路已停止创建和写入 `vehicle_mileage_points`
- 兼容:`/api/history/mileage-points` 已改为从 `vehicle_locations` 读取 `total_mileage_km IS NOT NULL` - 兼容:`/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` 重复。 2. `raw_frames.fields_json``raw_frames.parsed_json``vehicle_locations` 重复。
- 状态:新建 raw schema 和 raw 写入已停止使用 `fields_json` - 状态:新建 raw schema 和 raw 写入已停止使用 `fields_json`
- 兼容raw 查询只选择公共列,不依赖 `fields_json`;旧表保留该列也不影响查询。 - 兼容raw 查询只选择公共列,不依赖 `fields_json`;旧表保留该列也不影响查询。
- 删除:等历史查询和前端不再展示 `fields_json` 后删除列 - 生产ECS TDengine 历史库已在上线前重建,`raw_frames` 不再包含 `fields_json`
3. `vehicle_daily_metric``vehicle_key``vin` 同时存在。 3. `vehicle_daily_metric``vehicle_key``vin` 同时存在。
- 当前保留原因JT808 可能先用 phone 作为临时 key后续才绑定 VIN。 - 当前保留原因JT808 可能先用 phone 作为临时 key后续才绑定 VIN。

View File

@@ -278,16 +278,16 @@ git commit -m "refactor(go): remove duplicate raw fields json"
- Modify: `docs/architecture/storage-minimal-contract.md` - Modify: `docs/architecture/storage-minimal-contract.md`
- Modify: `docs/ops/vehicle-ingest-runbook.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 ```bash
systemctl restart lingniu-go-history-writer.service systemctl restart lingniu-go-history-writer.service
systemctl restart lingniu-go-realtime-api.service systemctl restart lingniu-go-realtime-api.service
``` ```
- [ ] **Step 2: Verify service health** - [x] **Step 2: Verify service health**
Run on ECS: Run on ECS:
@@ -306,26 +306,23 @@ Expected:
- history lag drains to `0` or remains bounded - history lag drains to `0` or remains bounded
- history writes continue increasing - 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 ```sql
SELECT COUNT(*) FROM lingniu_vehicle_ts.vehicle_locations WHERE total_mileage_km IS NOT NULL; DROP DATABASE IF EXISTS lingniu_vehicle_ts;
SELECT COUNT(*) FROM lingniu_vehicle_ts.vehicle_mileage_points; 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 - [x] **Step 5: Commit docs update**
DROP STABLE IF EXISTS lingniu_vehicle_ts.vehicle_mileage_points;
```
- [ ] **Step 5: Commit docs update**
```bash ```bash
git add docs/architecture/storage-minimal-contract.md docs/ops/vehicle-ingest-runbook.md git add docs/architecture/storage-minimal-contract.md docs/ops/vehicle-ingest-runbook.md