• Hello,

    why where is no AUTO INCREMENT parameter for the PRIMARY KEY in table wp_lightbox_photoswipe_img in database table column imgkey?

    I have php error log mistake: “WordPress database returned error Duplicate entry ‘…..’ for key ‘PRIMARY’ in response to INSERT INTO wp_lightbox_photoswipe_img (imgkey, created, ….”

    The page I need help with: [log in to see the link]

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Arno Welzel

    (@awelzel)

    Answer: because “imgkey” is not a number which just counts up.

    “imgkey” is a generated md5 hash based on the file modification time plus the absolute file name including its path. This is used to check wether the file data is already cached in the database or not.

    What you experienced should never happen. The plugin first checks if there is an entry for this imgkey value and adds a record only this is not the case yet. Furthermore old records will get delete after 24 hours, so it is made sure that the database will not grow forever and old data based on images which don’t exist any longer, will get discarded.

    Also see here:

    https://github.com/arnowelzel/lightbox-photoswipe/blob/main/lightbox-photoswipe.php#L612

    and here:

    https://github.com/arnowelzel/lightbox-photoswipe/blob/main/lightbox-photoswipe.php#L655-L702

    The only reason I could imagine that this happened is on a very loaded server with so many requests (at least more than 5-10 visits per second) that a second instance of the script tried to add a record before the first one had a chance to store the value to the database. But I never experienced this, even on sites with more than 100.000 visits per day.

    For a further investigation I would have to check your server personally. You can get in touch with me via e-mail (see my contact address on https://arnowelzel.de/en/about-me).

    • This reply was modified 3 years, 5 months ago by Arno Welzel.
    Thread Starter cantoostinato8989

    (@cantoostinato8989)

    Hello Arno, now it is clear that this is not a number. This is really md5 hash. Not a number and autoincrement are not applicable. Sorry we didn’t pay attention to this right away.

    Our tariff plan is on shared hosting, it is quite possible that the problem in the Database arose due to hosting problems. We have no idea how you can check our server.

    Thank you very much.

    Thread Starter cantoostinato8989

    (@cantoostinato8989)

    I deselected the option – “Load image captions from database (this can cause delays on slow servers)”. We will see how this affects the errors. Regards!

    Plugin Author Arno Welzel

    (@awelzel)

    This option will not change anything. Image meta data will always be cached. You will only turn off captions with this option if you don’t have captions as alt-attribute in the images text or <figcaption> on your site.

    For one of the next updates I will try to wrap the check/update operation with semaphores, so only one script instance at a time can will try to update the database.

    I just create a Github issue for this: https://github.com/arnowelzel/lightbox-photoswipe/issues/79

    • This reply was modified 3 years, 5 months ago by Arno Welzel.
    Thread Starter cantoostinato8989

    (@cantoostinato8989)

    Yes, the same error

    Thread Starter cantoostinato8989

    (@cantoostinato8989)

    [19-Jun-2021 00:30:41 UTC] WordPress database returned error Duplicate entry ‘f41252bb12——– –600611c874’ for key ‘PRIMARY’ in response to INSERT INTO wp_lightbox_photoswipe_img (imgkey, created, width, height, exif_camera, exif exif_shutter, exif_iso, exif_datetime) VALUES (“f41252bb——– –a43ed600611c874”, “2021-06-19 00:30:41”, “1920”, “1080”, “”, “”, “”, “”, “”, “” ) executed by require (‘wp-blog-header.php’), require_once (‘wp-includes / template-loader.php’), include (‘/ themes / theme5 / single.php’), get_footer, locate_template, load_template , require_once (‘/ themes / theme5 / footer.php’), wp_footer, do_action (‘wp_footer’), WP_Hook-> do_action, WP_Hook-> apply_filters, call_user_func_array, LightboxPhotoSwipe-> fooreplace, lightbox-end_flut> LightboxPhotoSwipe-> outputCallbackPropertie

    Plugin Author Arno Welzel

    (@awelzel)

    Is this a website with a lot of requests – and with “a lot” I mean at least more than 50 requests per second (because I run websites with 20-50 requests per second and have no problems with the plugin so far)? Otherwise there is no logical explanation why this happens at all.

    About “checking the server”: this would involve providing a debug version of my plugin which will output more detailed information about what is going on. However when you install this, you would also have to send me the data from the plugin.

    If you contact me via e-mail I can also provide you a beta version which implements a fix for https://github.com/arnowelzel/lightbox-photoswipe/issues/79

    Thread Starter cantoostinato8989

    (@cantoostinato8989)

    Hi Arno,

    as we saw in WordPress console of our web-site, 2 days ago you made a new release 3.1.14 for your plugin “Lightbox with PhotoSwipe”. But in this new version 3.1.14, the current bug has not been fixed.

    You made the following changes sponsored by someone:
    “Added support to use the data-lbwps-gid attribute in Elementor image widgets and image carousel widgets to put images in their own lightbox”

    It is a pity that you did not pay attention to our problem in the latest version.

    We will be happy to update your plugin when our problem is also resolved.

    Plugin Author Arno Welzel

    (@awelzel)

    I do pay attention! Why do you think I don’t?

    Maybe I was not clear enough: I can not solve your issue with an update. This is not possible.

    As I already worte:

    If you contact me via e-mail I can also provide you a beta version which implements a fix for https://github.com/arnowelzel/lightbox-photoswipe/issues/79

    There is no other way – there is no simple fix. We have to try several ways to fix this as you are the very first of more than 10000 users reporting this and I don’t know what problem the database on your server has.

    You also did not answer my question yet if your site is a highly loaded site or not.

    So please get in touch with me via e-mail and we can try to solve this – this is all I can offer for now.

    Thread Starter cantoostinato8989

    (@cantoostinato8989)

    Hello, Arno, sorry for the long silence. Yes, our site is not heavily loaded. It is even rarely visited at all. Our site is [ now moved to the link field in the very first post ]

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘AUTO INCREMENT parameter for imgkey’ is closed to new replies.