fix: add func_version to systable
This commit is contained in:
parent
4612d6d14b
commit
66c86a60d5
|
@ -116,6 +116,7 @@ static const SSysDbTableSchema userFuncSchema[] = {
|
||||||
{.name = "bufsize", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = false},
|
{.name = "bufsize", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = false},
|
||||||
{.name = "func_language", .bytes = TSDB_TYPE_STR_MAX_LEN - 1 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false},
|
{.name = "func_language", .bytes = TSDB_TYPE_STR_MAX_LEN - 1 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false},
|
||||||
{.name = "func_body", .bytes = TSDB_MAX_BINARY_LEN, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false},
|
{.name = "func_body", .bytes = TSDB_MAX_BINARY_LEN, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false},
|
||||||
|
{.name = "func_version", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = false},
|
||||||
};
|
};
|
||||||
|
|
||||||
static const SSysDbTableSchema userIdxSchema[] = {
|
static const SSysDbTableSchema userIdxSchema[] = {
|
||||||
|
|
|
@ -1921,11 +1921,17 @@ int32_t tDeserializeSRetrieveFuncRsp(void *buf, int32_t bufLen, SRetrieveFuncRsp
|
||||||
|
|
||||||
pRsp->pFuncVersions = taosArrayInit(pRsp->numOfFuncs, sizeof(int32_t));
|
pRsp->pFuncVersions = taosArrayInit(pRsp->numOfFuncs, sizeof(int32_t));
|
||||||
if (pRsp->pFuncVersions == NULL) return -1;
|
if (pRsp->pFuncVersions == NULL) return -1;
|
||||||
|
if (tDecodeIsEnd(&decoder)) {
|
||||||
for (int32_t i = 0; i < pRsp->numOfFuncs; ++i) {
|
for (int32_t i = 0; i < pRsp->numOfFuncs; ++i) {
|
||||||
int32_t version = 0;
|
int32_t version = 0;
|
||||||
if (tDecodeI32(&decoder, &version) < 0) return -1;
|
taosArrayPush(pRsp->pFuncVersions, &version);
|
||||||
taosArrayPush(pRsp->pFuncVersions, &version);
|
}
|
||||||
|
} else {
|
||||||
|
for (int32_t i = 0; i < pRsp->numOfFuncs; ++i) {
|
||||||
|
int32_t version = 0;
|
||||||
|
if (tDecodeI32(&decoder, &version) < 0) return -1;
|
||||||
|
taosArrayPush(pRsp->pFuncVersions, &version);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
tEndDecode(&decoder);
|
tEndDecode(&decoder);
|
||||||
|
|
||||||
|
|
|
@ -447,7 +447,7 @@ typedef struct {
|
||||||
int32_t codeSize;
|
int32_t codeSize;
|
||||||
char* pComment;
|
char* pComment;
|
||||||
char* pCode;
|
char* pCode;
|
||||||
int32_t funcVersions;
|
int32_t funcVersion;
|
||||||
} SFuncObj;
|
} SFuncObj;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
|
@ -83,7 +83,7 @@ static SSdbRaw *mndFuncActionEncode(SFuncObj *pFunc) {
|
||||||
SDB_SET_BINARY(pRaw, dataPos, pFunc->pComment, pFunc->commentSize, _OVER)
|
SDB_SET_BINARY(pRaw, dataPos, pFunc->pComment, pFunc->commentSize, _OVER)
|
||||||
}
|
}
|
||||||
SDB_SET_BINARY(pRaw, dataPos, pFunc->pCode, pFunc->codeSize, _OVER)
|
SDB_SET_BINARY(pRaw, dataPos, pFunc->pCode, pFunc->codeSize, _OVER)
|
||||||
SDB_SET_INT32(pRaw, dataPos, pFunc->funcVersions, _OVER)
|
SDB_SET_INT32(pRaw, dataPos, pFunc->funcVersion, _OVER)
|
||||||
SDB_SET_RESERVE(pRaw, dataPos, SDB_FUNC_RESERVE_SIZE, _OVER)
|
SDB_SET_RESERVE(pRaw, dataPos, SDB_FUNC_RESERVE_SIZE, _OVER)
|
||||||
SDB_SET_DATALEN(pRaw, dataPos, _OVER);
|
SDB_SET_DATALEN(pRaw, dataPos, _OVER);
|
||||||
|
|
||||||
|
@ -147,7 +147,7 @@ static SSdbRow *mndFuncActionDecode(SSdbRaw *pRaw) {
|
||||||
SDB_GET_BINARY(pRaw, dataPos, pFunc->pCode, pFunc->codeSize, _OVER)
|
SDB_GET_BINARY(pRaw, dataPos, pFunc->pCode, pFunc->codeSize, _OVER)
|
||||||
|
|
||||||
if(sver >= 2){
|
if(sver >= 2){
|
||||||
SDB_GET_INT32(pRaw, dataPos, &pFunc->funcVersions, _OVER)
|
SDB_GET_INT32(pRaw, dataPos, &pFunc->funcVersion, _OVER)
|
||||||
}
|
}
|
||||||
|
|
||||||
SDB_GET_RESERVE(pRaw, dataPos, SDB_FUNC_RESERVE_SIZE, _OVER)
|
SDB_GET_RESERVE(pRaw, dataPos, SDB_FUNC_RESERVE_SIZE, _OVER)
|
||||||
|
@ -234,7 +234,7 @@ static int32_t mndCreateFunc(SMnode *pMnode, SRpcMsg *pReq, SCreateFuncReq *pCre
|
||||||
if(oldFunc == NULL){
|
if(oldFunc == NULL){
|
||||||
goto _OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
func.funcVersions = oldFunc->funcVersions + 1;
|
func.funcVersion = oldFunc->funcVersion + 1;
|
||||||
mndReleaseFunc(pMnode, oldFunc);
|
mndReleaseFunc(pMnode, oldFunc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -473,7 +473,7 @@ static int32_t mndProcessRetrieveFuncReq(SRpcMsg *pReq) {
|
||||||
}
|
}
|
||||||
taosArrayPush(retrieveRsp.pFuncInfos, &funcInfo);
|
taosArrayPush(retrieveRsp.pFuncInfos, &funcInfo);
|
||||||
|
|
||||||
taosArrayPush(retrieveRsp.pFuncVersions, &pFunc->funcVersions);
|
taosArrayPush(retrieveRsp.pFuncVersions, &pFunc->funcVersion);
|
||||||
|
|
||||||
mndReleaseFunc(pMnode, pFunc);
|
mndReleaseFunc(pMnode, pFunc);
|
||||||
}
|
}
|
||||||
|
@ -590,6 +590,9 @@ static int32_t mndRetrieveFuncs(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBl
|
||||||
colDataSetVal(pColInfo, numOfRows, (const char*)b4, false);
|
colDataSetVal(pColInfo, numOfRows, (const char*)b4, false);
|
||||||
taosMemoryFree(b4);
|
taosMemoryFree(b4);
|
||||||
|
|
||||||
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
|
colDataSetVal(pColInfo, numOfRows, (const char*)&pFunc->funcVersion, false);
|
||||||
|
|
||||||
numOfRows++;
|
numOfRows++;
|
||||||
sdbRelease(pSdb, pFunc);
|
sdbRelease(pSdb, pFunc);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue