Yair Zaslavsky has uploaded a new change for review. Change subject: core: log flooding if db is down (#854598) ......................................................................
core: log flooding if db is down (#854598) The following patch relaxes log flooding in case postgresql DB service is down/inaccessible when the engine service is started the following way: a. Fixes the call to sleep between two subsequent calls to checkDbConnection b. Increases the interval (I see no point to try and probe every 1 second). https://bugzilla.redhat.com/854598 Change-Id: I05680581ff14ac916e4d9d559476dfb4683ed231 Signed-off-by: Yair Zaslavsky <[email protected]> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/Backend.java M backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/DbFacadeLocator.java 2 files changed, 5 insertions(+), 4 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/28/7928/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/Backend.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/Backend.java index 9d618f9..e78137d 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/Backend.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/Backend.java @@ -127,16 +127,17 @@ while (!dbUp && System.currentTimeMillis() < expectedTimeout) { try { dbUp = DbFacade.getInstance().CheckDBConnection(); + } catch (RuntimeException ex) { + log.error("Error in getting DB connection. The database is inaccessible. " + + "Original exception is: " + ExceptionUtils.getMessage(ex)); try { Thread.sleep(waitBetweenInterval); } catch (InterruptedException e) { log.warn("Failed to wait between connection polling attempts. " + "Original exception is: " + ExceptionUtils.getMessage(e)); } - } catch (RuntimeException ex) { - log.error("Error in getting DB connection. The database is inaccessible. " + - "Original exception is: " + ExceptionUtils.getMessage(ex)); } + } if (!dbUp) { throw new IllegalStateException("Could not obtain connection to the database." + diff --git a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/DbFacadeLocator.java b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/DbFacadeLocator.java index 92ce864..40244c8 100644 --- a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/DbFacadeLocator.java +++ b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/DbFacadeLocator.java @@ -73,7 +73,7 @@ final String ON_START_CONNECTION_TIMEOUT = "OnStartConnectionTimeout"; final String CONNECTION_CHECK_INTERVAL = "ConnectionCheckInterval"; final String DEFAULT_TIMEOUT_VALUE = "300000"; - final String DEFAULT_INTERVAL_VALUE = "1000"; + final String DEFAULT_INTERVAL_VALUE = "5000"; InputStream inputStream = null; try { String onStartConnectionTimeout = null; -- To view, visit http://gerrit.ovirt.org/7928 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I05680581ff14ac916e4d9d559476dfb4683ed231 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Yair Zaslavsky <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
