search_api_update_8107: Integrity constraint violation: 1062 Duplicate entry

Created on 26 March 2022, over 2 years ago
Updated 29 February 2024, 9 months ago

Problem/Motivation

Getting this error when running database updates:

[notice] Update started: search_api_update_8107
>  [error]  SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'deleteItems-solr_local-solr_site_search-NULL' for key 'task__unique': ALTER TABLE "search_api_task" ADD UNIQUE KEY `task__unique` (`type`, `server_id`, `index_id`, `data`(191)); Array
> (
> )
>
>  [error]  Update failed: search_api_update_8107

If I truncate the search_api_task table I can successfully run the updates.

I'm not sure what this table does or what the importance of the data is in this table? Is there a way to clear this data via the admin? Would I need to re-index after truncating this table (search_api_task)?

Hoping for some guidance. Thanks

Steps to reproduce

NA

Proposed resolution

NA

Remaining tasks

NA

πŸ’¬ Support request
Status

Closed: outdated

Version

1.23

Component

Database backend

Created by

πŸ‡ΊπŸ‡ΈUnited States kamkejj WI

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡¦πŸ‡ΉAustria drunken monkey Vienna, Austria

    Thanks for reporting this problem, and sorry it took me so long to respond!
    As it turns out, that update function was a complete disaster anyways, see #3247781: Database update fails, database schema problem on latest release β†’ . We finally removed and reverted it there, so hopefully this isn’t a problem anymore in more recent releases of the module.
    Accordingly, I’m closing this issue.

  • πŸ‡³πŸ‡±Netherlands jandewit6

    Reopening as I am running into the same problem.

    Drupal 9.5.10
    Search_api 8.x-1.29

    One server with 2 indexes of which one index keeps running fine, the other keeps reporting 0 nodes and terms to index.
    Rebuild tracking information gives a: "The website encountered an unexpected error. Please try again later."
    Dave's work around #3 doesn't seem to work either.

    I also tried to setup a new server and index, to no avail.

    Problem started when I disabled a taxonomy from indexing. Index kept reporting not to be able to find terms from disabled taxonomy.
    Then I did a rebuild tracking info causing the index from reporting 0 content to be indexed.

    The complete error message for your reference:

    Drupal\Core\Database\IntegrityConstraintViolationException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '63-search_api_task' for key 'PRIMARY': INSERT INTO "ip_posts" ("type", "id", "ip") VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2); Array ( [:db_insert_placeholder_0] => search_api_task [:db_insert_placeholder_1] => 63 [:db_insert_placeholder_2] => 1303258487 ) in Drupal\mysql\Driver\Database\mysql\ExceptionHandler->handleExecutionException() (line 50 of /home/***/core/modules/mysql/src/Driver/Database/mysql/ExceptionHandler.php).

  • Status changed to Active over 1 year ago
  • πŸ‡³πŸ‡±Netherlands jandewit6
  • Status changed to Closed: outdated about 1 year ago
  • πŸ‡¦πŸ‡ΉAustria drunken monkey Vienna, Austria

    Unless this error occurs while executing search_api_update_8107() it is a different problem. Please create a separate ticket for it.

  • πŸ‡¨πŸ‡³China lawxen

    like #3 saied Execute drush search-api:clear works

Production build 0.71.5 2024