What should the database do to recover


Assignment: Log-based recovery, distributed concurrency control

1. Recovery: Assuming a redo-only recovery, what should the database do to recover if the following is the contents of the log upon recovery:

• T1 write X: was 3, now 6
• T2 write Y: was 2, now 0
• T1 commit
• T3 write X: was 6, now 4
• T2 commit

2. Recovery: Assuming a undo-redo recovery, what should the database do to recover if the following is the contents of the log upon recovery:

• T1 write X: was 3, now 6
• T2 write Y: was 2, now 0
• T1 commit
• Checkpoint
• T3 write X: was 6, now 4
• T2 write Z: was 1, now 5
• T3 commit

3. Suppose we have a MongoDB database with 4 replicas:

• Replica 1 is the primary, the others are secondaries
• Replica 1 writes document A and replicas 2 and 3 get the updated document
• Replica 1 writes document B, but crashes before updating any of the secondaries
• Replica 2 detects that replica 1 has crashed
• How does the system recover?
• What happens to documents A and B?

4. Suppose we have a MongoDB database with 4 replicas:

• Replica 1 is the primary, the others are secondaries

• Replica 1 writes document A and replica 2 gets the updated document

• A partition occurs: replicas 1 and 2 are in one partition, while replicas 3 and 4 are in the other partition (the 2 partitions now cannot communicate)

• Replicas 1 and 3 detect the partition

• What does the system do?

• Discuss what you think should be done with document A, and why.

5. Suppose we had a distributed database which uses locking where a transaction must lock all copies to do a write, 1 copy to do a read. If a transaction T1 cannot get a lock because of a conflicting lock by another transaction T2, then T1 is put on a queue for the lock. What happens in the following schedule (this is like the 2-phase locking questions). Each operation is preceded by the transaction issuing the request. Each row should be treated as happening concurrently on the 3 servers during one time period, so (unrealistically), the execution is synchronized.

Server 1

Server 2

Server 3

T1:Read(A)

T2:Read(A)

T3:Read(B)

T1:Write(A)

T2:Write(B)

T2:Write(B)

T2:Write(B)

T1:Write(A)

T3:Read(A)

 

 

T1:Write(A)

 

 

T3:Commit

 

T2:Commit

 

T1:Commit

 

 

Format your assignment according to the following formatting requirements:

1. The answer should be typed, double spaced, using Times New Roman font (size 12), with one-inch margins on all sides.

2. The response also includes a cover page containing the title of the assignment, the student's name, the course title, and the date. The cover page is not included in the required page length.

3. Also include a reference page. The Citations and references should follow APA format. The reference page is not included in the required page length.

Request for Solution File

Ask an Expert for Answer!!
Database Management System: What should the database do to recover
Reference No:- TGS03024757

Expected delivery within 24 Hours