add ret check for par dir
This commit is contained in:
parent
1994c3339b
commit
9b3409c13e
|
@ -425,7 +425,7 @@ static SNodeList* getChildProjection(SNode* pStmt) {
|
||||||
|
|
||||||
static void eraseSetOpChildProjection(SSetOperator* pSetOp, int32_t index) {
|
static void eraseSetOpChildProjection(SSetOperator* pSetOp, int32_t index) {
|
||||||
SNodeList* pLeftProjs = getChildProjection(pSetOp->pLeft);
|
SNodeList* pLeftProjs = getChildProjection(pSetOp->pLeft);
|
||||||
nodesListErase(pLeftProjs, nodesListGetCell(pLeftProjs, index));
|
(void)nodesListErase(pLeftProjs, nodesListGetCell(pLeftProjs, index));
|
||||||
if (QUERY_NODE_SET_OPERATOR == nodeType(pSetOp->pLeft)) {
|
if (QUERY_NODE_SET_OPERATOR == nodeType(pSetOp->pLeft)) {
|
||||||
eraseSetOpChildProjection((SSetOperator*)pSetOp->pLeft, index);
|
eraseSetOpChildProjection((SSetOperator*)pSetOp->pLeft, index);
|
||||||
}
|
}
|
||||||
|
|
|
@ -296,13 +296,13 @@ int32_t smlBindData(SQuery* query, bool dataFormat, SArray* tags, SArray* colsSc
|
||||||
|
|
||||||
int ret = insInitBoundColsInfo(getNumOfTags(pTableMeta), &bindTags);
|
int ret = insInitBoundColsInfo(getNumOfTags(pTableMeta), &bindTags);
|
||||||
if (ret != TSDB_CODE_SUCCESS) {
|
if (ret != TSDB_CODE_SUCCESS) {
|
||||||
buildInvalidOperationMsg(&pBuf, "init bound cols error");
|
ret = buildInvalidOperationMsg(&pBuf, "init bound cols error");
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = smlBoundColumnData(tags, &bindTags, pTagsSchema, true);
|
ret = smlBoundColumnData(tags, &bindTags, pTagsSchema, true);
|
||||||
if (ret != TSDB_CODE_SUCCESS) {
|
if (ret != TSDB_CODE_SUCCESS) {
|
||||||
buildInvalidOperationMsg(&pBuf, "bound tags error");
|
ret = buildInvalidOperationMsg(&pBuf, "bound tags error");
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -347,20 +347,20 @@ int32_t smlBindData(SQuery* query, bool dataFormat, SArray* tags, SArray* colsSc
|
||||||
ret = insGetTableDataCxt(((SVnodeModifyOpStmt*)(query->pRoot))->pTableBlockHashObj, &pTableMeta->uid,
|
ret = insGetTableDataCxt(((SVnodeModifyOpStmt*)(query->pRoot))->pTableBlockHashObj, &pTableMeta->uid,
|
||||||
sizeof(pTableMeta->uid), pTableMeta, &pCreateTblReq, &pTableCxt, false, false);
|
sizeof(pTableMeta->uid), pTableMeta, &pCreateTblReq, &pTableCxt, false, false);
|
||||||
if (ret != TSDB_CODE_SUCCESS) {
|
if (ret != TSDB_CODE_SUCCESS) {
|
||||||
buildInvalidOperationMsg(&pBuf, "insGetTableDataCxt error");
|
ret = buildInvalidOperationMsg(&pBuf, "insGetTableDataCxt error");
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
SSchema* pSchema = getTableColumnSchema(pTableMeta);
|
SSchema* pSchema = getTableColumnSchema(pTableMeta);
|
||||||
ret = smlBoundColumnData(colsSchema, &pTableCxt->boundColsInfo, pSchema, false);
|
ret = smlBoundColumnData(colsSchema, &pTableCxt->boundColsInfo, pSchema, false);
|
||||||
if (ret != TSDB_CODE_SUCCESS) {
|
if (ret != TSDB_CODE_SUCCESS) {
|
||||||
buildInvalidOperationMsg(&pBuf, "bound cols error");
|
ret = buildInvalidOperationMsg(&pBuf, "bound cols error");
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = initTableColSubmitData(pTableCxt);
|
ret = initTableColSubmitData(pTableCxt);
|
||||||
if (ret != TSDB_CODE_SUCCESS) {
|
if (ret != TSDB_CODE_SUCCESS) {
|
||||||
buildInvalidOperationMsg(&pBuf, "initTableColSubmitData error");
|
ret = buildInvalidOperationMsg(&pBuf, "initTableColSubmitData error");
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -407,7 +407,7 @@ int32_t smlBindData(SQuery* query, bool dataFormat, SArray* tags, SArray* colsSc
|
||||||
if (errno == E2BIG) {
|
if (errno == E2BIG) {
|
||||||
uError("sml bind taosMbsToUcs4 error, kv length:%d, bytes:%d, kv->value:%s", (int)kv->length,
|
uError("sml bind taosMbsToUcs4 error, kv length:%d, bytes:%d, kv->value:%s", (int)kv->length,
|
||||||
pColSchema->bytes, kv->value);
|
pColSchema->bytes, kv->value);
|
||||||
buildInvalidOperationMsg(&pBuf, "value too long");
|
(void)buildInvalidOperationMsg(&pBuf, "value too long");
|
||||||
ret = TSDB_CODE_PAR_VALUE_TOO_LONG;
|
ret = TSDB_CODE_PAR_VALUE_TOO_LONG;
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
@ -440,7 +440,7 @@ int32_t smlBindData(SQuery* query, bool dataFormat, SArray* tags, SArray* colsSc
|
||||||
}
|
}
|
||||||
ret = tRowBuild(pTableCxt->pValues, pTableCxt->pSchema, pRow);
|
ret = tRowBuild(pTableCxt->pValues, pTableCxt->pSchema, pRow);
|
||||||
if (TSDB_CODE_SUCCESS != ret) {
|
if (TSDB_CODE_SUCCESS != ret) {
|
||||||
buildInvalidOperationMsg(&pBuf, "tRowBuild error");
|
ret = buildInvalidOperationMsg(&pBuf, "tRowBuild error");
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
SRowKey key;
|
SRowKey key;
|
||||||
|
|
|
@ -2277,9 +2277,11 @@ static int32_t constructStbRowsDataContext(SVnodeModifyOpStmt* pStmt, SStbRowsDa
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
tNameAssign(&pStbRowsCxt->stbName, &pStmt->targetTableName);
|
tNameAssign(&pStbRowsCxt->stbName, &pStmt->targetTableName);
|
||||||
collectUseTable(&pStbRowsCxt->stbName, pStmt->pTableNameHashObj);
|
int32_t code = collectUseTable(&pStbRowsCxt->stbName, pStmt->pTableNameHashObj);
|
||||||
collectUseDatabase(&pStbRowsCxt->stbName, pStmt->pDbFNameHashObj);
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
|
code = collectUseDatabase(&pStbRowsCxt->stbName, pStmt->pDbFNameHashObj);
|
||||||
|
}
|
||||||
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
pStbRowsCxt->ctbName.type = TSDB_TABLE_NAME_T;
|
pStbRowsCxt->ctbName.type = TSDB_TABLE_NAME_T;
|
||||||
pStbRowsCxt->ctbName.acctId = pStbRowsCxt->stbName.acctId;
|
pStbRowsCxt->ctbName.acctId = pStbRowsCxt->stbName.acctId;
|
||||||
memcpy(pStbRowsCxt->ctbName.dbname, pStbRowsCxt->stbName.dbname, sizeof(pStbRowsCxt->stbName.dbname));
|
memcpy(pStbRowsCxt->ctbName.dbname, pStbRowsCxt->stbName.dbname, sizeof(pStbRowsCxt->stbName.dbname));
|
||||||
|
@ -2287,11 +2289,14 @@ static int32_t constructStbRowsDataContext(SVnodeModifyOpStmt* pStmt, SStbRowsDa
|
||||||
pStbRowsCxt->pTagCond = pStmt->pTagCond;
|
pStbRowsCxt->pTagCond = pStmt->pTagCond;
|
||||||
pStbRowsCxt->pStbMeta = pStmt->pTableMeta;
|
pStbRowsCxt->pStbMeta = pStmt->pTableMeta;
|
||||||
|
|
||||||
cloneTableMeta(pStbRowsCxt->pStbMeta, &pStbRowsCxt->pCtbMeta);
|
code = cloneTableMeta(pStbRowsCxt->pStbMeta, &pStbRowsCxt->pCtbMeta);
|
||||||
|
}
|
||||||
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
pStbRowsCxt->pCtbMeta->tableType = TSDB_CHILD_TABLE;
|
pStbRowsCxt->pCtbMeta->tableType = TSDB_CHILD_TABLE;
|
||||||
pStbRowsCxt->pCtbMeta->suid = pStbRowsCxt->pStbMeta->uid;
|
pStbRowsCxt->pCtbMeta->suid = pStbRowsCxt->pStbMeta->uid;
|
||||||
|
|
||||||
pStbRowsCxt->aTagNames = taosArrayInit(8, TSDB_COL_NAME_LEN);
|
pStbRowsCxt->aTagNames = taosArrayInit(8, TSDB_COL_NAME_LEN);
|
||||||
|
}
|
||||||
pStbRowsCxt->aTagVals = taosArrayInit(8, sizeof(STagVal));
|
pStbRowsCxt->aTagVals = taosArrayInit(8, sizeof(STagVal));
|
||||||
|
|
||||||
// col values and bound cols info of STableDataContext is not used
|
// col values and bound cols info of STableDataContext is not used
|
||||||
|
@ -2653,10 +2658,16 @@ static int32_t buildTagNameFromMeta(STableMeta* pMeta, SArray** pTagName) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
SSchema* pSchema = getTableTagSchema(pMeta);
|
SSchema* pSchema = getTableTagSchema(pMeta);
|
||||||
|
int32_t code = 0;
|
||||||
for (int32_t i = 0; i < pMeta->tableInfo.numOfTags; ++i) {
|
for (int32_t i = 0; i < pMeta->tableInfo.numOfTags; ++i) {
|
||||||
taosArrayPush(*pTagName, pSchema[i].name);
|
if (NULL == taosArrayPush(*pTagName, pSchema[i].name)) {
|
||||||
|
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
taosArrayDestroy(*pTagName);
|
||||||
|
*pTagName = NULL;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return TSDB_CODE_SUCCESS;
|
}
|
||||||
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t checkSubtablePrivilegeForTable(const SArray* pTables, SVnodeModifyOpStmt* pStmt) {
|
static int32_t checkSubtablePrivilegeForTable(const SArray* pTables, SVnodeModifyOpStmt* pStmt) {
|
||||||
|
@ -2744,8 +2755,9 @@ static int32_t resetVnodeModifOpStmt(SInsertParseContext* pCxt, SQuery* pQuery)
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
SVnodeModifyOpStmt* pStmt = (SVnodeModifyOpStmt*)pQuery->pRoot;
|
SVnodeModifyOpStmt* pStmt = (SVnodeModifyOpStmt*)pQuery->pRoot;
|
||||||
|
|
||||||
(*pCxt->pComCxt->pStmtCb->getExecInfoFn)(pCxt->pComCxt->pStmtCb->pStmt, &pStmt->pVgroupsHashObj,
|
code = (*pCxt->pComCxt->pStmtCb->getExecInfoFn)(pCxt->pComCxt->pStmtCb->pStmt, &pStmt->pVgroupsHashObj,
|
||||||
&pStmt->pTableBlockHashObj);
|
&pStmt->pTableBlockHashObj);
|
||||||
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
if (NULL == pStmt->pVgroupsHashObj) {
|
if (NULL == pStmt->pVgroupsHashObj) {
|
||||||
pStmt->pVgroupsHashObj = taosHashInit(128, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), true, HASH_NO_LOCK);
|
pStmt->pVgroupsHashObj = taosHashInit(128, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), true, HASH_NO_LOCK);
|
||||||
}
|
}
|
||||||
|
@ -2757,6 +2769,7 @@ static int32_t resetVnodeModifOpStmt(SInsertParseContext* pCxt, SQuery* pQuery)
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
@ -2782,28 +2795,45 @@ static int32_t initInsertQuery(SInsertParseContext* pCxt, SCatalogReq* pCatalogR
|
||||||
|
|
||||||
static int32_t setRefreshMeta(SQuery* pQuery) {
|
static int32_t setRefreshMeta(SQuery* pQuery) {
|
||||||
SVnodeModifyOpStmt* pStmt = (SVnodeModifyOpStmt*)pQuery->pRoot;
|
SVnodeModifyOpStmt* pStmt = (SVnodeModifyOpStmt*)pQuery->pRoot;
|
||||||
|
int32_t code = 0;
|
||||||
|
|
||||||
if (taosHashGetSize(pStmt->pTableNameHashObj) > 0) {
|
if (taosHashGetSize(pStmt->pTableNameHashObj) > 0) {
|
||||||
taosArrayDestroy(pQuery->pTableList);
|
taosArrayDestroy(pQuery->pTableList);
|
||||||
pQuery->pTableList = taosArrayInit(taosHashGetSize(pStmt->pTableNameHashObj), sizeof(SName));
|
pQuery->pTableList = taosArrayInit(taosHashGetSize(pStmt->pTableNameHashObj), sizeof(SName));
|
||||||
|
if (!pQuery->pTableList) {
|
||||||
|
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
} else {
|
||||||
SName* pTable = taosHashIterate(pStmt->pTableNameHashObj, NULL);
|
SName* pTable = taosHashIterate(pStmt->pTableNameHashObj, NULL);
|
||||||
while (NULL != pTable) {
|
while (NULL != pTable) {
|
||||||
taosArrayPush(pQuery->pTableList, pTable);
|
if (NULL == taosArrayPush(pQuery->pTableList, pTable)) {
|
||||||
|
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
taosHashCancelIterate(pStmt->pTableNameHashObj, pTable);
|
||||||
|
break;
|
||||||
|
}
|
||||||
pTable = taosHashIterate(pStmt->pTableNameHashObj, pTable);
|
pTable = taosHashIterate(pStmt->pTableNameHashObj, pTable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (taosHashGetSize(pStmt->pDbFNameHashObj) > 0) {
|
if (TSDB_CODE_SUCCESS == code && taosHashGetSize(pStmt->pDbFNameHashObj) > 0) {
|
||||||
taosArrayDestroy(pQuery->pDbList);
|
taosArrayDestroy(pQuery->pDbList);
|
||||||
pQuery->pDbList = taosArrayInit(taosHashGetSize(pStmt->pDbFNameHashObj), TSDB_DB_FNAME_LEN);
|
pQuery->pDbList = taosArrayInit(taosHashGetSize(pStmt->pDbFNameHashObj), TSDB_DB_FNAME_LEN);
|
||||||
|
if (!pQuery->pDbList) {
|
||||||
|
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
} else {
|
||||||
char* pDb = taosHashIterate(pStmt->pDbFNameHashObj, NULL);
|
char* pDb = taosHashIterate(pStmt->pDbFNameHashObj, NULL);
|
||||||
while (NULL != pDb) {
|
while (NULL != pDb) {
|
||||||
taosArrayPush(pQuery->pDbList, pDb);
|
if (NULL == taosArrayPush(pQuery->pDbList, pDb)) {
|
||||||
|
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
taosHashCancelIterate(pStmt->pDbFNameHashObj, pDb);
|
||||||
|
break;
|
||||||
|
}
|
||||||
pDb = taosHashIterate(pStmt->pDbFNameHashObj, pDb);
|
pDb = taosHashIterate(pStmt->pDbFNameHashObj, pDb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return TSDB_CODE_SUCCESS;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
// INSERT INTO
|
// INSERT INTO
|
||||||
|
@ -2872,7 +2902,11 @@ static int32_t buildInsertTableReq(SName* pName, SArray** pTables) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
taosArrayPush(*pTables, pName);
|
if (NULL == taosArrayPush(*pTables, pName)) {
|
||||||
|
taosArrayDestroy(*pTables);
|
||||||
|
*pTables = NULL;
|
||||||
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
}
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2885,11 +2919,13 @@ static int32_t buildInsertDbReq(SName* pName, SArray** pDbs) {
|
||||||
}
|
}
|
||||||
|
|
||||||
STablesReq req = {0};
|
STablesReq req = {0};
|
||||||
tNameGetFullDbName(pName, req.dbFName);
|
(void)tNameGetFullDbName(pName, req.dbFName);
|
||||||
buildInsertTableReq(pName, &req.pTables);
|
int32_t code = buildInsertTableReq(pName, &req.pTables);
|
||||||
taosArrayPush(*pDbs, &req);
|
if (TSDB_CODE_SUCCESS == code && NULL == taosArrayPush(*pDbs, &req)) {
|
||||||
|
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
}
|
||||||
|
|
||||||
return TSDB_CODE_SUCCESS;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t buildInsertUserAuthReq(const char* pUser, SName* pName, SArray** pUserAuth) {
|
static int32_t buildInsertUserAuthReq(const char* pUser, SName* pName, SArray** pUserAuth) {
|
||||||
|
@ -2901,7 +2937,11 @@ static int32_t buildInsertUserAuthReq(const char* pUser, SName* pName, SArray**
|
||||||
SUserAuthInfo userAuth = {.type = AUTH_TYPE_WRITE};
|
SUserAuthInfo userAuth = {.type = AUTH_TYPE_WRITE};
|
||||||
snprintf(userAuth.user, sizeof(userAuth.user), "%s", pUser);
|
snprintf(userAuth.user, sizeof(userAuth.user), "%s", pUser);
|
||||||
memcpy(&userAuth.tbName, pName, sizeof(SName));
|
memcpy(&userAuth.tbName, pName, sizeof(SName));
|
||||||
taosArrayPush(*pUserAuth, &userAuth);
|
if (NULL == taosArrayPush(*pUserAuth, &userAuth)) {
|
||||||
|
taosArrayDestroy(*pUserAuth);
|
||||||
|
*pUserAuth = NULL;
|
||||||
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
}
|
||||||
|
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue