Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ID自增跳变问题 #5270

Open
SirCFC opened this issue Nov 4, 2024 · 6 comments
Open

ID自增跳变问题 #5270

SirCFC opened this issue Nov 4, 2024 · 6 comments
Labels

Comments

@SirCFC
Copy link

SirCFC commented Nov 4, 2024

在OCEANBASE下,自增ID跳变会导致这里的数据量巨大,自增跳变10000000,导致数据库崩溃;请问有什么优化方案吗?

private void recordMissingReleaseMessageIds(List messages, long startId) {
for (ReleaseMessage message : messages) {
long currentId = message.getId();
if (currentId - startId > 1) {
for (long i = startId + 1; i < currentId; i++) {
missingReleaseMessages.putIfAbsent(i, 1);
}
}
startId = currentId;
}
}

@nobodyiam
Copy link
Member

之前有过一些讨论,#5087,可以看下是否有好的实现方式

@SirCFC
Copy link
Author

SirCFC commented Nov 9, 2024

非常感谢回复,想了解下 ,如果注释掉扫描缺失ID代码行,会存在什么大的问题吗?因为我发现老的版本是没有这部分功能的。

@nobodyiam
Copy link
Member

当时是为了修复这个问题 #3806

@SirCFC
Copy link
Author

SirCFC commented Nov 11, 2024

#3806的问题,如果apollo客户端重启,会恢复缺失ID的读取吗?

@nobodyiam
Copy link
Member

主要影响的是 ConfigServiceWithCache,会导致缓存一直不更新,客户端无法加载最新配置。
我看了下代码,造成数据库崩溃的原因是否主要是因为对跳变的数据没有用分页?或者说当发现跳变的数据量大于某个量级后需要用不同的方式来解这个问题?

private void scanMissingMessages() {
Set<Long> missingReleaseMessageIds = missingReleaseMessages.keySet();
Iterable<ReleaseMessage> releaseMessages = releaseMessageRepository
.findAllById(missingReleaseMessageIds);
fireMessageScanned(releaseMessages);
releaseMessages.forEach(releaseMessage -> {
missingReleaseMessageIds.remove(releaseMessage.getId());
});
growAndCleanMissingMessages();

Copy link

stale bot commented Dec 20, 2024

This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in 7 days unless it is tagged "help wanted" or other activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Dec 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants