I have upgraded Sonarqube having a postgresql database backup of 8.6 sonar versions restored to 8.9 LTS and upgraded database then perform sonar upgrade to 9.9 LTS
An initial sonar version 8.6 is having LOC: 4,260,070 lines currently analyzed.
But after upgrading to 9.9 LTS version LOC increased to 5481000 lines which exceeded LOC limit of 5000000.
Java: OpenJDK 17.0.8+7-LTS
OS :Microsoft Windows Server 2019 Standard
Let me know if any info is needed.
It’s possible that you have run into this after we fixed [SONAR-15450] - Jira back in SonarQube v9.2, to make sure that pull requests are being counted when license utilization is being calculated.
When checking the total number of lines of code analyzed in an instance, we take the largest branch of each project without looking at the pull requests.
It’s rare, but there might be projects with no branches analyzed (only PRs), and currently, those projects contribute with 0 NLOC to the global count.
Is it possible that you have some very large pull requests being analyzed on your instance?
There is pull request, but I haven’t performed analysis after upgrade to 9.9 LTS yet. Is it possible that after upgrade these pull request analysis take place automatically or during indexing and contribute to total LOC count?
How to find which pull request analysis happened last since in Adminitration–>Projects–>Background Tasks i can see all the projects analyzes while indexing of project during upgrade.
Also, if its fixed in SonarQube v9.2 then why this issue is happening in 9.9 LTS
The issue was that Lines of Code weren’t being taken into account from Pull Requests – so as of SonarQube v9.9 LTS, they are. As a result, it’s possible that after the upgrade, the Lines of Code changed (a bug was fixed, not introduced).
You could try using the Web API GET api/projects/license_usage to see which branch/PR of each project is counting towards your Lines of Code.