TD-1471: use new error code when qhandle is null
This commit is contained in:
parent
e491a8908c
commit
820bf89a2e
|
@ -479,11 +479,8 @@ TAOS_ROW taos_fetch_row(TAOS_RES *res) {
|
|||
SSqlCmd *pCmd = &pSql->cmd;
|
||||
SSqlRes *pRes = &pSql->res;
|
||||
|
||||
if (pRes->qhandle == 0) {
|
||||
pRes->code = TSDB_CODE_TSC_INVALID_QHANDLE;
|
||||
return NULL;
|
||||
}
|
||||
if (pRes->code == TSDB_CODE_TSC_QUERY_CANCELLED ||
|
||||
if (pRes->qhandle == 0 ||
|
||||
pRes->code == TSDB_CODE_TSC_QUERY_CANCELLED ||
|
||||
pCmd->command == TSDB_SQL_RETRIEVE_EMPTY_RESULT ||
|
||||
pCmd->command == TSDB_SQL_INSERT) {
|
||||
return NULL;
|
||||
|
|
|
@ -7101,6 +7101,7 @@ void qCleanupQueryMgmt(void* pQMgmt) {
|
|||
|
||||
void** qRegisterQInfo(void* pMgmt, uint64_t qInfo) {
|
||||
if (pMgmt == NULL) {
|
||||
terrno = TSDB_CODE_VND_INVALID_VGROUP_ID;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -7109,6 +7110,7 @@ void** qRegisterQInfo(void* pMgmt, uint64_t qInfo) {
|
|||
SQueryMgmt *pQueryMgmt = pMgmt;
|
||||
if (pQueryMgmt->qinfoPool == NULL) {
|
||||
qError("QInfo:%p failed to add qhandle into qMgmt, since qMgmt is closed", (void *)qInfo);
|
||||
terrno = TSDB_CODE_VND_INVALID_VGROUP_ID;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -7116,6 +7118,7 @@ void** qRegisterQInfo(void* pMgmt, uint64_t qInfo) {
|
|||
if (pQueryMgmt->closed) {
|
||||
// pthread_mutex_unlock(&pQueryMgmt->lock);
|
||||
qError("QInfo:%p failed to add qhandle into cache, since qMgmt is colsing", (void *)qInfo);
|
||||
terrno = TSDB_CODE_VND_INVALID_VGROUP_ID;
|
||||
return NULL;
|
||||
} else {
|
||||
TSDB_CACHE_PTR_TYPE handleVal = (TSDB_CACHE_PTR_TYPE) qInfo;
|
||||
|
|
|
@ -166,10 +166,12 @@ static int32_t vnodeProcessQueryMsg(SVnodeObj *pVnode, SReadMsg *pReadMsg) {
|
|||
if (code == TSDB_CODE_SUCCESS) {
|
||||
handle = qRegisterQInfo(pVnode->qMgmt, (uint64_t)pQInfo);
|
||||
if (handle == NULL) { // failed to register qhandle, todo add error test case
|
||||
pRsp->code = terrno;
|
||||
terrno = 0;
|
||||
vError("vgId:%d QInfo:%p register qhandle failed, return to app, code:%s", pVnode->vgId, (void *)pQInfo,
|
||||
tstrerror(pRsp->code));
|
||||
pRsp->code = TSDB_CODE_QRY_INVALID_QHANDLE;
|
||||
qDestroyQueryInfo(pQInfo); // destroy it directly
|
||||
return pRsp->code;
|
||||
} else {
|
||||
assert(*handle == pQInfo);
|
||||
pRsp->qhandle = htobe64((uint64_t)pQInfo);
|
||||
|
|
Loading…
Reference in New Issue