Merge branch '3.0' of https://github.com/taosdata/TDengine into fix/TD-30837
This commit is contained in:
commit
b3fb0837d3
File diff suppressed because it is too large
Load Diff
|
@ -68,7 +68,11 @@ SSdb *sdbInit(SSdbOpt *pOption) {
|
|||
void sdbCleanup(SSdb *pSdb) {
|
||||
mInfo("start to cleanup sdb");
|
||||
|
||||
(void)sdbWriteFile(pSdb, 0);
|
||||
int32_t code = 0;
|
||||
|
||||
if ((code = sdbWriteFile(pSdb, 0)) != 0) {
|
||||
mError("failed to write sdb file since %s", tstrerror(code));
|
||||
}
|
||||
|
||||
if (pSdb->currDir != NULL) {
|
||||
taosMemoryFreeClear(pSdb->currDir);
|
||||
|
|
|
@ -258,8 +258,11 @@ static int32_t sdbReadFileImp(SSdb *pSdb) {
|
|||
if (code != 0) {
|
||||
mError("failed to read sdb file:%s head since %s", file, tstrerror(code));
|
||||
taosMemoryFree(pRaw);
|
||||
(void)taosCloseFile(&pFile);
|
||||
return -1;
|
||||
int32_t ret = 0;
|
||||
if ((ret = taosCloseFile(&pFile)) != 0) {
|
||||
mError("failed to close sdb file:%s since %s", file, tstrerror(ret));
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
||||
int64_t tableVer[SDB_MAX] = {0};
|
||||
|
@ -361,7 +364,9 @@ static int32_t sdbReadFileImp(SSdb *pSdb) {
|
|||
pSdb->commitTerm, pSdb->commitConfig);
|
||||
|
||||
_OVER:
|
||||
(void)taosCloseFile(&pFile);
|
||||
if ((ret = taosCloseFile(&pFile)) != 0) {
|
||||
mError("failed to close sdb file:%s since %s", file, tstrerror(ret));
|
||||
}
|
||||
sdbFreeRaw(pRaw);
|
||||
|
||||
TAOS_RETURN(code);
|
||||
|
@ -404,8 +409,11 @@ static int32_t sdbWriteFileImp(SSdb *pSdb, int32_t skip_type) {
|
|||
code = sdbWriteFileHead(pSdb, pFile);
|
||||
if (code != 0) {
|
||||
mError("failed to write sdb file:%s head since %s", tmpfile, tstrerror(code));
|
||||
(void)taosCloseFile(&pFile);
|
||||
return -1;
|
||||
int32_t ret = 0;
|
||||
if ((ret = taosCloseFile(&pFile)) != 0) {
|
||||
mError("failed to close sdb file:%s since %s", tmpfile, tstrerror(ret));
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
||||
for (int32_t i = SDB_MAX - 1; i >= 0; --i) {
|
||||
|
@ -613,12 +621,18 @@ static void sdbCloseIter(SSdbIter *pIter) {
|
|||
if (pIter == NULL) return;
|
||||
|
||||
if (pIter->file != NULL) {
|
||||
(void)taosCloseFile(&pIter->file);
|
||||
int32_t ret = 0;
|
||||
if ((ret = taosCloseFile(&pIter->file)) != 0) {
|
||||
mError("failed to close sdb file since %s", tstrerror(ret));
|
||||
}
|
||||
pIter->file = NULL;
|
||||
}
|
||||
|
||||
if (pIter->name != NULL) {
|
||||
(void)taosRemoveFile(pIter->name);
|
||||
int32_t ret = 0;
|
||||
if ((ret = taosRemoveFile(pIter->name)) != 0) {
|
||||
mError("failed to remove sdb file:%s since %s", pIter->name, tstrerror(ret));
|
||||
}
|
||||
taosMemoryFree(pIter->name);
|
||||
pIter->name = NULL;
|
||||
}
|
||||
|
|
|
@ -174,12 +174,12 @@ static int32_t sdbInsertRow(SSdb *pSdb, SHashObj *hash, SSdbRaw *pRaw, SSdbRow *
|
|||
if (insertFp != NULL) {
|
||||
code = (*insertFp)(pSdb, pRow->pObj);
|
||||
if (code != 0) {
|
||||
if (terrno == 0) terrno = TSDB_CODE_MND_TRANS_UNKNOW_ERROR;
|
||||
code = terrno;
|
||||
(void)taosHashRemove(hash, pRow->pObj, keySize);
|
||||
if (taosHashRemove(hash, pRow->pObj, keySize) != 0) {
|
||||
mError("failed to remove row from hash");
|
||||
}
|
||||
sdbFreeRow(pSdb, pRow, false);
|
||||
terrno = code;
|
||||
sdbUnLock(pSdb, type);
|
||||
terrno = code;
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1094,7 +1094,6 @@ static uint8_t sclGetOpValueNodeTsPrecision(SNode *pLeft, SNode *pRight) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int32_t sclConvertOpValueNodeTs(SOperatorNode *node) {
|
||||
if (node->pLeft && SCL_IS_VAR_VALUE_NODE(node->pLeft)) {
|
||||
if (node->pRight && (TSDB_DATA_TYPE_TIMESTAMP == ((SExprNode *)node->pRight)->resType.type)) {
|
||||
|
@ -1110,8 +1109,7 @@ int32_t sclConvertOpValueNodeTs(SOperatorNode *node) {
|
|||
SNode *pNode;
|
||||
FOREACH(pNode, ((SNodeListNode *)node->pRight)->pNodeList) {
|
||||
if (SCL_IS_VAR_VALUE_NODE(pNode)) {
|
||||
SCL_ERR_RET(
|
||||
sclConvertToTsValueNode(sclGetOpValueNodeTsPrecision(node->pLeft, pNode), (SValueNode *)pNode));
|
||||
SCL_ERR_RET(sclConvertToTsValueNode(sclGetOpValueNodeTsPrecision(node->pLeft, pNode), (SValueNode *)pNode));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1120,7 +1118,6 @@ int32_t sclConvertOpValueNodeTs(SOperatorNode *node) {
|
|||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
int32_t sclConvertCaseWhenValueNodeTs(SCaseWhenNode *node) {
|
||||
if (NULL == node->pCase) {
|
||||
return TSDB_CODE_SUCCESS;
|
||||
|
@ -1426,7 +1423,8 @@ EDealRes sclRewriteCaseWhen(SNode **pNode, SScalarCtx *ctx) {
|
|||
} else {
|
||||
int32_t type = output.columnData->info.type;
|
||||
if (IS_VAR_DATA_TYPE(type)) { // todo refactor
|
||||
res->datum.p = taosMemoryCalloc(varDataTLen(output.columnData->pData) + 1, sizeof(char)); // add \0 to the end for print json value
|
||||
res->datum.p = taosMemoryCalloc(varDataTLen(output.columnData->pData) + 1,
|
||||
sizeof(char)); // add \0 to the end for print json value
|
||||
if (NULL == res->datum.p) {
|
||||
sclError("calloc %d failed", (int)(varDataTLen(output.columnData->pData) + 1));
|
||||
sclFreeParam(&output);
|
||||
|
@ -1683,8 +1681,7 @@ static int32_t sclGetMathOperatorResType(SOperatorNode *pOp) {
|
|||
SDataType rdt = ((SExprNode *)(pOp->pRight))->resType;
|
||||
|
||||
if ((TSDB_DATA_TYPE_TIMESTAMP == ldt.type && TSDB_DATA_TYPE_TIMESTAMP == rdt.type) ||
|
||||
TSDB_DATA_TYPE_VARBINARY == ldt.type ||
|
||||
TSDB_DATA_TYPE_VARBINARY == rdt.type ||
|
||||
TSDB_DATA_TYPE_VARBINARY == ldt.type || TSDB_DATA_TYPE_VARBINARY == rdt.type ||
|
||||
(TSDB_DATA_TYPE_TIMESTAMP == ldt.type && (IS_VAR_DATA_TYPE(rdt.type) || IS_FLOAT_TYPE(rdt.type))) ||
|
||||
(TSDB_DATA_TYPE_TIMESTAMP == rdt.type && (IS_VAR_DATA_TYPE(ldt.type) || IS_FLOAT_TYPE(ldt.type)))) {
|
||||
return TSDB_CODE_TSC_INVALID_OPERATION;
|
||||
|
@ -1720,12 +1717,13 @@ static int32_t sclGetCompOperatorResType(SOperatorNode *pOp) {
|
|||
return TSDB_CODE_TSC_INVALID_OPERATION;
|
||||
}
|
||||
SDataType rdt = ((SExprNode *)(pOp->pRight))->resType;
|
||||
if (ldt.type == TSDB_DATA_TYPE_VARBINARY || !IS_VAR_DATA_TYPE(ldt.type) || QUERY_NODE_VALUE != nodeType(pOp->pRight) ||
|
||||
if (ldt.type == TSDB_DATA_TYPE_VARBINARY || !IS_VAR_DATA_TYPE(ldt.type) ||
|
||||
QUERY_NODE_VALUE != nodeType(pOp->pRight) ||
|
||||
(!IS_STR_DATA_TYPE(rdt.type) && (rdt.type != TSDB_DATA_TYPE_NULL))) {
|
||||
return TSDB_CODE_TSC_INVALID_OPERATION;
|
||||
}
|
||||
if (nodesIsMatchRegularOp(pOp)) {
|
||||
SValueNode *node = (SValueNode *)(pOp->pRight);
|
||||
if (!node->placeholderNo && nodesIsMatchRegularOp(pOp)) {
|
||||
if (checkRegexPattern(node->literal) != TSDB_CODE_SUCCESS) {
|
||||
return TSDB_CODE_PAR_REGULAR_EXPRESSION_ERROR;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue