mooli tayer has uploaded a new change for review.

Change subject: Fixing a bug preventing daemons from regaining DB connectivity
......................................................................

Fixing a bug preventing daemons from regaining DB connectivity

If db connectivity is down, closeConnection in checkConnection
will set connection null. From that point on,
on each call to checkConnectivity a NPE will be thrown.

Fix:
If connection is null attempt to open it, this way:
1.) if db goes back up we will regain connectivity.

2.) if db does not come back up we will have a proper sqlException
in the log thrown from openConnection, and not a NPE.

Change-Id: Ia8dc7eb95e055e793f51155cd4024ebf5ce1914a
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=973534
Signed-off-by: Mooli Tayer <mta...@redhat.com>
---
M 
backend/manager/tools/src/main/java/org/ovirt/engine/core/tools/common/db/StandaloneDataSource.java
1 file changed, 3 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/09/15609/1

diff --git 
a/backend/manager/tools/src/main/java/org/ovirt/engine/core/tools/common/db/StandaloneDataSource.java
 
b/backend/manager/tools/src/main/java/org/ovirt/engine/core/tools/common/db/StandaloneDataSource.java
index 4ea1654..64d3b6d 100644
--- 
a/backend/manager/tools/src/main/java/org/ovirt/engine/core/tools/common/db/StandaloneDataSource.java
+++ 
b/backend/manager/tools/src/main/java/org/ovirt/engine/core/tools/common/db/StandaloneDataSource.java
@@ -109,6 +109,9 @@
         Statement statement = null;
         ResultSet rs = null;
         try {
+            if ( connection == null) {
+                openConnection();
+            }
             statement = connection.createStatement();
             rs = statement.executeQuery("select null");
             rs.next();


-- 
To view, visit http://gerrit.ovirt.org/15609
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia8dc7eb95e055e793f51155cd4024ebf5ce1914a
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: mooli tayer <mta...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to