If client closes stream is successful in active node but it cannot be 
checkpointed
to standby node. This causes the "numOpeners" is different between active and 
standby.
It also different number of streams that client opened  between standby and 
active.
When the client open again that stream, the "numOpeners" is updated to be equal 
between
active and standby while the client own number of streams is still different 
betwwen
active and standby. This will causes the logd crash.

Should restart standby node if handling the checkpoint of reopening stream
with different of "numOpeners" between active and standby node.
---
 src/log/logd/lgs_mbcsv.cc | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/src/log/logd/lgs_mbcsv.cc b/src/log/logd/lgs_mbcsv.cc
index 8f66fb926..51201dbb7 100644
--- a/src/log/logd/lgs_mbcsv.cc
+++ b/src/log/logd/lgs_mbcsv.cc
@@ -800,7 +800,6 @@ static uint32_t edu_enc_streams(lgs_cb_t *cb, NCS_UBAID 
*uba) {
  *
  * Notes         : None.
  ***************************************************************************/
-
 static uint32_t edu_enc_reg_list(lgs_cb_t *cb, NCS_UBAID *uba) {
   log_client_t *client = NULL;
   lgs_ckpt_initialize_msg_t ckpt_reg_rec;
@@ -2086,11 +2085,17 @@ uint32_t ckpt_proc_open_stream(lgs_cb_t *cb, void 
*data) {
   stream = log_stream_get_by_name(param->logStreamName);
   if (stream != NULL) {
     TRACE("\tExisting stream - id %u", stream->streamId);
-    /*
-    ** Update stream attributes that might change when a stream is
-    ** opened a second time.
-    */
-    stream->numOpeners = param->numOpeners;
+
+    // Update the "numOpeners" on standby when reopening the stream
+    ++stream->numOpeners;
+    if (param->numOpeners != stream->numOpeners) {
+      // In some cases the checkpoint of closing stream fail and standby node
+      // haven't received the checkpoint. The "numOpeners" is different between
+      // standby and active node. Should restart standby node if reopening
+      // the stream
+      lgs_exit("NumOpeners is different between standby and active node",
+               SA_AMF_COMPONENT_RESTART);
+    }
   } else {
     TRACE("\tNew stream %s, id %u", param->logStreamName, param->streamId);
 
-- 
2.15.1



_______________________________________________
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to