add valid msg
This commit is contained in:
parent
50bda0b719
commit
c5d9a2b24d
|
@ -56,6 +56,7 @@ extern "C" {
|
||||||
|
|
||||||
extern char* tMsgInfo[];
|
extern char* tMsgInfo[];
|
||||||
extern int32_t tMsgDict[];
|
extern int32_t tMsgDict[];
|
||||||
|
extern int32_t tMsgRangeDict[];
|
||||||
|
|
||||||
typedef uint16_t tmsg_t;
|
typedef uint16_t tmsg_t;
|
||||||
|
|
||||||
|
@ -63,8 +64,17 @@ typedef uint16_t tmsg_t;
|
||||||
#define TMSG_SEG_SEQ(TYPE) ((TYPE)&0xff)
|
#define TMSG_SEG_SEQ(TYPE) ((TYPE)&0xff)
|
||||||
#define TMSG_INDEX(TYPE) (tMsgDict[TMSG_SEG_CODE(TYPE)] + TMSG_SEG_SEQ(TYPE))
|
#define TMSG_INDEX(TYPE) (tMsgDict[TMSG_SEG_CODE(TYPE)] + TMSG_SEG_SEQ(TYPE))
|
||||||
|
|
||||||
bool tmsgIsValid(tmsg_t type);
|
static inline bool tmsgIsValid(tmsg_t type) {
|
||||||
char* TMSG_INFO(tmsg_t type);
|
// static int8_t sz = sizeof(tMsgRangeDict) / sizeof(tMsgRangeDict[0]);
|
||||||
|
int8_t maxSegIdx = TMSG_SEG_CODE(TDMT_MAX_MSG);
|
||||||
|
int segIdx = TMSG_SEG_CODE(type);
|
||||||
|
if (segIdx >= 0 && segIdx < maxSegIdx) {
|
||||||
|
return type < tMsgRangeDict[segIdx];
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define TMSG_INFO(type) (tmsgIsValid(type) ? tMsgInfo[TMSG_INDEX(type)] : "unKnown")
|
||||||
|
|
||||||
static inline bool vnodeIsMsgBlock(tmsg_t type) {
|
static inline bool vnodeIsMsgBlock(tmsg_t type) {
|
||||||
return (type == TDMT_VND_CREATE_TABLE) || (type == TDMT_VND_ALTER_TABLE) || (type == TDMT_VND_DROP_TABLE) ||
|
return (type == TDMT_VND_CREATE_TABLE) || (type == TDMT_VND_ALTER_TABLE) || (type == TDMT_VND_DROP_TABLE) ||
|
||||||
|
|
|
@ -362,6 +362,8 @@ enum { // WARN: new msg should be appended to segment tail
|
||||||
TD_DEF_MSG_TYPE(TDMT_VND_TMQ_MAX_MSG, "vnd-tmq-max", NULL, NULL)
|
TD_DEF_MSG_TYPE(TDMT_VND_TMQ_MAX_MSG, "vnd-tmq-max", NULL, NULL)
|
||||||
TD_CLOSE_MSG_TYPE(TDMT_END_TMQ_MSG)
|
TD_CLOSE_MSG_TYPE(TDMT_END_TMQ_MSG)
|
||||||
|
|
||||||
|
TD_NEW_MSG_SEG(TDMT_MAX_MSG) // msg end mark
|
||||||
|
|
||||||
#if defined(TD_MSG_NUMBER_)
|
#if defined(TD_MSG_NUMBER_)
|
||||||
TDMT_MAX
|
TDMT_MAX
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -37,17 +37,6 @@
|
||||||
|
|
||||||
#include "tlog.h"
|
#include "tlog.h"
|
||||||
|
|
||||||
inline bool tmsgIsValid(tmsg_t type) {
|
|
||||||
static int8_t sz = sizeof(tMsgRangeDict) / sizeof(tMsgRangeDict[0]);
|
|
||||||
|
|
||||||
int segIdx = TMSG_SEG_CODE(type);
|
|
||||||
if (segIdx >= 0 && segIdx < sz) {
|
|
||||||
return type < tMsgRangeDict[segIdx];
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline char *TMSG_INFO(tmsg_t type) { return (tmsgIsValid(type) ? tMsgInfo[TMSG_INDEX(type)] : "unKnown"); };
|
|
||||||
|
|
||||||
#define DECODESQL() \
|
#define DECODESQL() \
|
||||||
do { \
|
do { \
|
||||||
|
|
Loading…
Reference in New Issue