Answered step by step
Verified Expert Solution
Question
1 Approved Answer
This question relates to transactions and concurrency. You may find it helpful to use transaction histories to explain your answers. Customers of Kim's Coffee
This question relates to transactions and concurrency. You may find it helpful to use transaction histories to explain your answers. Customers of Kim's Coffee are automatically enrolled in a loyalty scheme. Customers receive a bonus point each time they make a purchase. These are stored in Kim's database and a query is provided so that customers can see the number of points they have (their balance) at any time. To increase business and attract new customers, Kim's Coffee has two special promotions. During "Add 5" weeks, customers receive 5 bonus points instead of 1 when they make a purchase. In "Double Dip" weeks the balance of customers who make a purchase is doubled. Kim's Coffee has a transaction for each of these. 15 reads a customer's balance, adds 5 to it, writes it back to the database and commits. T2 reads a customer's balance, doubles it, writes it back to the database and commits. This week Kim's Coffee is offering both promotions. A customer, Lee, calls to complain. He says "I have only made one purchase this week. My points balance was 4 and now it is 13 I think it should be more." Another customer, Alex, also complains saying "I have only made one purchase this week. My points balance was 4 and now it is 8I didn't get my extra 5 points." Kim checks the logs and is horrified to discover that customers who had 4 points at the beginning of the week, and made only one purchase, now have different balances 13, 9, 8 or 18. 1. What is going on here? Clearly and concisely explain why customers whose initial balances were the same now have different balances. 2. Are any of the 4 values "incorrect"? Briefly explain. 3. What, if anything, could be done to prevent this situation from occurring? If you wish, you may attach PDF documents and/or image files as part of your answer to this question. Please ensure that your name or userid appears on any files you attach.
Step by Step Solution
★★★★★
3.47 Rating (144 Votes )
There are 3 Steps involved in it
Step: 1
Answer All the four customers whose initial points balances were 4 and have made a single p...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