Date: Tuesday, February 6, 2007 @ 19:53:07
Author: marc
Path: /cvsroot/carob/carob
Modified: include/Connection.hpp (1.84 -> 1.85) src/Connection.cpp (1.109
-> 1.110)
Updated comments and javadoc related to reconnections. Related to CAROB-125.
------------------------+
include/Connection.hpp | 16 +++++++++++-----
src/Connection.cpp | 10 ++++++++--
2 files changed, 19 insertions(+), 7 deletions(-)
Index: carob/include/Connection.hpp
diff -u carob/include/Connection.hpp:1.84 carob/include/Connection.hpp:1.85
--- carob/include/Connection.hpp:1.84 Tue Feb 6 12:35:08 2007
+++ carob/include/Connection.hpp Tue Feb 6 19:53:06 2007
@@ -719,10 +719,11 @@
ControllerException, ProtocolException,
UnexpectedException);
/**
- * Tries first to reconnect to the same controller. If unsuccessfull,
notifies
- * the suspicion of failure for the current controller and reconnects to a
- * controller chosen using the policy specified in the connection parameters
- * of this connection.
+ * Tries to restore connection on getConnectionToNewController()
+ *
+ * Register the current controller as a failing one so everybody is
+ * aware about it, cleans-up the current connection, calls
+ * getConnectionToNewController() then restores the connection state.
*
* @throw ConnectionException if the next controller (get from connection
* policy) is also down
@@ -732,10 +733,15 @@
void tryToReconnect() throw (NoMoreControllerException,
DriverException, UnexpectedException);
/**
- * Calls reconnect until :
+ *
+ * Repeatedly calls tryToReconnect() above until :
* - success
* - NoMoreControllerException
* - Other unrecoverable error
+ *
+ * Iterating here is probably useless since watchers keep an
+ * up-to-date list of running controllers and since are already
+ * using recursion below + iterating above.
*
* @throw ConnectionException if no valid controller is left
* @throw DriverException if controllers are misconfigurated
Index: carob/src/Connection.cpp
diff -u carob/src/Connection.cpp:1.109 carob/src/Connection.cpp:1.110
--- carob/src/Connection.cpp:1.109 Tue Feb 6 17:22:48 2007
+++ carob/src/Connection.cpp Tue Feb 6 19:53:07 2007
@@ -65,7 +65,7 @@
// TODO: catching non-socket exceptions should probably be done
// outside of the retry for loop. Like this we could
// try to reconnect() after corruptedConnectionClose()
-// WITHOUT trying to re-execute the failed query!
+// WITHOUT trying to re-execute the failed query! See CAROB-125
#define FO_CATCH_NTIMES\
@@ -75,6 +75,8 @@
{\
::sleep(static_cast<int>(foCnt*0.5)); /* sleep incrementally */\
reconnectOrDie();\
+ /* All controllers down? Maybe not, maybe it is OUR network \
+ connection which is down! So let's sleep and try NTIMES */ \
}\
catch (const ProtocolException& pe)\
{\
@@ -313,7 +315,7 @@
buffer << reason;
logError(fctName, buffer.str());
- // Brutally close network socket FIRST
+ // Brutally close network socket FIRST, just like in tryToReconnect()
try {
this->closeSocket();
} catch (const SocketIOException& sioe) {
@@ -1268,6 +1270,7 @@
if (isDebugEnabled())
logDebug(fctName, L"Closing socket of lost connection");
+ // Brutally close network socket FIRST, just like in
corruptedConnectionClose()
closeSocket();
// inform controller pool of the failure: even if the info came from the
@@ -1279,6 +1282,9 @@
controller_pool.forceControllerDown(connected_controller);
// ...And try next one in the list
+
+ // CAROB-125 : we may need to extract the code below in a new method
+ // so corruptedConnectionClose() can use it.
try
{
if (isDebugEnabled())
_______________________________________________
Carob-commits mailing list
[email protected]
https://forge.continuent.org/mailman/listinfo/carob-commits