Remove the 'C'/'R' character at the end of the “mgsid” field.
The purpose of remove to avoid the hashing of log streams
which have name of exactly 32 characters length.
Note: stream name length greater than 32 characters will not be impacted.
---
src/log/apitest/tet_cfg_destination.c | 2 +-
src/log/logd/lgs_dest.cc | 17 +++++++----------
src/log/logd/lgs_dest.h | 2 +-
src/log/logd/lgs_imm.cc | 10 ++++------
src/log/logd/lgs_mbcsv.cc | 8 ++++----
5 files changed, 17 insertions(+), 22 deletions(-)
diff --git a/src/log/apitest/tet_cfg_destination.c
b/src/log/apitest/tet_cfg_destination.c
index f1fe71661..a73c6547b 100644
--- a/src/log/apitest/tet_cfg_destination.c
+++ b/src/log/apitest/tet_cfg_destination.c
@@ -289,7 +289,7 @@ void invalidDestName(void)
//
const char sendMsg[] = "writing a record to destination";
const char sendCmd[] = "saflogger -y";
-const char logpath[] = "/var/log/opensaf/saLogSystemC";
+const char logpath[] = "/var/log/opensaf/saLogSystem";
bool is_executed_on_active_node()
{
diff --git a/src/log/logd/lgs_dest.cc b/src/log/logd/lgs_dest.cc
index 42282c2c1..bf5064d21 100644
--- a/src/log/logd/lgs_dest.cc
+++ b/src/log/logd/lgs_dest.cc
@@ -46,8 +46,7 @@ DestinationHandler::DestType DestinationHandler::GetDestType(
}
}
-std::string DestinationHandler::GenerateMsgId(const std::string& dn,
- bool isRtStream) {
+std::string DestinationHandler::GenerateMsgId(const std::string& dn) {
const std::string parent = ",safApp=safLogService";
std::string msgid{""};
size_t posa = 0, posb = 0;
@@ -61,17 +60,15 @@ std::string DestinationHandler::GenerateMsgId(const
std::string& dn,
//>
// Rules to generate msgid string:
- // 1) Use stream name (e.g: saLogSystem) + 'C'/'R' if it is not over 31 chars
+ // 1) Use stream name (e.g: saLogSystem) if it is not over 32 chars
// and the stream DN contains the @parent ",safApp=safLogService";
- // Note: 'C' means configuration stream, 'R' means runtime stream.
- // Why 31? It is due to MSGID field length limitation
- // (max is 32 chars length).
+ // Note: Why 32? It is due to MSGID field length limitation
+ // (max is 32 chars length).
// 2) Otherwise, generate a hash number from stream DN
- // if stream name is over 31 chars.
+ // if stream name is over 32 chars.
//<
- if (sname.length() < 32 && dn.find(parent) != std::string::npos) {
- msgid = ((isRtStream == true) ? std::string{sname + 'R'}
- : std::string{sname + 'C'});
+ if (sname.length() <= 32 && dn.find(parent) != std::string::npos) {
+ msgid = sname;
} else {
// Do `InitializeHashFunction()` once
static bool init_invoked = false;
diff --git a/src/log/logd/lgs_dest.h b/src/log/logd/lgs_dest.h
index fff4c03ab..826a3b806 100644
--- a/src/log/logd/lgs_dest.h
+++ b/src/log/logd/lgs_dest.h
@@ -254,7 +254,7 @@ class DestinationHandler {
// Unique object instance of @DestinationHandler class
static DestinationHandler& Instance() { return me_; }
// Extract the stream name from stream DN
- static std::string GenerateMsgId(const std::string&, bool);
+ static std::string GenerateMsgId(const std::string&);
// Do destination configuration basing on input @vdest and @type.
ErrCode ProcessCfgChange(const VectorString& vdest, ModifyType type);
diff --git a/src/log/logd/lgs_imm.cc b/src/log/logd/lgs_imm.cc
index fd6cb9f65..928a5b7dd 100644
--- a/src/log/logd/lgs_imm.cc
+++ b/src/log/logd/lgs_imm.cc
@@ -2336,8 +2336,7 @@ static SaAisErrorT stream_create_and_configure1(
// Generate & cache `MSGID` to `rfc5424MsgId` which later
// used in RFC5424 protocol
(*stream)->rfc5424MsgId =
- DestinationHandler::Instance().GenerateMsgId(
- (*stream)->name, (*stream)->isRtStream);
+ DestinationHandler::Instance().GenerateMsgId((*stream)->name);
TRACE("%s: stream %s - msgid = %s", __func__,
(*stream)->name.c_str(),
(*stream)->rfc5424MsgId.c_str());
}
@@ -2517,8 +2516,7 @@ static void stream_ccb_apply_modify(const
CcbUtilOperationData_t *opdata) {
// Generate & cache `MSGID` to `rfc5424MsgId` which later
// used in RFC5424 protocol
stream->rfc5424MsgId =
- DestinationHandler::Instance().GenerateMsgId(
- stream->name, stream->isRtStream);
+ DestinationHandler::Instance().GenerateMsgId(stream->name);
TRACE("%s: stream %s - msgid = %s", __func__, stream->name.c_str(),
stream->rfc5424MsgId.c_str());
}
@@ -2841,8 +2839,8 @@ static SaAisErrorT stream_create_and_configure(
if (vstring.empty() == false) {
// Generate & cache `MSGID` to `rfc5424MsgId` which later
// used in RFC5424 protocol
- stream->rfc5424MsgId = DestinationHandler::Instance().GenerateMsgId(
- dn, stream->isRtStream);
+ stream->rfc5424MsgId =
+ DestinationHandler::Instance().GenerateMsgId(dn);
TRACE("%s: stream %s - msgid = %s", __func__, stream->name.c_str(),
stream->rfc5424MsgId.c_str());
}
diff --git a/src/log/logd/lgs_mbcsv.cc b/src/log/logd/lgs_mbcsv.cc
index ee14da2f0..30d29c191 100644
--- a/src/log/logd/lgs_mbcsv.cc
+++ b/src/log/logd/lgs_mbcsv.cc
@@ -2455,8 +2455,8 @@ uint32_t ckpt_proc_open_stream(lgs_cb_t *cb, void *data) {
stream->dest_names = logutil::Parser(stream->stb_dest_names, ";");
// Generate & cache `MSGID` to `rfc5424MsgId` which later
// used in RFC5424 protocol
- stream->rfc5424MsgId = DestinationHandler::Instance().GenerateMsgId(
- stream->name, stream->isRtStream);
+ stream->rfc5424MsgId =
+ DestinationHandler::Instance().GenerateMsgId(stream->name);
TRACE("%s: stream %s - msgid = %s", __func__, stream->name.c_str(),
stream->rfc5424MsgId.c_str());
} else {
@@ -2757,8 +2757,8 @@ static uint32_t ckpt_proc_cfg_stream(lgs_cb_t *cb, void
*data) {
// 1) Have destination set
// 2) Not yet generated
if (stream->rfc5424MsgId.empty() == true) {
- stream->rfc5424MsgId = DestinationHandler::Instance().GenerateMsgId(
- stream->name, stream->isRtStream);
+ stream->rfc5424MsgId =
+ DestinationHandler::Instance().GenerateMsgId(stream->name);
TRACE("%s: stream %s - msgid = %s", __func__, stream->name.c_str(),
stream->rfc5424MsgId.c_str());
}
--
2.25.1
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel