Skip to content

Commit

Permalink
auto-increment: modify the description about the case of non-continuo…
Browse files Browse the repository at this point in the history
…us auto increment id (#17569) (#17598)
  • Loading branch information
ti-chi-bot authored May 23, 2024
1 parent 774d818 commit ed0adb0
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 @@ -372,7 +372,7 @@ CREATE TABLE t(a int AUTO_INCREMENT key) AUTO_ID_CACHE 1;
> - Since TiDB v6.4.0, the modification of the `AUTO_INCREMENT` value is faster because it is only an in-memory operation in the TiDB process as the centralized allocating service is introduced.
> - Setting `AUTO_ID_CACHE` to `0` means that TiDB uses the default cache size `30000`.
After you enable the MySQL compatibility mode, the allocated IDs are **unique** and **monotonically increasing**, and the behavior is almost the same as MySQL. Even if you access across TiDB instances, the IDs will keep monotonic. Only when the primary instance of the centralized service crashes, there might be a few IDs that are not continuous. This is because the secondary instance discards some IDs that are supposed to have been allocated by the primary instance during the failover to ensure ID uniqueness.
After you enable the MySQL compatibility mode, the allocated IDs are **unique** and **monotonically increasing**, and the behavior is almost the same as MySQL. Even if you access across TiDB instances, the IDs will keep monotonic. Only when the primary instance of the centralized auto-increment ID allocating service exits (for example, during the TiDB node restart) or crashes, there might be some non-consecutive IDs. This is because the secondary instance discards some IDs that are allocated by the primary instance during the failover to ensure ID uniqueness.

## Restrictions

Expand Down

0 comments on commit ed0adb0

Please sign in to comment.