Computer Science Engineering (CSE) Exam  >  Computer Science Engineering (CSE) Questions  >  Consider the following log sequence of two tr... Start Learning for Free
Consider the following log sequence of two transactions on a bank account, with initial balance 12000, that transfer 2000 to a mortgage payment and then apply a 5% interest.
1. T1 start
2. T1 B old=12000 new=10000
3. T1 M old=0 new=2000
4. T1 commit
5. T2 start
6. T2 B old=10000 new=10500
7. T2 commit
Q. Suppose the database system cra shes just before log record 7 is written. When the system is restarted, which one statement is true of the recovery procedure?
  • a)
    We must redo log record 6 to set B to 10500
  • b)
    We must undo log record 6 to set B to 10000 and then redo log records 2 and 3.
  • c)
    We need not redo log records 2 and 3 because transaction T1 has committed.
  • d)
    We can apply redo and undo operations in arbitrary order because they are idempotent
Correct answer is option 'B'. Can you explain this answer?
Verified Answer
Consider the following log sequence of two transactions on a bank acco...
We must undo log record 6 to set B to 10000 and then redo log records 2 and 3 bcoz system fail before commit operation. So we need to undone active transactions(T2) and redo committed transactions (T1) Note:Here we are not using checkpoints. Checkpoint : Checkpoint is a mechanism where all the previous logs are removed from the system and stored permanently in a storage disk. Checkpoint declares a point before which the DBMS was in consistent state, and all the transactions were committed. Recovery: When a system with concurrent transactions crashes and recovers, it behaves in the following manner − =>The recovery system reads the logs backwards from the end to the last checkpoint. =>It maintains two lists, an undo-list and a redo-list. =>If the recovery system sees a log with and or just , it puts the transaction in the redo-list. =>If the recovery system sees a log with but no commit or abort log found, it puts the transaction in undo-list. All the transactions in the undo-list are then undone and their logs are removed. All the transactions in the redo-list and their previous logs are removed and then redone before saving their logs. So Answer is B redo log records 2 and 3 and undo log record 6
View all questions of this test
Most Upvoted Answer
Consider the following log sequence of two transactions on a bank acco...
Recovery Procedure Explanation:

1. Understanding the Logs:
- The given log sequence consists of two transactions, T1 and T2, operating on a bank account with an initial balance of 12000.
- Transaction T1 transfers 2000 to a mortgage payment, while Transaction T2 applies a 5% interest.
- Each log record represents a specific operation performed by a transaction.

2. Crash Before Log Record 7:
- The system crashes just before log record 7 is written, which means the changes made by Transaction T2 are not yet permanently recorded in the log.
- This situation requires a recovery procedure to bring the database back to a consistent state.

3. Recovery Steps:
Given the crash scenario, the following steps need to be performed during the recovery procedure:

3.1. Identify the Last Committed Transaction:
- Since the system crashed before log record 7, the last committed transaction is T1, as indicated by log record 4 (T1 commit).

3.2. Redo and Undo Operations:
- Redo operation: Re-apply the changes made by the last committed transaction (T1) to bring the database up to date.
- Undo operation: Reverse the changes made by the uncommitted transaction (T2) to restore the database to a consistent state.

4. Applying the Recovery Procedure:
Based on the above steps, the recovery procedure in this scenario would involve the following operations:

4.1. Undo Log Record 6:
- Since Transaction T2 did not commit before the crash, log record 6 (T2 commit) needs to be undone.
- Undoing log record 6 involves setting the balance (B) back to its old value of 10000 (as mentioned in the log record).

4.2. Redo Log Records 2 and 3:
- After undoing log record 6, the recovery procedure should redo the changes made by Transaction T1.
- Log records 2 (T1 B) and 3 (T1 M) need to be applied in order to set the balance (B) to 10500 and update the mortgage payment (M) to 2000.

5. Final State:
- After applying the redo and undo operations, the database will be in a consistent state with a balance (B) of 10500, reflecting the changes made by Transaction T1.

Therefore, option 'B' is the correct answer because the recovery procedure involves undoing log record 6 and then redoing log records 2 and 3 to restore the database to its consistent state.
Explore Courses for Computer Science Engineering (CSE) exam

Similar Computer Science Engineering (CSE) Doubts

