Date: Wednesday, November 29, 2006 @ 18:06:17
Author: gilles
Path: /cvsroot/carob/carob/src
Modified: Connection.cpp (1.94 -> 1.95)
Fix for CAROB-114: call reconnectOrDie() before trying to retrieveXXXResult
+ comments and logging fixes
----------------+
Connection.cpp | 21 ++++++++++++++++-----
1 files changed, 16 insertions(+), 5 deletions(-)
Index: carob/src/Connection.cpp
diff -u carob/src/Connection.cpp:1.94 carob/src/Connection.cpp:1.95
--- carob/src/Connection.cpp:1.94 Tue Nov 28 17:07:55 2006
+++ carob/src/Connection.cpp Wed Nov 29 18:06:17 2006
@@ -363,7 +363,7 @@
}
if (isDebugEnabled())
- logDebug(fctName, L"Closing socket to controller");
+ logDebug(fctName, L"Closing socket to controller " +
static_cast<wstring>(connected_controller));
try
{
// Try to cleanly close the connection (also on controller side)
@@ -501,10 +501,11 @@
}
}
catch (SocketIOException e)
- { // Connection failed, try to reconnect and re-exec the commit
+ {
+ // Connection failed, try to reconnect and re-exec the commit
reconnectOrDie();
-
- // FIXME: we should probably retry NTIMES here
+ // Try to get the commit result from the newly connected controller: if
+ // this fails again, give up
int64_t acknowledgedTransactionId = retrieveCommitResult();
if (acknowledgedTransactionId != transactionId)
{
@@ -560,8 +561,11 @@
mustBeginTransaction = true;
}
catch (SocketIOException e)
- { // Connection failed, try to reconnect and re-exec the rollback
+ {
+ // Connection failed, try to reconnect and re-exec the rollback
reconnectOrDie();
+ // Try to get the rollback result from the newly connected controller: if
+ // this fails again, give up
int64_t acknowledgedTransactionId = retrieveRollbackResult();
if (acknowledgedTransactionId != transactionId)
{
@@ -704,6 +708,7 @@
}
catch (SocketIOException sioe)
{
+ reconnectOrDie();
FO_TRY_NTIMES(RECONNECT_RETRIES)
ret = retrieveExecuteUpdateResult(request);
FO_CATCH_NTIMES
@@ -752,6 +757,7 @@
}
catch (SocketIOException sioe)
{
+ reconnectOrDie();
FO_TRY_NTIMES(RECONNECT_RETRIES)
// Clean-up old results if any
if (results.size() > 0)
@@ -825,6 +831,7 @@
}
catch (SocketIOException sioe)
{
+ reconnectOrDie();
FO_TRY_NTIMES(RECONNECT_RETRIES)
// Clean-up old result if any
if (result.size() > 0)
@@ -1119,6 +1126,10 @@
throw (SocketIOException, BackendException, ControllerException,
ProtocolException, UnexpectedException)
{
+ wstring fctName(L"Connection::retrieveExecuteUpdateResult");
+ if (isDebugEnabled())
+ logDebug(fctName, L"Retrieving previous result of query "
+ + toWString(request.getId()));
sendCommand(*driverSocketPtr, RetrieveExecuteUpdateResult);
*driverSocketPtr << request.getId();
SQLWarning* sqlwPtr = receiveSQLWarnings();
_______________________________________________
Carob-commits mailing list
[email protected]
https://forge.continuent.org/mailman/listinfo/carob-commits