fix(go): singleflight tdengine child table ensures

This commit is contained in:
lingniu
2026-07-03 19:49:04 +08:00
parent 3a0d9bd840
commit 68b729fa7b
3 changed files with 151 additions and 42 deletions

View File

@@ -22,6 +22,8 @@ Go 版本车辆数据接入链路已经作为生产主链路运行在 ECS `115.2
2026-07-03 之后,`nats-fast-writer` 的快速路径是 TDengine 批写 + Redis 批量 pipeline一个 NATS fetch batch 先批量写 TDengine再用 `FastUpdateBatch` 把实时 KV、在线 TTL、last_seen 和协议索引合并到一次 Redis pipeline最后逐条 ack NATS。
TDengine writer 的 raw/location 子表创建有进程内单飞保护:同一子表 key 并发首次写入时,只有一个 goroutine 执行 `CREATE TABLE IF NOT EXISTS` 和 tag 更新,其他 goroutine 等待结果后继续 INSERT避免 10W 车辆启动或回放时对 TDengine 形成重复 DDL 风暴。
## 服务和端口
ECS`115.29.187.205`