Page 7 of 7 FirstFirst ... 567
Results 61 to 69 of 69
  1. #61
    Join Date
    Feb 2012
    Location
    mostly harmless
    Posts
    1,809
    Plugin Contributions
    8

    Default Re: 1062:Duplicate entry for key 1 in db_cache

    I would prefer an INSERT ... ON DUPLICATE KEY ... for MySQL.

    Longer syntax, but does performs an UPDATE if the insert fails versus always doing a DELETE + INSERT (if I remember correctly).

  2. #62
    Join Date
    Aug 2009
    Location
    North Idaho, USA
    Posts
    2,008
    Plugin Contributions
    1

    Default Re: 1062:Duplicate entry for key 1 in db_cache

    After 10 days without generating the MyDebug file, I was beginning to think that all was fine though I did not schedule a PCI scan on the first of the month which historically I see the file generated many times during a scan.

    Overnight, the 100K MyDebug file was generated.
    Rick
    RixStix (dot) com
    aka: ChainWeavers (dot) com

  3. #63
    Join Date
    Jan 2004
    Posts
    66,444
    Plugin Contributions
    279

    Default Re: 1062:Duplicate entry for key 1 in db_cache

    Just to close the loop here ...
    We've opted for ON DUPLICATE KEY UPDATE for ZC v1.6.0:
    https://github.com/zencart/zencart/pull/244/files
    and
    https://github.com/zencart/zencart/pull/245/files

    (Text in red is stuff that was removed. Text in green is stuff that was added/changed.
    Basically, remove all the lines that are shown as starting with a "-", and replace/add all lines that are shown as starting with a "+". The red and green are just clarifying guides.)
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  4. #64
    Join Date
    Jan 2007
    Location
    Australia
    Posts
    6,167
    Plugin Contributions
    7

    Default Re: 1062:Duplicate entry for key 1 in db_cache

    Quote Originally Posted by DrByte View Post
    Just to close the loop here ...
    We've opted for ON DUPLICATE KEY UPDATE for ZC v1.6.0:
    https://github.com/zencart/zencart/pull/244
    and
    https://github.com/zencart/zencart/pull/245

    I don't wish to be a pain, but is this really the best of the possible solutions?

    What happens when two visitors get given the same sessionID, but only one can be entered into the database, wouldn't the "on duplicate key" effectively cause customer#2 to 'steal' the SessionID assigned to customer#1?

    On the other hand, the 'insert ignore' will cause customer#2's insert to fail, which I assume will result in a new sessionID being generated for them, and customer#1's sessionID would remain unchanged.

    I'm not seeing any benefits with the 'on duplicate key update' in this particular scenario.

    Just my 2cents worth.

    Cheers
    RodG

  5. #65
    Join Date
    Feb 2012
    Location
    mostly harmless
    Posts
    1,809
    Plugin Contributions
    8

    Default Re: 1062:Duplicate entry for key 1 in db_cache

    The place in sessions.php where the "ON DUPLICATE KEY UPDATE" occurs is only called at the END of a script or when PHP needs to write / update the existing session in the database. The same code block also updates the expiry information for the session). Validation and session creation happen earlier in the process.

    The change in "sessions.php" basically replaces an existing "select; insert if not in database, update if in database" with a "insert in database, if cannot insert then update instead". By removing the first "select" and using the "on duplicate update", we remove a race condition - typically experienced when people use "multiple windows or tabs" in the browser.
    The glass is not half full. The glass is not half empty. The glass is simply too big!
    Where are the Zen Cart Debug Logs? Where are the HTTP 500 / Server Error Logs?
    Zen Cart related projects maintained by lhûngîl : Plugin / Module Tracker

  6. #66
    Join Date
    Aug 2009
    Location
    North Idaho, USA
    Posts
    2,008
    Plugin Contributions
    1

    Default Re: 1062:Duplicate entry for key 1 in db_cache

    I may be misunderstanding something but there are 2 similar threads but offer different solutions.

    1 edits sessions.php
    1 edits cache.php

    The edit to sessions.php did not appear to make any difference in the log files generated.
    The edit to cache.php did have an effect. ie: the log files are no longer generated.

    Can someone clear my clouded head? Are they intended to resolve different 1062: duplicate entry log files or are they 2 different attempts to resolve the same issue? Or are they both required to resolve the same issue?
    Rick
    RixStix (dot) com
    aka: ChainWeavers (dot) com

  7. #67
    Join Date
    Jan 2004
    Posts
    66,444
    Plugin Contributions
    279

    Default Re: 1062:Duplicate entry for key 1 in db_cache

    Similar issue, two different cases.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  8. #68
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    10,515
    Plugin Contributions
    126

    Default Re: 1062:Duplicate entry for key 1 in db_cache

    Quote Originally Posted by DrByte View Post
    Just to close the loop here ...
    We've opted for ON DUPLICATE KEY UPDATE for ZC v1.6.0:
    https://github.com/zencart/zencart/pull/244
    and
    https://github.com/zencart/zencart/pull/245
    Do you think this note warrants inclusion in the 1.5.4 fixes thread?
    http://www.zen-cart.com/showthread.p...s)-with-v1-5-4
    That Software Guy. My Store: Zen Cart Support
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

  9. #69
    Join Date
    Jan 2004
    Posts
    66,444
    Plugin Contributions
    279

    Default Re: 1062:Duplicate entry for key 1 in db_cache

    Quote Originally Posted by swguy View Post
    Do you think this note warrants inclusion in the 1.5.4 fixes thread?
    http://www.zen-cart.com/showthread.p...s)-with-v1-5-4
    While it's not specific only to 1.5.4, I've posted it there.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

 

 
Page 7 of 7 FirstFirst ... 567

Similar Threads

  1. Replies: 3
    Last Post: 21 Jan 2016, 10:35 PM
  2. ERROR message help 1062 Duplicate entry for key 1 in db_cache
    By shartlesville in forum General Questions
    Replies: 4
    Last Post: 30 Aug 2012, 03:21 AM
  3. 1062 Duplicate entry '1-1' for key 1
    By spooky130 in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 18 Jun 2011, 05:33 AM
  4. Replies: 6
    Last Post: 30 Dec 2008, 12:49 AM
  5. 1062 Duplicate entry db_cache ?
    By FoneGuy in forum General Questions
    Replies: 5
    Last Post: 30 Jan 2008, 07:42 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