Duplicate entry for key 'PRIMARY'

1,414 views
Skip to first unread message

Jason Terk

unread,
Dec 10, 2013, 4:59:15 PM12/10/13
to repo-d...@googlegroups.com
Hello,

Occasionally we encounter an issue in our Gerrit installation where a sequence of changes (as determined by the "depends on"/"included in" UI feature of Gerrit) get stuck in a "Submitted, Merge Pending" state. When this happens we can usually fix things by abandoning the "earliest" (first in the "depends on" sequence) commit, re-submitting the "second", and then restoring and re-submitting the first.

What can we do to prevent this from happening? When the problem occurs we typically see errors like the following in Gerrit's logs:

  Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '114073-3-1' for key 'PRIMARY'
    at sun.reflect.GeneratedConstructorAccessor243.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
    at com.mysql.jdbc.Util.getInstance(Util.java:386)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1040)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4074)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4006)
    at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2468)
    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2629)
    at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2719)
    at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2155)
    at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2450)
    at com.mysql.jdbc.PreparedStatement.executeBatchSerially(PreparedStatement.java:2006)
    ... 28 more
  [2013-12-10 13:44:25,765] ERROR com.google.gerrit.server.git.ChangeMergeQueue : Merge attempt for PROJECT_NAME,refs/heads/BRANCH_NAME failed
    com.google.gerrit.server.git.MergeException: Cannot merge b37fbee315d2dff0775894b87a718586c9876ab5

Additionally, the most recent time that this happened, we saw the following:

  [2013-12-10 13:52:55,219] WARN / : Error in rebaseChange
    com.google.gwtorm.server.OrmException: insert failure on patch_set_ancestors

Thanks,
-Jason

Doug Kelly

unread,
Dec 11, 2013, 9:44:14 AM12/11/13
to repo-d...@googlegroups.com
This error looks strangely familiar to https://code.google.com/p/gerrit/issues/detail?id=2034 -- only on MySQL.  On Postgres, a number of people (myself included) have worked around the issue by deleting the offending rows from the database (carefully) -- basically, a change started to merge and for some reason didn't make it in all the way. 

Curtis Kline

unread,
Feb 3, 2015, 10:59:59 AM2/3/15
to Doug Kelly, repo-discuss
This happens to us a few times each week. We are on 2.9 and using MySQL. It is incredibly annoying for both the engineers using Gerrit and the admins who have to fix the problem (by immediately but carefully deleting the garbage in the database).

It's something we've lived with on Gerrit since v2.6 (I think).

Curtis


--
--
To unsubscribe, email repo-discuss...@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en
 
---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply all
Reply to author
Forward
0 new messages