Question 71
HardSchedule: T1 writes X, T2 reads X, T2 commits, T1 aborts. What is wrong?
- A.
Popular companies
Prepare company by company
Hiring pattern, syllabus, past questions and mocks for each company.
All companiesPractice by subject
DBMS
Schedule: T1 writes X, T2 reads X, T2 commits, T1 aborts. What is wrong?
It is not recoverable: T2 committed after reading data that was later undone
Nothing
It is serial
It is deadlocked
Sign up free to see the answer and a step-by-step explanation.
A strict schedule is one in which:
Only reads are allowed
Every transaction aborts
Transactions run one at a time
No transaction reads or overwrites an item until the transaction that last wrote it has committed or aborted
Sign up free to see the answer and a step-by-step explanation.
What is a savepoint used for?
Backing up the database
Committing early
Rolling back part of a transaction without abandoning all of it
Locking a table
Sign up free to see the answer and a step-by-step explanation.
A bank transfer debits A and credits B in one transaction. The debit succeeds, but the credit fails a CHECK constraint. What should happen?
The database shuts down
The whole transaction is rolled back, restoring A's balance
Only the credit is retried
The debit stays
Sign up free to see the answer and a step-by-step explanation.
What is the two-phase commit protocol used for?
Running two copies of a database
Locking in two phases
Making a transaction that spans several databases either commit everywhere or abort everywhere
Splitting a table in two
Sign up free to see the answer and a step-by-step explanation.
What is the main weakness of two-phase commit?
It works only on one machine
It needs no log
It never commits
Participants can block if the coordinator fails after they have voted to commit
Sign up free to see the answer and a step-by-step explanation.
What does 'durability' require when a database reports that a transaction has committed?
The changes survive any later crash, typically because the commit record is on stable storage
The changes are visible only to the transaction
The changes can be undone later
The changes are in memory
Sign up free to see the answer and a step-by-step explanation.
Under READ COMMITTED, T1 runs SELECT SUM(balance) while T2 transfers money between two accounts and commits mid-way through T1's scan. What might T1 see?
Always the correct total
An error
A dirty read of uncommitted data
A total that is wrong, since it may read one account before and the other after the transfer
Sign up free to see the answer and a step-by-step explanation.
Which states can a transaction move to directly from 'active'?
Partially committed or failed
Committed only
Terminated only
Aborted only
Sign up free to see the answer and a step-by-step explanation.
Why should long-running user interactions not be placed inside a database transaction?
Users can't see data
It disables durability
Transactions can't last more than a second
Locks held during the interaction block other users and raise the risk of deadlocks
Sign up free to see the answer and a step-by-step explanation.