enh: add more error case handle code
This commit is contained in:
parent
f5da2c71ec
commit
a9e5699a4d
|
@ -895,6 +895,7 @@ int32_t taosGetErrSize();
|
||||||
#define TSDB_CODE_PAR_INVALID_ANOMALY_WIN_COL TAOS_DEF_ERROR_CODE(0, 0x2683)
|
#define TSDB_CODE_PAR_INVALID_ANOMALY_WIN_COL TAOS_DEF_ERROR_CODE(0, 0x2683)
|
||||||
#define TSDB_CODE_PAR_INVALID_ANOMALY_WIN_OPT TAOS_DEF_ERROR_CODE(0, 0x2684)
|
#define TSDB_CODE_PAR_INVALID_ANOMALY_WIN_OPT TAOS_DEF_ERROR_CODE(0, 0x2684)
|
||||||
#define TSDB_CODE_PAR_INVALID_FORECAST_CLAUSE TAOS_DEF_ERROR_CODE(0, 0x2685)
|
#define TSDB_CODE_PAR_INVALID_FORECAST_CLAUSE TAOS_DEF_ERROR_CODE(0, 0x2685)
|
||||||
|
#define TSDB_CODE_PAR_INVALID_VGID_LIST TAOS_DEF_ERROR_CODE(0, 0x2686)
|
||||||
#define TSDB_CODE_PAR_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x26FF)
|
#define TSDB_CODE_PAR_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x26FF)
|
||||||
|
|
||||||
//planner
|
//planner
|
||||||
|
|
|
@ -2132,6 +2132,8 @@ SNode* createCompactVgroupsStmt(SAstCreateContext* pCxt, SNode* pDbName, SNodeLi
|
||||||
pStmt->pEnd = pEnd;
|
pStmt->pEnd = pEnd;
|
||||||
return (SNode*)pStmt;
|
return (SNode*)pStmt;
|
||||||
_err:
|
_err:
|
||||||
|
nodesDestroyNode(pDbName);
|
||||||
|
nodesDestroyList(vgidList);
|
||||||
nodesDestroyNode(pStart);
|
nodesDestroyNode(pStart);
|
||||||
nodesDestroyNode(pEnd);
|
nodesDestroyNode(pEnd);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -10449,30 +10449,49 @@ static int32_t translateCompactDb(STranslateContext* pCxt, SCompactDatabaseStmt*
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t translateVgroupList(STranslateContext* pCxt, SNodeList* vgroupList, SArray** ppVgroups) {
|
static int32_t translateVgroupList(STranslateContext* pCxt, SNodeList* vgroupList, SArray** ppVgroups) {
|
||||||
int32_t code = TSDB_CODE_SUCCESS;
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
|
SHashObj* pHash = NULL;
|
||||||
int32_t numOfVgroups = LIST_LENGTH(vgroupList);
|
int32_t numOfVgroups = LIST_LENGTH(vgroupList);
|
||||||
|
|
||||||
(*ppVgroups) = taosArrayInit(numOfVgroups, sizeof(int64_t));
|
(*ppVgroups) = taosArrayInit(numOfVgroups, sizeof(int64_t));
|
||||||
if (NULL == *ppVgroups) {
|
if (NULL == *ppVgroups) {
|
||||||
return terrno;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
SNode* pNode = NULL;
|
pHash = taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_NO_LOCK);
|
||||||
FOREACH(pNode, vgroupList) {
|
if (NULL == pHash) {
|
||||||
SValueNode* pVal = (SValueNode*)pNode;
|
code = terrno;
|
||||||
if (DEAL_RES_ERROR == translateValue(pCxt, pVal)) {
|
}
|
||||||
code = TSDB_CODE_VND_INVALID_VGROUP_ID;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
int64_t vgroupId = getBigintFromValueNode(pVal);
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
if (NULL == taosArrayPush(*ppVgroups, &vgroupId)) {
|
SNode* pNode = NULL;
|
||||||
code = terrno;
|
FOREACH(pNode, vgroupList) {
|
||||||
break;
|
SValueNode* pVal = (SValueNode*)pNode;
|
||||||
|
if (DEAL_RES_ERROR == translateValue(pCxt, pVal)) {
|
||||||
|
code = TSDB_CODE_VND_INVALID_VGROUP_ID;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
int64_t vgroupId = getBigintFromValueNode(pVal);
|
||||||
|
|
||||||
|
if (NULL != taosHashGet(pHash, &vgroupId, sizeof(vgroupId))) {
|
||||||
|
code = TSDB_CODE_PAR_INVALID_VGID_LIST;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
code = taosHashPut(pHash, &vgroupId, sizeof(vgroupId), NULL, 0);
|
||||||
|
if (code) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (NULL == taosArrayPush(*ppVgroups, &vgroupId)) {
|
||||||
|
code = terrno;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
taosHashCleanup(pHash);
|
||||||
if (code) {
|
if (code) {
|
||||||
taosArrayDestroy(*ppVgroups);
|
taosArrayDestroy(*ppVgroups);
|
||||||
*ppVgroups = NULL;
|
*ppVgroups = NULL;
|
||||||
|
|
|
@ -739,6 +739,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_ANOMALY_WIN_COL, "ANOMALY_WINDOW not
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_ANOMALY_WIN_OPT, "ANOMALY_WINDOW option should include algo field")
|
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_ANOMALY_WIN_OPT, "ANOMALY_WINDOW option should include algo field")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_FORECAST_CLAUSE, "Invalid forecast clause")
|
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_FORECAST_CLAUSE, "Invalid forecast clause")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_REGULAR_EXPRESSION_ERROR, "Syntax error in regular expression")
|
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_REGULAR_EXPRESSION_ERROR, "Syntax error in regular expression")
|
||||||
|
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_VGID_LIST, "Invalid vgid list")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INTERNAL_ERROR, "Parser internal error")
|
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INTERNAL_ERROR, "Parser internal error")
|
||||||
|
|
||||||
//planner
|
//planner
|
||||||
|
|
Loading…
Reference in New Issue