Results 1 to 6 of 6
  1. #1
    Join Date
    Nov 2006
    Posts
    512
    Plugin Contributions
    0

    Default 1062 Duplicate entry 'zc_cc21d2f64edffccfe06d12dd3327bf64' for key 1........

    Hello,

    I have had this error twice today:

    1062 Duplicate entry 'zc_cc21d2f64edffccfe06d12dd3327bf64' for key 1
    in:
    [db_cache table]

    since my fresh install of 1.3.7 (yesterday) I have been moving products around and deleting the default products quickly. I also moved my cart to the root this morning, but made sure my paths and configs were correct + ran a fix key cache

    The error message pops up, I do a page refresh and its gone, Perhaps its from all the admin activity/product movement deletes?

    maybe its nothing, but since this cart is only 24 hours old, I thought I would check to see if there is a bigger issue lurking...

  2. #2
    Join Date
    May 2006
    Posts
    23
    Plugin Contributions
    0

    Default Re: 1062 Duplicate entry 'zc_cc21d2f64edffccfe06d12dd3327bf64' for key 1........

    Quote Originally Posted by dharma View Post
    I have had this error twice today:

    1062 Duplicate entry 'zc_cc21d2f64edffccfe06d12dd3327bf64' for key 1
    I've just been looking at this myself.

    I *think* that this is casued by the following process:
    - Visitor 1 views a page, which causes a query to be run. That query is not in the cache so ZC runs the query then caches it for future use.
    - Visitor 2 views the same page, after Visitor 1 but before the result from Visitor 1 has been stored. It sees no result, runs the query, then tries to store it. By this time the results of Visitor 1 have been stored, resulting in a duplicate entry and this error.

    If I am right, then the simplest solution is to change the sql_cache_store() function in ~/includes/classes/cache.php, so that
    PHP Code:
    insert into 
    becomes
    PHP Code:
    replace into 
    or maybe
    PHP Code:
    insert ignore into 
    "Replace" would cause the second query to replace the first if it existed. "insert ignore" would just ignore the second query without error. The first sounds better (in that the most recent result is probably the best one to store), but the second would perform better under load and its unlikely that there'd be a change in the results at this point anyway, and if there were then giving the visitor the old data is better than giving the 1062 error.

    So, I'm trialling the latter option, but by its nature its hard to test so feedback welcome.

  3. #3
    Join Date
    Nov 2006
    Posts
    512
    Plugin Contributions
    0

    Default Re: 1062 Duplicate entry 'zc_cc21d2f64edffccfe06d12dd3327bf64' for key 1........

    I tried this suggestion:

    http://www.zen-cart.com/forum/showthread.php?t=58002

    so far, I have not seen the issue repeat, but my site is not live or been in too much use, so I can't say for sure if it helped/corrected the issue.

  4. #4
    Join Date
    May 2006
    Posts
    23
    Plugin Contributions
    0

    Default Re: 1062 Duplicate entry 'zc_cc21d2f64edffccfe06d12dd3327bf64' for key 1........

    Quote Originally Posted by dharma View Post
    I tried this suggestion:

    http://www.zen-cart.com/forum/showthread.php?t=58002

    so far, I have not seen the issue repeat, but my site is not live or been in too much use, so I can't say for sure if it helped/corrected the issue.
    That should definitely work: it just removes the functionality rather than attempting to fix it.

  5. #5
    Join Date
    Apr 2007
    Posts
    139
    Plugin Contributions
    0

    Default Re: 1062 Duplicate entry 'zc_cc21d2f64edffccfe06d12dd3327bf64' for key 1........

    My error seem to happen when I execute a job concurently. I tested using 2 browser and click 2 from different browser action at the same time. By deleting the content in db_cache is not a permanent solution. Any one with better solutions? Dr Byte??

  6. #6
    Join Date
    May 2006
    Posts
    23
    Plugin Contributions
    0

    Default Re: 1062 Duplicate entry 'zc_cc21d2f64edffccfe06d12dd3327bf64' for key 1........

    Quote Originally Posted by CJJUNE View Post
    My error seem to happen when I execute a job concurently. I tested using 2 browser and click 2 from different browser action at the same time. By deleting the content in db_cache is not a permanent solution. Any one with better solutions? Dr Byte??
    Did you try my hack above? That should solve the problem, but needs testing - sounds like you have the ideal environment to test.

 

 

Similar Threads

  1. 1062 Duplicate entry '1-1' for key 1 ????
    By eggrush in forum Setting Up Categories, Products, Attributes
    Replies: 2
    Last Post: 20 Oct 2010, 06:03 PM
  2. 1062 Duplicate entry '0' for key 1
    By FredZ in forum General Questions
    Replies: 4
    Last Post: 3 May 2010, 02:32 AM
  3. 1062 Duplicate entry '0' for key 1
    By knitengale in forum General Questions
    Replies: 8
    Last Post: 12 Jul 2006, 12:50 AM

Posting Permissions

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