Hi Thang,

ack from me. Maybe we can just add another commit for NTF as Thuan suggested?

Thanks

Minh

On 8/7/20 1:17 pm, thang.d.nguyen wrote:
Should not invoke saAmfComponentErrorReport() to AMF
before exit with failure.
In case invoking, AMF don't know how to handle it.
And logd does not start again.
---
  src/log/README               |  8 --------
  src/log/logd/lgs_mbcsv.cc    | 16 ++++++++--------
  src/log/logd/lgs_oi_admin.cc |  7 +++----
  src/log/logd/lgs_util.cc     |  4 +---
  src/log/logd/lgs_util.h      |  2 +-
  5 files changed, 13 insertions(+), 24 deletions(-)

diff --git a/src/log/README b/src/log/README
index 30d784033..d38bb708b 100644
--- a/src/log/README
+++ b/src/log/README
@@ -564,10 +564,6 @@ synchronization.
  The following is checkpointed and done on standby:
  ===================================================
-If something goes wrong the general behavior is to restart the component using
-saAmfComponentErrorReport(...,SA_AMF_COMPONENT_RESTART,...) in order to avoid
-being out of sync (will trig a mbcs cold sync).
-
  Checkpointed
  -------------
@@ -653,10 +649,6 @@ synchronization is trigged when standby detects a new active.
  Cold sync:
   - At start up / restart
   - When changing role
- - When standby detects out of sync.
-   AMF is requested to perform a component restart (of standby)
-   "saAmfComponentErrorReport(...,SA_AMF_COMPONENT_RESTART,...)"
-
Synchronization of files and handling of log records
  ----------------------------------------------------
