From 5e6c7fee601d04dc82de2b3d86fb61576671e5fd Mon Sep 17 00:00:00 2001
Message-Id: <5e6c7fee601d04dc82de2b3d86fb61576671e5fd.1348657454.git.ibell@...>
In-Reply-To: <6456222f7ea01be922ce869d84b615bcc03cc79c.1348657454.git.ibell@...>
References: <6456222f7ea01be922ce869d84b615bcc03cc79c.1348657454.git.ibell@...>
From: Ian Bell <ibell@...>
Date: Wed, 26 Sep 2012 11:47:58 +0100
Subject: [PATCH 3/6] [mama] Fix wait for recap ft scheme
Fixed an issue where messages were forwarded during an ft takeover when
the WAIT_FOR_RECAP scheme was active
Signed-off-by: Ian Bell <ibell@...>
---
mama/c_cpp/src/c/dqstrategy.c | 26 +++++++++++++++-----------
1 file changed, 15 insertions(+), 11 deletions(-)
diff --git a/mama/c_cpp/src/c/dqstrategy.c b/mama/c_cpp/src/c/dqstrategy.c
index 6dbf4bb..7978c63 100644
--- a/mama/c_cpp/src/c/dqstrategy.c
+++ b/mama/c_cpp/src/c/dqstrategy.c
@@ -154,7 +154,7 @@ handleFTTakeover (dqStrategy strategy,
if (recoverOnRecap)
{
- ctx->mSeqNum = senderId;
+ ctx->mSeqNum = seqNum;
ctx->mDQState = DQ_STATE_WAITING_FOR_RECAP_AFTER_FT;
}
else
@@ -219,6 +219,7 @@ dqStrategy_checkSeqNum (dqStrategy strategy,
}
if (DQ_FT_WAIT_FOR_RECAP==mamaTransportImpl_getFtStrategyScheme(tport))
{
+ ctx->mDoNotForward = 1;
handleFTTakeover (strategy, msg, msgType, ctx, seqNum, senderId, 1);
}
else
@@ -227,12 +228,12 @@ dqStrategy_checkSeqNum (dqStrategy strategy,
}
}
- if (gMamaLogLevel >= MAMA_LOG_LEVEL_FINER)
+ if (gMamaLogLevel >= MAMA_LOG_LEVEL_FINEST)
{
const char* symbol = NULL;
mamaSubscription_getSymbol (subscription, &symbol);
symbol = symbol == NULL ? "" : symbol;
- mama_log (MAMA_LOG_LEVEL_FINER,
+ mama_log (MAMA_LOG_LEVEL_FINEST,
"dqStrategy_checkSeqNum(): %s : seq# %ld",
symbol,
seqNum);
@@ -276,14 +277,16 @@ dqStrategy_checkSeqNum (dqStrategy strategy,
/* If the sequence numbers for a message are correct then the
subscription is OK. */
- msgStatus = mamaMsgStatus_statusForMsg (msg);
- /* Check the status of the message. If it is stale,
- do not request a recap and do not set status OK. */
- if (msgStatus == MAMA_MSG_STATUS_OK)
- resetDqState (strategy, ctx);
-
- ctx->mSeqNum = seqNum;
- return MAMA_STATUS_OK;
+ msgStatus = mamaMsgStatus_statusForMsg (msg);
+ /* Check the status of the message. If it is stale,
+ do not request a recap and do not set status OK. */
+ if (msgStatus == MAMA_MSG_STATUS_OK)
+ {
+ resetDqState (strategy, ctx);
+
+ ctx->mSeqNum = seqNum;
+ return MAMA_STATUS_OK;
+ }
}
/* For late joins or middlewares that support a publish cache, it is possible that you will get old updates
@@ -384,6 +387,7 @@ dqStrategy_checkSeqNum (dqStrategy strategy,
mamaSubscription_unsetAllPossiblyStale (subscription);
resetDqState (strategy, ctx);
dqStrategyImpl_resetDqContext (ctx, seqNum, senderId);
+ ctx->mDoNotForward = 0;
return MAMA_STATUS_OK;
case MAMA_MSG_TYPE_DDICT_SNAPSHOT : /*No DQ checking for Datadictionary*/
return MAMA_STATUS_OK;
--
1.7.9.5