Hi!

On 02/17/2017 10:16 AM, A V Mahesh wrote:
> Hi Anders Widell,
>
> ACK  with following  ( tested as well )
>
> On 2/17/2017 2:22 PM, Anders Widell wrote:
>> Yes the max value is INT_MAX (2147483647), after which the next 
>> sequence number will start from 1 again. 
>
> Do we have to mention the things  in some README ?

This limit is documented in the RFC, but we should check that our README 
refers to the RFC somewhere.

>
> -AVM
>
> On 2/17/2017 2:22 PM, Anders Widell wrote:
>> See below.
>>
>> regards,
>>
>> Anders Widell
>>
>>
>> On 02/17/2017 06:21 AM, A V Mahesh wrote:
>>> Hi Anders Widell,
>>>
>>> Can you please clarify below :
>>>
>>> 1) is this  meta sequenceId is rotates after reaching some value ? 
>>> (   Max value )
>>
>> Yes the max value is INT_MAX (2147483647), after which the next 
>> sequence number will start from 1 again.
>>
>>>
>>> 2) is this  meta sequenceId  persistent even after application 
>>> respawn  ?
>>
>> No, but you can detect application restart using the PID, which is 
>> also included in the log message.
>>
>>>
>>> =============================================================================================================================================================
>>>  
>>>
>>>
>>> <143>1 2017-02-17T10:44:21.59772+05:30 PL-1 osafimmloadd 10183 - 
>>> [meta sequenceId="431572"] MDS_SND_RCV : calling cb ptr enc or enc 
>>> flatin mcm_msg_encode_full_or_flat_and_send
>>> <143>1 2017-02-17T10:44:21.597733+05:30 PL-1 osafimmloadd 10183 - 
>>> [meta sequenceId="431573"] >> mds_get_subtn_res_tbl_by_adest
>>>
>>> <143>1 2017-02-17T10:44:21.597771+05:30 PL-1 osafimmloadd 10183 - 
>>> [meta sequenceId="431576"] << mcm_msg_encode_full_or_flat_and_send
>>> <142>1 2017-02-17T10:44:21.597784+05:30 PL-1 osafimmloadd 10183 - 
>>> [meta sequenceId="431577"] MDTM: User Sending Data lenght=384 From 
>>> svc_id = IMMA_OM(26) to svc_id = IMMND(25)
>>> <143>1 2017-02-17T10:44:21.597798+05:30 PL-1 osafimmloadd 10183 - 
>>> [meta sequenceId="431578"] MDTM: Sending message with Service 
>>> Seqno=7482, TO Dest_id=<0x0002020f:9253>
>>>
>>> <143>1 2017-02-17T10:44:21.597875+05:30 PL-1 osafimmnd 9253 - [meta 
>>> sequenceId="1532911"] >> mds_vdest_tbl_get_role
>>> <143>1 2017-02-17T10:44:21.597879+05:30 PL-1 osafimmnd 9253 - [meta 
>>> sequenceId="1532912"] << mds_vdest_tbl_get_role
>>>
>>> =============================================================================================================================================================
>>>  
>>>
>>>
>>> -AVM
>>>
>>>
>>> On 2/13/2017 8:11 PM, Anders Widell wrote:
>>>>   src/mds/mds_log.cc |  24 ++++++++++++++++--------
>>>>   1 files changed, 16 insertions(+), 8 deletions(-)
>>>>
>>>>
>>>> Use the meta sequenceId structured element for message sequence 
>>>> numbers instead
>>>> of the MSGID field, as per RFC-5424.
>>>>
>>>> Also use a mutex to protect the UnixSocket instance, since users of 
>>>> this class
>>>> will be reponsible for thread safety after ticket [#2293].
>>>>
>>>> diff --git a/src/mds/mds_log.cc b/src/mds/mds_log.cc
>>>> --- a/src/mds/mds_log.cc
>>>> +++ b/src/mds/mds_log.cc
>>>> @@ -27,7 +27,6 @@
>>>>   #include <sys/time.h>
>>>>   #include <time.h>
>>>>   #include <unistd.h>
>>>> -#include <atomic>
>>>>   #include <cstdarg>
>>>>   #include <cstdio>
>>>>   #include <cstring>
>>>> @@ -35,6 +34,7 @@
>>>>   #include "base/buffer.h"
>>>>   #include "base/log_message.h"
>>>>   #include "base/macros.h"
>>>> +#include "base/mutex.h"
>>>>   #include "base/ncsgl_defs.h"
>>>>   #include "base/osaf_utility.h"
>>>>   #include "base/time.h"
>>>> @@ -54,12 +54,14 @@ class MdsLog {
>>>>               uint32_t proc_id, const char* socket_name);
>>>>     void LogInternal(base::LogMessage::Severity severity, const 
>>>> char *fmt,
>>>>                      va_list ap);
>>>> +  static constexpr const uint32_t kMaxSequenceId = 
>>>> uint32_t{0x7fffffff};
>>>>     static MdsLog* instance_;
>>>>     const base::LogMessage::HostName host_name_;
>>>>     const base::LogMessage::AppName app_name_;
>>>>     const base::LogMessage::ProcId proc_id_;
>>>> -  std::atomic<uint64_t> msg_id_;
>>>> +  uint32_t sequence_id_;
>>>>     base::UnixClientSocket log_socket_;
>>>> +  base::Mutex mutex_;
>>>>       DELETE_COPY_AND_MOVE_OPERATORS(MdsLog);
>>>>   };
>>>> @@ -72,8 +74,9 @@ MdsLog::MdsLog(const char* host_name, co
>>>>       host_name_{base::LogMessage::HostName{host_name}},
>>>>       app_name_{base::LogMessage::AppName{app_name}},
>>>> proc_id_{base::LogMessage::ProcId{std::to_string(proc_id)}},
>>>> -    msg_id_{0},
>>>> -    log_socket_{socket_name} {
>>>> +    sequence_id_{1},
>>>> +    log_socket_{socket_name},
>>>> +    mutex_{} {
>>>>   }
>>>>     /*****************************************************
>>>> @@ -130,16 +133,21 @@ void MdsLog::Log(base::LogMessage::Sever
>>>>     void MdsLog::LogInternal(base::LogMessage::Severity severity, 
>>>> const char *fmt,
>>>>                            va_list ap) {
>>>> -  uint64_t id = msg_id_++;
>>>> +  base::Lock lock(mutex_);
>>>> +  uint32_t id = sequence_id_;
>>>> +  sequence_id_ = id < kMaxSequenceId ? id + 1 : 1;
>>>>     base::Buffer<256> buffer;
>>>> - base::LogMessage::Write(base::LogMessage::Facility::kLocal0,
>>>> + base::LogMessage::Write(base::LogMessage::Facility::kLocal1,
>>>>                             severity,
>>>>                             base::ReadRealtimeClock(),
>>>>                             host_name_,
>>>>                             app_name_,
>>>>                             proc_id_,
>>>> - base::LogMessage::MsgId{std::to_string(id)},
>>>> -                          {},
>>>> +                          base::LogMessage::MsgId{""},
>>>> + {{base::LogMessage::SdName{"meta"},
>>>> +                              {base::LogMessage::Parameter{
>>>> + base::LogMessage::SdName{"sequenceId"},
>>>> + std::to_string(id)}}}},
>>>>                             fmt,
>>>>                             ap,
>>>>                             &buffer);
>>>
>>
>


------------------------------------------------------------------------------
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

Reply via email to