提交 e2056ba8 编写于 作者: S Shengliang Guan

Merge branch 'main' into FIX/TD-21043-main

...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# taos-tools # taos-tools
ExternalProject_Add(taos-tools ExternalProject_Add(taos-tools
GIT_REPOSITORY https://github.com/taosdata/taos-tools.git GIT_REPOSITORY https://github.com/taosdata/taos-tools.git
GIT_TAG 11b60a4 GIT_TAG 4776778
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taos-tools" SOURCE_DIR "${TD_SOURCE_DIR}/tools/taos-tools"
BINARY_DIR "" BINARY_DIR ""
#BUILD_IN_SOURCE TRUE #BUILD_IN_SOURCE TRUE
......
...@@ -154,6 +154,8 @@ void qCleanExecTaskBlockBuf(qTaskInfo_t tinfo); ...@@ -154,6 +154,8 @@ void qCleanExecTaskBlockBuf(qTaskInfo_t tinfo);
*/ */
int32_t qAsyncKillTask(qTaskInfo_t tinfo, int32_t rspCode); int32_t qAsyncKillTask(qTaskInfo_t tinfo, int32_t rspCode);
bool qTaskIsExecuting(qTaskInfo_t qinfo);
/** /**
* destroy query info structure * destroy query info structure
* @param qHandle * @param qHandle
......
...@@ -22,10 +22,10 @@ ...@@ -22,10 +22,10 @@
#define SL_NODE_SIZE(l) (sizeof(SMemSkipListNode) + ((l) << 4)) #define SL_NODE_SIZE(l) (sizeof(SMemSkipListNode) + ((l) << 4))
#define SL_NODE_FORWARD(n, l) ((n)->forwards[l]) #define SL_NODE_FORWARD(n, l) ((n)->forwards[l])
#define SL_NODE_BACKWARD(n, l) ((n)->forwards[(n)->level + (l)]) #define SL_NODE_BACKWARD(n, l) ((n)->forwards[(n)->level + (l)])
#define SL_GET_NODE_FORWARD(n, l) ((SMemSkipListNode *)atomic_load_64((int64_t *)&SL_NODE_FORWARD(n, l))) #define SL_GET_NODE_FORWARD(n, l) ((SMemSkipListNode *)atomic_load_ptr(&SL_NODE_FORWARD(n, l)))
#define SL_GET_NODE_BACKWARD(n, l) ((SMemSkipListNode *)atomic_load_64((int64_t *)&SL_NODE_BACKWARD(n, l))) #define SL_GET_NODE_BACKWARD(n, l) ((SMemSkipListNode *)atomic_load_ptr(&SL_NODE_BACKWARD(n, l)))
#define SL_SET_NODE_FORWARD(n, l, p) atomic_store_64((int64_t *)&SL_NODE_FORWARD(n, l), (int64_t)(p)) #define SL_SET_NODE_FORWARD(n, l, p) atomic_store_ptr(&SL_NODE_FORWARD(n, l), p)
#define SL_SET_NODE_BACKWARD(n, l, p) atomic_store_64((int64_t *)&SL_NODE_BACKWARD(n, l), (int64_t)(p)) #define SL_SET_NODE_BACKWARD(n, l, p) atomic_store_ptr(&SL_NODE_BACKWARD(n, l), p)
#define SL_MOVE_BACKWARD 0x1 #define SL_MOVE_BACKWARD 0x1
#define SL_MOVE_FROM_POS 0x2 #define SL_MOVE_FROM_POS 0x2
......
...@@ -704,6 +704,15 @@ int32_t qAsyncKillTask(qTaskInfo_t qinfo, int32_t rspCode) { ...@@ -704,6 +704,15 @@ int32_t qAsyncKillTask(qTaskInfo_t qinfo, int32_t rspCode) {
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
bool qTaskIsExecuting(qTaskInfo_t qinfo) {
SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)qinfo;
if (NULL == pTaskInfo) {
return false;
}
return 0 != atomic_load_64(&pTaskInfo->owner);
}
static void printTaskExecCostInLog(SExecTaskInfo* pTaskInfo) { static void printTaskExecCostInLog(SExecTaskInfo* pTaskInfo) {
STaskCostInfo* pSummary = &pTaskInfo->cost; STaskCostInfo* pSummary = &pTaskInfo->cost;
int64_t idleTime = pSummary->start - pSummary->created; int64_t idleTime = pSummary->start - pSummary->created;
......
...@@ -202,6 +202,15 @@ _return: ...@@ -202,6 +202,15 @@ _return:
QW_RET(code); QW_RET(code);
} }
bool qwTaskNotInExec(SQWTaskCtx *ctx) {
qTaskInfo_t taskHandle = ctx->taskHandle;
if (NULL == taskHandle || !qTaskIsExecuting(taskHandle)) {
return true;
}
return false;
}
int32_t qwGenerateSchHbRsp(SQWorker *mgmt, SQWSchStatus *sch, SQWHbInfo *hbInfo) { int32_t qwGenerateSchHbRsp(SQWorker *mgmt, SQWSchStatus *sch, SQWHbInfo *hbInfo) {
int32_t taskNum = 0; int32_t taskNum = 0;
...@@ -508,8 +517,10 @@ int32_t qwHandlePostPhaseEvents(QW_FPARAMS_DEF, int8_t phase, SQWPhaseInput *inp ...@@ -508,8 +517,10 @@ int32_t qwHandlePostPhaseEvents(QW_FPARAMS_DEF, int8_t phase, SQWPhaseInput *inp
} }
if (QW_EVENT_RECEIVED(ctx, QW_EVENT_DROP)) { if (QW_EVENT_RECEIVED(ctx, QW_EVENT_DROP)) {
QW_ERR_JRET(qwDropTask(QW_FPARAMS())); if (QW_PHASE_POST_FETCH != phase || qwTaskNotInExec(ctx)) {
QW_ERR_JRET(ctx->rspCode); QW_ERR_JRET(qwDropTask(QW_FPARAMS()));
QW_ERR_JRET(ctx->rspCode);
}
} }
if (ctx->rspCode) { if (ctx->rspCode) {
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include "thash.h" #include "thash.h"
#include "tlog.h" #include "tlog.h"
#include "types.h" #include "types.h"
#include "osString.h"
int32_t setChkInBytes1(const void *pLeft, const void *pRight) { int32_t setChkInBytes1(const void *pLeft, const void *pRight) {
return NULL != taosHashGet((SHashObj *)pRight, pLeft, 1) ? 1 : 0; return NULL != taosHashGet((SHashObj *)pRight, pLeft, 1) ? 1 : 0;
...@@ -208,16 +209,16 @@ int32_t compareLenPrefixedWStr(const void *pLeft, const void *pRight) { ...@@ -208,16 +209,16 @@ int32_t compareLenPrefixedWStr(const void *pLeft, const void *pRight) {
int32_t len1 = varDataLen(pLeft); int32_t len1 = varDataLen(pLeft);
int32_t len2 = varDataLen(pRight); int32_t len2 = varDataLen(pRight);
if (len1 != len2) { int32_t ret = tasoUcs4Compare((TdUcs4 *)varDataVal(pLeft), (TdUcs4 *)varDataVal(pRight), len1>len2 ? len2:len1);
return len1 > len2 ? 1 : -1; if (ret == 0) {
} else { if (len1 > len2)
int32_t ret = memcmp((TdUcs4 *)pLeft, (TdUcs4 *)pRight, len1); return 1;
if (ret == 0) { else if(len1 < len2)
return -1;
else
return 0; return 0;
} else {
return ret > 0 ? 1 : -1;
}
} }
return (ret < 0) ? -1 : 1;
} }
int32_t compareLenPrefixedWStrDesc(const void *pLeft, const void *pRight) { int32_t compareLenPrefixedWStrDesc(const void *pLeft, const void *pRight) {
......
...@@ -408,8 +408,8 @@ class TDTestCase: ...@@ -408,8 +408,8 @@ class TDTestCase:
# test group by & order by json tag # test group by & order by json tag
tdSql.query(f"select ts,jtag->'tag1' from {dbname}.jsons1 partition by jtag->'tag1' order by jtag->'tag1' desc") tdSql.query(f"select ts,jtag->'tag1' from {dbname}.jsons1 partition by jtag->'tag1' order by jtag->'tag1' desc")
tdSql.checkRows(11) tdSql.checkRows(11)
tdSql.checkData(0, 1, '"femail"') tdSql.checkData(0, 1, '"收到货"')
tdSql.checkData(2, 1, '"收到货"') tdSql.checkData(2, 1, '"femail"')
tdSql.checkData(7, 1, "false") tdSql.checkData(7, 1, "false")
...@@ -421,9 +421,10 @@ class TDTestCase: ...@@ -421,9 +421,10 @@ class TDTestCase:
tdSql.query(f"select count(*),jtag->'tag1' from {dbname}.jsons1 group by jtag->'tag1' order by jtag->'tag1' desc") tdSql.query(f"select count(*),jtag->'tag1' from {dbname}.jsons1 group by jtag->'tag1' order by jtag->'tag1' desc")
tdSql.checkRows(8) tdSql.checkRows(8)
tdSql.checkData(0, 0, 2) tdSql.checkData(0, 0, 2)
tdSql.checkData(0, 1, '"femail"') tdSql.checkData(0, 1, '"收到货"')
tdSql.checkData(1, 1, '"femail"')
tdSql.checkData(1, 0, 2) tdSql.checkData(1, 0, 2)
tdSql.checkData(1, 1, '"收到货"')
tdSql.checkData(2, 0, 1) tdSql.checkData(2, 0, 1)
tdSql.checkData(2, 1, "11.000000000") tdSql.checkData(2, 1, "11.000000000")
tdSql.checkData(5, 0, 1) tdSql.checkData(5, 0, 1)
...@@ -437,7 +438,7 @@ class TDTestCase: ...@@ -437,7 +438,7 @@ class TDTestCase:
tdSql.checkData(5, 0, 1) tdSql.checkData(5, 0, 1)
tdSql.checkData(5, 1, "11.000000000") tdSql.checkData(5, 1, "11.000000000")
tdSql.checkData(7, 0, 2) tdSql.checkData(7, 0, 2)
tdSql.checkData(7, 1, '"femail"') tdSql.checkData(7, 1, '"收到货"')
# test stddev with group by json tag # test stddev with group by json tag
tdSql.query(f"select stddev(dataint),jtag->'tag1' from {dbname}.jsons1 group by jtag->'tag1' order by jtag->'tag1'") tdSql.query(f"select stddev(dataint),jtag->'tag1' from {dbname}.jsons1 group by jtag->'tag1' order by jtag->'tag1'")
...@@ -445,8 +446,8 @@ class TDTestCase: ...@@ -445,8 +446,8 @@ class TDTestCase:
tdSql.checkData(0, 1, None) tdSql.checkData(0, 1, None)
tdSql.checkData(4, 0, 0) tdSql.checkData(4, 0, 0)
tdSql.checkData(4, 1, "5.000000000") tdSql.checkData(4, 1, "5.000000000")
tdSql.checkData(7, 0, 11) tdSql.checkData(6, 0, 11)
tdSql.checkData(7, 1, '"femail"') tdSql.checkData(7, 1, '"收到货"')
res = tdSql.getColNameList(f"select stddev(dataint),jsons1.jtag->'tag1' from {dbname}.jsons1 group by jsons1.jtag->'tag1' order by jtag->'tag1'") res = tdSql.getColNameList(f"select stddev(dataint),jsons1.jtag->'tag1' from {dbname}.jsons1 group by jsons1.jtag->'tag1' order by jtag->'tag1'")
cname_list = [] cname_list = []
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册