在 CockroachDB 中没有锁的情况下提交
Commits in the absence of locks in CockroachDB
我试图从应用程序员的角度理解 CockroachDB 中的 ACID 如何在没有锁的情况下工作。想将其用于会计/ERP 应用程序。
当两个用户同时更新同一个数据库字段(例如总账科目合计字段)时,CockroachDB 会做什么?假设每个交易同时更新许多其他非重叠字段作为各自交易的一部分。
是否会在提交时立即通知中止的应用程序的提交进程?
当我们在应用程序中编写数据库访问代码时,是否需要考虑比 ACID/locking PostgreSQL 中更多的可能性?
或者编写用于访问 CockroachDB 的所有实际目的代码与访问标准 RDBMS 关于提交和在一般的。
当然,忽略性能问题/连接等
I'm trying to understand how ACID in CockroachDB works without locks, from an application programmer's point of view. Would like to use it for an accounting / ERP application.
CockroachDB 确实有锁,但使用不同的术语。目前正在更新一些讨论乐观并发控制的现有文档。
When two users update the same database field (e.g. a general ledger account total field) at the same time what does CockroachDB do? Assuming each is updating many other non-overlapping fields at the same time as part of the respective transactions.
其中一个事务将阻塞等待另一个事务提交。如果检测到事务之间存在死锁,则将中止涉及死锁的两个事务之一。
Will the aborted application's commit process be informed about this immediately at the time of the commit?
是的。
Do we need to take care of additional possibilities than, for example, in ACID/locking PostgreSQL when we write the database access code in our application?
Or is writing code for accessing CockroachDB for all practical purposes the same as for accessing a standard RDBMS with respect to commits and in general.
在高层次上,您无需做任何额外的事情。 CockroachDB 默认为可序列化隔离,较弱的隔离级别会导致更多的事务重启,但它的优点是应用程序程序员不必担心异常。
我试图从应用程序员的角度理解 CockroachDB 中的 ACID 如何在没有锁的情况下工作。想将其用于会计/ERP 应用程序。
当两个用户同时更新同一个数据库字段(例如总账科目合计字段)时,CockroachDB 会做什么?假设每个交易同时更新许多其他非重叠字段作为各自交易的一部分。
是否会在提交时立即通知中止的应用程序的提交进程?
当我们在应用程序中编写数据库访问代码时,是否需要考虑比 ACID/locking PostgreSQL 中更多的可能性?
或者编写用于访问 CockroachDB 的所有实际目的代码与访问标准 RDBMS 关于提交和在一般的。
当然,忽略性能问题/连接等
I'm trying to understand how ACID in CockroachDB works without locks, from an application programmer's point of view. Would like to use it for an accounting / ERP application.
CockroachDB 确实有锁,但使用不同的术语。目前正在更新一些讨论乐观并发控制的现有文档。
When two users update the same database field (e.g. a general ledger account total field) at the same time what does CockroachDB do? Assuming each is updating many other non-overlapping fields at the same time as part of the respective transactions.
其中一个事务将阻塞等待另一个事务提交。如果检测到事务之间存在死锁,则将中止涉及死锁的两个事务之一。
Will the aborted application's commit process be informed about this immediately at the time of the commit?
是的。
Do we need to take care of additional possibilities than, for example, in ACID/locking PostgreSQL when we write the database access code in our application?
Or is writing code for accessing CockroachDB for all practical purposes the same as for accessing a standard RDBMS with respect to commits and in general.
在高层次上,您无需做任何额外的事情。 CockroachDB 默认为可序列化隔离,较弱的隔离级别会导致更多的事务重启,但它的优点是应用程序程序员不必担心异常。