Uploaded image for project: 'Confluence Data Center'
  1. Confluence Data Center
  2. CONFSERVER-57375

Confluence modifies tables with active objects on every restart

      Background

      When Confluence starts up, it verifies schemas for all tables with active objects (AO), and modifies / adds fields if required. For example, if a new version of a plugin is installed, and this plugin introduces a new field in AO class, the corresponding table will be updated and new column will be created.

      The problem

      For MySQL, migration procedure has a bug and updates several tables on every boot like this:

       [[SQLAction{statement='ALTER TABLE AO_BAF3AA_AOINLINE_TASK CHANGE COLUMN BODY BODY LONGTEXT DEFAULT NULL', undoAction=null}]]
      
      
      [[SQLAction{statement='ALTER TABLE AO_88BB94_BATCH_NOTIFICATION CHANGE COLUMN PAYLOAD PAYLOAD LONGTEXT NOT NULL', undoAction=null}]]
      
      
      [[SQLAction{statement='ALTER TABLE AO_21D670_WHITELIST_RULES CHANGE COLUMN EXPRESSION EXPRESSION LONGTEXT NOT NULL', undoAction=null}]]
      
      ...etc...

      It is not a serious issue for Confluence with one node (it only increases boot time), but in case of 2+ nodes it could lead Confluence to deadlock. Example:

      1. The first node is executing slow query (which takes a lot of time) on AO_BAF3AA_AOINLINE_TASK table
      2. The second node is being restarted and is trying to modify AO_BAF3AA_AOINLINE_TASK. But this operation is blocked while the first node does not finish all SQL queries on AO_BAF3AA_AOINLINE_TASK
      3. The first node tries to run more SQL queries on AO_BAF3AA_AOINLINE_TASK, but all of them are blocked by DDL operation on the second node.

      As a result, all threads could be blocked.

      Expected behaviour

      Confluence should not run any DDL operations on boot if tables do not require changes.

      Technical details

      It happens in SchemaGenerator.migrate

            [CONFSERVER-57375] Confluence modifies tables with active objects on every restart

            Thiago Masutti made changes -
            Remote Link New: This issue links to "PSR-278 (Bulldog)" [ 439878 ]
            Kurt Klinner made changes -
            Remote Link New: This issue links to "Page (Confluence)" [ 433098 ]
            Quan Pham made changes -
            Fix Version/s New: 6.15.6 [ 87697 ]
            Michelle made changes -
            Remote Link New: This issue links to "Page (Extranet)" [ 431326 ]
            Kurt Klinner made changes -
            Remote Link New: This issue links to "Page (Confluence)" [ 431136 ]
            Nhan Dang made changes -
            Link New: This issue relates to CONFSRVDEV-11130 [ CONFSRVDEV-11130 ]
            Quan Pham made changes -
            Resolution New: Fixed [ 1 ]
            Status Original: Waiting for Release [ 12075 ] New: Closed [ 6 ]
            SET Analytics Bot made changes -
            UIS Original: 2 New: 4
            Nancy Lopez made changes -
            Summary Original: Confluence modifies tables with active objects on every restart (MySQL only) New: Confluence modifies tables with active objects on every restart
            Nancy Lopez made changes -
            Affects Version/s New: 6.13.5 [ 86196 ]

              nhdang Nhan Dang
              glipatov George Lipatov
              Affected customers:
              3 This affects my team
              Watchers:
              10 Start watching this issue

                Created:
                Updated:
                Resolved: