fix: when update func, set createdtime to original time
This commit is contained in:
parent
765c09d59e
commit
6b68a373e9
|
@ -276,6 +276,7 @@ static int32_t mndCreateFunc(SMnode *pMnode, SRpcMsg *pReq, SCreateFuncReq *pCre
|
||||||
SFuncObj *oldFunc = mndAcquireFunc(pMnode, pCreate->name);
|
SFuncObj *oldFunc = mndAcquireFunc(pMnode, pCreate->name);
|
||||||
if (pCreate->orReplace == 1 && oldFunc != NULL) {
|
if (pCreate->orReplace == 1 && oldFunc != NULL) {
|
||||||
func.funcVersion = oldFunc->funcVersion + 1;
|
func.funcVersion = oldFunc->funcVersion + 1;
|
||||||
|
func.createdTime = oldFunc->createdTime;
|
||||||
|
|
||||||
SSdbRaw *pRedoRaw = mndFuncActionEncode(oldFunc);
|
SSdbRaw *pRedoRaw = mndFuncActionEncode(oldFunc);
|
||||||
if (pRedoRaw == NULL || mndTransAppendRedolog(pTrans, pRedoRaw) != 0) goto _OVER;
|
if (pRedoRaw == NULL || mndTransAppendRedolog(pTrans, pRedoRaw) != 0) goto _OVER;
|
||||||
|
@ -288,8 +289,7 @@ static int32_t mndCreateFunc(SMnode *pMnode, SRpcMsg *pReq, SCreateFuncReq *pCre
|
||||||
SSdbRaw *pCommitRaw = mndFuncActionEncode(&func);
|
SSdbRaw *pCommitRaw = mndFuncActionEncode(&func);
|
||||||
if (pCommitRaw == NULL || mndTransAppendCommitlog(pTrans, pCommitRaw) != 0) goto _OVER;
|
if (pCommitRaw == NULL || mndTransAppendCommitlog(pTrans, pCommitRaw) != 0) goto _OVER;
|
||||||
if (sdbSetRawStatus(pCommitRaw, SDB_STATUS_READY) != 0) goto _OVER;
|
if (sdbSetRawStatus(pCommitRaw, SDB_STATUS_READY) != 0) goto _OVER;
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
SSdbRaw *pRedoRaw = mndFuncActionEncode(&func);
|
SSdbRaw *pRedoRaw = mndFuncActionEncode(&func);
|
||||||
if (pRedoRaw == NULL || mndTransAppendRedolog(pTrans, pRedoRaw) != 0) goto _OVER;
|
if (pRedoRaw == NULL || mndTransAppendRedolog(pTrans, pRedoRaw) != 0) goto _OVER;
|
||||||
if (sdbSetRawStatus(pRedoRaw, SDB_STATUS_CREATING) != 0) goto _OVER;
|
if (sdbSetRawStatus(pRedoRaw, SDB_STATUS_CREATING) != 0) goto _OVER;
|
||||||
|
@ -640,7 +640,9 @@ static int32_t mndRetrieveFuncs(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBl
|
||||||
colDataSetVal(pColInfo, numOfRows, (const char *)varLang, false);
|
colDataSetVal(pColInfo, numOfRows, (const char *)varLang, false);
|
||||||
|
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
int32_t varCodeLen = (pFunc->codeSize + VARSTR_HEADER_SIZE) > TSDB_MAX_BINARY_LEN ? TSDB_MAX_BINARY_LEN : pFunc->codeSize + VARSTR_HEADER_SIZE;
|
int32_t varCodeLen = (pFunc->codeSize + VARSTR_HEADER_SIZE) > TSDB_MAX_BINARY_LEN
|
||||||
|
? TSDB_MAX_BINARY_LEN
|
||||||
|
: pFunc->codeSize + VARSTR_HEADER_SIZE;
|
||||||
char *b4 = taosMemoryMalloc(varCodeLen);
|
char *b4 = taosMemoryMalloc(varCodeLen);
|
||||||
memcpy(varDataVal(b4), pFunc->pCode, varCodeLen - VARSTR_HEADER_SIZE);
|
memcpy(varDataVal(b4), pFunc->pCode, varCodeLen - VARSTR_HEADER_SIZE);
|
||||||
varDataSetLen(b4, varCodeLen - VARSTR_HEADER_SIZE);
|
varDataSetLen(b4, varCodeLen - VARSTR_HEADER_SIZE);
|
||||||
|
|
Loading…
Reference in New Issue