Merge pull request #10185 from taosdata/feature/mnode
add comment for stb
This commit is contained in:
commit
8b367ada1f
|
@ -262,6 +262,7 @@ typedef struct {
|
||||||
int32_t numOfTags;
|
int32_t numOfTags;
|
||||||
SArray* pColumns;
|
SArray* pColumns;
|
||||||
SArray* pTags;
|
SArray* pTags;
|
||||||
|
char comment[TSDB_STB_COMMENT_LEN];
|
||||||
} SMCreateStbReq;
|
} SMCreateStbReq;
|
||||||
|
|
||||||
int32_t tSerializeSMCreateStbReq(void** buf, SMCreateStbReq* pReq);
|
int32_t tSerializeSMCreateStbReq(void** buf, SMCreateStbReq* pReq);
|
||||||
|
|
|
@ -187,7 +187,7 @@ do { \
|
||||||
#define TSDB_MAX_ALLOWED_SQL_LEN (1*1024*1024u) // sql length should be less than 1mb
|
#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.
|
* 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.
|
* - Firstly, we use 65531(65535 - 4), as the SDataRow/SKVRow contains 4 bits header.
|
||||||
|
|
|
@ -359,6 +359,7 @@ int32_t tSerializeSMCreateStbReq(void **buf, SMCreateStbReq *pReq) {
|
||||||
tlen += taosEncodeString(buf, pField->name);
|
tlen += taosEncodeString(buf, pField->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tlen += taosEncodeString(buf, pReq->comment);
|
||||||
return tlen;
|
return tlen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -397,6 +398,7 @@ void *tDeserializeSMCreateStbReq(void *buf, SMCreateStbReq *pReq) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
buf = taosDecodeStringTo(buf, pReq->comment);
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -307,6 +307,7 @@ typedef struct {
|
||||||
SSchema* pColumns;
|
SSchema* pColumns;
|
||||||
SSchema* pTags;
|
SSchema* pTags;
|
||||||
SRWLatch lock;
|
SRWLatch lock;
|
||||||
|
char comment[TSDB_STB_COMMENT_LEN];
|
||||||
} SStbObj;
|
} SStbObj;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
|
@ -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, 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_RESERVE(pRaw, dataPos, TSDB_STB_RESERVE_SIZE, STB_ENCODE_OVER)
|
||||||
SDB_SET_DATALEN(pRaw, dataPos, 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, 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)
|
SDB_GET_RESERVE(pRaw, dataPos, TSDB_STB_RESERVE_SIZE, STB_DECODE_OVER)
|
||||||
|
|
||||||
terrno = 0;
|
terrno = 0;
|
||||||
|
@ -234,6 +236,7 @@ static int32_t mndStbActionUpdate(SSdb *pSdb, SStbObj *pOld, SStbObj *pNew) {
|
||||||
pOld->numOfTags = pNew->numOfTags;
|
pOld->numOfTags = pNew->numOfTags;
|
||||||
memcpy(pOld->pColumns, pNew->pColumns, pOld->numOfColumns * sizeof(SSchema));
|
memcpy(pOld->pColumns, pNew->pColumns, pOld->numOfColumns * sizeof(SSchema));
|
||||||
memcpy(pOld->pTags, pNew->pTags, pOld->numOfTags * sizeof(SSchema));
|
memcpy(pOld->pTags, pNew->pTags, pOld->numOfTags * sizeof(SSchema));
|
||||||
|
memcpy(pOld->comment, pNew->comment, TSDB_STB_COMMENT_LEN);
|
||||||
taosWUnLockLatch(&pOld->lock);
|
taosWUnLockLatch(&pOld->lock);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue