fix: fix stop query

This commit is contained in:
dapan1121 2022-07-12 14:56:12 +08:00
parent 7fcf80a8f9
commit 9f0152239d
3 changed files with 12 additions and 5 deletions

View File

@ -1293,6 +1293,7 @@ void catalogDestroy(void) {
if (!taosCheckCurrentInDll()) { if (!taosCheckCurrentInDll()) {
ctgClearCacheEnqueue(NULL, true, true, true); ctgClearCacheEnqueue(NULL, true, true, true);
taosThreadJoin(gCtgMgmt.updateThread, NULL);
} }
taosHashCleanup(gCtgMgmt.pCluster); taosHashCleanup(gCtgMgmt.pCluster);

View File

@ -431,7 +431,7 @@ static int32_t taosDecRefCount(int32_t rsetId, int64_t rid, int32_t remove) {
} }
released = 1; released = 1;
} else { } else {
uTrace("rsetId:%d p:%p rid:%" PRId64 " is released", rsetId, pNode->p, rid); uTrace("rsetId:%d p:%p rid:%" PRId64 " is released, remain count %d", rsetId, pNode->p, rid, pNode->count);
} }
} else { } else {
uTrace("rsetId:%d rid:%" PRId64 " is not there, failed to release/remove", rsetId, rid); uTrace("rsetId:%d rid:%" PRId64 " is not there, failed to release/remove", rsetId, rid);

View File

@ -36,7 +36,7 @@ int64_t st, et;
char hostName[128]; char hostName[128];
char dbName[128]; char dbName[128];
char tbName[128]; char tbName[128];
int32_t runTimes = 10000; int32_t runTimes = 1000;
typedef struct { typedef struct {
int id; int id;
@ -88,6 +88,7 @@ static void sqExecSQLE(TAOS *taos, char *command) {
void sqExit(char* prefix, const char* errMsg) { void sqExit(char* prefix, const char* errMsg) {
fprintf(stderr, "%s error: %s\n", prefix, errMsg); fprintf(stderr, "%s error: %s\n", prefix, errMsg);
sleep(10000);
exit(1); exit(1);
} }
@ -141,16 +142,20 @@ void sqCloseFetchCb(void *param, TAOS_RES *pRes, int numOfRows) {
taos_close(qParam->taos); taos_close(qParam->taos);
*qParam->end = 1; *qParam->end = 1;
taos_free_result(pRes);
} }
void sqCloseQueryCb(void *param, TAOS_RES *pRes, int code) { void sqCloseQueryCb(void *param, TAOS_RES *pRes, int code) {
SSP_CB_PARAM *qParam = (SSP_CB_PARAM *)param; SSP_CB_PARAM *qParam = (SSP_CB_PARAM *)param;
if (code == 0 && pRes) { if (code == 0 && pRes) {
if (qParam->fetch) { if (qParam->fetch) {
taos_fetch_rows_a(pRes, sqFreeFetchCb, param); taos_fetch_rows_a(pRes, sqCloseFetchCb, param);
} else { } else {
taos_close(qParam->taos); taos_close(qParam->taos);
*qParam->end = 1; *qParam->end = 1;
taos_free_result(pRes);
} }
} else { } else {
sqExit("select", taos_errstr(pRes)); sqExit("select", taos_errstr(pRes));
@ -358,6 +363,7 @@ int sqCloseSyncQuery(bool fetch) {
} }
taos_close(taos); taos_close(taos);
taos_free_result(pRes);
} }
CASE_LEAVE(); CASE_LEAVE();
} }
@ -382,7 +388,7 @@ int sqCloseAsyncQuery(bool fetch) {
SSP_CB_PARAM param = {0}; SSP_CB_PARAM param = {0};
param.fetch = fetch; param.fetch = fetch;
param.end = &qEnd; param.end = &qEnd;
taos_query_a(taos, sql, sqFreeQueryCb, &param); taos_query_a(taos, sql, sqCloseQueryCb, &param);
while (0 == qEnd) { while (0 == qEnd) {
usleep(5000); usleep(5000);
} }
@ -640,7 +646,7 @@ void sqRunAllCase(void) {
int32_t l = 5; int32_t l = 5;
while (l) { while (l) {
printf("%d\n", l--); printf("%d\n", l--);
sleep(1); sleep(1000);
} }
} }