-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Flexible URI for connection with DB and new MariaDB driver #7895
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
good improvement. |
|
Thanks for the PR @JoaoJandre would these work on either/both MariaDB and MySQL, do you see any operations differences between the two? |
|
@JoaoJandre |
Yes, @rohityadavcloud , this should work with any DBMS that uses URI connections (MariaDB, MySQL, PostgreSQL, and others). CloudStack though would probably not work with other DBMSs with the current code base. About the operation differences between the two (MariaDB and MySQL); each DBMS has different forms of configuring the URI, the URI I used in my tests will not work with MySQL, for example. That is why I am proposing a way for users to specify manually the URI; therefore, we enable operators to configure ACS to handle multiple DBMSs (MariaDB or MySQL) without any need to change the code. Note that this PR only adds a new property, the old behavior is still maintained if you do not inform the property introduced here (no regression). |
The current behavior is to generate the URI in the java code, using the |
@JoaoJandre |
@weizhouapache , these settings will be maintained for backwards compatibility. They are used when the full URI is not set ( |
I suggest to add the following, in additional to existing settings
a predefined uri is flexible but I do not think it will happen often . If we want to support other engines, normally some jave changes are required as well. |
|
@JoaoJandre
what else are missing ? |
@JoaoJandre to |
@weizhouapache seems to me that the PR's scope is to allow the full URI definition, not to extend the current hard coded properties behavior; therefore, it does not make sense to me to require an extension out of the scope. Also, what is the point on having (and adding) several configurations that operators will have to learn how they work on CloudStack instead of having a single one that represents the full URI, that operators are used to work with? |
|
@GutoVeronezi cc @JoaoJandre
Because URI is not user-friendly. it is suitable to premium users, but not for normal users. |
framework/db/src/main/java/com/cloud/utils/db/TransactionLegacy.java
Outdated
Show resolved
Hide resolved
@weizhouapache it is the contributors will to add the MariaDB support, not a requirement from another contributor; also there are 6 lines adding support for MariaDB, which is far from "lots of changes", but I do agree this should be added to the PR's description, as the PR's description should describe in details what the PR is introducing and changing, to facilitate revision and tracking of changes. @JoaoJandre, please, could you mention the MariaDB support in the PR's title and description?
Normal users are able to describe a simple URI, it only needs to be well-documented. Anyways, the support for lots of properties to configure the connection is kept (the properties that we have so far); therefore, no problems will be created for users that are used to the current pattern. |
@GutoVeronezi
Currently for normal users, they just need to specify the db host ip. In order to support mariadb, they might need to specify the driver, failover mode and replicas, but it is still much more simple and friendly than the URI. To achieve it, we just need to add the new property for failover mode, which is not complicated. |
@weizhouapache, a contributor is not bound to address all the use cases. If the author is adding support to MariaDB with the full URI, we have to guarantee that the use case is being addressed and the changes are not breaking compatibility; other than that, is the author's choice to add support for other use cases or not. Therefore, it is on @JoaoJandre to choose adding the support for hardcoded properties or not. |
|
@GutoVeronezi sure, I've added it to the description and title. @weizhouapache about adding more properties, as previously written by @GutoVeronezi, I think that it is out of the scope of this PR, which is meant to add a single new property and add compatibility for MariaDB driver. If the community believes that new properties are needed, then I am sure that someone else will be happy to create them in another PR. I think that the functionality added in this PR is already complete, and there is no need for further changes. |
OK |
Codecov Report
@@ Coverage Diff @@
## main #7895 +/- ##
=============================================
+ Coverage 14.40% 30.26% +15.86%
- Complexity 10109 32510 +22401
=============================================
Files 2748 5182 +2434
Lines 259390 391259 +131869
Branches 40381 63968 +23587
=============================================
+ Hits 37353 118409 +81056
- Misses 217207 256740 +39533
- Partials 4830 16110 +11280
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 3683 files with indirect coverage changes 📣 Codecov offers a browser extension for seamless coverage viewing on GitHub. Try it in Chrome or Firefox today! |
framework/db/src/main/java/com/cloud/utils/db/TransactionLegacy.java
Outdated
Show resolved
Hide resolved
framework/db/src/main/java/com/cloud/utils/db/TransactionLegacy.java
Outdated
Show resolved
Hide resolved
|
@GutoVeronezi @weizhouapache @JoaoJandre , is this ready? |
|
@blueorangutan package |
|
@DaanHoogland a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
GutoVeronezi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CLGTM
|
@blueorangutan test |
|
@DaanHoogland a [SL] Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests |
Yes, it's ready :) |
|
@weizhouapache are your concerns all met? |
|
[SF] Trillian test result (tid-8198)
|
|
@weizhouapache can you concur? |
@DaanHoogland |
shwstppr
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks okay. Haven't tested but smoke tests are okay
|
@JoaoJandre @GutoVeronezi will you be making follow ups to this PR? |
|
testing some more to be sure... |
|
@blueorangutan test alma9 vmware-70u3 |
|
@DaanHoogland a [SL] Trillian-Jenkins test job (alma9 mgmt + vmware-70u3) has been kicked to run smoke tests |
@DaanHoogland, PR is good to me as it is; other improvements can be addressed further. |
|
[SF] Trillian test result (tid-8297)
|
Co-authored-by: João Jandre <joao@scclouds.com.br>
Description
Current properties on
db.propertiesare limited and focused only on mysql. This PR adds a new property ondb.properties,db.cloud.uri, that when set, will be used for the connection with the DBMS. This enables URI configuration and use with other DBMSs, such as mariaDB.When using the
db.cloud.uriproperty, the following properties will be ignored:db.cloud.host;db.cloud.port;db.cloud.name;db.cloud.autoReconnect;db.cloud.url.params;db.cloud.replicas;db.cloud.autoReconnect;db.cloud.failOverReadOnly;db.cloud.reconnectAtTxEnd;db.cloud.autoReconnectForPools;db.cloud.secondsBeforeRetrySource;db.cloud.queriesBeforeRetrySource;db.cloud.initialTimeout;When using the
db.usage.uriproperty, the following properties will be ignored:db.usage.host;db.usage.port;db.usage.name;db.usage.autoReconnect;db.usage.url.params;db.usage.replicas;db.usage.autoReconnect;db.usage.failOverReadOnly;db.usage.reconnectAtTxEnd;db.usage.autoReconnectForPools;db.usage.secondsBeforeRetrySource;db.usage.queriesBeforeRetrySource;db.usage.initialTimeout;When using both, the following properties will also be ignored:
db.ha.enable;db.ha.loadBalanceStrategy;This PR also adds support for the MariaDB driver.
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
How Has This Been Tested?
Using the current version in a setup with mariaDB and Galera, with a cluster size of 3 and the following configuration on the
db.propertiesfile:When the mysql service stops in the main node, ACS is able to switch to one of the other two. But if the host is shut down, this switch never occurs.
Using the changes proposed in this PR, by configuring the
db.cloud.uri:I was able to configure and use the
sequentialfail over mode. This way, when the mysql service stops in the main node and even if the host is shut down, ACS was able to switch to the other DBs.