Error when running update script to upgrade from 3.11 to 4.1.4

Created on 22 March 2023, over 1 year ago
Updated 30 July 2023, 11 months ago

I updated the module from version 3.11 to 4.1.4, but while running the update script (drush updb), I get the following error:

>  [notice] Update started: simple_sitemap_update_8401
>  [error]  SQLSTATE[23000]: Integrity constraint violation: 1062 ALTER TABLE causes auto_increment resequencing, resulting in duplicate entry '1' for key 'PRIMARY': ALTER TABLE "simple_sitemap" CHANGE `id` `id` INT unsigned NOT NULL auto_increment COMMENT 'Sitemap chunk unique identifier.'; Array

I tried again running /core/rebuild.php before drush updb as suggested on the project, but still get the error.

Any suggestions on how to resolve this?

πŸ’¬ Support request
Status

Fixed

Version

4.1

Component

Code

Created by

πŸ‡¨πŸ‡¦Canada brunodbo Coast Salish Territory

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @brunodbo
  • πŸ‡©πŸ‡ͺGermany gbyte Berlin

    I've never seen that. It seems there is a problem with existing sitemap data when updating the database table. Thankfully you can delete sitemap data (it's basically where your sitempas are cached) without having to delete sitemaps - just disable them all on the page /admin/config/search/simplesitemap, run the update and re-enable them. You will have to run indexation (or wait for cron to do it) to have those sitemaps back online though. Let me know if this helps.

  • πŸ‡¨πŸ‡¦Canada brunodbo Coast Salish Territory

    Thanks for the quick response. I wasn't seeing an option to disable the sitemaps in v3, and couldn't see any of my sitemaps after updating to v4. I ended up uninstalling Simple Sitemap v3 and starting again from scratch on v4, all in all pretty quick since I just had a single sitemap to deal with.

  • Status changed to Fixed over 1 year ago
  • πŸ‡¨πŸ‡¦Canada brunodbo Coast Salish Territory
  • πŸ‡©πŸ‡ͺGermany gbyte Berlin

    Obviously you can't disable sitemaps in 3.x, sorry for my brain fart... Glad to hear all is working now.

  • Automatically closed - issue fixed for 2 weeks with no activity.

  • Status changed to Fixed 12 months ago
  • πŸ‡¨πŸ‡¦Canada maursilveira Windsor, ON

    Leaving this note here, in case other have the same issue.

    I had the same error when trying to execute database updates (via drush updb) after upgrading from 8.x-3.11 to 4.1.x. I noticed that I had a sitemap regeneration in progress in the Sitemap status. After simply clicking on "Rebuild queue", I was able to execute the database updates with no errors.

  • πŸ‡¨πŸ‡¦Canada joseph.olstad

    @maursilveira , thanks so much for this, I also had to use your workaround.

    drush simple-sitemap:rebuild-queue
    I did find a drush command for this that will help, what we need is a patch for simple_sitemap_8401 that will run the code that is run by the simple-sitemap:rebuild-queue (ssr) command.

    However this is a bit inconvenient for us as we have hundreds of Drupal sites. I might have to write myself a patch.

    The hook update that is failing for us is simple_sitemap_8401

  • πŸ‡¨πŸ‡¦Canada joseph.olstad

    all that has to happen is this inserted to the beginning of 8401

        $generator = \Drupal::service('simple_sitemap.generator');
        $generator->rebuildQueue();
    
  • πŸ‡¨πŸ‡¦Canada joseph.olstad

    see patch

  • πŸ‡¨πŸ‡¦Canada joseph.olstad

    The regenerate queue didn't fix the issue for me, turns out I had no sitemaps, my distro requires this module, it's a bit of a pain to unravel it and uninstall/reinstall it but that could be one option, I'll look for another code solution first. My error might be slightly different.

  • πŸ‡¨πŸ‡¦Canada joseph.olstad

    Try the patch in this issue instead:
    #3377976-03: Error when running update script to upgrade from 3.11 to 4.1.4 lets fix this β†’
    The patch linked ^ i comment 3 of 3377976 got us passed the hook_update_8304 that was stuck.

Production build 0.69.0 2024