Too much records in the projects table that are not projects

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    Sonarqube Community Edition 7.7 (build 23042), sonar-maven-plugin:, external RDS DB Mysql 5.7
  • what are you trying to achieve
    I’m getting the same error as in this topic: Error updating database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry.
    The problem is that when I look into the projects table I see a bunch of records that are not projects. The name of those records are files and folders of the project and the kee is all the path down to the file or folder, therefore, the above error happens.
    I’d like to know what those records are and why they got created so that I can prevent it.
  • what have you tried so far to achieve this

Thanks in advance.

Hi @andresmiguel,

Unfortunately on MySQL, some duplications can happen if project keys is too long.
What is the size of the key of the project that is failing to be analysed ?

Julien Lancelot

Hi @julienlancelot!
The key’s size is not large, the problem is with the records that are not projects and whose key are formed by the name of the project and the file or dir they are pointed to. The following image shows what I mean. The part in gray is the path to the file that is part of the key, and when the path is too large the duplication error shows up:

I don’t know why those records are saved in the projects table.

With PostgresSQL this doesn’t happen then?

Thanks Julien!

Hi André,

Indeed, I was not clear, it’s when the size of project keys is big that file keys fail to be generated.
The problem doesn’t exist on other databases, that’s one of the reason we’ve stopped allowing usage of MySQL.
I highly recommend you to migrate to another DB and to upgrade to 7.9.

Thanks @julienlancelot. I’ll do that!