diff --git a/include/common/tmsg.h b/include/common/tmsg.h index 9b3407fb2b841449bb4c1aeca839b6b3e1bd41e7..6b880582ce0fdb523ceb8634092e263bdbdf8adf 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -262,6 +262,7 @@ typedef struct { int32_t numOfTags; SArray* pColumns; SArray* pTags; + char comment[TSDB_STB_COMMENT_LEN]; } SMCreateStbReq; int32_t tSerializeSMCreateStbReq(void** buf, SMCreateStbReq* pReq); diff --git a/include/util/tdef.h b/include/util/tdef.h index 4d3ef06bd6bd11332bb3345543627aaa09e80603..91418f5686af4555cf3504f0ff25caf137ff862f 100644 --- a/include/util/tdef.h +++ b/include/util/tdef.h @@ -186,8 +186,8 @@ do { \ #define TSDB_MAX_SQL_SHOW_LEN 1024 #define TSDB_MAX_ALLOWED_SQL_LEN (1*1024*1024u) // sql length should be less than 1mb -#define TSDB_APP_NAME_LEN TSDB_UNI_LEN - +#define TSDB_APP_NAME_LEN TSDB_UNI_LEN +#define TSDB_STB_COMMENT_LEN 1024 /** * In some scenarios uint16_t (0~65535) is used to store the row len. * - Firstly, we use 65531(65535 - 4), as the SDataRow/SKVRow contains 4 bits header. diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index f12950840592c5ca6b2102146878725a773e73ea..e4e9c6213740f7f51145e0f9dbbfd9c2281c28cf 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -359,6 +359,7 @@ int32_t tSerializeSMCreateStbReq(void **buf, SMCreateStbReq *pReq) { tlen += taosEncodeString(buf, pField->name); } + tlen += taosEncodeString(buf, pReq->comment); return tlen; } @@ -397,6 +398,7 @@ void *tDeserializeSMCreateStbReq(void *buf, SMCreateStbReq *pReq) { } } + buf = taosDecodeStringTo(buf, pReq->comment); return buf; } diff --git a/source/dnode/mnode/impl/inc/mndDef.h b/source/dnode/mnode/impl/inc/mndDef.h index b91dc03e48bc1a278b5d330422d872d473284bf6..445726fbe2cc197084b578d5228d36e28cc8744a 100644 --- a/source/dnode/mnode/impl/inc/mndDef.h +++ b/source/dnode/mnode/impl/inc/mndDef.h @@ -307,6 +307,7 @@ typedef struct { SSchema* pColumns; SSchema* pTags; SRWLatch lock; + char comment[TSDB_STB_COMMENT_LEN]; } SStbObj; typedef struct { diff --git a/source/dnode/mnode/impl/src/mndStb.c b/source/dnode/mnode/impl/src/mndStb.c index 6914923b66f12e869d170ab881c2083843f3810a..3ddea2290ef718cc198c39a3347ea84de0de96f1 100644 --- a/source/dnode/mnode/impl/src/mndStb.c +++ b/source/dnode/mnode/impl/src/mndStb.c @@ -104,6 +104,7 @@ static SSdbRaw *mndStbActionEncode(SStbObj *pStb) { SDB_SET_BINARY(pRaw, dataPos, pSchema->name, TSDB_COL_NAME_LEN, STB_ENCODE_OVER) } + SDB_SET_BINARY(pRaw, dataPos, pStb->comment, TSDB_STB_COMMENT_LEN, STB_ENCODE_OVER) SDB_SET_RESERVE(pRaw, dataPos, TSDB_STB_RESERVE_SIZE, STB_ENCODE_OVER) SDB_SET_DATALEN(pRaw, dataPos, STB_ENCODE_OVER) @@ -171,6 +172,7 @@ static SSdbRow *mndStbActionDecode(SSdbRaw *pRaw) { SDB_GET_BINARY(pRaw, dataPos, pSchema->name, TSDB_COL_NAME_LEN, STB_DECODE_OVER) } + SDB_GET_BINARY(pRaw, dataPos, pStb->comment, TSDB_STB_COMMENT_LEN, STB_DECODE_OVER) SDB_GET_RESERVE(pRaw, dataPos, TSDB_STB_RESERVE_SIZE, STB_DECODE_OVER) terrno = 0; @@ -234,6 +236,7 @@ static int32_t mndStbActionUpdate(SSdb *pSdb, SStbObj *pOld, SStbObj *pNew) { pOld->numOfTags = pNew->numOfTags; memcpy(pOld->pColumns, pNew->pColumns, pOld->numOfColumns * sizeof(SSchema)); memcpy(pOld->pTags, pNew->pTags, pOld->numOfTags * sizeof(SSchema)); + memcpy(pOld->comment, pNew->comment, TSDB_STB_COMMENT_LEN); taosWUnLockLatch(&pOld->lock); return 0; }