Skip navigation links

MySQL Forums :: Transactions :: mysql innodb transaction concurrency


Advanced Search

Re: mysql innodb transaction concurrency
Posted by: venu gopal ()
Date: August 20, 2011 09:00AM

Hi Rick,

A final one, sorry to bother you.

I am bit worried about using cron job. Since it would be hosted on scalable cloud environment.

I am thinking like this, Please Guide me If I am wrong.

Sol
---
Instead of using cron job, System would check how many are reserved since 9 mintues (minute extra to be safe). So That I don't need cron at all.

An item has 3 states:
* In inventory, available for someone to purchase; (row lock through select for update)
* Grabbed by someone, but awaiting confirmed purchase; others are not allowed to initiate a purchase on this item; (You could provide the info "this items is 'tentatively' sold.) (lock table using select for update)
* Purchased. (lock table using select for update)

Like this
---------
1) SELECT item_id, items_rem, sell_max, sell_max_person, customer_pays FROM items WHERE item_id = ? FOR UPDATE
2)SELECT SUM(quantity) as count FROM reservations WHERE item_id = ? AND subscriber_id = ? AND created_at >= DATE_SUB( NOW(), INTERVAL 540 SECOND ) FOR UPDATE
3)SELECT SUM(quantity) as count FROM purchases WHERE item_id = ? AND user_id = ? FOR UPDATE

Will this cause any issue?



Edited 2 time(s). Last edit at 08/20/2011 09:08AM by venu gopal.

Options: ReplyQuote


Subject Views Written By Posted
mysql innodb transaction concurrency 3460 venu gopal 08/02/2011 09:08AM
Re: mysql innodb transaction concurrency 752 venu gopal 08/02/2011 09:39AM
Re: mysql innodb transaction concurrency 706 venu gopal 08/03/2011 09:56AM
Re: mysql innodb transaction concurrency 773 Peter Brawley 08/03/2011 10:05AM
Re: mysql innodb transaction concurrency 799 venu gopal 08/03/2011 10:13AM
Re: mysql innodb transaction concurrency 709 venu gopal 08/04/2011 10:24AM
Re: mysql innodb transaction concurrency 682 Peter Brawley 08/04/2011 11:40AM
Re: mysql innodb transaction concurrency 758 venu gopal 08/04/2011 11:36PM
Re: mysql innodb transaction concurrency 672 venu gopal 08/06/2011 07:33AM
Re: mysql innodb transaction concurrency 688 Peter Brawley 08/06/2011 12:57PM
Re: mysql innodb transaction concurrency 803 venu gopal 08/09/2011 08:04AM
Re: mysql innodb transaction concurrency 716 Peter Brawley 08/10/2011 08:44PM
Re: mysql innodb transaction concurrency 648 venu gopal 08/11/2011 12:28AM
Re: mysql innodb transaction concurrency 1111 Rick James 08/13/2011 01:45PM
Re: mysql innodb transaction concurrency 1076 venu gopal 08/14/2011 04:47AM
Re: mysql innodb transaction concurrency 886 Peter Brawley 08/14/2011 08:50AM
Re: mysql innodb transaction concurrency 659 venu gopal 08/14/2011 08:57AM
Re: mysql innodb transaction concurrency 964 Rick James 08/14/2011 11:59AM
Re: mysql innodb transaction concurrency 880 venu gopal 08/14/2011 11:46PM
Re: mysql innodb transaction concurrency 638 venu gopal 08/19/2011 11:03AM
Re: mysql innodb transaction concurrency 656 Rick James 08/20/2011 08:52AM
Re: mysql innodb transaction concurrency 607 venu gopal 08/20/2011 09:00AM
Re: mysql innodb transaction concurrency 712 Rick James 08/21/2011 08:38AM
Re: mysql innodb transaction concurrency 643 venu gopal 08/22/2011 12:29AM
Re: mysql innodb transaction concurrency 692 Rick James 08/22/2011 07:38PM
Re: mysql innodb transaction concurrency 648 Peter Brawley 08/14/2011 01:39PM
Re: mysql innodb transaction concurrency 810 venu gopal 08/15/2011 12:07AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.