Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2010
    Posts
    3

    Unanswered: Data Integrity Issue

    I have a very popular website which uses a mysql database. There seems to be an issue with the database integrity as some of the information inserted and update are becoming corrupted when the server is under heavy load. One of the problems I am experiencing is some of the rows data being inserted or updated is cut short or completely left out. Other problems are with a marketplace in which two people who buy the same exact item at the same exact time. When this happens, both people lose their money, but only one person is getting the item. The site is programmed in PHP and the table uses the MYISAM storage engine. The problem with the missing or corrupt insert and update data happens about once a day, and the marketplace issue has only happened once so far, but I am trying to track down the cause or causes. Any and all suggestions are greatly appreciated.
    Last edited by bobage24; 03-04-10 at 03:21.

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    the odds are approximately 937,000 to 1 that the problem lies in the php code and not in the mysql server

    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Mar 2010
    Posts
    3
    Quote Originally Posted by r937 View Post
    the odds are approximately 937,000 to 1 that the problem lies in the php code and not in the mysql server

    Thanks, at least that gives me a starting point. Here's the thing, before the site became very popular, I had no problems with the database.
    Last edited by bobage24; 03-04-10 at 03:27.

  4. #4
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    still sounds like the PHP code
    check for row locks
    check for how a product migrates from being selected by a user to being purchased
    check if there are any retrospective checks done after the user goes tto he checkout to make sure the product is still available
    bear in mind you could be in very dodgy territory if you complete a sale and then subsequently don't have the goods.. you could be in breach of contract.
    I'd rather be riding on the Tiger 800 or the Norton

  5. #5
    Join Date
    Mar 2010
    Posts
    3
    Quote Originally Posted by healdem View Post
    still sounds like the PHP code
    check for row locks
    check for how a product migrates from being selected by a user to being purchased
    check if there are any retrospective checks done after the user goes tto he checkout to make sure the product is still available
    bear in mind you could be in very dodgy territory if you complete a sale and then subsequently don't have the goods.. you could be in breach of contract.

    Thanks, I will give those a shot. I do check to make sure the item hasn't yet been sold when completing the purchase with a query, and then if the item is still available, I go ahead and update the database. This issue with the market place has happened once so far, and I track the time of the purchases too, and they both occurred at the exact same second.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •