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

Stop and report why if another SonarQube is connected to the database

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Won't Do
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Database
    • Labels:
      None
    • Edition:
      Community

      Description

      What

      If another SonarQube instance is connected to the database, SonarQube can't operate correctly, behaves in unpredictable ways and data can get corrupted. Therefore SonarQube should stop and say why.

      How

      At startup, the SonarQube instance will write a UUID (or any other similar unique identifier) to the database and a flag indicating it takes ownership of this database.
      On a regular basis, the SonarQube instance will check whether it still has ownership of the database.

      If this is not the case, SonarQube will:

      1. log a FATAL log indicating another SonarQube instance has hijacked the database, reporting the identifier of this other instance, and that it must shutdown immediately. A message describing how to resume normal operations should also be logged as INFO.
      2. write to database its identifier and a flag indicating that it used to own this database
      3. shutdown immediately

      Because it also checks the DB on a regular basis, the other SonarQube instance will at some point of time see it's not the owner of the database anymore and that the first SonarQube instance set the flag "I used to own this DB".
      In this case, this other SonarQube must:

      1. log a FATAL log indicating the database was initially owned by another SonarQube, report the identifier of the first instance, and that it must shutdown immediately. The INFO message with instruction on how to resume normal operations should also be logged.
      2. shutdown immediately

      Datacenter edition

      This feature must be disabled when running SonarQube Datacenter edition.

      Discussion

      This won't prevent a SonarQube instance to start on a database which is in use.
      This is an accepted limitation as no solution for this has been found which won't cause any false positive or require to alter regular operations of SonarQube.

      This solution will allow all SonarQube instances running on the same database to stop, making visible a problem with unknown and unpredictable side effects, inform the user of the situation and how to resume regular operations.

      Also, if a SonarQube instance taking ownership of a database stores more information (such as a machine name, install directory path, ...), the log will allow the user to easily find the other running SonarQube instance.

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            sebastien.lesaint Sebastien Lesaint
            Votes:
            1 Vote for this issue
            Watchers:
            8 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: