Problem/Motivation

Noticed this in my log this morning, thought I'd share:

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'san0go8SL5SGtr38I1YFAMAEf0VyfGWmeUgrzj-dhUA-0V5KF_TtPDA59ru8VlFn' for key 'PRIMARY': INSERT INTO {advagg_aggregates_versions} (aggregate_filenames_hash, aggregate_contents_hash, atime, root) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3); Array ( [:db_insert_placeholder_0] => san0go8SL5SGtr38I1YFAMAEf0VyfGWmeUgrzj-dhUA [:db_insert_placeholder_1] => 0V5KF_TtPDA59ru8VlFnDARL0U7oaoHjWnHWNsKShes [:db_insert_placeholder_2] => 0 [:db_insert_placeholder_3] => 1 ) in advagg_insert_aggregate_version() (line 80 of sites/all/modules/contrib/advagg/advagg.inc).

It may have been right after a drush dbup considering the timing, which finishes with a drush cc all.

There are no other instances in the log, so it's very probable that that was the cause. Feel free to close this issue if there is no apparent way to fix it and I'll re-open it if it happens again with more details.

Proposed resolution

Remaining tasks

User interface changes

API changes

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mikeytown2’s picture

Status: Active » Closed (cannot reproduce)

Where you using a dev version that has this code included?
#2259309: Remove most lock calls by using db_merge instead of drupal_write_record

Code in question when using db_merge
https://api.drupal.org/api/drupal/includes!database!query.inc/function/M...

Since it only happened once, I'm thinking it was the dbup that did it. Re-open if you can repo this.

stanojevic.boban’s picture

In case anyone needs this (I'm using advagg version 2.8) here's a quick fix that skips insertion if record already exists.

mikeytown2’s picture

Related: #2492447: Fix usage of db_merge

Just a heads up that drupal.org is using AdvAgg 7.x-2.11 so I don't see any reason to not update :)