Error when running update script to upgrade from 3.11 to 4.1.4 lets fix this

Created on 30 July 2023, over 1 year ago

Problem/Motivation

Spun from:

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.

Steps to reproduce

Upgrade from 3x to 4x

Proposed resolution

Others have reported that this is fixed by rebuilding the queue, so lets rebuild the queue on the hook update that is failing. See patch.

Remaining tasks

Review patch

User interface changes

N/A

API changes

N/A

Data model changes

N/A

πŸ› Bug report
Status

Needs review

Version

4.1

Component

Code

Created by

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

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

Comments & Activities

  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 9.5.x + Environment: PHP 8.1 & MySQL 8
    last update over 1 year ago
    32 pass
  • Issue created by @joseph.olstad
  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 9.5.x + Environment: PHP 8.1 & MySQL 8
    last update over 1 year ago
    32 pass
  • πŸ‡¨πŸ‡¦Canada joseph.olstad

    Try this patch instead. This is basically sidestepping with a try catch, I'll worry about this later we weren't even using this module other than it being required by the distro we're using.

  • Issue was unassigned.
  • Status changed to Postponed: needs info over 1 year ago
  • πŸ‡©πŸ‡ͺGermany gbyte Berlin

    Not sure what's going on here, but rebuilding the queue during an update is certainly not a good solution. I'll need more reports/eyes on it.

  • πŸ‡ΈπŸ‡°Slovakia trafo

    Updating from 3.10 to 4.1.6:

    [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()
    

    In my case problem was that there was already sitemap chunk with id 0 in simple_sitemap table.

    Solution could be just simply delete all records with \Drupal::database()->query('DELETE FROM {simple_sitemap}');.
    Other possibility would be update with MAX(id) + 1

  • Status changed to Closed: cannot reproduce about 1 month ago
  • πŸ‡©πŸ‡ͺGermany gbyte Berlin

    There seems to be a rare problem with changing the sitemap ID column to serial in simple_sitemap_update_8401 and having data in that table. Since apparently this is so anecdotal and spinning up an ancient D8 instance is a bit of an inconvenience, I'm just going to close this issue as not reproducible. If you are a snowflake and encounter this, try and empty the simple_sitemap table and run the updates again.

Production build 0.71.5 2024