[英]Concurrent updates to shared database by microservices .. Lost Updates
我们的微服务正在调用第三方服务,使用 REST API 访问(读取/更新)共享数据库中的相同记录
用例 1:同一个微服务多次调用访问同一个记录
例子:
用例 2:多个微服务多次调用以访问同一记录
在这种情况下,用例 1 中解释的问题会加剧,因为需要多次调用来更新数据库中的相同记录。
Edit: 13-April-2021 The shared database is exposed to our microservices using REST API and we don't have any control over the physical database and the exposed REST API, to implement any transactions or locking mechanism at the database level.
I don't know which database you are using but traditional relational databases like: oracle, postgresql, mysql, db2, etc... already address these kind of issues using locks in the records that are being updated to ensure that there are not concurrent问题。
我的意思是,如果您打开一个读取值然后更新它的事务,则不会有任何问题,因为如果您尝试使用与当前设置的版本号不同的版本号更新数据库中的一行(一个过时的版本), 数据库不会让更新它
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.