Github user marcaurele commented on the issue:

    https://github.com/apache/cloudstack/pull/1768
  
    I'll try to make my point clearer with a better use case. Let say you were 
running version ACS 4.4.2 and wish to upgrade to 4.7.1. After installing the 
4.7.1, when ACS starts for the first time you will execute SQL scripts in that 
order (case A):
    ```
    schema-442to450.sql       -----> schema-442to450-cleanup.sql
          |                  |             |
          v                  |             v
    schema-450to451.sql      |       schema-450to451-cleanup.sql
          |                  |             |
          v                  |             v
    schema-451to452.sql      |       schema-451to452-cleanup.sql
          |                  |             |
          v                  |             v
    schema-452to460.sql      |       schema-452to460-cleanup.sql
          |                  |             |
          v                  |             v
    schema-460to461.sql      |       schema-460to461-cleanup.sql
          |                  |             |
          v                  |             v
    schema-461to470.sql      |       schema-461to470-cleanup.sql
          |                  |             |
          v                  |             v
    schema-470to471.sql >----        schema-470to471-cleanup.sql
    ```
    
    But if you would have updated to each versions, one after the other, you 
would have run those scripts in that order (case B):
    ```
    schema-442to450.sql -----> schema-442to450-cleanup.sql
                                     |
           --------------------------
          |
          v
    schema-450to451.sql -----> schema-450to451-cleanup.sql
                                     |
           --------------------------
          |
          v
    schema-451to452.sql -----> schema-451to452-cleanup.sql
                                     |
           --------------------------
          |
          v
    schema-452to460.sql -----> schema-452to460-cleanup.sql
                                     |
           --------------------------
          |
          v
    schema-460to461.sql -----> schema-460to461-cleanup.sql
                                     |
           --------------------------
          |
          v
    schema-461to470.sql -----> schema-461to470-cleanup.sql
                                     |
           --------------------------
          |
          v
    schema-470to471.sql -----> schema-470to471-cleanup.sql
    ```
    
    Since **case B** is that most developer would expect when fixing bugs and 
doing changes, but **case A** is the most common case of production upgrade, I 
wanted to correct the algorithm so that everyone will follow the same route 
(case B).
    
    Most `-cleanup.sql` scripts are either empty or only updating the 
`configuration` table, so it's safe. There is only one possible problematic 
script: 
https://github.com/apache/cloudstack/blob/master/setup/db/db/schema-481to490-cleanup.sql
 today. This one does change views, which IMO was a mistake to put in the 
cleanup script file, it should have gone into `schema-481to490.sql` (@rhtyd ?). 
Leaving the mechanism as it is today would leave people with a possible bug 
while upgrading from any version prior to 4.9.0 *if* any future SQL script was 
to change the views modified inside `schema-481to490-cleanup.sql` because of 
scenario case A. Did I lost people there?
    
    Any comment @remibergsma @DaanHoogland @syed @nvazquez ?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to