Hi Vu,

ACK not tested .

-AVM


On 3/24/2017 2:05 PM, Vu Minh Nguyen wrote:
>   src/log/logd/lgs_dest.cc  |   4 +---
>   src/log/logd/lgs_dest.h   |   1 +
>   src/log/logd/lgs_evt.cc   |   1 +
>   src/log/logd/lgs_imm.cc   |  10 ++++++++++
>   src/log/logd/lgs_mbcsv.cc |   5 +++++
>   src/log/logd/lgs_stream.h |   1 +
>   6 files changed, 19 insertions(+), 3 deletions(-)
>
>
> MSGID currently is calculated whenever sending log record
> to UNIX_SOCKET type, it may impact more or less on performance.
>
> This ticket is to cache the value at the time of log stream creation,
> and just refering to it whenever need that value.
>
> diff --git a/src/log/logd/lgs_dest.cc b/src/log/logd/lgs_dest.cc
> --- a/src/log/logd/lgs_dest.cc
> +++ b/src/log/logd/lgs_dest.cc
> @@ -386,10 +386,8 @@ bool WriteToDestination(const RecordData
>     // Origin is FQDN = <hostname>[.<networkname>]
>     // hostname = where the log record comes from (not active node)
>     const std::string origin = std::string {data.hostname} + networkname;
> -  const std::string msgid = DestinationHandler::Instance().GenerateMsgId(
> -      data.name, data.isRtStream);
>   
> -  info.msgid      = msgid.c_str();
> +  info.msgid      = data.msgid;
>     info.log_record = data.logrec;
>     info.record_id  = data.recordId;
>     info.stream_dn  = data.name;
> diff --git a/src/log/logd/lgs_dest.h b/src/log/logd/lgs_dest.h
> --- a/src/log/logd/lgs_dest.h
> +++ b/src/log/logd/lgs_dest.h
> @@ -71,6 +71,7 @@ struct RecordData {
>     const char* hostname;
>     const char* networkname;
>     const char* appname;
> +  const char* msgid;
>     bool isRtStream;
>     uint32_t recordId;
>     uint16_t sev;
> 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
> @@ -1401,6 +1401,7 @@ static uint32_t proc_write_log_async_msg
>     data.networkname = lgs_get_networkname().c_str();
>     data.appname = osaf_extended_name_borrow(
>         param->logRecord->logHeader.genericHdr.logSvcUsrName);
> +  data.msgid = stream->rfc5424MsgId.c_str();
>     data.isRtStream = stream->isRtStream;
>     data.recordId = stream->logRecordId;
>     data.sev = param->logRecord->logHeader.genericHdr.logSeverity;
> diff --git a/src/log/logd/lgs_imm.cc b/src/log/logd/lgs_imm.cc
> --- a/src/log/logd/lgs_imm.cc
> +++ b/src/log/logd/lgs_imm.cc
> @@ -2378,6 +2378,11 @@ static SaAisErrorT stream_create_and_con
>       osaf_abort(0);
>     }
>   
> +  // Generate & cache `MSGID` to `rfc5424MsgId` which later
> +  // used in RFC5424 protocol
> +  (*stream)->rfc5424MsgId = DestinationHandler::Instance().GenerateMsgId(
> +      (*stream)->name, (*stream)->isRtStream);
> +
>   done:
>     TRACE_LEAVE2("rc: %s", saf_error(rc));
>     return rc;
> @@ -2877,6 +2882,11 @@ static SaAisErrorT stream_create_and_con
>       }
>     }
>   
> +  // Generate & cache `MSGID` to `rfc5424MsgId` which later
> +  // used in RFC5424 protocol
> +  stream->rfc5424MsgId = DestinationHandler::Instance().GenerateMsgId(
> +      dn, stream->isRtStream);
> +
>   done:
>     TRACE_LEAVE2("rc: %s", saf_error(rc));
>     return rc;
> diff --git a/src/log/logd/lgs_mbcsv.cc b/src/log/logd/lgs_mbcsv.cc
> --- a/src/log/logd/lgs_mbcsv.cc
> +++ b/src/log/logd/lgs_mbcsv.cc
> @@ -2043,6 +2043,11 @@ uint32_t ckpt_proc_open_stream(lgs_cb_t
>           stream->stb_dest_names = "";
>           stream->dest_names.clear();
>         }
> +
> +      // Generate & cache `MSGID` to `rfc5424MsgId` which later
> +      // used in RFC5424 protocol
> +      stream->rfc5424MsgId = DestinationHandler::Instance().GenerateMsgId(
> +          stream->name, stream->isRtStream);
>       }
>     }
>   
> diff --git a/src/log/logd/lgs_stream.h b/src/log/logd/lgs_stream.h
> --- a/src/log/logd/lgs_stream.h
> +++ b/src/log/logd/lgs_stream.h
> @@ -52,6 +52,7 @@ typedef struct log_stream {
>     SaTimeT creationTimeStamp;
>     SaUint32T numOpeners;
>     SaUint64T filtered;     /* discarded by server due to filtering */
> +  std::string rfc5424MsgId;
>     /* --- end correspond to IMM Class --- */
>   
>     uint32_t streamId;      /* The unique stream id for this stream */


------------------------------------------------------------------------------
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
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to