Merge pull request #4724 from taosdata/hotfix/TD-2559
[TD-2559]<fix>: taos can't cancel stable query when fetching data
This commit is contained in:
commit
0f8b2b1111
|
@ -419,7 +419,7 @@ void tscCloseTscObj(void *pObj);
|
||||||
// todo move to taos? or create a new file: taos_internal.h
|
// todo move to taos? or create a new file: taos_internal.h
|
||||||
TAOS *taos_connect_a(char *ip, char *user, char *pass, char *db, uint16_t port, void (*fp)(void *, TAOS_RES *, int),
|
TAOS *taos_connect_a(char *ip, char *user, char *pass, char *db, uint16_t port, void (*fp)(void *, TAOS_RES *, int),
|
||||||
void *param, TAOS **taos);
|
void *param, TAOS **taos);
|
||||||
TAOS_RES* taos_query_h(TAOS* taos, const char *sqlstr, TAOS_RES** res);
|
TAOS_RES* taos_query_h(TAOS* taos, const char *sqlstr, int64_t* res);
|
||||||
void waitForQueryRsp(void *param, TAOS_RES *tres, int code);
|
void waitForQueryRsp(void *param, TAOS_RES *tres, int code);
|
||||||
|
|
||||||
void doAsyncQuery(STscObj *pObj, SSqlObj *pSql, __async_cb_func_t fp, void *param, const char *sqlstr, size_t sqlLen);
|
void doAsyncQuery(STscObj *pObj, SSqlObj *pSql, __async_cb_func_t fp, void *param, const char *sqlstr, size_t sqlLen);
|
||||||
|
|
|
@ -314,7 +314,7 @@ static void waitForRetrieveRsp(void *param, TAOS_RES *tres, int numOfRows) {
|
||||||
tsem_post(&pSql->rspSem);
|
tsem_post(&pSql->rspSem);
|
||||||
}
|
}
|
||||||
|
|
||||||
TAOS_RES* taos_query_c(TAOS *taos, const char *sqlstr, uint32_t sqlLen, TAOS_RES** res) {
|
TAOS_RES* taos_query_c(TAOS *taos, const char *sqlstr, uint32_t sqlLen, int64_t* res) {
|
||||||
STscObj *pObj = (STscObj *)taos;
|
STscObj *pObj = (STscObj *)taos;
|
||||||
if (pObj == NULL || pObj->signature != pObj) {
|
if (pObj == NULL || pObj->signature != pObj) {
|
||||||
terrno = TSDB_CODE_TSC_DISCONNECTED;
|
terrno = TSDB_CODE_TSC_DISCONNECTED;
|
||||||
|
@ -340,7 +340,7 @@ TAOS_RES* taos_query_c(TAOS *taos, const char *sqlstr, uint32_t sqlLen, TAOS_RES
|
||||||
doAsyncQuery(pObj, pSql, waitForQueryRsp, taos, sqlstr, sqlLen);
|
doAsyncQuery(pObj, pSql, waitForQueryRsp, taos, sqlstr, sqlLen);
|
||||||
|
|
||||||
if (res != NULL) {
|
if (res != NULL) {
|
||||||
*res = pSql;
|
atomic_store_64(res, pSql->self);
|
||||||
}
|
}
|
||||||
|
|
||||||
tsem_wait(&pSql->rspSem);
|
tsem_wait(&pSql->rspSem);
|
||||||
|
@ -351,7 +351,7 @@ TAOS_RES* taos_query(TAOS *taos, const char *sqlstr) {
|
||||||
return taos_query_c(taos, sqlstr, (uint32_t)strlen(sqlstr), NULL);
|
return taos_query_c(taos, sqlstr, (uint32_t)strlen(sqlstr), NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
TAOS_RES* taos_query_h(TAOS* taos, const char *sqlstr, TAOS_RES** res) {
|
TAOS_RES* taos_query_h(TAOS* taos, const char *sqlstr, int64_t* res) {
|
||||||
return taos_query_c(taos, sqlstr, (uint32_t) strlen(sqlstr), res);
|
return taos_query_c(taos, sqlstr, (uint32_t) strlen(sqlstr), res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -302,14 +302,12 @@ void shellRunCommandOnServer(TAOS *con, char command[]) {
|
||||||
|
|
||||||
st = taosGetTimestampUs();
|
st = taosGetTimestampUs();
|
||||||
|
|
||||||
TAOS_RES* tmpSql = NULL;
|
TAOS_RES* pSql = taos_query_h(con, command, &result);
|
||||||
TAOS_RES* pSql = taos_query_h(con, command, &tmpSql);
|
|
||||||
if (taos_errno(pSql)) {
|
if (taos_errno(pSql)) {
|
||||||
taos_error(pSql, st);
|
taos_error(pSql, st);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
atomic_store_64(&result, ((SSqlObj*)tmpSql)->self);
|
|
||||||
int64_t oresult = atomic_load_64(&result);
|
int64_t oresult = atomic_load_64(&result);
|
||||||
|
|
||||||
if (regex_match(command, "^\\s*use\\s+[a-zA-Z0-9_]+\\s*;\\s*$", REG_EXTENDED | REG_ICASE)) {
|
if (regex_match(command, "^\\s*use\\s+[a-zA-Z0-9_]+\\s*;\\s*$", REG_EXTENDED | REG_ICASE)) {
|
||||||
|
|
Loading…
Reference in New Issue