diff --git a/src/log/logd/lgs_mbcsv.cc b/src/log/logd/lgs_mbcsv.cc
index 2d1271c1c..a38f7a5d1 100644
--- a/src/log/logd/lgs_mbcsv.cc
+++ b/src/log/logd/lgs_mbcsv.cc
@@ -1825,7 +1825,7 @@ static uint32_t ckpt_decode_cold_sync(lgs_cb_t *cb, 
NCS_MBCSV_CB_ARG *cbk_arg) {
  done:
    if (rc != NCSCC_RC_SUCCESS) {
      /* Do not allow standby to get out of sync */
-    lgs_exit("Cold sync failed", SA_AMF_COMPONENT_RESTART);
+    lgs_exit("Cold sync failed");
    }
    TRACE_LEAVE();
    return rc;
@@ -1934,7 +1934,7 @@ static uint32_t ckpt_proc_initialize_client(lgs_cb_t *cb, 
void *data) {
        if ((client = lgs_client_new(param->mds_dest, param->client_id,
                                     param->stream_list)) == NULL) {
          /* Do not allow standby to get out of sync */
-        lgs_exit("Could not create new client", SA_AMF_COMPONENT_RESTART);
+        lgs_exit("Could not create new client");
        } else {
          client->client_ver = param->client_ver;
        }
@@ -1942,7 +1942,7 @@ static uint32_t ckpt_proc_initialize_client(lgs_cb_t *cb, 
void *data) {
        /* Client with ID already exist, check other attributes */
        if (client->mds_dest != param->mds_dest) {
          /* Do not allow standby to get out of sync */
-        lgs_exit("Client attributes differ", SA_AMF_COMPONENT_RESTART);
+        lgs_exit("Client attributes differ");
        }
      }
    } else if (lgs_is_peer_v6()) {
@@ -1957,7 +1957,7 @@ static uint32_t ckpt_proc_initialize_client(lgs_cb_t *cb, 
void *data) {
        if ((client = lgs_client_new(param->mds_dest, param->client_id,
                                     param->stream_list)) == NULL) {
          /* Do not allow standby to get out of sync */
-        lgs_exit("Could not create new client", SA_AMF_COMPONENT_RESTART);
+        lgs_exit("Could not create new client");
        } else {
          client->client_ver = param->client_ver;
        }
@@ -1965,7 +1965,7 @@ static uint32_t ckpt_proc_initialize_client(lgs_cb_t *cb, 
void *data) {
        /* Client with ID already exist, check other attributes */
        if (client->mds_dest != param->mds_dest) {
          /* Do not allow standby to get out of sync */
-        lgs_exit("Client attributes differ", SA_AMF_COMPONENT_RESTART);
+        lgs_exit("Client attributes differ");
        }
      }
    } else {
@@ -1980,13 +1980,13 @@ static uint32_t ckpt_proc_initialize_client(lgs_cb_t 
*cb, void *data) {
        if ((client = lgs_client_new(param->mds_dest, param->client_id,
                                     param->stream_list)) == NULL) {
          /* Do not allow standby to get out of sync */
-        lgs_exit("Could not create new client", SA_AMF_COMPONENT_RESTART);
+        lgs_exit("Could not create new client");
        }
      } else {
        /* Client with ID already exist, check other attributes */
        if (client->mds_dest != param->mds_dest) {
          /* Do not allow standby to get out of sync */
-        lgs_exit("Client attributes differ", SA_AMF_COMPONENT_RESTART);
+        lgs_exit("Client attributes differ");
        }
      }
    }
@@ -2488,7 +2488,7 @@ uint32_t ckpt_proc_open_stream(lgs_cb_t *cb, void *data) {
      /* Do not allow standby to get out of sync */
      LOG_ER("%s - Failed to add stream '%s' to client %u", __FUNCTION__,
             param->logStreamName, param->clientId);
-    lgs_exit("Could not add stream to client", SA_AMF_COMPONENT_RESTART);
+    lgs_exit("Could not add stream to client");
    }
/* Stream is opened on standby. Remove from rtobj list if exist */
diff --git a/src/log/logd/lgs_oi_admin.cc b/src/log/logd/lgs_oi_admin.cc
index 8b899219e..afbf3c5eb 100644
--- a/src/log/logd/lgs_oi_admin.cc
+++ b/src/log/logd/lgs_oi_admin.cc
@@ -343,11 +343,11 @@ static void createLogServerOi() {
               (ais_rc != SA_AIS_OK)) {
      LOG_WA("%s: Fail, OI creation timeout", __FUNCTION__);
      // The legacy behavior is to exit log service in this case
-    lgs_exit("createLogServerOi() failed", SA_AMF_COMPONENT_RESTART);
+    lgs_exit("createLogServerOi() failed");
    } else if (ais_rc != SA_AIS_OK) {
      LOG_WA("%s: Fail, OI creation error", __FUNCTION__);
      // The legacy behavior is to exit log service in this case
-    lgs_exit("createLogServerOi() failed", SA_AMF_COMPONENT_RESTART);
+    lgs_exit("createLogServerOi() failed");
    }
// Save OI handle and selection object
@@ -452,8 +452,7 @@ void lgsOiStop() {
    if ((io_thread_stop_timeout.is_timeout() == true) &&
        (oi_create_is_executing == true)) {
      // The OI creation thread is hanging. Recover by restarting log server
-    lgs_exit("lgsOiStop: Stopping OI create thread timeout",
-             SA_AMF_COMPONENT_RESTART);
+    lgs_exit("lgsOiStop: Stopping OI create thread timeout");
    }
// Note: oi_handle_ can be used unprotected here since we know that there is
diff --git a/src/log/logd/lgs_util.cc b/src/log/logd/lgs_util.cc
index 0538de70c..8ba100b1f 100644
--- a/src/log/logd/lgs_util.cc
+++ b/src/log/logd/lgs_util.cc
@@ -340,10 +340,8 @@ done:
    return rc;
  }
-void lgs_exit(const char *msg, SaAmfRecommendedRecoveryT rec_rcvr) {
+void lgs_exit(const char *msg) {
    LOG_ER("Exiting with message: %s", msg);
-  (void)saAmfComponentErrorReport(lgs_cb->amf_hdl, &lgs_cb->comp_name, 0,
-                                  rec_rcvr, SA_NTF_IDENTIFIER_UNUSED);
    exit(EXIT_FAILURE);
  }
diff --git a/src/log/logd/lgs_util.h b/src/log/logd/lgs_util.h
index 11a934fc4..b7c589a99 100644
--- a/src/log/logd/lgs_util.h
+++ b/src/log/logd/lgs_util.h
@@ -64,7 +64,7 @@ extern int lgs_file_rename_h(const std::string &root_path,
                               const std::string &suffix, std::string 
*new_name);
  // extern uint32_t lgs_create_known_streams(lgs_cb_t *lgs_cb); /* Not used, no
  // code */
-extern void lgs_exit(const char *msg, SaAmfRecommendedRecoveryT rec_rcvr);
+extern void lgs_exit(const char *msg);
  extern bool lgs_relative_path_check_ts(const std::string &path);
  extern int lgs_make_reldir_h(const std::string &path);
  extern int lgs_check_path_exists_h(const std::string &path_to_check);


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

Reply via email to