| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
At this time this PR is a POC; some points need to be better discussed or still have to be addressed: Topics to be better discussed: Points yet to be addressed:
I also added a validation to execute this workflow only after upgrading to 4.19.0.0, for back-compatibility purposes. If I am missing something, please, let me know. |
Sorry, something went wrong.
Codecov ReportAttention: 30 lines in your changes are missing coverage. Please review.
@@ Coverage Diff @@
## main #7417 +/- ##
============================================
+ Coverage 27.88% 29.17% +1.29%
- Complexity 29145 31072 +1927
============================================
Files 5165 5193 +28
Lines 364127 366263 +2136
Branches 53304 53548 +244
============================================
+ Hits 101523 106874 +5351
+ Misses 248630 244749 -3881
- Partials 13974 14640 +666
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Sorry, something went wrong.
|
SonarCloud Quality Gate failed. |
Sorry, something went wrong.
There was a problem hiding this comment.
great effort, looks good to me.
We might want to apply this on 4.18.1, if for nothing else, just for the extra test it gives
Sorry, something went wrong.
| } | ||
|
|
||
| String upgradedVersion = upgrade.getUpgradedVersion(); | ||
| executeViewScripts(conn, upgradedVersion); |
There was a problem hiding this comment.
so we upgrade the views on each step after the scripted upgrades but before the java based upgrades.
I wonder if we should just do it ones after everything, but maybe that will hamper some upgrades that depend on views for data collection.
Sorry, something went wrong.
|
@GutoVeronezi , I just tried to review the link in the description and it seems to be gone, can you check? |
Sorry, something went wrong.
@DaanHoogland I may have bumped the backspace button accidentally while writing the description, the link was missing the final character. I adjusted the description, the correct link is https://lists.apache.org/thread/qvb3kx78m7lvc21d90ld00v8o8wd27ro.
The topics described in #7417 (comment) will guide us in defining how to use it and guaranteeing that everyone complies with the new pattern. Resuming the discussion of them: Regarding point a, I believe creating a file for each VIEW is the best option; it will require more effort on backporting, however, it will bring us more organization and better backtracking. About point b, I do not have a formed opinion about it; we could go either way; we would just have to adjust the GH Actions (yet to be done) to comply with it. In respect of point c (and also @DaanHoogland's comment -- #7417 (comment)), the point in creating VIEW is to help us better handle the data via Java. In the schema files, we have total flexibility to use SQL as we want; therefore, if necessary to use a VIEW logic at some point, we could reproduce it easily in the query. With that, we might want to execute the VIEW scripts only after applying all the patches, as @DaanHoogland wondered. What are your thoughts on this? |
Sorry, something went wrong.
|
as for point b, i suggest keep a file with only a drop if exists statement. It will make explicit to readers of the code what the history is and is not a big overhead. A drop statement in one of the upgrade files is easier to overlook. a and c I agree with you. |
Sorry, something went wrong.
a looks good to me |
Sorry, something went wrong.
@weizhouapache, what are you concerns? |
Sorry, something went wrong.
@GutoVeronezi |
Sorry, something went wrong.
@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: AND (SELECT COUNT(id) AS count FROM `network_offering_view` WHERE supports_vm_autoscaling = 1) = 0However, 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: AND (SELECT COUNT(id) AS count FROM `network_offerings` WHERE supports_vm_autoscaling = 1) = 0We 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. (edit: this will not work for multiple upgrades) I have not found any use of views in the Java method performDataMigration in the last releases. If one might need to use them in the future, it will be a specific case, and that can be handled in other ways as well. We would just need to clarify those aspects in the documentation. |
Sorry, something went wrong.
…-management-via-separated-files
|
@GutoVeronezi do you think we can make this work before 4.19? |
Sorry, something went wrong.
@DaanHoogland yes, I'm working on the fix for the tests RN. |
Sorry, something went wrong.
|
This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch. |
Sorry, something went wrong.
ok, I'll do a simple upgrade test before merging. We'll have to test the RC intensively for upgrade anyway.
@shwstppr , can you concur? |
Sorry, something went wrong.
that sounds like you don't find it useful, @shwstppr ? any others have opinions on this? cc @rohityadavcloud @nvazquez @weizhouapache @wido @soreana at anybody on the thread? |
Sorry, something went wrong.
I am +1 on this based on the idea. I haven't been able to verify all the code, but splitting these kinds of things into seperate files is always a good thing. |
Sorry, something went wrong.
we need another review on this people. |
Sorry, something went wrong.
@DaanHoogland I'm all for it based on the concept. I haven't had a chance to check all the codes. But from what I've seen so far, it looks promising. |
Sorry, something went wrong.
I have tested some upgrades @soreana , Of course you're welcome to do more tests, but I would like extra eyes on the code especially. |
Sorry, something went wrong.
|
@DaanHoogland Overall the code looks good just some minor adjustments. @GutoVeronezi Thanks for the PR, it was well done. Did you use an automated script to extract the views or did you do that manually? Do I need to cross-validate to check if all the views have been transferred or not? |
Sorry, something went wrong.
@soreana If someone else could put effort into checking all the VIEWs we have and create the remaining files, it would be nice as well. |
Sorry, something went wrong.
There was a problem hiding this comment.
@GutoVeronezi Thanks for clarification, now it is crystal clear.
Sorry, something went wrong.
| UPDATE `cloud`.`configuration` SET | ||
| `options` = concat(`options`, ',OAUTH2'), | ||
| `default_value` = concat(`default_value`, ',OAUTH2'), | ||
| `value` = concat(`value`, ',OAUTH2') | ||
| WHERE `name` = 'user.authenticators.order' ; | ||
|
|
||
| UPDATE `cloud`.`configuration` SET | ||
| `options` = concat(`options`, ',OAUTH2Auth'), | ||
| `default_value` = concat(`default_value`, ',OAUTH2Auth'), | ||
| `value` = concat(`value`, ',OAUTH2Auth') | ||
| where `name` = 'pluggableApi.authenticators.order' ; | ||
|
|
||
| -- Create table for OAuth provider details | ||
| DROP TABLE IF EXISTS `cloud`.`oauth_provider`; | ||
| CREATE TABLE `cloud`.`oauth_provider` ( | ||
| `id` bigint unsigned NOT NULL auto_increment COMMENT 'id', | ||
| `uuid` varchar(40) NOT NULL COMMENT 'unique identifier', | ||
| `description` varchar(1024) COMMENT 'description of the provider', | ||
| `provider` varchar(40) NOT NULL COMMENT 'name of the provider', | ||
| `client_id` varchar(255) NOT NULL COMMENT 'client id which is configured in the provider', | ||
| `secret_key` varchar(255) NOT NULL COMMENT 'secret key which is configured in the provider', | ||
| `redirect_uri` varchar(255) NOT NULL COMMENT 'redirect uri which is configured in the provider', | ||
| `enabled` int(1) NOT NULL DEFAULT 1 COMMENT 'Enabled or disabled', | ||
| `created` datetime NOT NULL COMMENT 'date created', | ||
| `removed` datetime COMMENT 'date removed if not null', | ||
| PRIMARY KEY (`id`) | ||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
There was a problem hiding this comment.
@GutoVeronezi @DaanHoogland @harikrishna-patnala this PR removed some OAuth related changes. Can you please check if that was needed?
Sorry, something went wrong.
There was a problem hiding this comment.
Perhaps a mistake solving a conflict. I will add it again. Thanks @shwstppr.
Sorry, something went wrong.
There was a problem hiding this comment.
Created a draft PR https://github.com/apache/cloudstack/pull/8245/files
Sorry, something went wrong.
Fixes OAuth(2) schema changes removed in Database VIEW Management improvement apache#7417 Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
|
the trillian test was run 2 weeks ago, too long |
Sorry, something went wrong.
Co-authored-by: Daniel Augusto Veronezi Salvador <gutoveronezi@apache.org>
…che#8245) Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
| Back | FazBrowse Home | New Git URL |
Description
This PR is a follow up of the discussion we had in the thread
https://lists.apache.org/thread/qvb3kx78m7lvc21d90ld00v8o8wd27ro
For changes in database VIEWs, currently, we have to look at the changes in the previous schema files and replicate the whole CREATE VIEW command in the current schema file, modifying what we need (adding/removing columns, and so on). This process makes the changes in a VIEW to be distributed through several files, increasing the number of lines modified for simple changes (e.g.: for adding a single field to the VIEW result we need to replicate the whole command); thus, making it difficult to maintain and track.
With that in mind, the proposal is to, instead of adding the VIEW changes to the schema files, we manage them in a separated file (or several files). That would allow us to easily track VIEW modifications, as we would just change the VIEW declaration in the same file, instead of re-declaring the whole VIEW in a different file; and we would have a better history of the changes. Also, we would not need to migrate all VIEWs right away; we could migrate as we change them (I already created some files according to what was changed in 4.18).
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
How Has This Been Tested?
I created an environment from scratch and observed the upgrade logs:
management-server.log.tar.gz