Innomerc Learn
English is the default.
Web & Backend Technology

A Transfer Should Finish Together

Use a fictional points transfer to understand committing and rolling back related changes.

Foundational6 min explorationReviewed
My learningNot started

Choose your depth. Learn at your own pace.

Simple explanation

Understand it

Imagine moving ten points from one game account to another. Subtracting the points but failing to add them would leave an incorrect result. A database transaction groups related changes so they can be committed together or rolled back.

The example uses fictional points, not banking instructions. If a required operation fails, the application must handle the failure and ensure the transaction is rolled back rather than leaving an unfinished plan.

Technical explanation

Under the hood

BEGIN starts an explicit transaction; COMMIT completes it and ROLLBACK discards its changes. Concurrent transactions involve isolation rules and may require retries. A database transaction does not automatically make a message to another external service atomic with the database change.

Practitioner explanation

Practitioner perspective

Test interruption, concurrent updates and retry behavior against business invariants. A response lost after commit can leave the caller uncertain about the result; blind retries can repeat an operation. Use appropriate idempotency and reconciliation designs across service boundaries.

Database Transactions

A paired ledger mechanism links two sides of a transfer through one shared control.

Imagine moving ten points from one game account to another. Subtracting the points but failing to add them would leave an incorrect result. A database transaction groups related changes so they can be committed together or rolled back.

Illustrated analogy · Select the image to enlarge
See the decision happen

Watch it work

A fictional, simplified model. Select a component to inspect it, or follow the steps in order.

Interactive Lab

Two changes, one transaction.

Example: ten fictional game points move between two records. This is a database model, not a payment service.

Steps1. BEGIN + changes 2. COMMIT 3. Success
Click a box or choose its name to learn what it means.
Game serviceReadyDatabaseReadyResultReadyGame serviceReadyDatabaseReadyResultReady
Ready to traceBoth changes commit
Before you start · 3 stepsBoth changes commit

The application groups the dependent updates in one database transaction.

How to use this example

Select Next step to read at your own pace, or Animate step to watch one exchange. Nothing advances until you choose.

Inspect components & read every step
  • Game service

    The fictional application requesting a points transfer.

    Example: It asks the database to subtract and add points as one transaction.

  • Database

    An organized store of records that software can read and update.

    Example: A shop stores product quantities and order records.

  • Result

    The outcome produced by the operation in this example.

    Example: Read the current state and the step explanation to see what succeeded or failed.

Both changes commit

The application groups the dependent updates in one database transaction.

  1. Game service Database: BEGIN + changes. Subtract from one fictional record and add to the other within the transaction.
  2. Game service Database: COMMIT. The successful transaction is committed as one unit.
  3. Database Result: Success. The result reports a completed database transaction.

A condition fails

The application discards the transaction when a required condition is not satisfied.

  1. Game service Database: BEGIN + check. The application begins and checks the required conditions.
  2. Game service Database: ROLLBACK. A required condition fails, so the transaction is rolled back.
  3. Database Result: Not completed. The result explains that this attempted transfer did not commit.

Fictional teaching trace. One moving dot represents an exchange, not a measured network capture.

Open the detailed lesson walkthrough

Explore the system

Begin

Start a transaction for the fictional points transfer.

1 / 3
Read every step without animation

Commit

  1. Begin. Start a transaction for the fictional points transfer.
  2. Changes. Apply both related updates with the required checks.
  3. Commit. Make the completed transaction’s changes durable.

Both related changes belong to one transaction.

Rollback

  1. Begin. Start the group of related changes.
  2. Failure. A required condition is not met.
  3. Rollback. Discard the uncommitted changes.

A failed attempt should not leave half a transfer.

Attack view

Two concurrent requests pass a balance check based on stale state and attempt inconsistent updates.

Defender view

  • Group dependent changes and enforce invariants within an appropriate concurrency design.
  • Test failures before and after commit and make retries safe for the business operation.

Common mistakes

  • Atomicity does not replace authorization.
  • A database transaction does not roll back every external side effect.

Check your understanding

Does a database transaction automatically undo an email sent during it?
Active recall: explain this idea in 30 seconds

Imagine moving ten points from one game account to another. Subtracting the points but failing to add them would leave an incorrect result. A database transaction groups related changes so they can be committed together or rolled back.

Now give an example and name one limitation. Revisit the explanation if you get stuck.

Primary sources

Original explanations informed by these specifications and official resources. Source versions and lesson review are separate from product updates.

Content reviewed 2026-09-10. Read the editorial policy.

What comes next?

Technology fundamentals

Back to topic