Skip to main content
Database Design and Applications

Database Recovery, Checkpointing, and the NoSQL Shift

Published: 2026-08-06
Level: postgraduate
Audience: Postgraduate students in Database Design and Applications

Prerequisite Knowledge

This lecture builds on the following concepts from earlier lectures. If any feel unfamiliar, review the linked notes before proceeding.

Previously Covered in This Subject

  • Transactions, schedules, and ACID — covered in Lectures 14 (14.6–14.7) and 15 (15.2)
  • Conflict serializability and the precedence graph — covered in Lectures 15 (15.5–15.6) and 16 (16.1)
  • View serializability and blind writes — covered in Lecture 15 (15.7)
  • Recoverability and cascading rollback — covered in Lecture 15 (15.8–15.9)
  • Lock-based and timestamp-based concurrency control — covered in Lectures 15 (15.10) and 16 (16.2–16.4)
  • Relational versus NoSQL document databases — covered in Lectures 3 (3.10) and 4 (4.2)

17.1 Comprehensive Examination: Scope, Strategy, and Grading

17.1.1 The Syllabus Is the Handout

The last session opens with a simple and blunt statement about the comprehensive examination: whatever is in the handout is part of it. That "whatever" really means whatever — it includes the topics written in the handout, the topics covered in the live sessions, and the topics covered in the recorded sessions. There is no hidden division between "the handout part" and "the taught part". If a topic appears anywhere in the handout, it is examinable, even if the live sessions never touched it. This is why the session spends its first twenty minutes on preparation strategy rather than new material: everyone needs to plan the remaining days with an accurate map of the syllabus.

Think of it like a travel plan. You would not set off on a multi-day trip without deciding which cities are actually on the route — yet students often study a subject by opening the textbook at chapter one and reading linearly. The handout is the route map: topics that appear anywhere in it — written, live, or recorded — are on the route and can be asked. Topics that do not appear are off the route, no matter how interesting they look. Every hour you spend on an off-route topic is an hour you cannot spend on an on-route one, and with a fixed number of days left, the map is decided before the driving begins.

The topic list itself is a review of the whole course: normalization, the ER model, the basics of SQL, relational algebra, relational calculus, B-tree and B+ tree indexing, database security, access control, and recovery — the last one being the main technical content of this final session. On indexing, the advice is blunt: B-trees and B+ trees must already be practiced. An open-book examination does not forgive "we do not know anything about this" for something that is part of the course.

Examinable territory — the full list. Everything in the handout is examinable, including live and recorded session topics. Concretely, the covered topics are: normalization, the ER model, SQL basics, relational algebra, relational calculus, B-tree and B+ tree indexing, database security and access control, and recovery. B-trees and B+ trees must be practiced — you must be able to insert into, delete from, and search a tree by hand — not merely read about once. The open book helps you find a formula or definition; it does not help you learn a procedure you never drilled.

Pitfall: treating the open book as a substitute for practice. "It is an open-book exam, so I can just look it up" is the fastest way to lose marks on procedural topics. For a B-tree question, there is no time in the exam hall to learn the insertion algorithm from the index. The open book is for finding material you already know — a definition, a formula, a chapter — not for learning it. The same rule applies to anything else in the list: if you have not executed the procedure by hand at least a few times before the exam, you have not practiced it.

Exam note: everything in the handout is part of the comprehensive examination, including live and recorded session topics. B-tree and B+ tree indexing must be practiced, not read once.

17.1.2 What This Course Is Really Judged On

Before any topic details, the session states the benchmarks the course is judged against. The first is experiential learning: you must have designed a database, worked on a database, edited a database, and ideally integrated that database into an application. The assignment was the component that carried the experiential learning load — actually building something, not just reading about building something. The second benchmark is knowledge of the internals of a database management system. The point is made with a comparison: plenty of people can write a select statement and do basic CRUD operations. The difference between you and everyone else is whether you can sit with a client, understand their requirements, design a schema, create the indexes, let the application access the database concurrently, and make sure it is recoverable — all in a professional manner. Query proficiency is a third benchmark, and so is the ability to keep a database optimized in challenging situations. These are the "north poles" against which performance is judged.

The select-statement person versus the professional. The benchmark is not "can you run a query" — almost anyone can. It is whether you can walk through the entire lifecycle of a database product: sit with a client and extract the real requirements, design a schema that models them, create the indexes that make queries fast, hand the database to an application that accesses it concurrently from many machines, and keep the data recoverable when hardware fails. Query proficiency is still a benchmark — but a junior one. The "north poles" that separate skill levels are internals knowledge, experiential design, concurrency, and recovery.

Real-world: the description of a professional database person — requirements gathering, schema design, index creation, concurrency, recovery — is exactly the skill set a working database administrator or backend engineer is paid for. An interview question like "your application is slow, what do you check first?" is answered from the internals and indexing portion of this list; a production incident is resolved from the concurrency and recovery portion. The course is deliberately built so that every benchmark maps to a real professional duty.

17.1.3 Relative Grading and the Fifty Percent Average

Grading is relative, and the session is explicit about what that means. If everyone scores 190 and you score 89, that is not good for you; if everyone scores 50 and you score 60, that is good for you. Individual marks out of 30 or out of 100 do not define a result by themselves — the position relative to everyone else does. This relative system is also what allows questions that are challenging and thorough.

Worked example: why absolute marks are meaningless here.

Take two imaginary course results and compare them:

  • Case A: The class average in the final is 190 out of 200. You score 89 out of 200. Absolutely, 89 is more than half the paper — but relatively, you are more than 100 marks below where everyone else sits. In a relative scheme, that is a poor result.
  • Case B: The class average is 50 out of 100. You score 60 out of 100. Absolutely, the number 60 looks no better than the number 89 in Case A — but relatively, you are above the pack. In a relative scheme, that is a good result.

The same conclusion in both: the position relative to the class decides the result, not the raw number. The consequence for strategy is direct — a hard paper that everyone finds tough is an opportunity, because a modest absolute score can still place you well. A paper full of easy questions raises the bar for everyone.

Sense-check: if marks were absolute, Case A's 89 would beat Case B's 60. The professor's examples deliberately contradict that intuition to show that relative position, not absolute score, is what counts.

The second part of the grading picture is the average guideline. The heuristic passed to the evaluation team is that the average for the course should be near 50 percent. For a 100-mark paper, the relative average should sit close to 50. The same idea applies component by component: if an assignment average was very low, say an average of 5 out of 30, that is a signal about how that component was graded, not about you personally. The 50-percent average is a guideline for the whole course, and it separates the people who practiced and thought hard from the people who came without spending time. Nobody is labelled a failure or a success — the marks simply separate skill from its absence.

Exam note: the course average guideline is 50 percent, and grading is relative. A low average in a component means marks were given tightly, not that everyone underperformed. Conversely, a very high average means marks were given loosely. In either direction, your standing is decided by your position relative to the class — so the practical question is never "what mark did I get?" but "where do I sit?"

17.1.4 Q&A: What Does Self-Study Mean?

A student asks about the "additional topics" section of the handout: query optimization, the XML data model, database programming, distributed databases and client-server architecture, and recent trends in databases. The question is whether these are part of the course, or whether they should be read after the exam simply to be more complete as a database person.

Q: The additional topics — query optimization, XML data model, database programming, distributed databases and client-server architecture, recent trends — what do you mean by self-study? Are they part of the course, or do we read them after the exam?

A: We need a strategy, and a strategy is designed for a particular outcome. Our immediate objective is the comprehensive examination. The constraint is time — and really, energy: when someone says they have no time, usually what they lack is energy, because energy is being drained by everything else going on in professional and personal life. The strength we have is that this is an open-book examination: you should know where each topic lives in a textbook and how to find the way to handle a question there. Given all three, the recommendation is to put your energy where the marks are. Topics after the mid-semester were assessed only feebly in the quizzes, so expect more opportunity to showcase skills in those topics. Self-study topics, even in the worst case, are at most around 10 marks out of 40; the 30 to 37 marks that are "in your plate" come from topics you can practice. The plan: seven days, one hour per day, and on one of those days go through a previous-year question paper, find each question in the book, and put bookmarks or ear-tags so you can navigate straight to it.

Exam note: the strategy is a three-part calculation — objective (the comprehensive examination), constraint (time and energy), and strength (open book). Its conclusion: put energy where the marks are. Self-study topics — query optimization, XML data model, database programming, distributed databases and client-server architecture, recent trends — carry at most about 10 marks out of 40 even in the worst case, while the practiced topics carry roughly 30–37. The plan is mechanical and bounded: seven days, one hour a day, with one day spent on a previous-year paper — matching each question to its page in the book and ear-tagging it for the exam hall.

17.1.5 Q&A: Open-Book Rules and the Bound-Notes Strategy

A student raises a practical crisis: the published open-book examination guidelines say that handwritten notes, loose sheets, and solved solutions must not be carried. But this student had prepared simplified, lucid notes — tips from the course written in plain language instead of complex textbook prose — and those are exactly the notes that would help in the exam hall. What is really allowed?

Q: The open-book guidelines say we should not carry handwritten notes, loose sheets, or solved solutions. I have simplified my own notes with tips and tactics from the course — what is really allowed, and what should we do?

A: The examination team decides this, not the instructor. Ask them directly: are bound notes allowed — tape binding, hard binding, spiral binding, or a notebook format? Even if loose notes are barred, bound notes are not loose notes. But do not ask in person and walk away: create a trail of evidence. Take a written reply, or a photocopy or photograph of your question and their answer. Frame your request the way you would frame any problem to any authority: first state the action taken, the problem it creates, and the consequence — "I prepared using my notes; if I cannot carry them I may score poorly because of how I prepared". Second, list the options: tape binding, hard binding, spiral binding, book format. Third, evaluate each option by its constraints and advantages — a bound book is easy for an evaluator to accept but takes time and money to produce. Fourth, give your recommendation and ask "is it okay for me to do that?". When you present problem, consequence, options, evaluation, and recommendation, the person across the table has nothing left to say but yes.

The problem–consequence–options–evaluation–recommendation pattern. This is the five-part frame used for approaching any authority:

  1. Problem + consequence — state what you did and what happens if nothing changes. The consequence is what makes the problem real to the other person.
  2. Options — enumerate the alternatives, not just one request. Binding options: tape binding, hard binding, spiral binding, notebook format.
  3. Evaluation — weigh each option. A bound book is easy for an evaluator to accept (it cannot be exchanged mid-exam like a loose sheet) but costs time and money to produce.
  4. Recommendation — pick one and ask for a yes: "is it okay for me to do that?"

