Atomicity - a transaction to transfer funds from one account to another involves making a withdrawal operation from the first account and a deposit operation on the second. If the deposit operation failed, you don’t want the withdrawal operation to happen either.
Consistency - a database tracking a checking account may only allow unique check numbers to exist for each transaction
Isolation - a teller looking up a balance must be isolated from a concurrent transaction involving a withdrawal from the same account. Only when the withdrawal transaction commits successfully and the teller looks at the balance again will the new balance be reported.
Durability - A system crash or any other failure must not be allowed to lose the results of a transaction or the contents of the database. Durability is often achieved through separate transaction logs that can "re-create" all transactions from some picked point in time (like a backup).
(summary of the real world examples from le dorfier's link)
• Atomicity—From a user perspective, a transaction is either completed in its entirety (i.e., all relevant database tables are updated) or not at all. If an error or interruption occurs, all changes made up to that point are backed out.
• Consistency—All integrity conditions in the database are maintained with each transaction, taking the database from one consistent state into another consistent state.
• Isolation—Each transaction is isolated from other transactions, and hence, each transaction only accesses data that are part of a consistent database state.
• Durability—If a transaction has been reported back to a user as complete, the resulting changes to the database survive subsequent hardware or software failures.
获取任何用于操作关系数据库中的数据的给定 Perl 脚本,在其顶部放置一个“BEGIN”,在底部放置一个“COMMIT”,您就知道该 Perl 脚本有效,或者没有影响您的操作。数据库(除非您在 mysql 上插入 DDL 语句)。 原子性非常强大,可以在设计健壮的软件(也是我最喜欢的属性)时获得这样的保证。
Take any given perl script you use to manipulate a data in a relational database, put a "BEGIN" at the top of it and a "COMMIT" at the bottom, and you know the perl script worked, or didn't have effect your database at all (unless you inserted DDL statements on mysql). Atomicity is very powerful to have an assurance like that when designing robust software (and my favorite of the properties).
发布评论
评论(3)
原子性 - 将资金从一个帐户转移到另一个帐户的交易涉及从第一个帐户进行提款操作并在第二个帐户上进行存款操作。 如果存款操作失败,您也不希望发生取款操作。
一致性 - 跟踪支票帐户的数据库可能只允许每笔交易存在唯一的支票号码
隔离 - 查找余额的出纳员必须与涉及从同一帐户提款的并发交易隔离。 只有当取款交易成功提交并且出纳员再次查看余额时,才会报告新的余额。
持久性 - 不允许系统崩溃或任何其他故障丢失事务结果或数据库内容。 持久性通常是通过单独的事务日志来实现的,这些日志可以“重新创建”某个选定时间点(例如备份)的所有事务。
(来自 le dorfier 的现实世界示例的摘要 链接)
Atomicity - a transaction to transfer funds from one account to another involves making a withdrawal operation from the first account and a deposit operation on the second. If the deposit operation failed, you don’t want the withdrawal operation to happen either.
Consistency - a database tracking a checking account may only allow unique check numbers to exist for each transaction
Isolation - a teller looking up a balance must be isolated from a concurrent transaction involving a withdrawal from the same account. Only when the withdrawal transaction commits successfully and the teller looks at the balance again will the new balance be reported.
Durability - A system crash or any other failure must not be allowed to lose the results of a transaction or the contents of the database. Durability is often achieved through separate transaction logs that can "re-create" all transactions from some picked point in time (like a backup).
(summary of the real world examples from le dorfier's link)
• 原子性——从用户的角度来看,事务要么完全完成(即更新所有相关数据库表),要么根本不完成。 如果发生错误或中断,则该点之前所做的所有更改都将被撤销。
• 一致性——每个事务都维护数据库中的所有完整性条件,使数据库从一种一致状态进入另一种一致状态。
• 隔离 - 每个事务都与其他事务隔离,因此每个事务仅访问属于一致数据库状态一部分的数据。
• 持久性——如果事务已完成报告给用户,则对数据库所做的更改将在随后的硬件或软件故障中幸存下来。
• Atomicity—From a user perspective, a transaction is either completed in its entirety (i.e., all relevant database tables are updated) or not at all. If an error or interruption occurs, all changes made up to that point are backed out.
• Consistency—All integrity conditions in the database are maintained with each transaction, taking the database from one consistent state into another consistent state.
• Isolation—Each transaction is isolated from other transactions, and hence, each transaction only accesses data that are part of a consistent database state.
• Durability—If a transaction has been reported back to a user as complete, the resulting changes to the database survive subsequent hardware or software failures.
获取任何用于操作关系数据库中的数据的给定 Perl 脚本,在其顶部放置一个“BEGIN”,在底部放置一个“COMMIT”,您就知道该 Perl 脚本有效,或者没有影响您的操作。数据库(除非您在 mysql 上插入 DDL 语句)。 原子性非常强大,可以在设计健壮的软件(也是我最喜欢的属性)时获得这样的保证。
Take any given perl script you use to manipulate a data in a relational database, put a "BEGIN" at the top of it and a "COMMIT" at the bottom, and you know the perl script worked, or didn't have effect your database at all (unless you inserted DDL statements on mysql). Atomicity is very powerful to have an assurance like that when designing robust software (and my favorite of the properties).