mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Reset unusable db connections (#6725)
When the management service detects a broken database connection, it didn't do anything about it. It already has code to reset the connection, but that doesn't get used. This change causes the connection to be reset after it's found to be unusable. Fixes #6724 (see issue for repro steps)
This commit is contained in:
parent
4ed1be821c
commit
77df050160
@ -174,7 +174,7 @@ public class ConnectionConcierge {
|
|||||||
|
|
||||||
Connection conn = TransactionLegacy.getStandaloneConnection();
|
Connection conn = TransactionLegacy.getStandaloneConnection();
|
||||||
if (conn == null) {
|
if (conn == null) {
|
||||||
return "Unable to get anotehr db connection";
|
return "Unable to get another db connection";
|
||||||
}
|
}
|
||||||
|
|
||||||
concierge.reset(conn);
|
concierge.reset(conn);
|
||||||
@ -198,9 +198,13 @@ public class ConnectionConcierge {
|
|||||||
protected void runInContext() {
|
protected void runInContext() {
|
||||||
s_logger.trace("connection concierge keep alive task");
|
s_logger.trace("connection concierge keep alive task");
|
||||||
for (Map.Entry<String, ConnectionConcierge> entry : _conns.entrySet()) {
|
for (Map.Entry<String, ConnectionConcierge> entry : _conns.entrySet()) {
|
||||||
|
String name = entry.getKey();
|
||||||
ConnectionConcierge concierge = entry.getValue();
|
ConnectionConcierge concierge = entry.getValue();
|
||||||
if (concierge.keepAlive()) {
|
if (concierge.keepAlive()) {
|
||||||
testValidity(entry.getKey(), entry.getValue().conn());
|
if (testValidity(name, concierge.conn()) != null) {
|
||||||
|
s_logger.info("Resetting DB connection " + name);
|
||||||
|
resetConnection(name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user