fix table xxl_job_registry id exhausted#3915
Open
s137740 wants to merge 2 commits intoxuxueli:masterfrom
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What kind of change does this PR introduce? (check at least one)
The description of the PR:
注册中心使用 SQL
INSERT INTO xxl_job_registry xxxx ON DUPLICATE KEY UPDATE来实现注册和更新,并针对registry_group,registry_key,registry_value三列设置唯一,猜测源于该 issue #2256 。在更新场景下,由于 UNIQUE KEY 的存在,会导致数据库的自增主键不断增加,目前该表的主键是 int,存在被消耗殆尽的可能。
给个我司数据:生产有 300 个执行器 * 2 个 Pod(每个执行器),自增 ID 每天预计消耗 170 万,三年多就会用光。
至于 #2256 提及的并发问题,因为已经添加唯一键,所以可以简单地先查询后更新(或插入),遇到冲突可以 safely ignore。
Other information: