Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

Admin Logs - Lock_Keys Lot Of Duplicates Rate Topic   - - - - -

 
  • VerDan
  • Member
  • Trial users
  • Join Date: 13-Nov 18
  • 24 posts

Posted 26 April 2019 - 06:19 PM #1

Looking at our Admin Logs, we have so many issues with the Duplicate entry when doing an insert in to the lock_keys table.    Our system is pretty heavily loaded and this really only seems to appear during high concurrency.

 

Problem is, it is completely cluttering up the log to the point where we do miss the occasional important item.

 

Looking into this, on solution I have seen (really the only one i could find anywhere) was to wrap the try-catch with an if key exists check and if it did, just putOffExpiration.   Trying this it didn't really help.

 

What did help was using that if key exists check in conjunction with changing the INSERT to a REPLACE.

// FROM  
   'INSERT INTO ?:lock_keys (key_id, token, expiry_at) VALUES (?s, ?s, UNIX_TIMESTAMP(NOW()) + ?i)',
//TO
   'REPLACE INTO ?:lock_keys (key_id, token, expiry_at) VALUES (?s, ?s, UNIX_TIMESTAMP(NOW()) + ?i)',

What i cannot find is any information related to the DatabaseStore.php file and what the impact of doing this will be.

 

I do know that REPLACE is slower than INSERT.   However, using Exception Handling to catch something that can be handled with the above seems like a better option.    I just don't know or can find what the purpose or issues I may face could be.

 

Anyone else seeing this or have suggestions or info?



 
  • The Tool
  • Been Here Way Too Long Member
  • Members
  • Join Date: 30-Mar 07
  • 3798 posts

Posted 28 April 2019 - 04:48 PM #2

https://forum.cs-car...ock-keys-table/



 
  • VerDan
  • Member
  • Trial users
  • Join Date: 13-Nov 18
  • 24 posts

Posted 30 April 2019 - 01:33 PM #3

Thank You !    I  posted what I "believe" is a better solution/addition to what was provided in your link.   Question I don't know since I don't really know the deep level guts of the code is if it is a negative change.

 

Hopefully others will add in -- especially the cs-cart team.