The professor's business-school point: never walk in with "what should I do now?" — walk in with the decision nearly made, and the other person's job shrinks to approving it. The same pattern works for an exam notice, for a manager, for anyone whose only job is to say yes.

The strategy point is made sharper with a second example: the reason the exam team may have banned loose notes is probably not hostility — it may be that loose sheets can be exchanged during the examination. Hypothesize the reason behind a rule before attacking the rule. If printouts of slides, photocopies, and handwritten notes are all separately questioned, think from the inspector's perspective about why each was restricted, then align your request with the shared objective: the exam exists so students can demonstrate skill, and the rules exist to keep it fair. Business schools teach exactly this pattern: when a problem arrives, never walk in and ask "what should I do now?" — walk in with the consequence, the options, the evaluation, and the recommendation. It works for an exam notice, for a manager, for anyone whose only job is to say yes.

Pitfall: attacking the rule without asking why the rule exists. The likely reason loose sheets are banned is not hostility — loose sheets can be passed between students during the examination. Once you hypothesize that reason, your request aligns itself: bound notes cannot be passed, so they do not threaten the fairness the rule protects. Always ask what problem the rule solves before you fight it; the request that acknowledges the rule's purpose is the one that gets approved.

17.1.6 Q&A: Marks, SQL Evaluation, and Answer-Writing Strategy

Three student questions land together here, and each one sharpens a different part of the examination strategy.

Q: How many marks can we expect in the paper?

A: The guideline given to the evaluation team is that the average should be 50 percent for the entire course. If the average in a component is far from that, it tells you the component was graded tightly or loosely. What you personally can expect depends on your practice and your level — the 50 percent is an average, not a promise.

Q: Why was my query judged wrong? I ran it and it seemed correct.

A: Run it again in SQL. The error is in the way the count function works — the way the function behaves makes this query incorrect. You can also check your favorite book to see the question discussed there.

Q: One SQL query can be solved in two or three ways. We solved it with the knowledge we had, and we did not get the marks. We have asked for re-evaluation — what is the right way? For example, sometimes a join is required, and sometimes the same thing can be solved without a join.

A: Multiple correct solutions do exist — nested queries, joins, and different ways of structuring a join — and the way you structure a query shows how you think about the problem. But evaluation of queries is close to yes-or-no: will it run or not? A semicolon and a comma make a lot of difference. A client is not happy with work that is 99.99 percent correct but fails because of one spelling mistake, a missing comma, or a missing space. In the exam, most queries carried only one or two marks, so evaluation was mostly complete-correct or completely-wrong rather than step-wise. What protects you: write out all your assumptions in full — "this is what I assume the question means"; write your thought process; and if something is ambiguous, state it. A short line of background theory, then how you applied it, then the consequences, then your verdict — that articulation is what earns partial marks when marks are available.

The answer-writing method is then generalized into a repeatable exam procedure. Whatever the question — "is this schedule serializable?", "is it ACID?", "is it concurrent?" — first write one line saying what you understand the question to be asking. Then write the definition: "for me, concurrency means conflict serializability; for me, serializability means this schedule is equivalent to a serial schedule". Then apply it, state the consequences, and give the verdict. Even with a time constraint, that is two or three minutes of writing if you have practiced. The statement "I am assuming conflict serializability as my parameter for deciding whether this schedule is serializable" helps the evaluator see exactly what you expected, and helps you get partial marks when your conclusion differs from the expected one.

The four-line answer frame (use for every exam question). Whatever the question, write:

  1. Understanding — one line: "this question asks whether this schedule is serializable."
  2. Definition — one or two lines of background theory: "for me, concurrency means conflict serializability; a schedule is serializable when it is equivalent to a serial schedule."
  3. Application — apply the definition to the given case: draw the precedence graph, list the conflicts, check for cycles.
  4. Consequences + verdict — what your application implies, then the final answer: "there is a cycle, so the schedule is not conflict serializable."

The single most protective sentence: "I am assuming conflict serializability as my parameter for deciding whether this schedule is serializable." It shows the evaluator exactly what you expected, so a different expected conclusion still earns partial marks. With practice, the whole frame is two to three minutes of writing.

17.1.7 The Written Exam as a Thinking Exercise

The session closes this topic with a larger argument: the written examination is not just a memory test. Writing answers under time pressure trains you to comprehend a question, organize your thoughts, process the information, and present it as a structured argument — three, four, five, ten statements that align with your initial thought. A person who is formally trained in this way presents a logical case on any subject, and the person listening has no option but to give them a patient ear. The written exam, in other words, is a personality-building exercise disguised as an assessment. That is the deeper reason the answer-writing structure matters — it is the same structure you will use in front of any client or any manager.

Recap + bridge. This topic turned the exam from a syllabus into a strategy: the handout is the map (17.1.1), the professional benchmarks are the destination (17.1.2), relative grading tells you how the map is scored (17.1.3), and the self-study split tells you where to spend energy (17.1.4). The practical tools — the bound-notes request frame (17.1.5) and the four-line answer frame (17.1.6) — convert the strategy into actions. The handoff: with strategy settled, the session turns to the actual technical content, and the first item is the concurrency-control story that recovery builds on — the transaction, the schedule, and serializability. That is where the four-line answer frame will earn its keep in the exam.

17.2 Concurrency Control Recap: From ACID to Schedules

17.2.1 The Story So Far: Client-Server, Transactions, ACID

Before recovery, the session runs a careful recap of the concurrency story developed over the previous weeks, because recovery only makes sense on top of that foundation. The setting: an application running in client-server mode, with people accessing it from all over the globe. Many people access the same application, and the application has a database behind it. The claim is precise: the application behaves properly — follows the right properties — only when the database itself follows the ACID properties: atomicity, consistency, isolation, and durability.

Atomicity means either everything works or nothing works. Isolation means every user feels like they are working alone — other people's work should not impact their work. Durability and consistency must also hold.

Every user action arrives as a transaction — a set of program instructions, a program that should either work entirely or not work at all. With a single processor, transactions are processed one after another. If transactions were always executed fully one after the other — transaction one completes, then transaction two, then transaction three — the ACID properties would automatically hold. But real execution interleaves instructions from different transactions according to the processor's scheduling, and the exact interleaving is a schedule — the transactions working at a particular point in time. The question for any schedule is whether it will still follow the ACID properties. Two schedules that produce the same effect are equivalent, and a schedule is serializable when it is equivalent to some serial schedule. Serializability, not the raw interleaving, is the property that protects ACID.

The vocabulary, in one place.

  • Transaction — a set of program instructions that must work entirely or not at all (the unit of atomicity). Written .
  • Schedule — the exact interleaving of instructions from multiple transactions as the processor runs them; the transactions working at a particular point in time.
  • Serial schedule — transactions executed one fully after another (no interleaving). Serial schedules automatically satisfy ACID.
  • Equivalent schedules — two schedules that produce the same effect on the database.
  • Serializable schedule — a schedule equivalent to some serial schedule.

The chain of reasoning: the application behaves properly only if the database follows ACID; ACID is guaranteed if every executed schedule is serializable; so the whole discipline of concurrency control is "keep the schedules serializable."

Think of it like a kitchen with one stove. A serial schedule is one cook making dishes one at a time — messy but predictable. Real life is several cooks sharing one stove, swapping pans mid-dish (the processor context-switch). Each swapped interleaving is a schedule. Some interleavings still produce the same final meal as a single-cook run (serializable); others burn the meal (lost updates, dirty reads). Concurrency control is the kitchen rulebook that keeps every allowed interleaving safe — and recovery is what happens when the kitchen power fails mid-cook. That link is why the recap comes first.

17.2.2 Conflict Serializability and the Precedence Graph

The first test discussed is conflict serializability. A conflicting operation involves two different transactions operating on the same data item where at least one of them is a write. For example, if transaction reads item and transaction writes item — written and — those two operations conflict when their order changes the outcome.

Formalize: what is a conflict, and what is the graph test?

Two operations conflict when all three conditions hold:

  1. They belong to two different transactions (),
  2. They act on the same data item (),
  3. At least one is a write ().

So the conflicting pairs on item are , , and . A read-read pair does not conflict — two readers never disturb each other, so their order cannot change the outcome.

The precedence graph (also called the serializability graph) turns the schedule into a picture:

  • Node for each transaction.
  • Arrow when a conflicting operation of appears before a conflicting operation of in the schedule.

The test: if the graph contains a cycle, the schedule is not conflict serializable. If the graph has no cycle, it is conflict serializable — and an equivalent serial order is any topological ordering of the graph.

Worked example: three transactions, a cycle, and the verdict.

Consider this schedule — the transactions interleave at different points in time, exactly as the professor describes:

Step 1 — find every conflicting pair, in order:

Item Operations in order Conflict Edge
before read–write
before write–read
before write–write

Step 2 — draw the graph. Nodes ; arrows , , .

Step 3 — the verdict: the arrows close into a cycle . A cycle means the schedule is not conflict serializable — no serial order of the three transactions reproduces this schedule's conflicting orderings.

Sense-check: try to order the three transactions serially. If goes first, it must be before (edge ), but must be before (edge and chain the demand after ) — a contradiction. The cycle is the contradiction, made visible.

A quick worked picture in the lecture itself: three transactions , , and interleave at different timestamps; suppose there is a conflicting operation from to and from back to — the arrow loop means a cycle, and the schedule fails the conflict serializability test. The example above realizes that picture with concrete reads and writes: the loop already fails the test on its own, and the third transaction simply chains another edge into the same cycle.

Visual intuition: picture the graph on paper — transaction nodes as dots, conflict arrows as arrows between them. The axes here are not data axes; the graph is a relation diagram. Walk along the arrows with a finger: if your finger returns to the dot it started from, you have walked a cycle and the schedule fails. Landmarks to notice: a node with only outgoing arrows is a candidate to run first in the equivalent serial order; a node with only incoming arrows is a candidate to run last. The one-sentence takeaway: a cycle is the only thing that can kill conflict serializability.

Real-world: the precedence graph used here is the same idea as the wait-for graph used in deadlock detection — one graph shape, two different questions asked of it. The wait-for graph draws an arrow from a transaction that waits for a lock held by another; a cycle there means deadlock, and the system kills one transaction. The precedence graph draws an arrow from a transaction whose operation conflicts with and precedes another's; a cycle here means non-serializability, and the schedule is rejected or repaired. Learn one graph shape and you can answer both "is there a deadlock?" and "is this schedule serializable?"

