Uploaded image for project: 'SonarQube'
  1. SonarQube
  2. SONAR-7175

DbCleaner keeps the oldest analysis instead of the newest one

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 4.5.6, 5.2
    • Fix Version/s: 5.6
    • Component/s: Database
    • Labels:

      Description

      When DbCleaner purge analysis from previous day, it currently keep the oldest snapshot instead of the newest one (as described in the description of the parameter "sonar.dbcleaner.hoursBeforeKeepingOnlyOneSnapshotByDay" -> "After this number of hours, if there are several snapshots during the same day, the DbCleaner keeps the most recent one and fully deletes the other ones.")

      Technical details :
      When snapshots are loaded from db, there are sorted by date (https://github.com/SonarSource/sonarqube/blob/master/sonar-db/src/main/java/org/sonar/db/purge/PurgeDao.java#L168), but we keep the first one (https://github.com/SonarSource/sonarqube/blob/master/sonar-db/src/main/java/org/sonar/db/purge/period/KeepOneFilter.java#L77) where we should keep the last one.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              julien.lancelot Julien Lancelot
              Reporter:
              julien.lancelot Julien Lancelot
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Due:
                Created:
                Updated:
                Resolved: