Skip to content

Commit

Permalink
Update auto-increment.md
Browse files Browse the repository at this point in the history
  • Loading branch information
tangenta committed Sep 5, 2024
1 parent 6513876 commit a648445
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion auto-increment.md
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ SELECT * FROM t;

### 清除自增 ID 缓存

一些场景下可能需要清除缓存,例如在某个 TiDB 节点已经分配了缓存的情况下,执行了自增 ID 列的显式写入并且最大值超出了缓存范围。此时如果切回到隐式分配,TiDB 可能会报主键冲突的错误。常见的场景包括:
一些场景下可能需要清除缓存。例如某个 TiDB 实例 A 已经分配了缓存,同时业务通过其他 TiDB 实例执行了显式写入并且 ID 值落在实例 A 的缓存范围中。此时如果切回到实例 A 进行隐式分配,TiDB 可能会报主键冲突的错误。常见的场景包括:

- 使用 DM 进行增量同步,下游 TiDB 的写入流量回切到业务时,自增列 ID 的写入模式通常由显式写入转换成隐式分配。
- 业务混用了显式写入和隐式分配,需要修复潜在的主键冲突错误。
Expand Down

0 comments on commit a648445

Please sign in to comment.