17.2.3 View Serializability and the Blind-Write Case

View serializability is the weaker test. For a schedule to be view-equivalent to a serial schedule, three conditions must hold for every data item. First, the initial read of each data item must be done by the same transaction in both schedules. Second, the final write of each data item must be done by the same transaction in both schedules. Third, intermediate reads — a read of a value written by a particular transaction — must come from the same writing transaction in both schedules. In short: for each data item, same initial reader, same final writer, same intermediate read-write pairing. A student illustrates the mechanics: if transaction 3 initially reads data item Q in one schedule, the candidate serial schedule must also have transaction 3 reading Q first; if transaction 5 does the final write of item P, the candidate must also finish with transaction 5 writing P.

Formalize: the three view-equivalence conditions.

Two schedules and over the same transactions are view equivalent when, for every data item :

  1. Initial read — if reads the initial value of in , then must also read the initial value of in .
  2. Read-from pairing — if reads a value of written by in , it must read the value written by in .
  3. Final write — the transaction that performs the final write of in must also perform the final write of in .

A schedule is view serializable when it is view equivalent to some serial schedule.

The trouble with view serializability is practical: there is no single graph test. You must take the schedule and check it against candidate serial orders one option at a time, and with transactions the checking effort grows so fast that it becomes a very long job. There is a classic shortcut. A schedule that is conflict serializable is always view serializable. So when someone asks "is this schedule view serializable?", the fast route is to check conflict serializability first; if it passes, stop — it is view serializable too, and ACID is protected. View serializability becomes interesting precisely when conflict serializability fails, and that happens in the presence of blind writes — a transaction writes a data item without reading it first. A blind write is the one situation where a schedule can be view serializable without being conflict serializable, because the write-write conflicts that the precedence graph would flag do not exist as read-write conflicts. So the decision procedure: check conflict serializability first (easy); if it passes, done; if it fails, only then consider whether blind writes make a view-equivalent serial order possible — and be prepared for the time cost of ruling out all the candidate orders.

Worked example: the blind-write schedule that passes view but fails conflict.

The classic case (from the concurrency-control reference): three transactions each write , and also reads it first.

Conflict test: the conflicting pairs on are before (edge ) and before (edge ). The loop is a cycle. Not conflict serializable.

View test against the serial order (i.e., ):

  • Initial read: in , reads the initial value of . In the serial order, also reads first. ✓
  • Read-from: 's read comes from the initial value, not from any other transaction's write — the same in both. ✓
  • Final write: in , the last write of is — transaction . In the serial order, writes last. ✓

All three conditions hold, so is view serializable even though it is not conflict serializable. The writes and are blind — neither transaction reads before writing it — and that blindness is what makes the escape possible: there is no read-write conflict to expose the write-write ordering.

Sense-check: the three conditions are exactly what a reader of the final database can observe — who saw the original value, who saw whose updates, and who wrote the last version. Because nobody reads the intermediate versions of , the schedule is indistinguishable from running in series. The cycle existed in the graph but none of the conflict edges corresponds to a visible dependency.

The checking effort deserves a precise note. With transactions, the candidate serial orders number — for that is already 120 orders to try. The professor quotes the effort as growing on the order of ("almost taking order of n square time") — that is the informal claim from the lecture; the standard textbook result is stronger and worse: testing view serializability is, in general, an exponential (NP-complete) problem, which is precisely why no efficient graph test exists and why the concept is taught for understanding rather than used for verification. Keep both pictures in mind: the growth is fast enough that you never want to do it by hand beyond a couple of transactions.

Pitfalls on serializability questions.

  1. Answering "is it view serializable?" with the conflict test alone. The conflict test is a shortcut, not the whole answer. If the schedule passes the conflict test, you may stop (conflict serializable implies view serializable). If it fails, you must still check the three view conditions — a blind write may rescue it. Stopping at "there is a cycle, so not view serializable" is wrong.
  2. Forgetting the read-read pair does not conflict. Two reads of the same item never conflict. Students flag before as a conflict and draw a spurious edge; the graph then has a cycle that does not exist.
  3. Confusing "initial read" with "any read." Only the first read of an item (the one seeing the initial value) is pinned by condition 1. A mid-schedule read is governed by condition 2 — it must read from the same writer.
  4. Skipping the final-write check. A schedule with no reads at all still has final writes, and they must match. The blind-write example above passes only because the final writer is preserved.

Exam note: for a serializability question, always check conflict serializability first. Conflict serializable implies view serializable, so you save a large amount of work. Say it in the answer: "I check conflict serializability first because conflict serializable schedules are automatically view serializable."

Comparison — conflict serializability versus view serializability:

Dimension Conflict serializability View serializability
Meaning Schedule is conflict-equivalent to a serial schedule Schedule is view-equivalent to a serial schedule
Test Precedence graph; cycle check Check the three conditions against candidate serial orders
Cost Fast — build the graph, look for a cycle Very slow — with transactions the candidate orders explode ()
Strength Stronger (smaller class of schedules) Weaker (larger class — accepts more schedules)
Relationship Conflict serializable view serializable View serializable does not imply conflict serializable (needs a blind write)
Practical use The default check; what locking protocols guarantee Understanding only; too expensive to enforce

When to pick which: use the conflict test first in every exam question; fall back to the view conditions only when the precedence graph has a cycle and blind writes are present.

17.2.4 Runtime Control: Timestamp-Based and Lock-Based Mechanisms

The serializability tests assume you know the schedule in advance — a schedule where transactions execute at different known points in time. In real operation, transactions keep arriving while the processor works, and you cannot predict when the processor will context-switch and give the turn to someone else. So at runtime, the database must decide, operation by operation: should I allow this transaction to read or write now?

Two mechanisms were discussed. The first is lock-based control: each data item carries locks. A shared lock allows reads; an exclusive lock allows writes; and the two-phase locking discipline — including its strict and rigorous variants — decides when a transaction may acquire and release them. At runtime, based on the locks held on each data item, the database allows or blocks each operation. The second is timestamp-based control: every transaction carries a timestamp, and every data item carries a read timestamp and a write timestamp. Comparing the transaction's timestamp against the data item's timestamps decides whether a read or write goes through. That is the entire gist of concurrency control — how a database allows operations to proceed concurrently while keeping schedules serializable.

The two engines, side by side.

  • Lock-based (pessimistic): each data item carries locks. A shared lock () lets others also read; an exclusive lock () blocks everyone else. Two-phase locking (2PL) forces each transaction into a growing phase (acquire all locks) and a shrinking phase (release them); strict 2PL holds all locks until commit, and rigorous 2PL holds them until commit or abort. The runtime decision is "may this operation proceed given the locks currently held on ?"
  • Timestamp-based (optimistic ordering): each transaction carries a timestamp ; each item carries a read timestamp and a write timestamp . A read of by goes through if ; a write of by goes through if and — otherwise the transaction is rolled back and restarted with a fresh timestamp.

Both engines answer the same runtime question — "is allowing this operation now still safe for ACID?" — with different machinery: locks block and wait; timestamps reject and restart.

Trace: the timestamp rule on one item.

Item is currently stamped , (the last reader and last writer both had timestamp 40).

  • Transaction with wants to write . Check: ✓ and ✓. The write goes through; becomes 60.
  • Transaction with wants to write . Check: ? No. An older transaction is trying to overwrite a value newer readers have seen — that would let the old transaction's write silently replace a value that newer transactions read. The write is rejected and is restarted with a fresh (higher) timestamp.

Sense-check: timestamps encode "first come, first served" — older transactions act first. A late-arriving old transaction that would invalidate what newer ones already saw is exactly the interleaving that breaks serializability, so it is the one rejected.

17.2.5 Q&A: Revising Locks and Timestamps

Before moving to recovery, a student asks to revise the lock-based and timestamp-based mechanisms once again. The response refuses to re-teach the whole topic and turns the question into a lesson about responsibility — and then gives the one question that makes both mechanisms make sense.

Q: Can you help me revise once again — the lock-based mechanism, and the transaction-based or timestamp-based mechanism?

A: I would be happy, but you must take your own responsibility — nobody else will ask for you. It is my responsibility to ask, and I leave it up to everyone here. Now, the basic objective behind both mechanisms: when a schedule is given to me, will it follow the ACID property when I allow it? To allow it to follow ACID, I ask whether it is equivalent to a serial schedule — is the final output the same as a serial schedule's output, with no conflicting operations before and after? The lock-based and timestamp-based approaches are two different engines for answering that same runtime question.

Pitfall: learning mechanisms before learning the question they answer. Both 2PL and timestamping look like collections of fiddly rules — when to release a lock, which timestamps to compare. Stored that way, they are impossible to recall under exam pressure. Stored as answers to one question — "is this schedule equivalent to a serial schedule, with the same final output and no conflicting operations before and after?" — the rules reorganize themselves: locks prevent conflicts from ever appearing in the executed schedule; timestamps reject the operations that would create them. Same question, two engines.

Recap + bridge. The recap rebuilt the chain: transactions and ACID (17.2.1), the conflict test and precedence graph (17.2.2), the view test and the blind-write exception (17.2.3), and the two runtime engines that keep real schedules serializable (17.2.4). One sentence to carry forward: serializability — conflict first, view only when blind writes appear — is the property that protects ACID, and locks and timestamps are the two engines that enforce it at runtime. The handoff: serializability protects ACID while the system runs; the next topic asks what happens when the system stops — a power failure, a crashed disk, a transaction cut off mid-write. That is recovery, and it is the main technical content of this session.

17.3 Recovery: Failures, Logs, and Undo-Redo

17.3.1 Why Recovery Exists: Failure Types

The transition to recovery is motivated the way every topic in this course is motivated: understand the need first, because if you understand the need you can replicate the solution when a similar challenge appears in your real life. The need is that a transaction can fail at any time, and there are many kinds of failure. The most frequent is a power failure: the power goes, and when it comes back the system works again. But deeper failures exist too. Every hardware component fails — just like every system, hardware has limitations. The hard disk can fail, the processor can fail, the network can fail. The "army" that stores the database — the main memory and the secondary storage — can fail at any point in time, and the system must be prepared for that.

