Hi Vu,

ACK

-AVM


On 7/20/2016 11:40 AM, Vu Minh Nguyen wrote:
>   osaf/services/saf/logsv/lgs/lgs_imm.cc    |  25 +++++++++----------------
>   osaf/services/saf/logsv/lgs/lgs_mbcsv.cc  |   1 +
>   osaf/services/saf/logsv/lgs/lgs_stream.cc |   6 ++++--
>   osaf/services/saf/logsv/lgs/lgs_stream.h  |   8 ++++++++
>   4 files changed, 22 insertions(+), 18 deletions(-)
>
>
> saImmRtObjectDelete() was always called when closing app streams,
> even the stream was configurable. If it was the case, that IMM API
> would return SA_AIS_ERR_NOT_EXIST and had WA in syslog.
>
> This patch introduce one flag in `log_stream_t`, showing
> the closed stream is runtime or configurable. And only
> call to the IMM API if the app stream is runtime.
> And this flag value is cached locally at SCs node.
>
> diff --git a/osaf/services/saf/logsv/lgs/lgs_imm.cc 
> b/osaf/services/saf/logsv/lgs/lgs_imm.cc
> --- a/osaf/services/saf/logsv/lgs/lgs_imm.cc
> +++ b/osaf/services/saf/logsv/lgs/lgs_imm.cc
> @@ -405,28 +405,21 @@ static void adminOperationCallback(SaImm
>   
>       if (opId == SA_LOG_ADMIN_CHANGE_FILTER) {
>               /* Only allowed to update runtime objects (application streams) 
> */
> -             /**
> -              * className holds a pointer to an duplicated memory (strdup).
> -              * Must be free after done using.
> -              */
> -             SaImmClassNameT className = immutil_get_className(objectName);
> -
> -             if (!strcmp(className, "SaLogStreamConfig")) {
> +             if (stream->streamType != STREAM_TYPE_APPLICATION) {
> +                     report_om_error(immOiHandle, invocation,
> +                                     "Admin op change filter for non app 
> stream");
> +                     goto done;
> +             }
> +
> +             /* Not allow perform adm op on configurable app streams */
> +             if (stream->isRtStream != SA_TRUE) {
>                       ais_rc = 
> immutil_saImmOiAdminOperationResult(immOiHandle,
> -                                               invocation, 
> SA_AIS_ERR_NOT_SUPPORTED);
> +                                                                  
> invocation, SA_AIS_ERR_NOT_SUPPORTED);
>                       if (ais_rc != SA_AIS_OK) {
>                               LOG_ER("immutil_saImmOiAdminOperationResult 
> failed %s", saf_error(ais_rc));
>                               osaf_abort(0);
>                       }
>   
> -                     free(className);
> -                     goto done;
> -             }
> -             free(className);
> -
> -             if (stream->streamType != STREAM_TYPE_APPLICATION) {
> -                     report_om_error(immOiHandle, invocation,
> -                                     "Admin op change filter for non app 
> stream");
>                       goto done;
>               }
>   
> diff --git a/osaf/services/saf/logsv/lgs/lgs_mbcsv.cc 
> b/osaf/services/saf/logsv/lgs/lgs_mbcsv.cc
> --- a/osaf/services/saf/logsv/lgs/lgs_mbcsv.cc
> +++ b/osaf/services/saf/logsv/lgs/lgs_mbcsv.cc
> @@ -1943,6 +1943,7 @@ uint32_t ckpt_proc_open_stream(lgs_cb_t
>               stream->logFileCurrent = param->logFileCurrent;
>               stream->stb_prev_actlogFileCurrent = param->logFileCurrent;
>               stream->stb_logFileCurrent = param->logFileCurrent;
> +             stream->isRtStream = SA_TRUE;
>       }
>   
>       /* If configured for split file system files shall be opened on stand by
> diff --git a/osaf/services/saf/logsv/lgs/lgs_stream.cc 
> b/osaf/services/saf/logsv/lgs/lgs_stream.cc
> --- a/osaf/services/saf/logsv/lgs/lgs_stream.cc
> +++ b/osaf/services/saf/logsv/lgs/lgs_stream.cc
> @@ -386,7 +386,7 @@ void log_stream_delete(log_stream_t **s)
>       TRACE_ENTER2("%s", stream->name.c_str());
>   
>       if (lgs_cb->ha_state == SA_AMF_HA_ACTIVE) {
> -             if (stream->streamType == STREAM_TYPE_APPLICATION) {
> +             if (stream->isRtStream == SA_TRUE) {
>                       SaAisErrorT rv;
>                       TRACE("Stream is closed, I am HA active so remove IMM 
> object");
>                       SaNameT objectName;
> @@ -457,6 +457,7 @@ int lgs_populate_log_stream(
>       o_stream->twelveHourModeFlag = twelveHourModeFlag;
>       o_stream->logRecordId = logRecordId;
>       o_stream->stb_logRecordId = 0;
> +     o_stream->isRtStream = SA_TRUE;
>   
>       o_stream->logFileFormat = strdup(logFileFormat);
>       if (o_stream->logFileFormat == NULL) {
> @@ -633,7 +634,8 @@ log_stream_t *log_stream_new(const std::
>       stream->streamId = stream_id;
>       stream->creationTimeStamp = lgs_get_SaTime();
>       stream->severityFilter = 0x7f;  /* by default all levels are allowed */
> -     
> +     stream->isRtStream = SA_FALSE;
> +
>       /* Initiate local or shared stream file descriptor dependant on shared 
> or
>        * split file system
>        */
> diff --git a/osaf/services/saf/logsv/lgs/lgs_stream.h 
> b/osaf/services/saf/logsv/lgs/lgs_stream.h
> --- a/osaf/services/saf/logsv/lgs/lgs_stream.h
> +++ b/osaf/services/saf/logsv/lgs/lgs_stream.h
> @@ -61,6 +61,14 @@ typedef struct log_stream {
>       uint32_t logRecordId;   /* log record indentifier increased for each 
> record */
>       SaBoolT twelveHourModeFlag; /* Not used. Can be removed? */
>       logStreamTypeT streamType;
> +     /**
> +      * This info is cached locally at SCs node when stream is opened.
> +      * Means that it is not checkpointed to standby node (to keep BC).
> +      * Using this variable to avoid cost in sending request to IMM
> +      * to get info whether the app stream is configurable or runtime
> +      * when performing adm op or closing app stream.
> +      */
> +     SaBoolT isRtStream; // default value is false
>       
>       /*
>        *  Checkpointed parameters used by standby in split file mode


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

Reply via email to