Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
7891ff0f
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1187
Star
22018
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
7891ff0f
编写于
7月 13, 2022
作者:
D
dapan1121
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: fix stop query issue
上级
cfa989e6
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
70 addition
and
17 deletion
+70
-17
source/client/src/clientEnv.c
source/client/src/clientEnv.c
+1
-1
source/client/src/clientImpl.c
source/client/src/clientImpl.c
+1
-1
source/util/src/tlockfree.c
source/util/src/tlockfree.c
+1
-1
source/util/src/tsched.c
source/util/src/tsched.c
+10
-8
tests/script/api/stopquery.c
tests/script/api/stopquery.c
+57
-6
未找到文件。
source/client/src/clientEnv.c
浏览文件 @
7891ff0f
...
...
@@ -42,7 +42,7 @@ volatile int32_t tscInitRes = 0;
void
initTscQhandle
()
{
// init handle
tscQhandle
=
taosInitScheduler
(
4096
,
5
,
"tsc"
);
tscQhandle
=
taosInitScheduler
(
4096
,
5
,
"tsc
Q
"
);
}
void
cleanupTscQhandle
()
{
...
...
source/client/src/clientImpl.c
浏览文件 @
7891ff0f
...
...
@@ -153,7 +153,7 @@ int32_t buildRequest(uint64_t connId, const char* sql, int sqlLen, void* param,
*
pRequest
=
createRequest
(
connId
,
TSDB_SQL_SELECT
);
if
(
*
pRequest
==
NULL
)
{
tscError
(
"failed to malloc sqlObj, %s"
,
sql
);
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
return
terrno
;
}
(
*
pRequest
)
->
sqlstr
=
taosMemoryMalloc
(
sqlLen
+
1
);
...
...
source/util/src/tlockfree.c
浏览文件 @
7891ff0f
...
...
@@ -44,7 +44,7 @@ void taosWLockLatch(SRWLatch *pLatch) {
nLoops
=
0
;
while
(
1
)
{
oLatch
=
atomic_load_32
(
pLatch
);
if
(
0
==
oLatch
)
break
;
if
(
oLatch
==
TD_RWLATCH_WRITE_FLAG
)
break
;
nLoops
++
;
if
(
nLoops
>
1000
)
{
sched_yield
();
...
...
source/util/src/tsched.c
浏览文件 @
7891ff0f
...
...
@@ -129,7 +129,7 @@ void *taosProcessSchedQueue(void *scheduler) {
while
(
1
)
{
if
((
ret
=
tsem_wait
(
&
pSched
->
fullSem
))
!=
0
)
{
uFatal
(
"wait %s fullSem failed(%s)"
,
pSched
->
label
,
strerror
(
errno
));
exit
(
ret
);
ASSERT
(
0
);
}
if
(
pSched
->
stop
)
{
break
;
...
...
@@ -137,7 +137,7 @@ void *taosProcessSchedQueue(void *scheduler) {
if
((
ret
=
taosThreadMutexLock
(
&
pSched
->
queueMutex
))
!=
0
)
{
uFatal
(
"lock %s queueMutex failed(%s)"
,
pSched
->
label
,
strerror
(
errno
));
exit
(
ret
);
ASSERT
(
0
);
}
msg
=
pSched
->
queue
[
pSched
->
fullSlot
];
...
...
@@ -146,12 +146,12 @@ void *taosProcessSchedQueue(void *scheduler) {
if
((
ret
=
taosThreadMutexUnlock
(
&
pSched
->
queueMutex
))
!=
0
)
{
uFatal
(
"unlock %s queueMutex failed(%s)"
,
pSched
->
label
,
strerror
(
errno
));
exit
(
ret
);
ASSERT
(
0
);
}
if
((
ret
=
tsem_post
(
&
pSched
->
emptySem
))
!=
0
)
{
uFatal
(
"post %s emptySem failed(%s)"
,
pSched
->
label
,
strerror
(
errno
));
exit
(
ret
);
ASSERT
(
0
);
}
if
(
msg
.
fp
)
...
...
@@ -174,12 +174,12 @@ void taosScheduleTask(void *queueScheduler, SSchedMsg *pMsg) {
if
((
ret
=
tsem_wait
(
&
pSched
->
emptySem
))
!=
0
)
{
uFatal
(
"wait %s emptySem failed(%s)"
,
pSched
->
label
,
strerror
(
errno
));
exit
(
ret
);
ASSERT
(
0
);
}
if
((
ret
=
taosThreadMutexLock
(
&
pSched
->
queueMutex
))
!=
0
)
{
uFatal
(
"lock %s queueMutex failed(%s)"
,
pSched
->
label
,
strerror
(
errno
));
exit
(
ret
);
ASSERT
(
0
);
}
pSched
->
queue
[
pSched
->
emptySlot
]
=
*
pMsg
;
...
...
@@ -187,12 +187,12 @@ void taosScheduleTask(void *queueScheduler, SSchedMsg *pMsg) {
if
((
ret
=
taosThreadMutexUnlock
(
&
pSched
->
queueMutex
))
!=
0
)
{
uFatal
(
"unlock %s queueMutex failed(%s)"
,
pSched
->
label
,
strerror
(
errno
));
exit
(
ret
);
ASSERT
(
0
);
}
if
((
ret
=
tsem_post
(
&
pSched
->
fullSem
))
!=
0
)
{
uFatal
(
"post %s fullSem failed(%s)"
,
pSched
->
label
,
strerror
(
errno
));
exit
(
ret
);
ASSERT
(
0
);
}
}
...
...
@@ -200,6 +200,8 @@ void taosCleanUpScheduler(void *param) {
SSchedQueue
*
pSched
=
(
SSchedQueue
*
)
param
;
if
(
pSched
==
NULL
)
return
;
uDebug
(
"start to cleanup %s schedQsueue"
,
pSched
->
label
);
pSched
->
stop
=
true
;
for
(
int32_t
i
=
0
;
i
<
pSched
->
numOfThreads
;
++
i
)
{
if
(
taosCheckPthreadValid
(
pSched
->
qthread
[
i
]))
{
...
...
tests/script/api/stopquery.c
浏览文件 @
7891ff0f
...
...
@@ -85,10 +85,12 @@ static void sqExecSQLE(TAOS *taos, char *command) {
taos_free_result
(
pSql
);
}
void
sqError
(
char
*
prefix
,
const
char
*
errMsg
)
{
fprintf
(
stderr
,
"%s error: %s
\n
"
,
prefix
,
errMsg
);
}
void
sqExit
(
char
*
prefix
,
const
char
*
errMsg
)
{
fprintf
(
stderr
,
"%s error: %s
\n
"
,
prefix
,
errMsg
);
sleep
(
10000
);
sqError
(
prefix
,
errMsg
);
exit
(
1
);
}
...
...
@@ -208,7 +210,9 @@ void sqAsyncQueryCb(void *param, TAOS_RES *pRes, int code) {
*
qParam
->
end
=
1
;
}
}
else
{
sqExit
(
"select"
,
taos_errstr
(
pRes
));
sqError
(
"select"
,
taos_errstr
(
pRes
));
*
qParam
->
end
=
1
;
taos_free_result
(
pRes
);
}
}
...
...
@@ -463,8 +467,6 @@ void *closeThreadFp(void *arg) {
}
}
void
*
killThreadFp
(
void
*
arg
)
{
SSP_CB_PARAM
*
qParam
=
(
SSP_CB_PARAM
*
)
arg
;
while
(
true
)
{
...
...
@@ -477,6 +479,19 @@ void *killThreadFp(void *arg) {
}
}
void
*
cleanupThreadFp
(
void
*
arg
)
{
SSP_CB_PARAM
*
qParam
=
(
SSP_CB_PARAM
*
)
arg
;
while
(
true
)
{
if
(
qParam
->
taos
)
{
usleep
(
rand
()
%
10000
);
taos_cleanup
();
break
;
}
usleep
(
1
);
}
}
int
sqConCloseSyncQuery
(
bool
fetch
)
{
...
...
@@ -607,9 +622,40 @@ int sqConKillAsyncQuery(bool fetch) {
CASE_LEAVE
();
}
int
sqConCleanupSyncQuery
(
bool
fetch
)
{
CASE_ENTER
();
pthread_t
qid
,
cid
;
for
(
int32_t
i
=
0
;
i
<
runTimes
;
++
i
)
{
SSP_CB_PARAM
param
=
{
0
};
param
.
fetch
=
fetch
;
pthread_create
(
&
qid
,
NULL
,
syncQueryThreadFp
,
(
void
*
)
&
param
);
pthread_create
(
&
cid
,
NULL
,
cleanupThreadFp
,
(
void
*
)
&
param
);
pthread_join
(
qid
,
NULL
);
pthread_join
(
cid
,
NULL
);
}
CASE_LEAVE
();
}
int
sqConCleanupAsyncQuery
(
bool
fetch
)
{
CASE_ENTER
();
pthread_t
qid
,
cid
;
for
(
int32_t
i
=
0
;
i
<
runTimes
;
++
i
)
{
SSP_CB_PARAM
param
=
{
0
};
param
.
fetch
=
fetch
;
pthread_create
(
&
qid
,
NULL
,
asyncQueryThreadFp
,
(
void
*
)
&
param
);
pthread_create
(
&
cid
,
NULL
,
cleanupThreadFp
,
(
void
*
)
&
param
);
pthread_join
(
qid
,
NULL
);
pthread_join
(
cid
,
NULL
);
}
CASE_LEAVE
();
}
void
sqRunAllCase
(
void
)
{
#if 0
sqStopSyncQuery(false);
sqStopSyncQuery(true);
sqStopAsyncQuery(false);
...
...
@@ -638,11 +684,16 @@ void sqRunAllCase(void) {
sqConKillSyncQuery(false);
sqConKillSyncQuery(true);
#if 0
sqConKillAsyncQuery(false);
sqConKillAsyncQuery(true);
#endif
sqConCleanupSyncQuery
(
false
);
sqConCleanupSyncQuery
(
true
);
sqConCleanupAsyncQuery
(
false
);
sqConCleanupAsyncQuery
(
true
);
int32_t
l
=
5
;
while
(
l
)
{
printf
(
"%d
\n
"
,
l
--
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录