DataBurst Data Engineering Wiki - Roadmap Step-by-Step: https://wiki.databurst.tech/docs/roadmap/ - Introduction: https://wiki.databurst.tech/docs/roadmap/introduction/ - Programming Language: https://wiki.databurst.tech/docs/roadmap/programming-language/ - Python: https://wiki.databurst.tech/docs/roadmap/programming-language/python/ - Java: https://wiki.databurst.tech/docs/roadmap/programming-language/java/ - Scala: https://wiki.databurst.tech/docs/roadmap/programming-language/scala/ - Go: https://wiki.databurst.tech/docs/roadmap/programming-language/go/ - Rust: https://wiki.databurst.tech/docs/roadmap/programming-language/rust/ - Operating System: https://wiki.databurst.tech/docs/roadmap/operating-system/ - Windows: https://wiki.databurst.tech/docs/roadmap/operating-system/windows/ - Linux: https://wiki.databurst.tech/docs/roadmap/operating-system/linux/ - Networking: https://wiki.databurst.tech/docs/roadmap/networking/ - Protocols: https://wiki.databurst.tech/docs/roadmap/networking/protocols/ - TCP/IP: https://wiki.databurst.tech/docs/roadmap/networking/protocols/tcp/ - DNS: https://wiki.databurst.tech/docs/roadmap/networking/protocols/dns/ - HTTP: https://wiki.databurst.tech/docs/roadmap/networking/protocols/http/ - HTTPS: https://wiki.databurst.tech/docs/roadmap/networking/protocols/https/ - SSH: https://wiki.databurst.tech/docs/roadmap/networking/protocols/ssh/ - UDP: https://wiki.databurst.tech/docs/roadmap/networking/protocols/udp/ - Concepts: https://wiki.databurst.tech/docs/roadmap/networking/concepts/ - IP addressing: https://wiki.databurst.tech/docs/roadmap/networking/concepts/ip-addressing/ - DHCP: https://wiki.databurst.tech/docs/roadmap/networking/concepts/dhcp/ - Firewalls: https://wiki.databurst.tech/docs/roadmap/networking/concepts/firewalls/ - VPN: https://wiki.databurst.tech/docs/roadmap/networking/concepts/vpn/ - General Software Engineering Skills: https://wiki.databurst.tech/docs/roadmap/general-software-engineering-skills/ - OAuth: https://wiki.databurst.tech/docs/roadmap/general-software-engineering-skills/oauth/ - JWT: https://wiki.databurst.tech/docs/roadmap/general-software-engineering-skills/jwt/ - GraphQL: https://wiki.databurst.tech/docs/roadmap/general-software-engineering-skills/graphql/ - REST: https://wiki.databurst.tech/docs/roadmap/general-software-engineering-skills/rest/ - gRPC: https://wiki.databurst.tech/docs/roadmap/general-software-engineering-skills/grpc/ - Caching: https://wiki.databurst.tech/docs/roadmap/general-software-engineering-skills/caching/ - Web Frameworks and API Development: https://wiki.databurst.tech/docs/roadmap/web-frameworks-and-api-development/ - Python: https://wiki.databurst.tech/docs/roadmap/web-frameworks-and-api-development/python/ - Go: https://wiki.databurst.tech/docs/roadmap/web-frameworks-and-api-development/go/ - Java: https://wiki.databurst.tech/docs/roadmap/web-frameworks-and-api-development/java/ - Version Control System: https://wiki.databurst.tech/docs/roadmap/version-control-system/ - git: https://wiki.databurst.tech/docs/roadmap/version-control-system/git/ - Version Control System Hosting: https://wiki.databurst.tech/docs/roadmap/version-control-system-hosting/ - Github: https://wiki.databurst.tech/docs/roadmap/version-control-system-hosting/github/ - Gitlab: https://wiki.databurst.tech/docs/roadmap/version-control-system-hosting/gitlab/ - BitBucket: https://wiki.databurst.tech/docs/roadmap/version-control-system-hosting/bitbucket/ - Distributed Systems Concepts: https://wiki.databurst.tech/docs/roadmap/distributed-systems-concepts/ - CAP: https://wiki.databurst.tech/docs/roadmap/distributed-systems-concepts/cap/ - PACELC: https://wiki.databurst.tech/docs/roadmap/distributed-systems-concepts/pacelc/ - Sharding: https://wiki.databurst.tech/docs/roadmap/distributed-systems-concepts/sharding/ - Clock: https://wiki.databurst.tech/docs/roadmap/distributed-systems-concepts/clock/ - ACID: https://wiki.databurst.tech/docs/roadmap/distributed-systems-concepts/acid/ - Replication: https://wiki.databurst.tech/docs/roadmap/distributed-systems-concepts/replication/ - Distributed Transactions: https://wiki.databurst.tech/docs/roadmap/distributed-systems-concepts/transaction/ - Indexing: https://wiki.databurst.tech/docs/roadmap/distributed-systems-concepts/indexing/ - Batch and Stream Processing: https://wiki.databurst.tech/docs/roadmap/distributed-systems-concepts/batch-and-stream-processing/ - Consistency vs Eventual Consistency: https://wiki.databurst.tech/docs/roadmap/distributed-systems-concepts/consistency-vs-eventual-consistency/ - Normalization or Denormalization: https://wiki.databurst.tech/docs/roadmap/distributed-systems-concepts/normalization-or-denormalization/ - SQL Fundamentals: https://wiki.databurst.tech/docs/roadmap/sql-fundamentals/ - Basic SQL: https://wiki.databurst.tech/docs/roadmap/sql-fundamentals/basic-sql/ - Advanced SQL: https://wiki.databurst.tech/docs/roadmap/sql-fundamentals/advanced-sql/ - Databases: https://wiki.databurst.tech/docs/roadmap/databases/ - Relational: https://wiki.databurst.tech/docs/roadmap/databases/relational/ - NoSQL: https://wiki.databurst.tech/docs/roadmap/databases/nosql/ - Columnar: https://wiki.databurst.tech/docs/roadmap/databases/nosql/columnar/ - Document Based: https://wiki.databurst.tech/docs/roadmap/databases/nosql/document-based/ - Key-Value: https://wiki.databurst.tech/docs/roadmap/databases/nosql/key-value/ - Time Series: https://wiki.databurst.tech/docs/roadmap/databases/nosql/time-series/ - Vector: https://wiki.databurst.tech/docs/roadmap/databases/nosql/vector/ - Graph: https://wiki.databurst.tech/docs/roadmap/databases/nosql/graph/ - NewSQL: https://wiki.databurst.tech/docs/roadmap/databases/nosql/newsql/ - Data Modeling: https://wiki.databurst.tech/docs/roadmap/data-modeling/ - Star Schema (Ralph Kimball): https://wiki.databurst.tech/docs/roadmap/data-modeling/star-schema/ - Snowflake: https://wiki.databurst.tech/docs/roadmap/data-modeling/snowflake/ - Data Vault: https://wiki.databurst.tech/docs/roadmap/data-modeling/data-vault/ - Data Management Architecture: https://wiki.databurst.tech/docs/roadmap/data-management-architecture/ - Relational Data Warehouse: https://wiki.databurst.tech/docs/roadmap/data-management-architecture/relational-data-warehouse/ - Data Lake: https://wiki.databurst.tech/docs/roadmap/data-management-architecture/data-lake/ - Modern Data Warehouse: https://wiki.databurst.tech/docs/roadmap/data-management-architecture/modern-data-warehouse/ - Data Fabric: https://wiki.databurst.tech/docs/roadmap/data-management-architecture/data-fabric/ - Data Mart: https://wiki.databurst.tech/docs/roadmap/data-management-architecture/data-mart/ - Data Lakehouse: https://wiki.databurst.tech/docs/roadmap/data-management-architecture/data-lakehouse/ - Data Mesh: https://wiki.databurst.tech/docs/roadmap/data-management-architecture/data-mesh/ - Data Integration: https://wiki.databurst.tech/docs/roadmap/data-integration/ - ETL: https://wiki.databurst.tech/docs/roadmap/data-integration/etl/ - ELT: https://wiki.databurst.tech/docs/roadmap/data-integration/elt/ - CDC: https://wiki.databurst.tech/docs/roadmap/data-integration/cdc/ - Reverse ETL: https://wiki.databurst.tech/docs/roadmap/data-integration/reverse-etl/ - Storage: https://wiki.databurst.tech/docs/roadmap/storage/ - Block Storage: https://wiki.databurst.tech/docs/roadmap/storage/block-storage/ - Object Storage: https://wiki.databurst.tech/docs/roadmap/storage/object-storage/ - File Formats and Serialization: https://wiki.databurst.tech/docs/roadmap/file-formats-and-serialization/ - File Formats: https://wiki.databurst.tech/docs/roadmap/file-formats-and-serialization/file-formats/ - CSV: https://wiki.databurst.tech/docs/roadmap/file-formats-and-serialization/file-formats/csv/ - JSON: https://wiki.databurst.tech/docs/roadmap/file-formats-and-serialization/file-formats/json/ - Parquet: https://wiki.databurst.tech/docs/roadmap/file-formats-and-serialization/file-formats/parquet/ - XML: https://wiki.databurst.tech/docs/roadmap/file-formats-and-serialization/file-formats/xml/ - Serialization: https://wiki.databurst.tech/docs/roadmap/file-formats-and-serialization/serialization/ - Avro: https://wiki.databurst.tech/docs/roadmap/file-formats-and-serialization/serialization/avro/ - Protocol Buffers: https://wiki.databurst.tech/docs/roadmap/file-formats-and-serialization/serialization/protobuf/ - Query Engine: https://wiki.databurst.tech/docs/roadmap/query-engine/ - Apache Hive: https://wiki.databurst.tech/docs/roadmap/query-engine/hive/ - SparkSQL: https://wiki.databurst.tech/docs/roadmap/query-engine/sparksql/ - Trino: https://wiki.databurst.tech/docs/roadmap/query-engine/trino/ - Presto: https://wiki.databurst.tech/docs/roadmap/query-engine/presto/ - Data Architecture: https://wiki.databurst.tech/docs/roadmap/data-architecture/ - Kappa: https://wiki.databurst.tech/docs/roadmap/data-architecture/kappa/ - Lambda: https://wiki.databurst.tech/docs/roadmap/data-architecture/lambda/ - Data Processing: https://wiki.databurst.tech/docs/roadmap/data-processing/ - Pipeline Orchestration: https://wiki.databurst.tech/docs/roadmap/pipeline-orchestration/ - Messaging and Streaming Platform: https://wiki.databurst.tech/docs/roadmap/messaging-and-streaming-platform/ - Data Governance: https://wiki.databurst.tech/docs/roadmap/data-governance/ - Data Quality: https://wiki.databurst.tech/docs/roadmap/data-governance/data-quality/ - Data Visualization: https://wiki.databurst.tech/docs/roadmap/data-visualization/ - Containerization: https://wiki.databurst.tech/docs/roadmap/containerization/ - Docker: https://wiki.databurst.tech/docs/roadmap/containerization/docker/ - Podman: https://wiki.databurst.tech/docs/roadmap/containerization/podman/ - containerd: https://wiki.databurst.tech/docs/roadmap/containerization/containerd/ - Container Orchestration: https://wiki.databurst.tech/docs/roadmap/container-orchestration/ - Kubernetes: https://wiki.databurst.tech/docs/roadmap/container-orchestration/kubernetes/ - Docker Swarm: https://wiki.databurst.tech/docs/roadmap/container-orchestration/docker-swarm/ - Apache Mesos: https://wiki.databurst.tech/docs/roadmap/container-orchestration/apache-mesos/ - CI/CD: https://wiki.databurst.tech/docs/roadmap/cicd/ - DataOps: https://wiki.databurst.tech/docs/roadmap/cicd/dataops/ - Infrastructure as Code: https://wiki.databurst.tech/docs/roadmap/infrastructure-as-code/ - Configuration Management: https://wiki.databurst.tech/docs/roadmap/infrastructure-as-code/configuration-management/ - Infrastructure Provisioning: https://wiki.databurst.tech/docs/roadmap/infrastructure-as-code/infrastructure-provisioning/ - Observability: https://wiki.databurst.tech/docs/roadmap/observability/ - Logging: https://wiki.databurst.tech/docs/roadmap/observability/logging/ - Monitoring: https://wiki.databurst.tech/docs/roadmap/observability/monitoring/ - Tracing: https://wiki.databurst.tech/docs/roadmap/observability/tracing/ - Glossary: https://wiki.databurst.tech/docs/roadmap/glossary/
$ man acid # BEGIN; ... COMMIT;
# ACID **ACID** is the set of guarantees a database gives a **transaction**, a group of reads and writes that should behave as one unit. A transfer of 100 from Alice to Sam is two updates; ACID promises that both happen or neither does, that concurrent transfers do not corrupt each other, and that a committed transfer survives a power cut.
A · Atomicity

