Upgrade from 6.7.3 LTS->7.7 causes duplicate key failures?

(Norman Greenlee) #1

I have a multi module java project that analysed successfully using maven under 6.7.3 but after upgrading to 7.7 (ce), 3 specific files in 1 sub module fail with a duplicate (and massively truncated key ) trying to insert into the db. The component.VisitException error, shows what looks like a valid project_kee with 284 character, but the com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry has a key of only 64 chars. The module can be successfully analysed as a separate project, and other files (which would have longer keys) can be analysed within that module while in the multi-module project. So i’m at a bit of loss as to what the cause of this could be. I’m using a mysql db (which i saw will be deprecated in teh near future) but i dont see a key that would be a duplicate for this as either the full or truncated versions. schema looks to be 400 varchars, so shouldnt be reaching the column limit

Any ideas?

(Julien Henry) #3

Hi @Norman_Greenlee

Could it be possible to share a bit more details, like the offending file keys/module keys, plus the physical module layout (please also specify if this is a Maven or Gradle project and you are using the specific scanner).

One possibility for a key conflict could be that some disabled components in DB are colliding with the new key after the drop of modules.

(Norman Greenlee) #4

It’s a maven project:

  • sonar.scanner.app=ScannerMaven
  • sonar.scanner.appVersion=

Scanner moduleKey is just the normal <group_id>:<module_name>

The VisitException lists the Component Key as:
<group_id>:<project_name>: < relative file location in project >
and looks valid

The project name is a2p-analyzer

The log output for the MySQLIntegrityConstraintViolationException: Duplicate entry: “<group_id>:a2p-anal” for key ‘projects_kee’ ie. truncating the project name to 8 characters and not including the file path at all.

The physical structure has an extra directory level between project and module, but essentially just a standard maven java project. src/main/java/com… etc

I manually added the 3 offending files to the -Dsonar.exclusions & -Dsonar.test.exclusion parameters appropriately and the project task is then successful, but i don’t have anything disabled, the files haven’t changed since the upgrade.

(Julien Henry) #5

Any chance you could share (privately) the full stacktrace of the error, as well as the list of components in your DB, using a query like:
select * from projects where kee like '<group_id>:a2p-anal%'

You can send it to me directly (julien.henry at sonarsource.com).