Atomicity is a property of a system, usually a database, where operations either happen completely or don’t happen at all. For example, let’s say that our database contains bank accounts, and Alice is trying to transfer $10 to Bob. We might implement this by decrementing Alice’s account by $10, then incrementing Bob’s account by $10.
But what happens if the system crashes right after we perform the decrement? Then the increment doesn’t happen and money has disappeared into nothingness. We call this a “half-way state” or partial success because part of the operation is complete and part is incomplete.
To solve this, some databases have features that provide atomicity. To use them, you wrap your desired operations to mark them as an atomic group, which is called a database transaction (no relation to financial transactions). If any operation in a transaction is unable to complete, the already-finished operations before it will be automatically undone.
In summary, with atomicity, either the whole transaction happens, or none of it happens. There is no half-completed state.
00:00 Definition
00:20 Uh Oh: Money Disappeared
00:36 How Atomicity Solves This
00:55 Summary
Смотрите видео Atomicity, the A of ACID | Software Engineering Dictionary онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь Studying With Alex 12 Октябрь 2021, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 4,689 раз и оно понравилось 158 людям.