Top Courses for Computer Science Engineering (CSE)

Consider the following log sequence of two transactions on a bank account, with initial balance 12000, that transfer 2000 to a mortgage payment and then apply a 5% interest.1. T1 start2. T1 B old=12000 new=100003. T1 M old=0 new=20004. T1 commit5. T2 start6. T2 B old=10000 new=105007. T2 commitQ. Suppose the database system cra shes just before log record 7 is written. When the system is restarted, which one statement is true of the recovery procedure?a)We must redo log record 6 to set B to 10500b)We must undo log record 6 to set B to 10000 and then redo log records 2 and 3.c)We need not redo log records 2 and 3 because transaction T1 has committed.d)We can apply redo and undo operations in arbitrary order because they are idempotentCorrect answer is option 'B'. Can you explain this answer?
Question Description
Consider the following log sequence of two transactions on a bank account, with initial balance 12000, that transfer 2000 to a mortgage payment and then apply a 5% interest.1. T1 start2. T1 B old=12000 new=100003. T1 M old=0 new=20004. T1 commit5. T2 start6. T2 B old=10000 new=105007. T2 commitQ. Suppose the database system cra shes just before log record 7 is written. When the system is restarted, which one statement is true of the recovery procedure?a)We must redo log record 6 to set B to 10500b)We must undo log record 6 to set B to 10000 and then redo log records 2 and 3.c)We need not redo log records 2 and 3 because transaction T1 has committed.d)We can apply redo and undo operations in arbitrary order because they are idempotentCorrect answer is option 'B'. Can you explain this answer? for Computer Science Engineering (CSE) 2024 is part of Computer Science Engineering (CSE) preparation. The Question and answers have been prepared according to the Computer Science Engineering (CSE) exam syllabus. Information about Consider the following log sequence of two transactions on a bank account, with initial balance 12000, that transfer 2000 to a mortgage payment and then apply a 5% interest.1. T1 start2. T1 B old=12000 new=100003. T1 M old=0 new=20004. T1 commit5. T2 start6. T2 B old=10000 new=105007. T2 commitQ. Suppose the database system cra shes just before log record 7 is written. When the system is restarted, which one statement is true of the recovery procedure?a)We must redo log record 6 to set B to 10500b)We must undo log record 6 to set B to 10000 and then redo log records 2 and 3.c)We need not redo log records 2 and 3 because transaction T1 has committed.d)We can apply redo and undo operations in arbitrary order because they are idempotentCorrect answer is option 'B'. Can you explain this answer? covers all topics & solutions for Computer Science Engineering (CSE) 2024 Exam. Find important definitions, questions, meanings, examples, exercises and tests below for Consider the following log sequence of two transactions on a bank account, with initial balance 12000, that transfer 2000 to a mortgage payment and then apply a 5% interest.1. T1 start2. T1 B old=12000 new=100003. T1 M old=0 new=20004. T1 commit5. T2 start6. T2 B old=10000 new=105007. T2 commitQ. Suppose the database system cra shes just before log record 7 is written. When the system is restarted, which one statement is true of the recovery procedure?a)We must redo log record 6 to set B to 10500b)We must undo log record 6 to set B to 10000 and then redo log records 2 and 3.c)We need not redo log records 2 and 3 because transaction T1 has committed.d)We can apply redo and undo operations in arbitrary order because they are idempotentCorrect answer is option 'B'. Can you explain this answer?.
Solutions for Consider the following log sequence of two transactions on a bank account, with initial balance 12000, that transfer 2000 to a mortgage payment and then apply a 5% interest.1. T1 start2. T1 B old=12000 new=100003. T1 M old=0 new=20004. T1 commit5. T2 start6. T2 B old=10000 new=105007. T2 commitQ. Suppose the database system cra shes just before log record 7 is written. When the system is restarted, which one statement is true of the recovery procedure?a)We must redo log record 6 to set B to 10500b)We must undo log record 6 to set B to 10000 and then redo log records 2 and 3.c)We need not redo log records 2 and 3 because transaction T1 has committed.d)We can apply redo and undo operations in arbitrary order because they are idempotentCorrect answer is option 'B'. Can you explain this answer? in English & in Hindi are available as part of our courses for Computer Science Engineering (CSE). Download more important topics, notes, lectures and mock test series for Computer Science Engineering (CSE) Exam by signing up for free.
Here you can find the meaning of Consider the following log sequence of two transactions on a bank account, with initial balance 12000, that transfer 2000 to a mortgage payment and then apply a 5% interest.1. T1 start2. T1 B old=12000 new=100003. T1 M old=0 new=20004. T1 commit5. T2 start6. T2 B old=10000 new=105007. T2 commitQ. Suppose the database system cra shes just before log record 7 is written. When the system is restarted, which one statement is true of the recovery procedure?a)We must redo log record 6 to set B to 10500b)We must undo log record 6 to set B to 10000 and then redo log records 2 and 3.c)We need not redo log records 2 and 3 because transaction T1 has committed.d)We can apply redo and undo operations in arbitrary order because they are idempotentCorrect answer is option 'B'. Can you explain this answer? defined & explained in the simplest way possible. Besides giving the explanation of Consider the following log sequence of two transactions on a bank account, with initial balance 12000, that transfer 2000 to a mortgage payment and then apply a 5% interest.1. T1 start2. T1 B old=12000 new=100003. T1 M old=0 new=20004. T1 commit5. T2 start6. T2 B old=10000 new=105007. T2 commitQ. Suppose the database system cra shes just before log record 7 is written. When the system is restarted, which one statement is true of the recovery procedure?a)We must redo log record 6 to set B to 10500b)We must undo log record 6 to set B to 10000 and then redo log records 2 and 3.c)We need not redo log records 2 and 3 because transaction T1 has committed.d)We can apply redo and undo operations in arbitrary order because they are idempotentCorrect answer is option 'B'. Can you explain this answer?, a detailed solution for Consider the following log sequence of two transactions on a bank account, with initial balance 12000, that transfer 2000 to a mortgage payment and then apply a 5% interest.1. T1 start2. T1 B old=12000 new=100003. T1 M old=0 new=20004. T1 commit5. T2 start6. T2 B old=10000 new=105007. T2 commitQ. Suppose the database system cra shes just before log record 7 is written. When the system is restarted, which one statement is true of the recovery procedure?a)We must redo log record 6 to set B to 10500b)We must undo log record 6 to set B to 10000 and then redo log records 2 and 3.c)We need not redo log records 2 and 3 because transaction T1 has committed.d)We can apply redo and undo operations in arbitrary order because they are idempotentCorrect answer is option 'B'. Can you explain this answer? has been provided alongside types of Consider the following log sequence of two transactions on a bank account, with initial balance 12000, that transfer 2000 to a mortgage payment and then apply a 5% interest.1. T1 start2. T1 B old=12000 new=100003. T1 M old=0 new=20004. T1 commit5. T2 start6. T2 B old=10000 new=105007. T2 commitQ. Suppose the database system cra shes just before log record 7 is written. When the system is restarted, which one statement is true of the recovery procedure?a)We must redo log record 6 to set B to 10500b)We must undo log record 6 to set B to 10000 and then redo log records 2 and 3.c)We need not redo log records 2 and 3 because transaction T1 has committed.d)We can apply redo and undo operations in arbitrary order because they are idempotentCorrect answer is option 'B'. Can you explain this answer? theory, EduRev gives you an ample number of questions to practice Consider the following log sequence of two transactions on a bank account, with initial balance 12000, that transfer 2000 to a mortgage payment and then apply a 5% interest.1. T1 start2. T1 B old=12000 new=100003. T1 M old=0 new=20004. T1 commit5. T2 start6. T2 B old=10000 new=105007. T2 commitQ. Suppose the database system cra shes just before log record 7 is written. When the system is restarted, which one statement is true of the recovery procedure?a)We must redo log record 6 to set B to 10500b)We must undo log record 6 to set B to 10000 and then redo log records 2 and 3.c)We need not redo log records 2 and 3 because transaction T1 has committed.d)We can apply redo and undo operations in arbitrary order because they are idempotentCorrect answer is option 'B'. Can you explain this answer? tests, examples and also practice Computer Science Engineering (CSE) tests.
Explore Courses for Computer Science Engineering (CSE) exam

Top Courses for Computer Science Engineering (CSE)

Explore Courses
Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev