Scan fails - Duplicate key entry

630 views
Skip to first unread message

kip...@gmail.com

unread,
Mar 14, 2016, 7:49:35 AM3/14/16
to SonarQube
Hi there,

Scans seem to be failing because of a duplicate key entry. This seems to happen when I've run an analysis locally and have told soanr to publish the findings.

It's also worth mentioning that this is the first time a project has been added -- previous scans have been preview's (no publishing to the backend)

2016.03.13 19:45:37 ERROR [o.s.s.c.t.CeWorkerCallableImpl] Failed to execute task AVNxgZ13iN9v0U4zVZFI
org.apache.ibatis.exceptions.PersistenceException: 
### Error committing transaction.  Cause: org.apache.ibatis.executor.BatchExecutorException: org.sonar.db.issue.IssueMapper.insert (batch index #1) failed. Cause: java.sql.BatchUpdateException: Duplicate entry 'AVNxglrMiN9v0U4zVZHh' for key 'issues_kee'
### Cause: org.apache.ibatis.executor.BatchExecutorException: org.sonar.db.issue.IssueMapper.insert (batch index #1) failed. Cause: java.sql.BatchUpdateException: Duplicate entry 'AVNxglrMiN9v0U4zVZHh' for key 'issues_kee'
	at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:26) ~[mybatis-3.2.7.jar:3.2.7]
	at org.apache.ibatis.session.defaults.DefaultSqlSession.commit(DefaultSqlSession.java:177) ~[mybatis-3.2.7.jar:3.2.7]
	at org.apache.ibatis.session.defaults.DefaultSqlSession.commit(DefaultSqlSession.java:169) ~[mybatis-3.2.7.jar:3.2.7]
	at org.sonar.db.DbSession.commit(DbSession.java:60) ~[sonar-db-5.4.jar:na]
	at org.sonar.db.BatchSession.commit(BatchSession.java:176) ~[sonar-db-5.4.jar:na]
	at org.sonar.db.BatchSession.increment(BatchSession.java:213) ~[sonar-db-5.4.jar:na]
	at org.sonar.db.BatchSession.insert(BatchSession.java:133) ~[sonar-db-5.4.jar:na]
	at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:51) ~[mybatis-3.2.7.jar:3.2.7]
	at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:52) ~[mybatis-3.2.7.jar:3.2.7]
	at com.sun.proxy.$Proxy88.insert(Unknown Source) ~[na:na]
	at org.sonar.server.computation.step.PersistIssuesStep.execute(PersistIssuesStep.java:70) ~[sonar-server-5.4.jar:na]
	at org.sonar.server.computation.step.ComputationStepExecutor.execute(ComputationStepExecutor.java:39) ~[sonar-server-5.4.jar:na]
	at org.sonar.server.computation.taskprocessor.report.ReportTaskProcessor.process(ReportTaskProcessor.java:72) ~[sonar-server-5.4.jar:na]
	at org.sonar.server.computation.taskprocessor.CeWorkerCallableImpl.executeTask(CeWorkerCallableImpl.java:80) [sonar-server-5.4.jar:na]
	at org.sonar.server.computation.taskprocessor.CeWorkerCallableImpl.call(CeWorkerCallableImpl.java:55) [sonar-server-5.4.jar:na]
	at org.sonar.server.computation.taskprocessor.CeWorkerCallableImpl.call(CeWorkerCallableImpl.java:34) [sonar-server-5.4.jar:na]
	at java.util.concurrent.FutureTask.run(FutureTask.java:262) [na:1.7.0_79]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [na:1.7.0_79]
	at java.util.concurrent.FutureTask.run(FutureTask.java:262) [na:1.7.0_79]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178) [na:1.7.0_79]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292) [na:1.7.0_79]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_79]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_79]
	at java.lang.Thread.run(Thread.java:745) [na:1.7.0_79]

Simon Brandhof

unread,
Mar 14, 2016, 12:19:21 PM3/14/16
to kip...@gmail.com, SonarQube
Hi,

Just in case, is your database SQLServer ? If yes then is the collation case-sensitive (CS) and accent-sensitive (AS) ?

Thanks


--
You received this message because you are subscribed to the Google Groups "SonarQube" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonarqube+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarqube/b0d0459d-7096-49a0-a384-a40ad7a21bd2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
Simon BRANDHOF | SonarSource
Tech Lead & Co-Founder
http://twitter.com/SimonBrandhof

Simon Brandhof

unread,
Mar 15, 2016, 5:48:28 AM3/15/16
to kip...@gmail.com, SonarQube
According to your other message https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg/sonarqube/rR9d4aQiRb4/YtjIbpWdBQAJ, it seems that the collation of your MySQL database was not correct, probably case-insensitive, when SonarQube created the tables. Could you please check which collation is defined on the table ISSUES ? You can get it with the command "SHOW TABLE STATUS".

Thanks

Jared Mooring

unread,
Mar 15, 2016, 9:32:58 AM3/15/16
to Simon Brandhof, SonarQube
Sure thing --

Here is a pastebin - http://pastebin.com/TpQD4g76


JM

Simon Brandhof

unread,
Mar 15, 2016, 9:39:53 AM3/15/16
to Jared Mooring, SonarQube
The collation of your table ISSUES is collation is utf8mb4_unicode_ci so it's case-insensitive. That raises conflicts with key of issues. 
Character set must be UTF-8 and case-sensitive (see documentation). Note that the next release will fail fast if the database character-set is not correct.
Regards

Jared Mooring

unread,
Mar 15, 2016, 9:50:24 AM3/15/16
to Simon Brandhof, SonarQube
Great pick up - I'll make some changes and try again.

Appreciate the speediness of your reply.
Reply all
Reply to author
Forward
0 new messages