All or nothing

If anything fails mid-transaction, every change is rolled back. Never "Alice debited, Sam not credited".

C · Consistency

Rules still hold

Constraints (foreign keys, CHECK balance >= 0, unique keys) are true before and after. Mostly your schema's job.

I · Isolation

Concurrency looks safe

Transactions running at the same time do not see each other's half-done work. How strictly depends on the isolation level.

D · Durability

Committed means saved

Once COMMIT returns, the change survives a crash: it is in the write-ahead log on disk (and often on a replica).

## How databases deliver it - **Atomicity and durability** come from the **write-ahead log (WAL)**: changes are appended to a log and flushed to disk before `COMMIT` returns. After a crash, the database replays committed work and discards the rest. - **Isolation** comes from **locks** and **MVCC** (multi-version concurrency control): readers see a consistent snapshot while writers create new row versions. - **Consistency** is shared: the database enforces the constraints you declare; your application must keep the rest of the business rules. ## Isolation is where the bugs live Atomicity and durability are rarely the problem in practice. Isolation is, because most databases do **not** run fully isolated by default. Here is the most common bug it causes. {{< fig kicker="$ psql -c 'SHOW default_transaction_isolation' # read committed" title="A lost update: two checkouts, one item" >}} product 7 has 1 left · T1 = Alice's checkout · T2 = Sam's checkout T1 ROW T2 time → stock 1 · orders 0 READ stock = 1 READ stock = 1 SET stock=0 · COMMIT stock 0 · orders 1 SET stock=0 · COMMIT stock 0 · orders 2 LOST UPDATE FIX SELECT … FOR UPDATE T2 waits on T1's lock, re-reads stock = 0, rejects the order. or SERIALIZABLE: T2 aborts and retries
  1. One item left in stock. Alice and Sam press "Buy" at the same moment, starting transactions T1 and T2.
  2. Both read stock = 1. Each sees "in stock", which was true when it looked.
  3. T1 computes 1 − 1 = 0, writes stock = 0, inserts an order and commits.
  4. T2 does the same math on its stale read and overwrites stock with 0. Two orders, one item: T1's decrement was lost. READ COMMITTED allows this.
  5. Fix it by locking the row (SELECT … FOR UPDATE), by an atomic UPDATE … SET stock = stock - 1 WHERE stock > 0, or by running at SERIALIZABLE and retrying aborted transactions.
{{< /fig >}} ## Isolation levels The SQL standard defines four levels by which anomalies they allow. Real databases differ in the details, so check yours. | Level | Dirty read | Non-repeatable read | Lost update | Write skew / phantoms | Default in | |---|---|---|---|---|---| | Read uncommitted | possible | possible | possible | possible | rarely used | | Read committed | prevented | possible | possible | possible | PostgreSQL, Oracle, SQL Server | | Repeatable read / snapshot | prevented | prevented | depends on DB | possible | MySQL InnoDB | | Serializable | prevented | prevented | prevented | prevented | CockroachDB, Spanner (strict serializable) | Notes that trip people up: - PostgreSQL's REPEATABLE READ is **snapshot isolation** and detects the lost update above (T2 gets a serialization error). MySQL's REPEATABLE READ does **not**, because a plain `SELECT` reads a snapshot while `UPDATE` writes the latest version. - Oracle's "SERIALIZABLE" is actually snapshot isolation and still allows **write skew** (two doctors both going off call because each saw the other still on call). - Serializable costs throughput and produces aborts, so the application **must retry** failed transactions. ## ACID's C is not CAP's C The same letter means two different things: | | ACID consistency | CAP consistency | |---|---|---| | About | Data obeys your rules (constraints, invariants) | Every replica returns the latest write (linearizability) | | Scope | One database, one transaction | Many replicas of the same data | | Broken by | A bug or a missing constraint | Replication lag, network partitions | | Read more | This page | [CAP]({{< relref "/docs/roadmap/distributed-systems-concepts/cap" >}}) | ## ACID in data engineering - **Warehouses** give ACID per statement or transaction, but isolation varies: Snowflake runs READ COMMITTED, BigQuery snapshot isolation, Redshift serializable or snapshot depending on configuration. - **Lakehouse table formats** (Apache Iceberg, Delta Lake, Apache Hudi) bring ACID commits to files on object storage: a commit atomically publishes a new version of the table metadata, and concurrent writers use optimistic concurrency (one wins, the other retries). - **NoSQL stores** traditionally offered single-row atomicity and **BASE** (basically available, soft state, eventually consistent). Many now add transactions: MongoDB multi-document transactions, DynamoDB `TransactWriteItems`. - Across databases or services you need [distributed transactions]({{< relref "/docs/roadmap/distributed-systems-concepts/transaction" >}}) or sagas. ## Common mistakes - **Read, compute in the app, write back.** That pattern is exactly the lost update. Prefer atomic SQL (`SET x = x - 1`) or explicit locks. - **Assuming the default level is serializable.** It almost never is. - **Long transactions.** Holding a transaction open while calling an external API keeps locks and old row versions alive. - **Not retrying.** Serialization failures and deadlocks are normal under load; wrap transactions in a retry loop. - **Turning off `fsync` or `synchronous_commit` for speed** and then being surprised that "committed" data vanished after a crash. ## Learning Resources ### Books - *Designing Data-Intensive Applications* (2nd ed.), Martin Kleppmann and Chris Riccomini: the transactions chapter - [Database Internals](https://www.oreilly.com/library/view/database-internals/9781492040330/), Alex Petrov: chapter 5, transaction processing and recovery ### Docs and papers - [PostgreSQL: Transaction Isolation](https://www.postgresql.org/docs/current/transaction-iso.html) - [A Critique of ANSI SQL Isolation Levels](https://www.microsoft.com/en-us/research/publication/a-critique-of-ansi-sql-isolation-levels/): Berenson et al., 1995 - [Hermitage](https://github.com/ept/hermitage): Martin Kleppmann's tests of which anomalies each database really allows - [ACID Transactions](https://www.yugabyte.com/acid/acid-transactions/), Yugabyte ### Videos - [ACID Properties in Databases With Examples](https://www.youtube.com/watch?v=GAe5oB742dw)