Date: Friday, October 6, 2006 @ 17:26:24
Author: gilles
Path: /cvsroot/carob/carob/src
Modified: Connection.cpp (1.90 -> 1.91)
Do not try to reconnect to the same controller upon failure anymore: in case of
network down (or dropped packets, or unplugged wires or...), this adds yet
another delay to failover. Furthermore, even if reconnection is done on the
same controller, there will be a reconnection process anyway. So there is no
advantage to try to reconnect to the same controller
----------------+
Connection.cpp | 64 ++++++++++++++++++++-----------------------------------
1 files changed, 24 insertions(+), 40 deletions(-)
Index: carob/src/Connection.cpp
diff -u carob/src/Connection.cpp:1.90 carob/src/Connection.cpp:1.91
--- carob/src/Connection.cpp:1.90 Wed Sep 20 17:09:29 2006
+++ carob/src/Connection.cpp Fri Oct 6 17:26:24 2006
@@ -1248,50 +1248,34 @@
isClosed = true;
closeSocket();
- // try to reconnect to the same controller if it has never been suspected of
- // failure before
- if
(!ControllerPinger::getInstance().isSuspectedOfFailure(connected_controller))
+ // Add controller to the suspect list...
+ if (isDebugEnabled())
+ logDebug(fctName, L"Controller " +
static_cast<wstring>(connected_controller)
+ + L" is not responding, suspecting it of failure");
+
ControllerPinger::getInstance().suspectControllerOfFailure(connected_controller);
+
+ // ...And try next one in the list
+ try
{
- try
- {
- if (isDebugEnabled())
- logDebug(fctName, L"Trying to reconnect to the same controller...");
- initConnection();
- finalizeConnect();
- isClosed = false;
- }
- catch (...)
- { //ignore but destroy socket if created
- delete driverSocketPtr; driverSocketPtr = NULL;
- }
+ if (isDebugEnabled())
+ logDebug(fctName, L"Getting a new controller from the list...");
+ connected_controller = controller_pool.getController();
+ initConnection();
+ finalizeConnect();
+ if (isInfoEnabled())
+ logInfo(fctName, L"Connection succeded");
+ isClosed = false;
}
- if (isClosed) //connection failed
+ catch (AuthenticationException ae)
{
- if (isDebugEnabled())
- logDebug(fctName, L"Controller " +
static_cast<wstring>(connected_controller)
- + L" is still not responding, suspecting it of failure");
-
ControllerPinger::getInstance().suspectControllerOfFailure(connected_controller);
- try
- {
- if (isDebugEnabled())
- logDebug(fctName, L"Getting a new controller from the list...");
- connected_controller = controller_pool.getController();
- initConnection();
- finalizeConnect();
- if (isInfoEnabled())
- logInfo(fctName, L"Connection succeded");
- isClosed = false;
- }
- catch (AuthenticationException ae)
- {
- // Should not happen, this probably mean an inconsistency in controller
- // configuration but safely ignore (see below)
- wstring msg = L"Warning! Authentication exception received on connection
retry, controller configuration might be inconsistent";
- if (isWarnEnabled())
- logWarn(fctName, msg);
- throw DriverException(msg+ae.description());
- }
+ // Should not happen, this probably mean an inconsistency in controller
+ // configuration but safely ignore (see below)
+ wstring msg = L"Warning! Authentication exception received on connection
retry, controller configuration might be inconsistent";
+ if (isWarnEnabled())
+ logWarn(fctName, msg);
+ throw DriverException(msg+ae.description());
}
+
// Connection succeeded, restore the previous connection state on the
// controller
try
_______________________________________________
Carob-commits mailing list
[email protected]
https://forge.continuent.org/mailman/listinfo/carob-commits