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

Makes the update key feature transactionnel

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Database, Web API
    • Labels:
      None
    • Edition:
      Community
    • Production Notes:
      None

      Description

      Description of the problem

      When updating the key of a project, if for some reason the process is stopped at the middle, only some component keys will be updated, which will result in a project in a bad situation.
      Indeed, trying to update again the project key could fail with

      java.lang.StringIndexOutOfBoundsException: String index out of range: -7
      	at java.lang.String.substring(String.java:1967)
      	at org.sonar.db.component.ComponentKeyUpdaterDao.runBatchUpdateForAllResources(ComponentKeyUpdaterDao.java:172)
      	at org.sonar.db.component.ComponentKeyUpdaterDao.updateKey(ComponentKeyUpdaterDao.java:78)
      	at org.sonar.server.component.ComponentService.updateKey(ComponentService.java:65)
      	at org.sonar.server.project.ws.UpdateKeyAction.handle(UpdateKeyAction.java:110)
      	at org.sonar.server.ws.WebServiceEngine.execute(WebServiceEngine.java:110)
      

      Solution

      In order for this situation to not happen again, we should made this feature transactional by using the "B columns" strategy (introduced with SONAR-7700).

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated: