Hi Canh Ack Has done a legacy test including switch over and fail over tests
Thanks Lennart > -----Original Message----- > From: Canh Van Truong [mailto:[email protected]] > Sent: den 17 mars 2017 14:14 > To: Lennart Lund <[email protected]>; Vu Minh Nguyen > <[email protected]>; [email protected] > Cc: [email protected] > Subject: [PATCH 1 of 1] log: fix both active and standby sites own the same > log file name [#2383] > > src/log/logd/lgs_amf.cc | 4 +--- > src/log/logd/lgs_evt.cc | 9 +++++++++ > src/log/logd/lgs_stream.cc | 4 ++-- > 3 files changed, 12 insertions(+), 5 deletions(-) > > > The issues: > It's happen because when switchover, active side switch to quiesced. For > short period > (MDS's quiesced acknowledgment time), the log server in quiesced state > may still get > request from log agent if these request already put to mds queue. if the > request are open > stream or write async, the log file is opened and is not closed in switchover > processing > any more when it up to standby. An other side that switch from standby to > active state > may also open the same log file name. This cause when delete cfg app > stream, closing, > rename log file will happen in both active and standby. And just rename in > active side is > successfull, in standby will be failed > > Fix: > When the lgs has HA state up to quiesced and receive mds callback with > MDS_CALLBACK_QUIESCED_ACK, lgs check all stream, if any stream are > opening log file, closing all log file. > > There are also converting LOG_ER to LOG_WA if renaming log file and get > error return > from file handle thread. > > diff --git a/src/log/logd/lgs_amf.cc b/src/log/logd/lgs_amf.cc > --- a/src/log/logd/lgs_amf.cc > +++ b/src/log/logd/lgs_amf.cc > @@ -153,13 +153,11 @@ static SaAisErrorT amf_quiescing_state_h > > ********************************************************** > *******************/ > static SaAisErrorT amf_quiesced_state_handler(lgs_cb_t *cb, SaInvocationT > invocation) { > V_DEST_RL mds_role; > - SaAisErrorT rc = SA_AIS_OK; > > TRACE_ENTER2("HA AMF QUIESCED STATE request"); > - close_all_files(); > > /* Give up our IMM OI implementer role */ > - rc = immutil_saImmOiImplementerClear(cb->immOiHandle); > + SaAisErrorT rc = immutil_saImmOiImplementerClear(cb->immOiHandle); > if (rc != SA_AIS_OK) { > LOG_WA("immutil_saImmOiImplementerClear failed: %s", saf_error(rc)); > } > diff --git a/src/log/logd/lgs_evt.cc b/src/log/logd/lgs_evt.cc > --- a/src/log/logd/lgs_evt.cc > +++ b/src/log/logd/lgs_evt.cc > @@ -499,12 +499,21 @@ static uint32_t proc_lga_updn_mds_msg(lg > > ********************************************************** > *******************/ > static uint32_t proc_mds_quiesced_ack_msg(lgsv_lgs_evt_t *evt) { > TRACE_ENTER(); > + log_stream_t *stream = nullptr; > + SaBoolT endloop = SA_FALSE, jstart = SA_TRUE; > > if (lgs_cb->is_quiesced_set == true) { > /* Update control block */ > lgs_cb->is_quiesced_set = false; > lgs_cb->ha_state = SA_AMF_HA_QUIESCED; > > + // Closing all current log file > + while ((stream = iterate_all_streams(endloop, jstart)) && !endloop) { > + jstart = SA_FALSE; > + if (log_stream_file_close(stream) != 0) > + LOG_WA("Could not close file for stream %s", stream->name.c_str()); > + } > + > /* Inform MBCSV of HA state change */ > if (lgs_mbcsv_change_HA_state(lgs_cb, lgs_cb->ha_state) != > NCSCC_RC_SUCCESS) > diff --git a/src/log/logd/lgs_stream.cc b/src/log/logd/lgs_stream.cc > --- a/src/log/logd/lgs_stream.cc > +++ b/src/log/logd/lgs_stream.cc > @@ -860,7 +860,7 @@ void log_stream_close(log_stream_t **s, > } > > if (rc == -1) { > - LOG_ER("Could not rename log file: %s", strerror(errno)); > + LOG_WA("Could not rename log file: %s", strerror(errno)); > goto done_files; > } > > @@ -876,7 +876,7 @@ void log_stream_close(log_stream_t **s, > LGS_LOG_FILE_CONFIG_EXT, emptyStr); > } > if (rc == -1) { > - LOG_ER("Could not rename config file: %s", strerror(errno)); > + LOG_WA("Could not rename config file: %s", strerror(errno)); > goto done_files; > } > } ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Opensaf-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/opensaf-devel
