惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

有赞技术团队
有赞技术团队
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
P
Palo Alto Networks Blog
C
Cisco Blogs
The Hacker News
The Hacker News
T
Threatpost
S
Schneier on Security
K
Kaspersky official blog
Spread Privacy
Spread Privacy
博客园_首页
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
NISL@THU
NISL@THU
量子位
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Google DeepMind News
Google DeepMind News
Security Latest
Security Latest
博客园 - 司徒正美
云风的 BLOG
云风的 BLOG
博客园 - 叶小钗
H
Hackread – Cybersecurity News, Data Breaches, AI and More
N
News and Events Feed by Topic
爱范儿
爱范儿
P
Proofpoint News Feed
C
CERT Recently Published Vulnerability Notes
Project Zero
Project Zero
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Cisco Talos Blog
Cisco Talos Blog
GbyAI
GbyAI
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Apple Machine Learning Research
Apple Machine Learning Research
T
Tenable Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
V
Vulnerabilities – Threatpost
Forbes - Security
Forbes - Security
博客园 - 三生石上(FineUI控件)
C
Cyber Attacks, Cyber Crime and Cyber Security
N
News and Events Feed by Topic
V
V2EX
Webroot Blog
Webroot Blog
The Register - Security
The Register - Security
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
阮一峰的网络日志
阮一峰的网络日志
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Blog — PlanetScale
Blog — PlanetScale
M
MIT News - Artificial intelligence
Scott Helme
Scott Helme
Simon Willison's Weblog
Simon Willison's Weblog
L
LangChain Blog
W
WeLiveSecurity
Cloudbric
Cloudbric

MySQL

请教大家一个关于 mysql 服务崩溃的问题 - V2EX 数据库连接数超了如何解决 - V2EX count 的语句优化问题 - V2EX 连接 MySQL 很慢的问题 - V2EX MYSQL UPDATE 在很短的时间内更新相同的语句,就会有告警,导至事务失败,有没有人遇到这问题? MySQL 磁盘读取飙升,导致阿里云服务器卡死 - V2EX 求 Macos 下面 homebrew 安装 mysql 到指定目录的方法 使用 EXISTS 优化 IN 子查询 - V2EX 跨平台的 MySQL Parser - V2EX MySQL 大表排序有什么好的方案?只能上 Mongo? Mysql 无法修改自增主键的 AUTO_INCREMENT 值 升级服务器后, mysql 性能反而更慢了,求排查思路 《高性能 MySQL》第三版:是否已经过时? 坑爹的字符集问题:踩到了 MySQL 的 bug 两个人的数据开发团队,被要求从零开始治理企业数据 MySQL 8.4 LTS 与 Metabase 奇怪兼容性问题:降级到 8.0.4 后问题解决 (1Panel and BT Panel 复现) - V2EX 公司内网,怎么搭建主备 mysql,高可用。故障自动切。 不买云服务 mysql 自增 ID 突然变为 int 最大值问题 覆盖还原 data 文件夹后, mysql 无法启动了 - V2EX 生产力工具 - V2EX 各位大佬,有个奇葩的技术问题 - V2EX 关于 mysql trx_id 的疑惑 发帖一问 sql 性能讨论 - V2EX 数据库高频更新问题 谁遇到过没 有啥好的解决方案部 - V2EX 有用过 SyncNavigator 或者类似的简单数据库同步软件吗, - V2EX mysql 遇到最愚蠢的查询性能问题,求解决 - V2EX 有什么优雅的 mysql 增加字段名的方法呢? - V2EX 各位 Mysql 大佬,问一个 8.0 版本 json 的问题 - V2EX mysql online DDL 时间很长,咋整,数据量不多,就 30W - V2EX 数据库中 select for update 和 version 乐观锁各自的适用场景是啥? - V2EX mysql 宿主机没有办法访问的问题 - V2EX mysql 求助 - V2EX MySQL 8.4 MGR 可以上生产吗? - V2EX mysql 亿级数据,数据筛选和导入导出 - V2EX 大佬们你们 Mysql 的数据库名称怎么分割的? - V2EX mysql 数据增量同步 - V2EX 新项目准备启动, MYSQL 选择 8.4.2 这个版本,有没什么坑? - V2EX mysql 一年新增 800 多万条数据,如果是单表的话请问服务器能支撑吗?各位有什么好的办法吗? - V2EX 新手求个远程数据库稳妥的解决方案~或者实时备份数据库的方法 - V2EX 铁子们,求助 docker 中 MySQL 导入数据库速度问题 - V2EX 大家的 SQL 一般怎么管理? - V2EX 询问一个慢查询的问题 - V2EX 现在用 mysql 的多 还是 mariadb 的多 - V2EX 关于 MySQL 查询咨询 - V2EX 请教个问题,如何快速的删除 mysql 的数据 求助:Mysql 数据文件夹如何被新安装的 Mysql 读取 - V2EX mysql 有没有什么中间件能模拟 mongodb? - V2EX 请问 debian12 mysql5.7 可以通过添加 apt 源安装吗?
什么时候可以将 mysql 默认隔离机制改为读已提交
byerer · 2025-07-07 · via MySQL

@byerer

// @Transactional(rollbackFor = Exception.class,isolation = Isolation.READ_COMMITTED)
public void addBalanceByVersion(Long id, BigDecimal amount) {
//乐观锁 没有 for update
long systemTime = System.currentTimeMillis();
boolean flag = false;
while (System.currentTimeMillis() - systemTime < waitTime) {
flag = updateBalanceCheckVersion(id, amount);
if (flag) {
break;
}
try {
Thread.sleep(10);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
if (!flag) {
throw new BizException("加款超时,稍后再试");
}

}

要么不用事务,要么就加上 isolation = Isolation.READ_COMMITTED
都用事务了 老老实实的 select for update 或者 update xx set balance = balance - amount . 如果要记录流水还是 行锁。