[CLOUDSTACK-10195] CloudStack MySQL HA problem -- No database selected#2364
[CLOUDSTACK-10195] CloudStack MySQL HA problem -- No database selected#2364yadvr merged 1 commit intoapache:masterapache/cloudstack:masterfrom rafaelweingartner:fixMysqlHaWithNoDbNameExceptionrafaelweingartner/cloudstack:fixMysqlHaWithNoDbNameExceptionCopy head branch name to clipboard
Conversation
When using CloudStack with database HA configuration user receives warnings constantly saying “No database selected”.
This problem happens at com.cloud.cluster.ClusterManagerImpl.getHeartbeatTask().new ManagedContextRunnable(){...}.runInContext(), line 550. The scheme of the database is not properly set in the transaction when database HA options are enabled.
|
@rafaelweingartner why was the unit test removed? |
|
Because it was testing the method If you see in that code at line 600, after "trying" to reuse a connection if something goes wrong, it will try to transit to a transaction using schema "Cloud_DB", and then it will close the transaction. The only place where the transaction was "reused" is there. So, when I changed |
|
Alright, let me kick some tests. |
|
@rhtyd a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress. |
|
Packaging result: ✔centos6 ✔centos7 ✔debian. JID-1405 |
|
@blueorangutan test |
|
@rhtyd a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests |
|
@rhtyd Thanks! |
|
Trillian test result (tid-1819)
|
|
Tests LGTM. We'll need an additional review on this. |
|
@khos2ow, @nvazquez, @DaanHoogland, @GabrielBrascher can some of you review this PR as well? |
GabrielBrascher
left a comment
There was a problem hiding this comment.
Thanks for the fix @rafaelweingartner. Code LGTM.
|
Merging based on reviews and test results. |
When using CloudStack with database HA configuration user receives warnings constantly saying “No database selected”.
This problem happens at com.cloud.cluster.ClusterManagerImpl.getHeartbeatTask().new ManagedContextRunnable(){...}.runInContext(), line 550. The scheme of the database is not properly set in the transaction when database HA options are enabled.
The problem was found and discussed in the following thread: http://mail-archives.apache.org/mod_mbox/cloudstack-dev/201712.mbox/%3CCAOVNhEJUPYxE7Y04c1LKkGGJ1igXg3PAb8RL5vobjhAtX-%2BgTQ%40mail.gmail.com%3E