582 - 780: Transaction Management Flashcards

1
Q

What does a transaction ensure when executed?
a) Only atomicity
b) All or nothing principle
c) Partial data storage
d) Immediate durability

A

b) All or nothing principle

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Which problem is caused by a transaction reading uncommitted data?
a) Lost update anomaly
b) Dirty read
c) Inconsistent read
d) Serializability issue

A

b) Dirty read

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What does Two-Phase Locking (2PL) guarantee?
a) Non-conflicting writes
b) Serializability of transactions
c) Read-only isolation
d) Durability

A

b) Serializability of transactions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the primary goal of recovery in transaction management?
a) Achieving isolation
b) Guaranteeing durability and atomicity
c) Avoiding rollback failures
d) Managing transaction anomalies

A

b) Guaranteeing durability and atomicity

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Which of the following is NOT a type of transaction failure?
a) Device failure
b) System failure
c) User-induced failure
d) Catastrophe

A

c) User-induced failure

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Define Dirty Read.

A

When a transaction reads data that has been modified by another transaction but not yet committed.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Define Inconsistent Read.

A

Occurs when a transaction reads data at different points in time and sees a non-consistent state due to updates by other transactions.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Define Lost Update Anomaly.

A

Happens when two transactions read the same data and update it simultaneously, leading to one update being overwritten.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What are the ACID properties?

A

Atomicity: Ensures all operations in a transaction are completed or none at all.
Consistency: Maintains database consistency before and after the transaction.
Isolation: Transactions appear to run independently.
Durability: Completed transactions are permanently stored.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Explain Two-Phase Locking (2PL).

A

A concurrency control method where:

Growing Phase: Locks are acquired but not released.
Shrinking Phase: Locks are released, and no new locks can be acquired.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is Serializability in transactions?

A

The property ensuring that the result of executing transactions concurrently is the same as executing them serially in some order.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Explain what happens during a system crash in a committed transaction.

A

Changes from the committed transaction must be redone to ensure durability.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Explain what happens if a system crash occurs during an uncommitted transaction.

A

All changes made by the uncommitted transaction are undone to maintain atomicity.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is Write-Ahead Logging (WAL)?

A

A method ensuring changes are logged before they are applied to the database, allowing recovery through redo and undo operations.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is the goal of crash recovery?

A) To revert the database to its original state.
B) To ensure all transactions are completed.
C) To restore the database to the most recent consistent state before the crash.
D) To delete uncommitted transactions.

A

C) To restore the database to the most recent consistent state before the crash.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Which recovery phase identifies winner and loser transactions?

A) Redo
B) Analysis
C) Undo
D) Checkpoints

A

B) Analysis

17
Q

What does the Write-Ahead Logging (WAL) principle ensure?

A) Logs are written after pages are updated on disk.
B) Logs are written before any modifications are written to disk.
C) Logs are ignored during recovery.
D) Logs are only used for redo operations.

A

B) Logs are written before any modifications are written to disk.

18
Q

What configuration combines steal and no force policies?

A) No Undo, No Redo
B) Redo Only
C) Undo Only
D) Undo and Redo

A

D) Undo and Redo

19
Q

Explain the concept of steal in buffer management.

A

Steal allows dirty pages to be replaced in the buffer and written to disk before a transaction commits.

20
Q

Describe the purpose of the recovery table in crash recovery.

A

The recovery table identifies winner transactions, loser transactions, and helps track which operations need to be redone or undone.

21
Q

What are the three phases of a restart after a failure?

A

Analysis: Identify the current state and categorize transactions as winners or losers.
Redo: Replay history to ensure all committed changes are on disk.
Undo: Revert changes made by loser transactions.

22
Q

How does logging help in crash recovery?

A

Logs provide a record of changes that can be replayed (redo) or reverted (undo) to restore the database to a consistent state.

23
Q

What does a compensation log record (CLR) do during recovery?

A

A CLR records the reversal of an operation, ensuring idempotence even if the recovery process crashes.

24
Q

Differentiate between force and no force policies in recovery.

A

Force: Writes all modified pages of a transaction to disk upon commit.
No force: Allows modified pages to remain in the buffer, requiring redo during recovery.

25
Q

How do checkpoints improve recovery efficiency?

A

Checkpoints reduce the log file size that needs to be analyzed during recovery by marking a point where the database was consistent.

26
Q

What is the PageLSN, and why is it important?

A

PageLSN is the Log Sequence Number stored in a page, identifying the most recent log entry for the page. It helps determine if an operation has already been applied.