Think of it like a house fire insurance policy, but for data. You do not buy fire insurance because you expect your house to burn every week; you buy it because the cost of the rare event is total, and you cannot afford to be unprepared when it arrives. Power failures are the "candle left near the curtain" — common and small. Hardware failures are the "lightning strike" — rare and complete. The professor's point is that every hardware component has a failure rate: disk, processor, network, memory, all of them. A system designed "for the happy path only" is a system that loses data the first time a disk dies.

The consequence of a failure lands on the ACID properties. A transaction can work and commit, with the committed operations sitting in main memory, and then the power fails or the memory fails — or even the secondary storage fails. In that position, the changes that were made are not persistent: the durability of the committed transaction is impacted. And when the system must undo work, the consistency portion is what is at risk — undoing some changes while leaving others breaks the before-and-after constraints of a consistent database.

Scope: which failure, which ACID property is hurt. Power failure (the common case): committed work still sitting in volatile main memory is lost — durability is violated. Hardware failure of a disk: the stored database itself may be damaged — both durability and consistency are at risk. Transaction-level failure (a deadlock victim or a crashed transaction): partial work must be rolled back — atomicity demands either everything or nothing, so the partial changes must be undone. Recovery is the subsystem that repairs all three cases from one artifact — the log — and the design pressure is on the power-failure case because it is the most frequent.

17.3.2 The Volatile-Memory Problem and ACID Impact

The power failure case deserves a precise model, because it is the most common failure and the one the recovery design must handle carefully. The processor executes instructions from main memory. There is a pointer that records the last instruction already executed, so after a restart the processor knows to continue from the next instruction. But the changes made by the executed instructions were made in main memory — and main memory is volatile. The power goes, the power comes back, and the operations that were done in main memory are not persistent. The pointer tells you where execution stopped; it does not tell you what the database lost.

The pointer's lie. After a power failure the system restarts and the program counter — the pointer to the next instruction — resumes exactly where execution stopped. The pointer is accurate about instructions, and useless about data. The instructions ran in registers and main memory; the data they changed lived in main memory; main memory (RAM) is volatile — its contents die with the power. So "where did execution stop?" and "what did the database lose?" are two completely different questions, and only the first has an answer after restart. The log is the artifact built to answer the second.

This is also the point where recovery and concurrency meet. Suppose transaction writes data item , and transaction reads that item later in the schedule. If commits before and a failure happens, the system has a problem. Transaction must be rolled back — there is no option for : everything it wrote is undone. But has already committed, having read a value that wrote and then rolled back. For there are two options, and both are bad. Allow the committed to stand, and the database is inconsistent — 's result is built on data that no longer exists. Undo the committed , and durability is violated — a committed transaction came back. The resolution is recoverability: whenever a transaction reads a data item written by another transaction, the reading transaction must commit after the writing transaction commits. Only recoverable schedules are safe, because then a failure never forces a committed transaction to be undone.

The two-bad-options trap. This is the dead center of recovery: after a failure, a committed transaction that read uncommitted data from leaves recovery with two options and no good one:

  • Option 1 — keep committed : the database is inconsistent; 's committed result rests on values that recovery just erased.
  • Option 2 — roll back committed : durability is broken; a committed transaction was silently undone, and anything built on 's result must now cascade.

Recovery must never be forced into this corner. That is exactly what the recoverability rule prevents (next subsection).

17.3.3 Recoverability: Who Must Commit Before Whom

Recoverability is familiar from the timestamp-based discussion, but recovery makes it a hard requirement rather than a design choice. In a recoverable schedule, if reads written by , then can only appear after in the schedule. That single rule prevents the cascade of rollbacks described above — there is no way to end up with multiple committed transactions depending on an uncommitted writer. The rule matters at the moment of failure: when the system restarts, it must be able to recover each transaction independently, without creating inconsistencies between committed transactions.

Formalize: the recoverability rule.

If transaction reads a data item written by transaction , then

Read it as "readers must commit after their writer." The reason is a chain of dependence: 's output depends on the value it read, which depends on 's write, which is not final until commits. If never commits (it is rolled back, or crashes), the value read was never real — so 's commit cannot be allowed to stand before 's fate is settled. The rule guarantees: at restart time, the set of committed transactions is closed under "readers of my data" — no committed transaction ever depends on an uncommitted writer, so no committed transaction ever needs to be undone.

The standard terminology sits on top of this rule. A strict schedule strengthens it: no transaction reads or writes an item written by another transaction until that writer has finished — committed or rolled back — so recovery can undo a failed writer simply by restoring the old values, and cascading rollbacks never occur. Cascading rollback is the domino effect the rule exists to prevent: fails, so (who read 's data) rolls back, so (who read 's data) rolls back, and so on — one failing transaction dragging a chain of others down with it. The reference texts stress what the lecture implies: practical recovery mechanisms are designed so that cascading rollback is never required — recoverable, and in practice strict, schedules are the norm.

17.3.4 The Log File and Stable Storage

Recovery needs a record of what happened, and that record lives in a log file on stable storage. Stable storage is the Hollywood version of a vault: in the analogy, a stable-storage situation survives the rain, the thunderstorm, the tsunami, and the earthquake — if the power goes or comes, if the tsunami comes or goes, if the hardware fails, the log is still there. Stable storage is achieved by replication: multiple copies of the log stored at different places, at different times. The cost of full replication is very high, which is why the log is special — it is a very small portion of the database, written in a stable format, always available even after failure. The recovery model is a fail-stop model: the system fails, the system restarts, and after restart the system works correctly again — at least well enough to read the log files.

The vault analogy. Stable storage is the vault that survives the rain, the thunderstorm, the tsunami, and the earthquake. The point of the exaggeration is the design posture: the log is the one thing recovery may never lose, so it is the one thing that gets the full replication treatment — multiple copies, at different places, written at different times. Notice the cost asymmetry that makes this affordable: replicating the whole database is prohibitive, but the log is a very small portion of the database — a few records per transaction, not the data itself — so the vault is cheap enough to keep full-strength. The fail-stop model completes the picture: the system is assumed to stop cleanly on failure and to restart correctly — "at least well enough to read the log files."

The log format is simple and fixed. When a transaction starts, the log records . When writes item , the log records the transaction, the item, the old value, and the new value:

When commits, the log records . Nothing more and nothing less: only operations relevant to the database are logged — every other detail of the application is left out.

Formalize: the log record format.

Record Meaning
Transaction has begun
wrote item ; before the write it was , after it is
has committed — its work is final

The four fields of a write record are the whole design: transaction, data item, old value, new value. The old value makes undo possible (restore ); the new value makes redo possible (re-apply ). The two together make recovery independent of what the database happened to contain at crash time. Nothing else belongs in the log: reads are not logged (they change nothing), and application details are not logged (they are irrelevant to the database). This is the write-ahead discipline in its plainest form: the record of a change is written to the log before the change is trusted.

Real-world: the same log-before-change idea — write the old and new value down before touching the database — is the foundation of journaling in file systems, versioned storage, and even financial accounting, where every change leaves an audit trail. A file system journals its metadata updates; a ledger journal records every entry before the books are updated; a database logs every write before it is durable. The same record — "item, old value, new value" — appears in all of them because the same need appears in all of them: if the machine dies mid-change, something must be able to tell the difference between "the change happened" and "the change did not happen."

17.3.5 The Worked Log Example

The example is built around a small social media application where members perform transactions at different points in time — say one member's transaction is logged as , another's as , and so on. As soon as anyone does anything, the change is written to the log in the fixed format.

Worked example: reading a log.

The session reads out a log from this application (member names are anonymized — in the session each belonged to a named member). In record order, the log says:

Reading each record in plain language:

  • started.
  • Item was changed from 1000 to 950 (old value 1000, new value 950).
  • Item was changed from 2000 to 150 — the numbers are exactly as the professor stated them in the session.
  • committed.
  • started — and then something went wrong. The database state after the failure is exactly what these records say, nothing more and nothing less.

A note on the labels: in the session's narration the transaction labels around the and updates are scrambled — the recovery outcome the professor goes on to describe (next subsection) is what fixes the reading: the and writes are the work of the committed transaction (they are redone to exactly 950 and 150), while is the uncommitted transaction whose write of item is undone.

Sense-check: the log holds every fact recovery will need: who started, what each committed write changed (old and new values), and who committed. Given only this log, recovery must be able to rebuild the database — and the next subsection runs exactly that scan.

17.3.6 Immediate Versus Deferred Modification

A design choice appears here: when the database itself is modified. With immediate modification, every change made in main memory is written back to secondary storage immediately. With deferred modification, the changes wait. The distinction matters because power failures are far more frequent than hardware failures, and random access memory is volatile: power goes, and changes that lived only in main memory vanish. In a power failure, the processor needs to know exactly what changes were done so it can continue from the right point — the log, with its old and new values, supplies exactly that knowledge. Immediate modification means the database on disk always tracks the most recent change, and the log decides afterward which of those changes are real (redo) and which are phantom (undo).

Comparison — immediate versus deferred modification:

