ACID started with three letters. Jim Gray's 1981 paper "The Transaction Concept: Virtues and Limitations" defines a transaction by atomicity, consistency and durability; isolation joined, and the four-letter acronym was coined, in a 1983 survey by Haerder and Reuter.
Transactions, partitions and replicas: what one machine promises
After this lesson you will run the slide's bank transfer through a commit, a rollback and a crash and name the property that saved it, explain why "buy a better machine" stops working and when, and say what partitioning and replication each buy and cost.
Account 12202 holds 100 and account 42177 holds 25. A bank's server starts moving 10 from the second account to the first: it adds 10 to 12202 — and the power fails before it can take 10 from 42177. For that instant the two accounts hold 135 instead of 125, ten units of money that came from nowhere, and the new balance 110 may already sit on the disk.
When the server comes back, who has the extra 10? Keep the question open. The first half of this lesson answers it with four letters that a single relational machine promises. The second half asks why, if one machine keeps its promises so well, the slides still draw "buy a better machine" as a staircase that runs out — even when the machine has 576 cores and 24 TB of memory.
The relational contract: a schema and a unit of work
The slides' example works on one table, Account, with an account number AccNum and a Balance. Before any transaction runs, its schema already promises three things, which p. 144 ("The data schema") lists as three bare words: Typing, Coherence, Uniformity. Fig. 1 shows what each one refuses.
Account before any row arrives, and the DBMS rejects every insert that does not fit — at write time.Typing: every column has a type, so a balance of 'ten' is refused. Coherence: integrity constraints — keys, references, conditions — keep the data consistent with itself, so a second account 12202 is refused. Uniformity: every row has the same columns. The slide gives only the three words; these glosses are their standard reading. Note when the checks happen: at write time, before the data is accepted. Lesson 4 is about systems that drop them on purpose.
A transaction is one unit of work
The next slide (p. 145) names three settings where transactions matter: "The relational world", "Multi-user", "Distributed systems". This lesson lives in the first two and ends at the door of the third.
Transaction — "An elementary unit of work performed by an application" (p. 146). It is encapsulated within two commands, begin transaction (bot) and end transaction (eot); within it exactly one of commit work (commit) or rollback work (abort) is executed.
The slides' example (p. 148) moves 10 from account 42177 to account 12202:
-- p. 148: transfer 10 from account 42177 to account 12202
begin transaction;
update Account
set Balance = Balance + 10 where AccNum = 12202;
update Account
set Balance = Balance - 10 where AccNum = 42177;
commit work;
end transaction;
Credit 12202, debit 42177, make both permanent. The order of the two updates does not matter; that they happen together or not at all does. The next slide (p. 149) adds a business rule — no overdraft — and lets the program choose how to end:
-- p. 149: commit only if 42177 does not go below zero
begin transaction;
update Account
set Balance = Balance + 10 where AccNum = 12202;
update Account
set Balance = Balance - 10 where AccNum = 42177;
select Balance into A from Account
where AccNum = 42177;
if (A>=0) then commit work
else rollback work;
end transaction;
After the debit, the program reads the new balance of 42177 into the variable A. If A is at least zero it commits; otherwise it executes rollback work — and the rollback cancels the credit to 12202 as well, although that update ran without error. The unit is the transaction, not the statement.
Well-formed transactions and the path of states
An application program is a sequence of such units (p. 147), and each must be well-formed (p. 150): begin transaction; code for data manipulation (reads and writes); commit work or rollback work; no data manipulation; end transaction. Fig. 2 draws the template twice, once for each outcome.
commit work or rollback work, touches no data after that, and closes."commit work ends the transaction." It decides the outcome; end transaction closes the unit afterwards, and between the two the template allows "no data manipulation". The outcome is decided once: commit or rollback is executed "exactly once" (p. 146), never both.
Under the template, p. 150 draws the transaction as a path of states: \(S_0\) before it, a new state after each write W1, W2, …, and \(S_r\), the result. Only the two ends are meant to be seen from outside. With the hook's balances (the slides give none): \(S_0\) = (100, 25), \(S_1\) = (110, 25) after the credit, \(S_r\) = (110, 15) after the debit.
ACID, one letter at a time
"A transaction is a unit of work enjoying the following properties: Atomicity, Consistency, Isolation, Durability" (p. 188). The slides give each letter its own page (pp. 189–192); here each one meets the transfer.
Atomicity: all or nothing
"A transaction is an atomic transformation from the initial state to the final state" (p. 189). Atomic means indivisible: seen from outside, the database either jumps from \(S_0\) to \(S_r\) or stays in \(S_0\), and \(S_1\) — the money from nowhere — is never where it ends. The slide lists three possible behaviours:
- "Commit work: SUCCESS" — the database reaches \(S_r\) and stays there.
- "Rollback work or error prior to commit: UNDO" — every write already made is undone, the newest first, back to \(S_0\).
- "Fault after commit: REDO" — committed writes that may not have reached the disk are applied again, up to \(S_r\).
Under the chain of states the slide draws UNDO arrows back to \(S_0\) and a REDO arrow forward to \(S_r\). Make them happen.
How does a restarted server know what to undo or redo? The slides only name the mechanisms: "Abort-rollback-restart" under atomicity, "Recovery management" under durability (p. 193). The widget shows the textbook answer, background rather than slide material: a log. Every write is first recorded in a log on stable storage, with the old and the new value, before the changed balance itself may reach the disk; commit work appends a commit record. At restart, a transaction without a commit record is undone with the old values; one with a commit record is redone with the new ones.
Consistency: constraints in, constraints out
"The transaction satisfies the integrity constraints"; consequence: "If the initial state is consistent, Then the final state is also consistent" (p. 190). Only the two ends count. Under a rule "the total of all balances never changes", \(S_1\) would be illegal — 135 instead of 125 — and that is allowed, because \(S_1\) is neither the start nor the end.
Which constraints? Those declared in the schema are checked by the DBMS itself; p. 193 calls it "integrity checking of the DBMS". A rule nobody declared, like "no overdraft" here, is the application's job — the if (A>=0) of p. 149. Had the bank declared "balance at least zero" on the column, the DBMS would have refused the debit with an error, and that error before commit would have triggered the UNDO.
Isolation: no half-finished state on show
"A transaction is not affected by the behavior of other, concurrent transactions"; consequence: "Its intermediate states are not exposed" and “The ‘domino effect’ is avoided” (p. 191, over a picture of falling dominoes). The slide does not spell the dominoes out; Fig. 3 shows their standard reading, a cascade of rollbacks.
Before: no isolation
After: isolation
Without isolation, an interest transaction T₂ could read 110 from 12202 while the transfer T₁ sits in \(S_1\). If T₁ then rolls back, T₂ has paid interest on money that never existed and must roll back too — and so must T₃, which read T₂'s result. With isolation T₂ reads the committed 100, or waits for T₁ to finish, and the first domino never falls. Isolation does not mean one transaction at a time: they still run concurrently, kept apart by "concurrency control" (p. 193).
Durability: committed means forever
“The effect of a transaction that has successfully committed will last ‘forever’”, "Independently of any system fault" (p. 192). Once commit work has run, no crash may bring back 25 for account 42177. Durability is the promise and REDO is how a restarted server keeps it, which is why p. 193 files it under "recovery management". That slide is the one to learn as a table:
| Property | Mechanism (p. 193) | In the transfer |
|---|---|---|
| Atomicity | Abort-rollback-restart; Commit protocols | the rollback of p. 149 cancels the credit too |
| Consistency | Integrity checking of the DBMS | a declared constraint, such as the key AccNum, holds at the end |
| Isolation | Concurrency control | nobody reads 110 before the commit |
| Durability | Recovery management | a crash after the commit is answered with REDO |
"Commit protocols" sit under atomicity because of the third setting of p. 145: when the two accounts live on two machines, both must commit or both must abort, and a protocol — two-phase commit is the classic one, background here — makes them agree. Lesson 5 shows what keeping machines in agreement costs once the network between them can fail.
Where ACID lives: OLTP, and why relational stayed
The definition slide calls a system that runs transactions "on behalf of multiple, concurrent applications" a Transactional System (OLTP), "As opposed to OLAP" (p. 146). OLTP is the bank counter: many short transactions like the transfer, each touching a few rows of current data. OLAP is the analyst: long read-only queries that scan and aggregate history, such as the average balance per branch over ten years. ACID was built for the first; the data warehouses of lesson 23 serve the second.
This is also the slides' answer to "Why didn't we change Relational?" (p. 205): it is "Consolidated", it is an "Integration platform" — the one database many applications share — and it is "Granting ACID properties!". Nothing in this half of the lesson is broken. What breaks is the size.
How big is big? Scaling up or scaling out
A slide of three lines (p. 158) sets the agenda: "How big is big?", "Not only scaling up", "Elasticity". The answer begins on p. 177 with two bullets in deliberate parallel:
“Adding data to a ‘traditional’ SQL system may degrade its performances.” When the machine "no longer performs as required, the solution is to buy a better machine (with more RAM, more cores and more disk)".
"Adding data to a Big Data solution may degrade its performances." When the machines "no longer performs as required, the solution is to add another machine".
Both degrade as data grows; only the remedy differs. Vertical scaling — scaling up — replaces the machine with a better one. Horizontal scaling — scaling out — adds a machine next to the ones you have. Fig. 4 is the picture to keep.
Scale up: replace the machine
Scale out: add machines
Vertical scaling has a cost curve (p. 178): cost against data size, rising through "commodity hardware", then "appliance", then "exceptional hardware", each segment steeper than the one before. The slides put numbers on the first two classes:
| Commodity hardware (p. 179) | Appliance (p. 180): Oracle Exadata Database Machine X6-8 | |
|---|---|---|
| CPU | 8–32 cores | 576 cores |
| RAM | 16–64 GB | 24 TB |
| Disk | 1–3 TB | 360 TB of flash storage per rack |
| Network | 10 GE | 40 Gb/second InfiniBand |
One appliance rack has 18 to 72 times the cores and 375 to 1,500 times the memory of one commodity server. On the slide's curve each class costs more per terabyte than the one below it, and after "exceptional hardware" there is nothing left to buy: the curve leaves the top of the chart.
Horizontal scaling (p. 181) is one straight line labelled “‘only more’ commodity hardware”: every further slice of data costs about one more cheap machine. The line does not start at zero; the slide leaves the gap unexplained, and the natural reading is the price of having a cluster at all — several machines, a network, the software and the people to run them.
Overlay the two (p. 182) and the chart splits: "Use vertically scalable solutions" on the left, where one machine is cheaper than any cluster; "Use horizontally scalable solutions" on the right, where the staircase has shot past the line. Around the crossing lies “The ‘grey area’” (p. 183), where neither is clearly cheaper and other reasons decide. The last slide of the set is the one to remember: “The ‘grey area’ is time dependent” (p. 184).
Page 184 draws four lines of horizontal scaling, one per generation of distributed platforms. "Hadoop 2.x using clusters on premises (2006)" crosses the staircase near 10 PB, "Hadoop 2.x using cloud-based services (2010)" near 1 PB, "Spark 1.6 using cloud-based service (2013)" near 100 TB, and "Spark on HDInsight (today)?" near 10 TB. Each generation made a cluster cheaper to start and cheaper per terabyte — rented in the cloud instead of bought, with better software on top — so the line sank and the crossing slid left by a factor of ten each time.
"How big is big?" has no fixed answer: big starts where many cheap machines cost less than one good one, and on p. 184 that threshold fell a thousandfold, from about 10 PB to about 10 TB.
"Not only scaling up" also points the other way: what scales out can scale back in. Elasticity — the slide names it without a definition; the meaning comes from cloud computing — is adding machines when the load grows and releasing them when it falls, so that cost follows load. It comes naturally to horizontal scaling, where a machine is a unit you can rent for a month; nobody hands back half an appliance.
Split it, copy it: partitioning and replication
Spreading data over many machines takes two moves, and a section title of the slides names both: partitioning and replication. Both start from "the traditional tabular view of a database" (p. 152), where a table can be cut by columns or by rows.
Vertical: by columns
Horizontal: by rows
Vertical partitioning gives each piece a group of columns, with the key AccNum repeated so that rows can be joined back. Horizontal partitioning gives each piece a group of whole rows with the same columns — here the Milano accounts on one node and the Como accounts on the other. A rule decides which row goes where; later lessons call its input the shard key (MongoDB, lesson 16) and the partition key (Cassandra, lesson 21).
Partitioning — "Aim: scalability, distribution." — "splits the data in the database and partitions pieces of it to different storage nodes" (p. 153): one database of three layers A, B, C, an arrow "SPLIT", three separate databases. The same slide adds two sentences that pull in different directions: "Databases can be sharded horizontally (by rows) or vertically (by columns)" and "See also: Sharding (as horizontal partitioning)".
"Sharding and partitioning are the same thing." Partitioning is the general move, by rows or by columns. Sharding is its horizontal form: whole rows spread over nodes, as the slide's own last line says. The sentence before it uses "sharded" loosely for "partitioned". Know both sentences as printed — the exam is matched against the slides — and in your own answers keep "sharding" for rows on different machines.
Replication — "Aim: fault-tolerance, backup" (p. 154) — copies instead of splitting: one database, an arrow "COPY", two identical databases. The sentence printed under the aim needs a correction.
"Partitioning + Replication — Possible?" asks p. 155, and its picture answers: copy the A/B/C database into two identical databases, then split each copy into A, B and C — six nodes, every piece on two of them. Splitting first and copying each piece gives the same layout, and real systems describe it that way: a number of shards, each stored a fixed number of times, its replication factor (the term of later lessons, not of these slides). Then the slides weigh the two moves (p. 156):
| Partitioning | Replication | |
|---|---|---|
| Pros | Fast data writing / reading. Low memory overhead. | Fast data reading. High data reliability. |
| Cons | Potential data loss | High network overhead. High memory overhead. |
Every cell has a mechanism behind it. A partitioned node holds and serves only its piece, so the work spreads and each datum is stored once — but a dead node takes its piece with it. A replicated datum can be read from any copy and survives while one copy does — but every write must reach every copy, and \(N\) copies take \(N\) times the space. The sandbox shows both columns at once.
How much safer is "safer"? The slides stop at the table. A back-of-envelope model, not from the slides, gives numbers under one assumption: nodes fail independently, each with probability \(p\).
A shard is lost only if all \(N\) of its copies are on failed nodes. With independent failures: \[ P(\text{shard lost}) = p^N . \]
So a shard survives with probability \(1 - p^N\), and all \(k\) shards survive together — they sit on different nodes, so their fates are independent too — with \[ (1 - p^N)^k . \]
Losing something is the complement: \[ P(\text{data lost}) = 1 - (1 - p^N)^k . \]
Partitioning alone, \(N = 1\): \(1 - (1 - p)^k\) grows with \(k\), about \(k\) times \(p\). With \(p = 0.01\) and \(k = 3\) it is 2.97 %: more pieces, more ways to lose one — the table's "potential data loss".
Replication alone, \(k = 1\): \(p^N\) collapses, 0.01, then 0.0001, then 0.000001 for \(N\) = 1, 2, 3. Both, \(k = N = 3\): about 3 in a million, for three times the storage.
Independence is the assumption behind Bernoulli trials in statistics, and it is the weak point: a fire or a power cut takes a whole rack down at once. That is why the HDFS slides of lesson 31 put the "Second replica on a remote rack" (p. 857). And one cost is missing from the table altogether: the copies must agree. A write does not reach every copy at the same instant, so for a moment two copies of the same row can differ — remember that for the last section.
Getting data in: ingestion and wrangling
The "Data Architecture Concepts" deck closes its scaling section at the other end of the pipe (pp. 157–160, "Scale and Ingestion"): before data can be split and copied, it has to arrive and become usable. Data ingestion is "The process of importing, transferring and loading data for storage and later use"; "It involves loading data from a variety of sources" and "can involve altering and modification of individual files to fit into a format that optimizes the storage" (p. 159).
The slide's example is pure engineering: "in Big Data small files are concatenated to form files of 100s of MBs and large files are broken down in files of 100s of MB." Hundreds of megabytes is what the distributed file system of lesson 31 wants — "Typically 100MB or more per file", "Millions as opposed to billions of files" (p. 847) — because one server, the NameNode, holds the record of every file: "The entire metadata is in main memory" (p. 855). Around a "bus" that collects the sources, "Integration services" do "Transportation management, message routing, message brokering, transaction management, security, and transformation" — the top band of Fig. 6.
Data wrangling turns what arrived into something worth analysing: “cleansing ‘raw’ data” so that it "can be analysed to generate valid actionable insights", by "understanding, cleansing, augmenting and shaping data", with the result "in the best format (e.g., columnar) for the analysis to perform" (p. 160). The four boxes: understand which types of data there are (qualitative, quantitative, categorical), whether there are outliers, whether data is missing; cleanse — remove outliers, add missing values, transform quantitative values into categorical ones; augment — aggregate data within one source, add data from other sources by exact or fuzzy matches; shape — give the data the best format for the analysis.
If this sounds like the preprocessing done before training a neural network, it is — done once for a whole company and kept running as a pipeline. Lesson 4 places both bands in the architecture of a big-data system; lesson 33 opens the ingestion tools and lessons 35–37 the wrangling.
Back to the missing 10
Now the hook. Who has the extra 10 when the server comes back? Nobody. The power failed before commit work, so the log holds the credit and no commit record: the restart undoes the credit, 12202 is back to 100, and the two accounts hold 125 again. Had the power failed one line after the commit, the restart would redo both writes and the transfer would stand at 110 and 15, whatever had reached the disk. \(S_1\) is never an outcome and never on show — atomicity and isolation — and a committed outcome stays — durability.
Why, then, give up a machine that keeps such promises? Not because of the promises; because of the machine. Its staircase runs out, and the size at which a cluster wins kept falling, from about 10 PB to about 10 TB on p. 184. Beyond it the data is partitioned and replicated — and the hook's question comes back in a new form.
Which copy is right — and when 12202 and 42177 sit on different shards, who makes sure that both writes happen or neither? That is the third setting of p. 145, "Distributed systems". Lesson 5 takes up the first question: the CAP theorem, and the BASE properties that many distributed stores offer instead of ACID.
Exam-style questions
Theory questions in the form of the written exam — open answers of a few sentences, and closed questions (multiple choice, true or false) where a wrong answer may carry a penalty — plus two small exercises: one on the slides' own transaction, one on the arithmetic of partitioning and replication.
Define a transaction. Which commands delimit it, which commands decide its outcome, and when is a transaction well-formed?
Show model answer
A transaction is an elementary unit of work performed by an application. It is encapsulated between begin transaction (bot) and end transaction (eot), and within it exactly one of commit work (commit) or rollback work (abort) is executed. A transaction is well-formed when it has the structure: begin transaction; code for data manipulation (reads and writes); commit work or rollback work; no data manipulation; end transaction — that is, no read or write happens after the outcome has been decided. A system that provides the definition and execution of transactions on behalf of multiple, concurrent applications is a transactional system (OLTP), as opposed to OLAP.
A complete answer has three parts: the slide's definition, "exactly once" for commit or rollback, and the "no data manipulation" step between the outcome and end transaction. The OLTP sentence shows you read p. 146 to the end.
List the ACID properties of a transaction. For each one, give a one-sentence definition and the mechanism the DBMS uses to guarantee it.
Show model answer
Atomicity: a transaction is an atomic transformation from the initial to the final state — all of its effects or none; commit work means success, rollback work or an error before the commit means UNDO, a fault after the commit means REDO. Mechanisms: abort-rollback-restart and commit protocols. Consistency: the transaction satisfies the integrity constraints, so if the initial state is consistent the final state is consistent too (intermediate states may violate them). Mechanism: integrity checking of the DBMS. Isolation: a transaction is not affected by the behaviour of other, concurrent transactions; its intermediate states are not exposed, so the domino effect of cascading rollbacks is avoided. Mechanism: concurrency control. Durability: the effects of a committed transaction last forever, independently of any system fault. Mechanism: recovery management.
The pairing of p. 193 fits a closed question just as well: learn it as a table. An easy slip is to put "commit protocols" under durability; the slide puts them under atomicity.
True or false: when a system fault happens after a transaction has executed commit work, the DBMS undoes the transaction's writes at restart.
Show model answer
False. A fault after the commit requires REDO, not UNDO (p. 189): the effects of a committed transaction must survive any system fault (durability, p. 192). UNDO applies to rollback work and to errors before the commit.
With a possible penalty, answer only if you can say which side of the commit the fault is on: that single fact decides between UNDO and REDO.
Explain the difference between vertical and horizontal scalability, and say which one traditional SQL systems use and which one Big Data solutions use. What is the "grey area", and why is it time dependent?
Show model answer
In both kinds of system adding data may degrade performance; the difference is the remedy. Vertical scalability (scaling up), used by traditional SQL systems, replaces the machine with a better one, with more RAM, more cores and more disk; its cost rises in a convex staircase from commodity hardware to appliances (for example an Oracle Exadata X6-8 rack: 576 cores, 24 TB of RAM) to exceptional hardware, and then there is nothing bigger to buy. Horizontal scalability (scaling out), used by Big Data solutions, adds another machine; its cost is a straight line of "only more" commodity hardware with a fixed starting cost. So for small data one machine is cheaper, for big data the cluster is. The grey area is the band of data sizes around the crossing of the two cost curves, where neither is clearly cheaper. It is time dependent because distributed platforms keep getting cheaper and easier (Hadoop on premises, Hadoop in the cloud, Spark in the cloud, Spark on a managed service), so the horizontal line sinks and the crossing moves to smaller sizes: roughly 10 PB, 1 PB, 100 TB and 10 TB on the slide.
A complete answer names the remedy as the difference (not "SQL is slow"), the two shapes of cost and the drift to the left. Quote the trend rather than the years: the slide's years and version numbers do not match.
Compare data partitioning and replication: the aim of each, one advantage and one disadvantage of each, and whether the two can be combined.
Show model answer
Partitioning splits the data and places the pieces on different storage nodes, horizontally by rows (sharding) or vertically by columns; its aim is scalability and distribution. Pros: fast data writing and reading, because each node handles only its piece, and low memory overhead, because each datum is stored once. Con: potential data loss, because a failed node takes its piece with it. Replication keeps copies of the same data on several nodes; its aim is fault tolerance and backup. Pros: fast data reading, because any copy can answer, and high data reliability. Cons: high network overhead, because every write must reach every copy, and high memory overhead, because every copy costs storage. The two combine: split the data into partitions and store each partition on several nodes (or copy, then split), so that every piece survives the failure of a node — the usual layout of distributed databases.
Half of the answer is the four cells of the table on p. 156, the other half is the "because" behind each cell. If you use the slide's definition of replication ("the entire database across all nodes"), add that real systems copy each partition a fixed number of times.
A bank stores its accounts in the table Account(AccNum, Balance). Account 12202 holds 100 and account 42177 holds 5. The following transaction (the slides' "Example with Alternative", p. 149) runs to its end without failures. Which balances does the database hold after end transaction?
begin transaction;
update Account
set Balance = Balance + 10 where AccNum = 12202;
update Account
set Balance = Balance - 10 where AccNum = 42177;
select Balance into A from Account
where AccNum = 42177;
if (A>=0) then commit work
else rollback work;
end transaction;
Show model answer
12202 holds 100 and 42177 holds 5. After the two updates A = 5 − 10 = −5, the condition A >= 0 is false, the program executes rollback work, and the DBMS undoes both writes (atomicity): the database returns to its initial state.
The trap is the credit: it ran without error, yet the rollback cancels it. The third task of the transaction stepper rehearses exactly this run.
A hospital keeps its patient records in a database of 2 TB. The database is horizontally partitioned into 4 shards of equal size, and every shard is stored with a replication factor of 3, each copy on a different node. How much data does the cluster store in total?
Show model answer
6 TB. Each shard holds 2 / 4 = 0.5 TB and is stored 3 times, so 4 × 3 = 12 nodes hold 0.5 TB each: 12 × 0.5 = 6 TB. The number of shards does not change the total; only the replication factor does: total storage = replication factor × database size = 3 × 2 TB.
Partitioning spreads the data, replication multiplies it: the "low memory overhead" and "high memory overhead" cells of p. 156 in one number. The usual slip is to multiply by the number of shards as well.
Check yourself
The power fails right after the first update of the transfer: 12202 has been credited, 42177 not yet debited. After the restart the two accounts hold…
During the transfer the database passes through \(S_1\): 12202 credited, 42177 not yet debited. Which statements are true? Select all that apply.
\(S_1\) exists, but only inside the transaction: nobody sees it, and no crash leaves it behind.
Two transactions add interest to account 12202 at the same moment. Which property, and which mechanism of p. 193, makes the result the same as if they had run one after the other?
A bank splits its accounts by branch over four servers and keeps no copies. One server's disk is destroyed. In the terms of the table on p. 156, what happened?
You raise the replication factor from 1 to 3 and keep the same shards. What gets worse? Select all that apply.
On the 2006 line of p. 184 (Hadoop on premises), which choice was cheaper for a 300 TB database?
A web shop needs ten servers in December and three in July. Which word of p. 158 names renting ten for December and handing seven back in January?
Key take-aways
- The relational schema promises typing, coherence and uniformity, checked at write time. A transaction is "an elementary unit of work" between
begin transactionandend transaction, with exactly onecommit workorrollback work, and a well-formed one touches no data after the outcome. - Atomicity takes the database from \(S_0\) to \(S_r\) or not at all: commit gives SUCCESS, rollback or an error before commit gives UNDO, a fault after commit gives REDO — and a rollback cancels the credit to 12202 too.
- Consistency checks the two ends against the integrity constraints, isolation hides intermediate states and stops the domino effect, durability keeps committed effects through any fault. Mechanisms: abort-rollback-restart and commit protocols; integrity checking of the DBMS; concurrency control; recovery management.
- Vertical scaling buys a better machine along a convex staircase that ends; horizontal scaling adds "only more" commodity machines along a straight line with a starting cost. The grey area around their crossing moved from about 10 PB to about 10 TB: how big is big depends on when you ask.
- Partitioning (scalability, distribution) splits data by rows — sharding — or by columns: fast and lean, but a lost node loses data. Replication (fault tolerance, backup) copies data: fast reads and reliability, for network and memory overhead. Real systems combine them, each shard with a replication factor.
- Ingestion imports and loads data from many sources, reshaping files into hundreds of megabytes; wrangling understands, cleanses, augments and shapes it for analysis.
What to watch and read
-
Distributed Systems in One Lesson
Tim Berglund, Devoxx Poland
A database that outgrows one machine, told as a story: why the bigger box stops working, then sharding and replication and what breaks the moment data lives on two machines — the second half of this lesson in one talk.
-
Sharding
MongoDB manual
Look for the part where every shard is itself a replica set: the answer to the "Possible?" of p. 155 in a real product, with hashed and ranged pictures of horizontal partitioning. You will meet it again in lesson 16.
-
Transactions: myths, surprises and opportunities
Martin Kleppmann, Strange Loop 2015
What each ACID letter really guarantees and why consistency is the odd one out — it belongs to the application's rules, like the overdraft check of p. 149.
-
The Transaction Concept: Virtues and Limitations
Jim Gray, VLDB 1981
The paper behind the story box: transactions defined by atomicity, consistency and durability, before isolation joined and ACID got its name.
-
Distributed systems: for fun and profit
Mikito Takada
Chapter 1 covers scalability, partitioning and replication in a few pages, with the vocabulary of the later lessons; chapters 4–5 go on to keeping replicas in agreement, the bridge to lesson 5.