Question
MYSQL - All context given, can't give more info out due to teacher being vague with requirements. Inconsistent Reads The transactions shown below do not
MYSQL - All context given, can't give more info out due to teacher being vague with requirements.
- Inconsistent Reads
The transactions shown below do not use any locking. Transaction 1 reads and writes checking and savings records to do a transfer of $100. Transaction 2 reads checking and savings and incorrectly get a total amount of $1600. Describe what would happens at each time (what data values are read/written to the database and any locks, waits or errors) when pessimistic locking is used.
Time | Transaction 1 | Transaction 2 | Database |
t1 | read record Checking as 1000. | checking 1000.00 savings 500.00 | |
t2 | read record Checking as 1000. | ||
t3 | read record Savings as 500 | ||
t4 | subtract $100 from checking add $100 to savings | ||
t5 | write checking as 900. | checking 900.00 savings 500.00 | |
t6 | write savings as 600. | checking 900.00 savings 600.00 | |
t7 | commit | ||
t8 | read record savings as 600. | ||
t9 | display sum=checking+savings display 1600. |
1. Inconsistent Reads The transactions shown below do not use any locking. Transaction 1 reads and writes checking and savings records to do a transfer of $100. Transaction 2 reads checking and savings and incorrectly get a total amount of $1600. Describe what would happens at each time (what data values are read/written to the database and any locks, waits or errors) when pessimistic locking is used. Time Transaction 2 t1 Transaction 1 read record Checking as 1000. Database checking 1000.00 savings 500.00 t2 read record Checking as 1000. t3 t4 t5 read record Savings as 500 subtract $100 from checking add $100 to savings write checking as 900. write savings as 600. commit checking 900.00 savings 500.00 checking 900.00 savings 600.00 t6 t7 t8 t9 read record savings as 600. display sum=checking+savings display 1600
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started