Dimension Immediate modification Deferred modification
When the disk is touched Every change is written back to secondary storage immediately Updates wait until the transaction reaches its commit point
Log needs Both old and new values () Only new values (REDO-type entries; nothing to undo)
After a crash Some changes on disk may be phantom — uncommitted work must be undone Uncommitted work never reached the disk — only committed work is redone
Recovery flavor UNDO/REDO (the lecture's main case) NO-UNDO/REDO
Practical catch More complex recovery; undo needed Buffers must hold all changes until commit — short transactions only, or memory runs out

The professor's emphasis is on immediate modification, and the reason is frequency: power failures are far more frequent than hardware failures, so the recovery design is tuned for the case where the disk holds recent-but-not-final changes. The log's old and new values are exactly the information the processor needs after restart: redo the changes that are real (committed), undo the changes that are phantom (uncommitted).

17.3.7 Undo, Redo, and Idempotency

The recovery operations themselves are familiar from everyday life. Undo means: whatever I did, I take it back — the way Ctrl-Z undoes the last change. Redo means: do it again — the way Ctrl-Y redoes a change in a word processor. The subtle and important point is why redo is safe. Redoing an operation must not change the result — the property the source describes with the garbled phrase "a.a is equal to": the property of idempotency — repeating an operation leaves the result unchanged. Concretely: if the log says changed from 1000 to 950, then writing once, and writing again, both leave at 950:

Because the redo operation is idempotent — repeat it twice and the outcome is identical — the recovery algorithm can apply a redone operation even if the database had already been written back before the failure. The database might already contain the value, and redoing it is harmless. Undo works the other way: undoing restores the old value, so for the undo would return 1000.

Ctrl-Z and Ctrl-Y, with the difference that matters. Undo is Ctrl-Z — "whatever I did, I take it back." Redo is Ctrl-Y — "do it again." In a word processor the difference is cosmetic; in a database it is load-bearing. Why is redo safe to apply to a database that might already contain the change? Because redo operations are idempotent: applying the same write twice leaves the value unchanged, since a write sets the value, and setting it again sets the same thing. The garbled lecture phrase "a.a is equal to" is exactly this property — an operation with . Undo is safe for the mirror reason: it restores the old value , and if the database already holds , restoring it again changes nothing. Idempotency is what lets the recovery scan be dumb and safe: it can replay log records without knowing what is already on disk.

17.3.8 The Basic Recovery Algorithm

With the log understood, the recovery algorithm is a scan. Look at the log and classify every transaction. If a transaction has a start record and no commit record and no abort record, then by atomicity it either works entirely or not at all — it has not committed, so all of its operations must be undone. If a transaction has a commit record, its operations must be redone — re-established on the database.

Purpose. Recovery turns the log into a correct database state after a failure: committed work must be durable, uncommitted work must be erased.

Inputs and outputs. Input: the log on stable storage (start/write/commit records). Output: a database state in which every committed transaction's writes are present and every uncommitted transaction's writes are gone — plus abort records written to the log so the log itself reflects what recovery did.

Steps.

  1. Classify — scan the log, and for each transaction note whether it has a commit record (or an abort record) or not.
  2. Redo — for every transaction with a commit record, apply its write records in log order: set each item to . Safe because writes are idempotent.
  3. Undo — for every transaction with a start and no commit, apply its write records in reverse log order: set each item back to .
  4. Abort — write an abort record for each undone transaction, so the log's own record of the world is complete.

Worked example: the recovery scan (the session's case).

The log (from 17.3.5):

Classification:

  • has committed → redo.
  • has and no commit and no abort → uncommitted → undo.

Redo : item is set to 950 once again (the log's new value); item is set to 150, its committed value. If the disk already held these values, the redo changes nothing — idempotency makes it harmless.

Undo : the log holds a write of item by whose old value is 700 (the exact new value was not read out in the session — the restore target is what matters). is restored to 700, its before-image.

Abort: the log receives , so the system's state is complete and consistent: committed work is redone, uncommitted work is undone and formally aborted.

Sense-check: two committed values (950, 150) survive; one uncommitted write (700) is erased; the log now says aborted. Any observer reading the log can reproduce the same final state — that reproducibility is the point of the algorithm.

Cost: one forward scan of the log, plus one reverse pass for undo. Recovery time grows with log length since the last checkpoint — which is exactly the problem the next topic (17.4) solves.

Pitfalls.

  1. Redo before checking commit. Only transactions with a commit record are redone. Redoing an uncommitted transaction's writes would re-create work that must be erased.
  2. Undo in the wrong direction. Undo applies in reverse log order — the last write first. If two records touch the same item, undoing forward would restore the first old value, leaving the wrong state.
  3. Forgetting the abort record. The log must record what recovery did. Without , a second crash would classify again as uncommitted and undo it again — harmless by idempotency, but the log would no longer tell the truth.
  4. Reading the log as the database. The log is a record of changes, not a snapshot. The database state after failure is what the records imply, which is why the scan must replay them.

17.3.9 Q&A: Isolation Levels and the Question-Setter's Psychology

A student reports seeing questions about isolation levels in old question papers, a topic that seems to be covered nowhere in the syllabus material or in the sessions, and asks whether it will appear in the examination.

Q: In an old question paper there is something called isolation levels. The topic is not covered in the course material or in the sessions. Will it be part of the examination — is it in the recorded sessions?

A: If it is there in the live sessions, it is there; if it is not, it is likely not. The syllabus keeps changing year to year — the course has been taught for several years, on campus and off campus, and the syllabus changed between those offerings. So here is the general procedure, for this and any other uncertain topic. First, check the handout: is the topic in it or not? That is the whole test. Prepare from the live and recorded sessions first. Second, while preparing, bookmark the topic in the textbook — if it comes up, you can look at it in the exam hall. Third, if it actually appears in the exam hall: do not panic — use the book's index, find the pages, study the portion on the spot, and attempt it. Afterward you can take the matter up with the appropriate authorities if you believe the paper overstepped the handout. Practically, questions like "relate this schema to this isolation level" may not be explained anywhere — but the book will have the concept, and the exam is open book.

The answer then turns into a broader lesson about preparation. You do not need a PhD in psychology to read the question-setter's psychology. The best lawyers prepare by understanding the judge: how they refer to things, what they focus on, which of their top logics this case will trigger — not a plain template, but a presentation tailored to the person and the situation. The same applies to an examination: the question is set by a person, the topics that person focuses upon get the questions. Understand how the course material was presented — what was covered and how deeply — and you can predict both the questions and the expected depth. A general "plain vanilla" preparation covers everything; a smart preparation weights the areas the setter visibly emphasized. This transfers directly to professional life: your immediate supervisor or manager is the one you report to, and reports shaped for a previous manager may not fit the current one. When a manager asks "have you covered this portion?", the answer is already in your memory of what was covered and how — and if other instructors taught something in more detail in earlier years, their exams expected that detail; here the depth expectation matches what was actually taught.

The lawyer-and-judge analogy. A good lawyer does not walk into court with a generic argument; they study the judge — how the judge refers to things, what the judge focuses on, which of the judge's top logics the case triggers — and tailor the presentation. The exam is the same situation: the question is set by a person, and the topics that person focuses on are the topics that get questions. Preparation therefore has two tiers: "plain vanilla" coverage of everything, plus weighted preparation of the areas the setter visibly emphasized in the course. The professional transfer is direct: a report shaped for a previous manager may not fit the current one — you prepare for the person across the table.

Recap + bridge. Recovery exists because failures happen (17.3.1), the volatile-memory model shows exactly what is lost (17.3.2), recoverability orders commits so recovery is never trapped (17.3.3), the log on stable storage is the vault that survives (17.3.4–17.3.5), immediate versus deferred modification decides what the scan must do (17.3.6), idempotency makes replay safe (17.3.7), and the scan itself is a short procedure: redo the committed, undo the uncommitted, write the aborts (17.3.8). One sentence to carry forward: recovery is a scan over the log — redo committed work, undo uncommitted work, write abort records — and it is safe only because writes are idempotent. The handoff: the scan described here starts at the beginning of the log — which is fine for a toy example and impossible for a system that has been running for years. The next topic gives the scan its starting line: the checkpoint.

17.4 Checkpointing: Where Does Recovery Begin?

17.4.1 The Problem: How Far Back Do We Scan?

The basic recovery algorithm has a fatal practical flaw, and the session builds it up with an extreme example. The system started working years ago — say the application went live in 2001, and the failure happens in May 2024. Does recovery scan the log all the way back to 2001, redoing and undoing decades of operations? Consider an application like IRCTC — train ticket booking — where people arrive rampantly day and night. Every second there are hundreds of transactions, every hour hundreds at least; in 10 or 20 days there are thousands; after a year, an order of magnitude higher. Two years in, a failure happens — a small power failure, or a big hardware failure, since hardware always fails eventually. Where does the scan start? Ten years back? Three years back? One second back?

Ask ten people and you get ten answers: one second, one hour, one day, five days, fourteen days, one year. Nobody is sure when the last point was that everything in memory got written back to secondary storage — whether a given committed portion has reached the disk or not. The recovery algorithm is a computer program, and a computer program needs a deterministic boundary: "after this point, I will not look at the log files". The session's analogy is an exam deadline: when a quiz has a hard closing time — 10:59 AM — there must be a clear rule about when responses stop being accepted, one that is followed every single time, the way legal precedent is followed by every lower court once a higher court rules. What is that boundary for recovery? The answer is the checkpoint.

Worked example: the growth of the log at IRCTC scale.

Take the professor's numbers and multiply them out:

  • Per second: hundreds of transactions — say 200 per second.
  • Per hour: at least hundreds — say 200 × 3,600 ≈ 720,000 transactions per hour.
  • In 10–20 days: thousands... more precisely, 720,000 × 24 × 15 ≈ 260 million transactions in fifteen days.
  • After a year: an order of magnitude higher again — billions.

Each transaction writes at least a start record and a commit record, plus a write record for every item it changes. After a year of operation the log holds billions of records. Now a failure happens. Recovery must scan back to where? Ten years? Three years? One second?

Sense-check: the arithmetic is the entire argument — at this scale, "scan from the beginning of the log" is not a slow answer, it is an impossible answer. The recovery time budget is minutes, not days, and nobody in the room can say where the last disk-write boundary was — ten people give ten different answers. A recovery procedure whose starting point is a matter of opinion cannot be the recovery procedure.

The exam-deadline analogy. A quiz has a hard closing time — 10:59 AM. When the clock hits it, responses stop being accepted, and the rule is followed every single time — the way legal precedent is followed by every lower court once a higher court rules. No one reopens the quiz "just this once"; the deadline is deterministic. Recovery needs exactly this kind of boundary: a point in the log after which the scan is allowed to stop looking — fixed, published, and followed on every failure. The answer the session lands on is the checkpoint.

17.4.2 The Checkpoint Boundary

A checkpoint is a point in time at which everything that was happening up to then has been written back to secondary storage. If a checkpoint exists, anything before it is already safely on disk and needs no attention. The recovery scan then starts at the checkpoint — not at the beginning of the log, and not at an arbitrary time. Transactions that finished before the checkpoint are ignored entirely: their work is already persisted. Only transactions that were still running at the checkpoint, or that started after it, need to be examined. And the scan is still safe even when a redo is unnecessary — because redo operations are idempotent, redoing a change whose value already reached the disk is harmless. The checkpoint converts the unbounded "where do I start?" question into a fixed, known boundary, and it is deterministic: every failure, the same rule applies.

Formalize: the checkpoint.

A checkpoint is a point in time at which the system writes out to secondary storage every modified buffer held in main memory. Its log record is

Consequences, in order:

  1. Anything before the checkpoint is already on disk — the buffers holding those changes were flushed. Transactions that committed before the checkpoint need no redo: their work is already durable. Transactions active before the checkpoint but finished by it also need no attention.
  2. The scan starts at the checkpoint, not at the log's beginning and not at an arbitrary time. Everything before it is skipped.
  3. Only transactions active at the checkpoint, or started after it, are examined — the checkpoint record's list of active transactions is exactly the starting set the scan needs.
  4. Safety is preserved by idempotency — if a redo is applied to a value that already reached the disk, the write just sets the same value; nothing is corrupted.

The checkpoint record is written periodically — the interval is a system parameter, measured in time (every minutes) or in activity (every committed transactions since the last checkpoint). Taking one involves suspending transactions, flushing modified buffers to disk, writing the checkpoint record, and force-writing the log.

Scope: what the checkpoint does and does not do. The checkpoint is a starting line, not a cure. It does not make uncommitted work durable — an active transaction's writes may still sit only in the log, and recovery will still undo them. It does not remove the need to scan forward from it — committed transactions that started after the checkpoint must still be redone, because their values may not have reached the disk. What it removes is the need to scan backwards: everything before the boundary is already on disk, and re-scanning it would be pure waste. The boundary assumption is also worth naming: it holds because "everything up to now was written back" is true by construction at checkpoint time — which is why the checkpoint procedure flushes buffers before recording the checkpoint.

17.4.3 Worked Example: One Checkpoint, Four Transactions

The first worked case reads a log that contains a checkpoint. Suppose transaction was running and finished before the checkpoint. Then needs no attention — everything did was written back before the checkpoint, so its log records are ignored, and so are the records of everything before it. That is the saving the checkpoint produces.

At the checkpoint itself, had started, with some operations in progress. committed after the checkpoint. Its operations must be redone — even though the values may already be on disk, redoing them is safe because the operations are idempotent, so the redo is mandatory but harmless. Transaction also committed after the checkpoint; the same logic applies: redo 's operations. Transaction started but never committed — the log has a start and no commit — so undo 's operations. In one line: redo the committed and , undo the uncommitted , and ignore the pre-checkpoint entirely.

Worked example: one checkpoint, four transactions, one line of work.

Picture the timeline — time running left to right:

   T1 (finished)       checkpoint        failure
      |                    |                 |
      |  T2 (in progress)  |--------- commit(T2)
      |                    |  T3 ---- commit(T3)
      |                    |  T4 ---------- (no commit)
      v                    v                 v
   <----------------  scanned area  ----------------->

The recovery scan starts at the checkpoint and moves forward to the failure. Each transaction is classified by what the scan finds:

Transaction What the scan sees Verdict Action
Ran and finished before the checkpoint Pre-checkpoint — already on disk Ignore entirely
Started by the checkpoint, committed after it Committed Redo its operations
Started after the checkpoint, committed Committed Redo its operations
Started, has a start with no commit Uncommitted Undo its operations

In one line: redo the committed and , undo the uncommitted , and ignore the pre-checkpoint entirely.

Sense-check: the redo of and is mandatory but harmless — their values may already be on disk (idempotent writes make the replay a no-op), and if they are not, the replay supplies them. The undo of erases work that must not survive. And ? Its writes were flushed to disk before the checkpoint was recorded — no log replay can add anything, so the scan simply skips it. The whole recovery did not even look at anything before the boundary.

17.4.4 Worked Example: The Undo and Redo Buckets

The second worked case is the "beautiful case" that shows the standard two-bucket procedure. The log contains a checkpoint that records two transactions in operation at that moment: and . The procedure starts by placing both in the undo bucket: by default, every transaction active at the checkpoint is assumed to need undoing. As the scan moves forward through the log, each transaction's fate is decided by its commit record.

  • 's commit appears in the log → move out of the undo bucket and into the redo bucket. All of 's operations are redone.
  • has a start and no commit → stays in the undo bucket. Its operations are undone, and the log is updated with a abort record.
  • starts after the checkpoint and never commits → it was never in the original bucket list, but the same rule applies: it joins the undo bucket. Its operations are undone, and the log gets a abort record.

The final state: , . The recovery does exactly that — redoes 's operations, undoes 's and 's operations, and writes the abort records for and so the log itself reflects the recovery.

Worked example: the two-bucket procedure, traced.

The log: a checkpoint record naming and as active, then records moving forward, ending in a failure.

Step 0 — the checkpoint record . Both active transactions are dropped into the undo bucket by default — assume undo until a commit says otherwise:

Step 1 — scan forward. 's commit record appears: a commit is a ticket out of the undo bucket. Move :

Step 2 — the scan reaches the failure. has a start and no commit: it stays in the undo bucket. Meanwhile a transaction — started after the checkpoint, never committed — was never on the checkpoint's list, but the same rule applies to it: no commit, so it joins the undo bucket:

Step 3 — act on the buckets. Redo 's operations (apply each logged write's ). Undo 's and 's operations (restore each logged write's ). Write and so the log reflects the recovery.

Sense-check: the undo bucket started with both checkpoint-listed transactions — the pessimistic default — and the commit record promoted to the redo bucket. was a late arrival that belonged in the undo bucket by the same rule. Every transaction is in exactly one bucket, and the buckets exhaust the possibilities: committed (redo) or not committed (undo). Nothing is left undecided, and the aborts make the log consistent with the database.

The reaction to the case is a teaching moment in itself: "this is so simple". The claim is that an entire database course is full of topics that seem mysterious until explained once — the way 2NF sounds impossible until someone walks you through it — and checkpointing is exactly that kind of topic: once the boundary is clear, the bucket procedure is trivial.

Why "this is so simple" is the real lesson. The professor's reaction — "this is so simple" — is a statement about how to learn database theory, not just about checkpointing. The way 2NF sounds impossible until someone walks you through one example, the way serializability sounds like a maze until you draw one precedence graph, the way the recovery scan sounds like a nightmare until you read one log — checkpointing is the same: once the boundary ("everything before this point is already on disk") is clear, the bucket procedure is two rules. When a topic feels impossible, the honest first move is "I have not yet been walked through it" — not "this topic is hard." The course is full of topics that collapse the moment their one boundary or one rule is stated.

17.4.5 Q&A: Restarting After an Abort

Two questions close the checkpoint discussion, and both are about what happens after a failure is handled.

Q: After T0 abort, if we want to start T0 again, what should we do?

A: The transaction restarts as a brand-new transaction — it will get a fresh name, say T3, and start once again. Whenever a transaction fails and is restarted, it is a new transaction with a new name. On a timestamp-based system this matters: the new transaction receives a fresher timestamp, which makes it easier to schedule and allows it to proceed.

Q: My transaction was booking a train ticket — something crashed while booking, what do I do?

A: You try once again — the same user, the same booking, but logged as a fresh transaction (T3, say) with a fresh timestamp. The new transaction name is local bookkeeping; the important thing is that after any crash, retrying is always possible, and the fresh timestamp lets the new attempt work its way through timestamp-based control. In the session's terms, the retried booking gets a new transaction identity — a new name and a fresher timestamp — while representing the same logical user action.

Why the fresh timestamp matters. A crashed transaction had an old timestamp — and under timestamp-based control, an old timestamp is a handicap: every item the new transactions have touched carries newer read/write timestamps, so the old timestamp's operations get rejected again and again. Restarting under the old identity would condemn the retry to the same rejections that killed the original. A fresh transaction name with a fresher timestamp re-enters the scheduling as a newcomer: the timestamp comparisons now go through, and the retry can proceed. The name is bookkeeping; the timestamp is the mechanism. And it is free: the same logical user action, tried again, is simply logged as a new transaction.

Pitfalls on checkpoint questions.

  1. Redoing the pre-checkpoint transaction. finished before the checkpoint; its writes were flushed with the checkpoint. Redoing it is wasted work — and in an exam answer, redoing it shows you missed the saving that checkpoints exist to create. The ignore rule is the point of the topic.
  2. Assuming checkpoint means "everything committed." A checkpoint does not commit anything — it flushes buffers. Uncommitted transactions active at the checkpoint still need undoing; committed ones after it still need redoing.
  3. Leaving the undone transactions without abort records. Recovery is complete only when the log itself says the transaction aborted; otherwise a re-crash re-undoes and the log lies about history.
  4. Forgetting the default. The checkpoint's active list enters the undo bucket by default; a commit record is the only promotion ticket. Inverting the default (assuming redo) misclassifies every uncommitted transaction.

Exam note + recap + bridge. For a checkpoint-recovery question, draw the boundary first: ignore what finished before it, redo what committed after it, undo what never committed, write the aborts. The bucket procedure is the same rule in two lines: active at the checkpoint → undo bucket; commit record seen → redo bucket; no commit → stay and be undone. The exam answer earns its marks by naming the boundary, placing each transaction, and recording the abort records. The handoff: with recovery and checkpointing settled, the session's remaining material is the story of what happened after the relational database proved too small for the modern world — the NoSQL shift, which the professor marks as not examinable but essential for real life.

17.5 SQL vs NoSQL, Sharding, and the Modern Database

17.5.1 The Pre-2000s World: One Database, Manageable Data

The final topic of the session is framed as a bonus — explicitly stated to be outside the examination — but insisted to matter for real life. Before the 2000s, the database world was simple: a single database in a single location, queried in the network format, and the whole arrangement was manageable. Data was not bombarding in volume; the workload was modest. Then the world changed. Hotmail and Gmail arrived, Yahoo mail was already there, and mail started coming in big proportions — the SMTP protocol moved messages, but the database behind the mail service itself became very high-volume. Shopping applications followed, and so did social media applications in the style of Orkut and, soon after, YouTube. Each of these pushed more data at the database than the old single-store arrangement could comfortably absorb.

The one-database world. Before the 2000s, the typical arrangement was a single database in a single location, queried in the network format, serving a modest workload. Think of a small-town post office: one building, one counter, one ledger — everything manageable because the traffic is manageable. Then the mail exploded — Hotmail and Gmail arrived, Yahoo mail was already there, and the SMTP protocol (the postman) faithfully moved messages, but the database behind the mail service (the ledger) had to record every single one of them. Shopping applications followed, then social platforms in the style of Orkut, then YouTube. Each one bombarded the ledger with more entries than the single counter could record. The post office did not get worse; the traffic outgrew the building — and that is the exact situation the next subsection names.

17.5.2 Volume, Variety, Velocity: The Three Limits

The old relational database had constraints that the new world exposed. The data it was designed for was limited: mostly text that could be stored, without variety — no audio, no video, no multimedia combinations — and it was not increasing in volume. The new world pushes in three directions at once: volume (data increasing), variety (many kinds of data), and velocity (the pace at which data arrives).

Formalize: the three V's of the modern data problem.

Dimension Meaning The 2000s wave
Volume The amount of data being stored Mail, shopping, and social data multiplied every year
Variety The kinds of data being stored From mostly text to audio, video, multimedia combinations — and data that does not even fit the old schema yet
Velocity The pace at which data arrives From daily batch traffic to streams arriving every second

The old relational design assumed the first column only: text-like data, no multimedia variety, no exploding volume. The new world hits all three at once, and each one breaks a different silent assumption of the single-store design.

In that situation, following ACID strictly is difficult, and storing everything in a single relational database in one location is not easy either. Even if a miraculously scalable format existed for storage, the application layer creates a second problem: relational queries depend on joins, and joins need every table. A relational application cannot work unless all the tables and relations are available together.

Scope: what exactly breaks. Two separate walls hit the relational arrangement at scale:

  1. The strictness wall. Following ACID strictly — every transaction fully isolated and durable — is difficult when millions of concurrent writes arrive at one store. The guarantees do not disappear by magic; they cost coordination, and coordination costs time.
  2. The join wall. A relational query computes joins, and a join needs every participating table present in the same place. Split the database across machines and a join must gather fragments from all of them — so the relational application cannot be served from a partial copy. This wall is the one that decides the whole replication story in the next subsection.

The storage-format wall and the join wall are independent — the lecture's point is that even a miraculous storage format would not fix the application layer, because the application's queries still demand all the tables.

17.5.3 The Replication Argument and MongoDB's Rise

The session walks through a concrete replication scenario using the social media application built in the course. The database sits locally, with replication. But the decision taken was to replicate the entire database at a remote site: if a query arrives, the remote site cannot answer it unless all the tables and all the relations are present there, because the joins need everything. That is the honest cost of relational replication — you replicate the whole database or nothing works. The audience is asked to agree: unless everything is replicated, queries will not work. That is precisely the situation that explains why MongoDB and the NoSQL family came into existence. The new approach lets go of the rigid table boundaries: all the data about movies, students, universities — and data that does not even exist yet in the old schema — sits in a single flexible format. A document holds the name, roll number, ID, phone, marks, and courses together in one file, and replication becomes easy because you do not need to replicate every relational constraint — just the documents. The application becomes much simpler to run and much easier to scale.

Worked example: why relational replication means replicating everything.

Take the course's social media application: a database of members, posts, comments — stored as relations. A query arrives at the remote site: "list each member with their posts." In relational terms that is a join of the member and post tables. Now ask the honest question: what must be present at the remote site for that query to run?

The answer, traced through the join:

  1. The query needs member rows → the member relation must be there.
  2. It needs post rows → the post relation must be there.
  3. Joins can require a third table to connect them → every relation that any query touches must be there.

Conclusion: a relational application cannot be answered from a partial replica — you replicate the whole database or nothing works. The professor asks the audience to agree, and the audience must: the joins demand everything.

Now contrast with the document model. All the data about one member — name, roll number, ID, phone, marks, courses — sits together in one document, one file. A query about that member touches one file, not three tables. Replication is now per document: the remote site can serve any query about any document it holds, with no join to fail. You do not need to replicate every relational constraint — just the documents. That is the argument in one line, and it is the argument that explains MongoDB's existence.

Sense-check: the relational replica needed every table because joins are global operations; the document replica needs only the documents because every document is self-contained. The join wall is what made relational replication heavy; self-containment is what makes NoSQL replication light.

17.5.4 NoSQL Formats and Eventual Consistency

NoSQL is not one format — it is any format that is not the relational one: MongoDB as a document format, column-based stores, graph-based stores, and document stores like Cassandra. Each format has its own advantages, and the primary reason the family exists in real life is that the relational approach took a lot of time to establish and to maintain, and its strict ACID guarantees are not always needed. Sometimes eventual consistency is fine: the application accepts that in between, data may be momentarily inconsistent, as long as it becomes consistent eventually. That trade — weaker guarantees for easier scale — is the deal that motivated the migration to the new stores.

The NoSQL family: one name, four formats.

Format Idea Representative
Document One self-contained document per entity (the replication-friendly shape from 17.5.3) MongoDB
Column-based Data stored by column, not by row — good for scanning huge columns Cassandra (standard classification: a wide-column store; the session describes it as a document format, and the point of the comparison — non-relational, flexible — is what matters here)
Graph Data as nodes and edges — good for relationship-heavy queries Graph stores
Key-value A simple lookup by key — the fastest, the least structured Key-value stores

The unifying fact is negative: any format that is not the relational one counts as NoSQL. Each format trades differently — but they share the two motivators: the relational approach took a lot of time to establish and to maintain, and its strict ACID guarantees are not always needed.

The eventual-consistency deal. A strongly consistent system guarantees that every reader sees the latest committed write, everywhere, immediately. That guarantee is expensive — it requires coordinating all copies before answering. Eventual consistency trades it: the application accepts that in between, data may be momentarily inconsistent — a replica may briefly serve an older value — as long as it becomes consistent eventually. In exchange, replicas can answer from their own copy without waiting for everyone else, which is what makes scale easy. The professor's framing is the whole deal in one sentence: weaker guarantees buy easier scale.

Real-world: the eventual-consistency trade is the same one made by modern social feeds, notification counters, and recommendation caches: a few moments of staleness are acceptable; losing the ability to scale is not. Your feed can be five seconds behind a friend's post — you will not notice — but the service cannot afford to make every feed read wait for every replica on the planet.

17.5.5 Sharding: Facebook's Path to Scale

The big-name technique in this story is sharding, which Facebook made famous. The idea: split the entire database into portions, and keep each portion replicated — in the picture drawn here, three replica copies, with a master and a sub-replica arrangement where the directory knows where the actual copy of each portion lives. A query from Singapore, one from Switzerland, one from India: each hits the database, is told where the actual data is, goes to that portion, and is served locally. The portion knows where its data is, and everything related to serving the query resides in that portion.

Sharding delivered scalability "from decent to great", and the mechanism that made it possible is the same letting-go of rigid tables: data is sorted and dumped across portions in JSON format. Because JSON is a plain, replicable representation, the portions can be replicated freely, and because replication works, the application becomes scalable. That is the modern pattern: new-age databases that people work with day in and day out are built on this trade.

Worked example: three queries, three portions, one directory.

The picture drawn in the session: the database is split into portions; each portion is kept in three replica copies, in a master-and-sub-replica arrangement; a directory records where the actual copy of each portion lives.

Three users query at the same moment:

  • A user in Singapore sends a query. It hits the database, the directory says "your data's portion is the copy in Singapore," the query is routed there and served locally.
  • A user in Switzerland sends a query. Same dance — routed to the Swiss copy of their portion — served locally.
  • A user in India sends a query. Routed to the Indian copy — served locally.

Each portion knows where its own data is, and everything needed to serve a query on that portion resides in that portion — no join to a far-away table, no trip across the world. The routing-by-location picture in the session is deliberately loose ("basically loosely the concept of sharding"); the essential mechanics — split, replicate, route by location — are exactly what the description above preserves.

Sense-check: without the split, one database serves every user on earth. With the split, a Singapore user's query touches a Singapore copy. The latency win and the throughput win come from the same move: every request is answered close to home, and no single machine holds the world's data. The database literature calls the two moves by their formal names — fragmentation (split the data) and replication (copy each fragment) — and sharding is the popular name for the combination.

Why JSON makes the shards replicable. The lecture gives the mechanism in one line: data is sorted and dumped across portions in JSON format, and because JSON is a plain, replicable representation, portions can be replicated freely. The point to carry: JSON has no relations, no foreign keys, no join constraints — a JSON document is just a file. A file is copied by one operation on one object. A relation is copied only with all the relations it joins to — one operation on the whole connected graph. That difference is why the shards can be replicated freely. That is the same self-containment argument from 17.5.3, now doing double duty: it makes both replication and sharding cheap, and together they took Facebook's scalability "from decent to great."

17.5.6 PL/SQL: Object Style Over Procedural Style

Alongside the new stores, the relational world itself evolved. PL/SQL and object-based formats allow a more object-style way of working with databases — the analogy given is the migration from C to Java: procedural style to object-oriented style, more natural for modern programmers. The claim is reassuring: the heart remains the same. PL/SQL is still SQL, the relational core still sits underneath, and the object style is a wrapper around the same ideas.

PL/SQL is to SQL as Java is to C. C is procedural — you write step-by-step procedures over data. Java is object-oriented — you wrap the same computations in objects, methods, and types, which modern programmers find more natural. The migration from C to Java did not change the underlying machine; it changed the style in which programs are written. The professor's analogy is exactly parallel: PL/SQL wraps SQL in object-style programming constructs, but the heart remains the same — PL/SQL is still SQL, the relational core still sits underneath, and the object style is a wrapper around the same ideas. Learn the relational core once, and SQL, PL/SQL, and object-relational variations are all dialects of the same language.

17.5.7 Q&A: Is Sharding in the Exam?

The status of the whole NoSQL discussion is settled with a direct question from a student.

Q: Is sharding also part of the examination? Can we discuss it sometime?

A: Sharding is not a topic for this examination — you can erase it from your preparation. But it is important: when you work in real life you will face situations where the database is not SQL and not relational. Be prepared for that. We can discuss it at length later, after the examination.

Pitfall: studying the bonus instead of the syllabus. The professor's instruction is explicit and slightly uncomfortable: this topic is not in the examination at all — erase it from preparation, but keep the knowledge for real life. The trap is psychological: NoSQL and sharding are interesting, and a fascinating non-examinable topic is the perfect excuse to avoid the boring examinable one. Resist it. The examinable map from section 17.1 does not contain MongoDB; it contains recovery, checkpointing, serializability, normalization, and indexing. Keep the NoSQL story as real-world knowledge, and spend the preparation hours where the marks are.

Exam note: sharding, NoSQL formats, and the SQL-versus-NoSQL comparison are not part of the comprehensive examination. The topic list that is examinable was given in section 17.1.

Recap + bridge. The final topic told the story of the modern database in four moves: the manageable one-database world (17.5.1), the three V's that broke it (17.5.2), the join wall that forced the replication of everything and launched MongoDB (17.5.3), and the sharding mechanism — split, replicate, route by location — that made the new stores scale (17.5.4–17.5.5), with PL/SQL as the relational world's own evolution (17.5.6). One sentence to carry forward: relational joins need every table, so relational replication is all-or-nothing; NoSQL documents are self-contained, so they replicate and shard cheaply — at the price of weaker consistency. The session as a whole closes the course: recovery and checkpointing are the examinable technical heart, and this NoSQL story is the bonus that matters in the working world.

Exam Guidance Summary

The comprehensive examination guidance, gathered in one place. Everything here was stated in the session; nothing has been added.

  • Scope: whatever is in the handout is part of the comprehensive examination — including topics from live sessions and recorded sessions. Nothing in the handout is exempt.
  • Examinable topics: normalization, ER model, SQL basics, relational algebra, relational calculus, B-tree and B+ tree indexing (must be practiced), database security and access control, and recovery. Lab-session query work is also part of it.
  • Not in the exam: query optimization (it exists in the on-campus offering only), and the NoSQL material from section 17.5 — sharding, MongoDB, and the SQL-versus-NoSQL comparison.
  • Where the questions will lean: topics after the mid-semester were assessed only feebly in the quizzes, so expect more opportunity to score there. Self-study topics are at worst about 10 marks out of 40 — covered topics carry the rest.
  • Open book: the examination is open book, so know where every topic lives in a textbook and in the references. Use bookmarks and ear-tags; practice a previous-year question paper.
  • Grading: relative grading, with a 50 percent average guideline for the course. Individual marks only matter relative to the class.
  • Uncertain topics (e.g., isolation levels): check the handout first, then the live and recorded sessions; bookmark the topic in the textbook; in the exam hall, use the book's index and study on the spot before attempting.
  • Answer-writing strategy: for every question, write one line of what you understand the question to mean; then the background theory in one or two lines; then your application of it; then consequences and your verdict. Write all assumptions out in full. Articulation is what earns partial marks.
  • SQL questions: evaluated as essentially correct or incorrect — a semicolon or a comma can change whether a query runs. Multiple correct solutions exist (nested queries, joins, join styles); what matters is that the query actually works and that your thought process is visible.
  • Planning: seven days, one hour per day, with at least one session on a previous-year question paper; then bookmark-and-navigate.

The whole summary in one paragraph. Everything in the handout — written, live, and recorded — is examinable; the concrete list is normalization, ER model, SQL, relational algebra and calculus, B/B+ tree indexing (practiced, not read), security and access control, and recovery. Query optimization and the NoSQL material are not in the exam. Grading is relative with a 50 percent average guideline, the exam is open book, and every answer should carry understanding, definition, application, consequences, and verdict — with assumptions written out, because articulation earns partial marks.

Key Industry Applications

The real-world names behind this lecture's technical content. Each entry ties one concept to where it actually shows up in industry.

  • IRCTC-style ticket booking: the running example of extreme transaction load — hundreds of transactions per second — used to motivate both concurrency control and checkpointing.
  • Social media applications: the course's own small social app is the example database for the log-file worked cases and the replication argument.
  • Hotmail, Gmail, Yahoo mail: the post-2000 explosion in mail data that outgrew the single-store relational arrangement; SMTP moves the mail, the database behind it is huge.
  • Shopping applications and Orkut, YouTube: the platforms that pushed volume, variety, and velocity past the old limits.
  • MongoDB and the NoSQL family: document, column-based, and graph formats (Cassandra included) that trade strict ACID for scale and ease of replication.
  • Facebook sharding: splitting the database into replicated portions with location-aware routing — queries served from the nearest copy, in JSON, enabling scalability.
  • PL/SQL: object-style database programming, compared to the C-to-Java migration, with the relational heart unchanged.
  • Journal-style logging: the log-file format is the same audit-trail idea used in financial accounting and file-system journaling.
  • Stable storage by replication: the vault analogy — multiple copies at different places surviving power loss, hardware failure, and natural disaster.
  • Undo/redo in everyday software: Ctrl-Z and Ctrl-Y in word processors as the everyday face of the undo-redo recovery operations.
  • Word-of-mouth professional practice: the problem-consequence-options-evaluation-recommendation framing taught for approaching any authority — exam teams, managers, or clients.

Why these names matter. Every technical concept in this lecture has a named industry face: recovery is the journaling inside every file system and the audit trail inside every accounting system; checkpointing is what keeps an IRCTC-scale log scannable; the NoSQL story is the MongoDB, Cassandra, and Facebook sharding world a working database person actually meets. Knowing the concept is the course; knowing its industry name is the professional's edge.

DDA Lecture 17 notes · Database Recovery, Checkpointing, and the NoSQL Shift

Database Design and Applications· postgraduate· 2026-08-06

Sections Breakdown

117.1 Comprehensive Examination: Scope, Strategy, and Grading

The comprehensive exam's scope (handout, live, recorded), the professional benchmarks the course is judged on, relative grading with a 50 percent average guideline, and the preparation strategy: the self-study split, open-book rules, and the four-line answer-writing frame.

217.2 Concurrency Control Recap: From ACID to Schedules

Transactions and ACID revisited; conflict serializability with the precedence-graph cycle test; view serializability's three conditions and the blind-write exception; and the two runtime engines — lock-based and timestamp-based control.

317.3 Recovery: Failures, Logs, and Undo-Redo

Failure types and their ACID impact; the recoverability rule; the log on stable storage and its record format; immediate versus deferred modification; idempotency; and the undo-redo recovery scan with a worked log.

417.4 Checkpointing: Where Does Recovery Begin?

Why the scan cannot start at the log's beginning; the checkpoint boundary and record; the worked four-transaction case and the two-bucket undo-redo procedure; and restarting a transaction after an abort.

517.5 SQL vs NoSQL, Sharding, and the Modern Database

The three V's (volume, variety, velocity), the join wall that makes relational replication all-or-nothing, NoSQL formats and eventual consistency, Facebook-style sharding, and PL/SQL as object-style SQL.

6Exam Guidance Summary

The professor's comprehensive-examination guidance in one place: examinable scope, relative grading, the open-book strategy, and the answer structure that earns partial marks.

7Key Industry Applications

Where the lecture's concepts live in industry: IRCTC-scale booking, social applications, mail platforms, MongoDB and the NoSQL family, Facebook sharding, journal-style logging, and undo-redo in everyday software.

Postgraduate students in Database Design and Applications

Exam Revision Notes

Below is the distilled, exam-ready core. Every entry comes from the full explanation above. Use this section for rapid review; return to the main notes when a point needs more context.

Comprehensive Examination: Scope, Strategy, and Grading

Must-know: Everything in the handout (written, live, recorded) is examinable; grading is relative with a 50 percent average guideline; self-study topics carry at most about 10 of 40 marks.

⚠️ Top pitfall: Treating the open book as a substitute for practice (B-tree procedures must be drilled), and attacking a rule without hypothesizing the reason behind it (loose sheets are banned because they can be exchanged).

Self-check: The class average is 190/200 and you scored 89. Is that a good result in a relative scheme?

Connects to: Sections 17.2, 17.3 of this lecture

Concurrency Control Recap: From ACID to Schedules

Must-know: Two operations conflict when they belong to different transactions, act on the same item, and at least one is a write. A schedule is conflict serializable iff its precedence graph has no cycle; conflict serializable implies view serializable.

⚠️ Top pitfall: Stopping at the conflict test when the question asks for view serializability: a failing conflict test is not a failing view test when blind writes are present.

Self-check: Schedule: r1(A), w2(A), w1(A), w3(A). Is it conflict serializable? Is it view serializable?

Connects to: Section 17.3 of this lecture

Recovery: Failures, Logs, and Undo-Redo

Must-know: Log format <T_i, X, v_old, v_new>; recovery scan: redo committed transactions (set items to v_new), undo uncommitted ones in reverse log order (restore v_old), write abort records. Redo is safe because writes are idempotent. Recoverability: readers must commit after the writer.

⚠️ Top pitfall: Undoing uncommitted work in forward order instead of reverse log order; redoing transactions that never committed.

Self-check: A log shows <T0, A, 1000, 950>, <T0, commit>, <T1, start>, <T1, P, 700, 750>. What does the recovery scan do?

Connects to: Sections 17.2, 17.4 of this lecture

Checkpointing: Where Does Recovery Begin?

Must-know: Checkpoint = all modified buffers written to disk, recorded as <checkpoint, active list>. Scan starts at the checkpoint: ignore pre-checkpoint transactions, redo committed ones, undo uncommitted ones (writing abort records). Undo bucket by default; commit record promotes to redo bucket.

⚠️ Top pitfall: Redoing the pre-checkpoint transaction (its work is already on disk) or assuming the checkpoint commits anything.

Self-check: A checkpoint lists T0 and T1 as active; after it, T1 commits and T2 starts but never commits. Where does each transaction end up?

Connects to: Section 17.3 of this lecture

SQL vs NoSQL, Sharding, and the Modern Database

Must-know: Sharding, NoSQL formats, and the SQL-versus-NoSQL comparison are NOT in the comprehensive examination. Relational replication is all-or-nothing because joins need every table; NoSQL documents are self-contained, enabling easy replication and sharding with eventual consistency.

⚠️ Top pitfall: Studying the fascinating non-examinable NoSQL material instead of the examinable syllabus (recovery, checkpointing, serializability, normalization, indexing).

Self-check: Why must a relational replica contain every table, while a document store can replicate per document?

Connects to: Section 17.1 of this lecture

Exam Guidance Summary

Must-know: Everything in the handout (written, live, recorded) is examinable: normalization, ER model, SQL basics, relational algebra, relational calculus, B-tree and B+ tree indexing (practiced), security and access control, recovery. Query optimization and NoSQL are not.

Connects to: Sections 17.1, 17.3, 17.5 of this lecture

Key Industry Applications

Connects to: Sections 17.3, 17.4, 17.5 of this lecture

Was this lecture useful?

Loading comments…
🤖

BitsNotes AI Assistant

Subject Notes Assistant

Configure AI Chat

Choose how to access the chatbot
Have your own API key?

Switch to "Bring Your Own Key" tab above for unlimited access with any OpenAI-compatible provider.

🔑 Enter API key above to fetch live models from provider, or enter model name manually.
OpenAI-Compatible API Support

Choose any provider preset (Gemini, DeepSeek, Kimi, GLM, MiniMax, Qwen, OpenAI, Groq, Ollama, etc.) or enter a custom endpoint URL.

Security & Privacy First

Your API key is sent directly from your browser to your specified provider. BitsNotes servers never store or see your key.