GutoVeronezi commented on PR #7417:
URL: https://github.com/apache/cloudstack/pull/7417#issuecomment-1741821866

   > > > c looks complicated, it needs further investigation
   > > 
   > > 
   > > @weizhouapache, what are you concerns?
   > 
   > @GutoVeronezi As I remember, there were some SQL sentences which use views 
in the upgrade SQL or upgrade java. I might be wrong. it would be good to check.
   
   @weizhouapache, I checked both the SQL file and java method 
`performDataMigration` since 4.17.0 and, besides dropping and creating views, 
the only use I found was in `schema-41720to41800.sql`, in an `UPDATE` that uses 
the following as a condition:
   
   ```sql
   AND (SELECT COUNT(id) AS count FROM `network_offering_view` WHERE 
supports_vm_autoscaling = 1) = 0
   ``` 
   
   However, if you look at the view definition (right above the `UPDATE` 
query), you will notice that the view was used unnecessarily; the same result 
would be achieved with the following:
   
   ```sql
   AND (SELECT COUNT(id) AS count FROM `network_offerings` WHERE 
supports_vm_autoscaling = 1) = 0
   ```
   
   We have rare cases where we use a view in the SQL files, and they can be 
easily replaced.
   
   Though I have not found any use of views in the java method 
`performDataMigration`, one might use them. Therefore, rethinking it, seems 
that the approach of upgrading the views on each step after the scripted 
upgrades and before the java based upgrades would be the best choice.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to