Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
651b3971
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
651b3971
编写于
3月 10, 2022
作者:
wafwerar
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-13766]<fix>: redefine sleep api.
上级
f0445edf
变更
23
隐藏空白更改
内联
并排
Showing
23 changed file
with
149 addition
and
152 deletion
+149
-152
include/os/osSleep.h
include/os/osSleep.h
+10
-0
source/client/src/clientHb.c
source/client/src/clientHb.c
+1
-1
source/client/src/tmq.c
source/client/src/tmq.c
+5
-5
source/libs/catalog/src/catalog.c
source/libs/catalog/src/catalog.c
+1
-1
source/libs/catalog/test/catalogTests.cpp
source/libs/catalog/test/catalogTests.cpp
+45
-45
source/libs/qcom/test/queryTest.cpp
source/libs/qcom/test/queryTest.cpp
+3
-3
source/libs/qworker/test/qworkerTests.cpp
source/libs/qworker/test/qworkerTests.cpp
+32
-32
source/libs/scheduler/test/schedulerTests.cpp
source/libs/scheduler/test/schedulerTests.cpp
+7
-7
source/libs/sync/test/syncIOSendMsgClientTest.cpp
source/libs/sync/test/syncIOSendMsgClientTest.cpp
+2
-2
source/libs/sync/test/syncIOSendMsgServerTest.cpp
source/libs/sync/test/syncIOSendMsgServerTest.cpp
+1
-1
source/libs/sync/test/syncIOSendMsgTest.cpp
source/libs/sync/test/syncIOSendMsgTest.cpp
+2
-2
source/libs/sync/test/syncIOTickPingTest.cpp
source/libs/sync/test/syncIOTickPingTest.cpp
+1
-1
source/libs/sync/test/syncIOTickQTest.cpp
source/libs/sync/test/syncIOTickQTest.cpp
+1
-1
source/libs/transport/test/pushClient.c
source/libs/transport/test/pushClient.c
+2
-2
source/libs/transport/test/pushServer.c
source/libs/transport/test/pushServer.c
+2
-2
source/libs/transport/test/rclient.c
source/libs/transport/test/rclient.c
+2
-2
source/libs/transport/test/rsclient.c
source/libs/transport/test/rsclient.c
+1
-1
source/libs/transport/test/syncClient.c
source/libs/transport/test/syncClient.c
+2
-2
source/os/src/osSleep.c
source/os/src/osSleep.c
+20
-32
source/os/src/osString.c
source/os/src/osString.c
+3
-4
source/util/test/cacheTest.cpp
source/util/test/cacheTest.cpp
+2
-2
source/util/test/trefTest.c
source/util/test/trefTest.c
+3
-3
tests/script/api/batchprepare.c
tests/script/api/batchprepare.c
+1
-1
未找到文件。
include/os/osSleep.h
浏览文件 @
651b3971
...
...
@@ -20,7 +20,17 @@
extern
"C"
{
#endif
// If the error is in a third-party library, place this header file under the third-party library header file.
#ifndef ALLOW_FORBID_FUNC
#define Sleep SLEEP_FUNC_TAOS_FORBID
#define sleep SLEEP_FUNC_TAOS_FORBID
#define usleep USLEEP_FUNC_TAOS_FORBID
#define nanosleep NANOSLEEP_FUNC_TAOS_FORBID
#endif
void
taosSsleep
(
int32_t
s
);
void
taosMsleep
(
int32_t
ms
);
void
taosUsleep
(
int32_t
us
);
#ifdef __cplusplus
}
...
...
source/client/src/clientHb.c
浏览文件 @
651b3971
...
...
@@ -449,7 +449,7 @@ static void hbStopThread() {
}
while
(
2
!=
atomic_load_8
(
&
clientHbMgr
.
threadStop
))
{
u
sleep
(
10
);
taosU
sleep
(
10
);
}
tscDebug
(
"hb thread stopped"
);
...
...
source/client/src/tmq.c
浏览文件 @
651b3971
...
...
@@ -1146,13 +1146,13 @@ tmq_message_t* tmq_consumer_poll(tmq_t* tmq, int64_t blocking_time) {
if (taosArrayGetSize(tmq->clientTopics) == 0) {
tscDebug("consumer:%ld poll but not assigned", tmq->consumerId);
/*printf("over1\n");*/
usleep(blocking_time * 1000
);
taosMsleep(blocking_time
);
return NULL;
}
SMqClientTopic* pTopic = taosArrayGet(tmq->clientTopics, tmq->nextTopicIdx);
if (taosArrayGetSize(pTopic->vgs) == 0) {
/*printf("over2\n");*/
usleep(blocking_time * 1000
);
taosMsleep(blocking_time
);
return NULL;
}
...
...
@@ -1165,14 +1165,14 @@ tmq_message_t* tmq_consumer_poll(tmq_t* tmq, int64_t blocking_time) {
SMqConsumeReq* pReq = tmqBuildConsumeReqImpl(tmq, blocking_time, pTopic, pVg);
if (pReq == NULL) {
ASSERT(false);
usleep(blocking_time * 1000
);
taosMsleep(blocking_time
);
return NULL;
}
SMqPollCbParam* param = malloc(sizeof(SMqPollCbParam));
if (param == NULL) {
ASSERT(false);
usleep(blocking_time * 1000
);
taosMsleep(blocking_time
);
return NULL;
}
param->tmq = tmq;
...
...
@@ -1204,7 +1204,7 @@ tmq_message_t* tmq_consumer_poll(tmq_t* tmq, int64_t blocking_time) {
if (tmq_message == NULL) {
if (beginVgIdx == pTopic->nextVgIdx) {
usleep(blocking_time * 1000
);
taosMsleep(blocking_time
);
} else {
continue;
}
...
...
source/libs/catalog/src/catalog.c
浏览文件 @
651b3971
...
...
@@ -2635,7 +2635,7 @@ void catalogDestroy(void) {
tsem_post
(
&
gCtgMgmt
.
sem
);
while
(
CTG_IS_LOCKED
(
&
gCtgMgmt
.
lock
))
{
u
sleep
(
1
);
taosU
sleep
(
1
);
}
CTG_LOCK
(
CTG_WRITE
,
&
gCtgMgmt
.
lock
);
...
...
source/libs/catalog/test/catalogTests.cpp
浏览文件 @
651b3971
...
...
@@ -723,7 +723,7 @@ void *ctgTestGetDbVgroupThread(void *param) {
}
if
(
ctgTestEnableSleep
)
{
u
sleep
(
taosRand
()
%
5
);
taosU
sleep
(
taosRand
()
%
5
);
}
if
(
++
n
%
ctgTestPrintNum
==
0
)
{
printf
(
"Get:%d
\n
"
,
n
);
...
...
@@ -747,7 +747,7 @@ void *ctgTestSetSameDbVgroupThread(void *param) {
}
if
(
ctgTestEnableSleep
)
{
u
sleep
(
taosRand
()
%
5
);
taosU
sleep
(
taosRand
()
%
5
);
}
if
(
++
n
%
ctgTestPrintNum
==
0
)
{
printf
(
"Set:%d
\n
"
,
n
);
...
...
@@ -771,7 +771,7 @@ void *ctgTestSetDiffDbVgroupThread(void *param) {
}
if
(
ctgTestEnableSleep
)
{
u
sleep
(
taosRand
()
%
5
);
taosU
sleep
(
taosRand
()
%
5
);
}
if
(
++
n
%
ctgTestPrintNum
==
0
)
{
printf
(
"Set:%d
\n
"
,
n
);
...
...
@@ -801,7 +801,7 @@ void *ctgTestGetCtableMetaThread(void *param) {
tfree
(
tbMeta
);
if
(
ctgTestEnableSleep
)
{
u
sleep
(
taosRand
()
%
5
);
taosU
sleep
(
taosRand
()
%
5
);
}
if
(
++
n
%
ctgTestPrintNum
==
0
)
{
...
...
@@ -838,7 +838,7 @@ void *ctgTestSetCtableMetaThread(void *param) {
}
if
(
ctgTestEnableSleep
)
{
u
sleep
(
taosRand
()
%
5
);
taosU
sleep
(
taosRand
()
%
5
);
}
if
(
++
n
%
ctgTestPrintNum
==
0
)
{
printf
(
"Set:%d
\n
"
,
n
);
...
...
@@ -880,7 +880,7 @@ TEST(tableMeta, normalTable) {
ASSERT_EQ
(
vgInfo
.
epSet
.
numOfEps
,
3
);
while
(
0
==
ctgDbgGetClusterCacheNum
(
pCtg
,
CTG_DBG_DB_NUM
))
{
usleep
(
5000
0
);
taosMsleep
(
5
0
);
}
ctgTestSetRspTableMeta
();
...
...
@@ -901,7 +901,7 @@ TEST(tableMeta, normalTable) {
while
(
true
)
{
uint32_t
n
=
ctgDbgGetClusterCacheNum
(
pCtg
,
CTG_DBG_META_NUM
);
if
(
0
==
n
)
{
usleep
(
5000
0
);
taosMsleep
(
5
0
);
}
else
{
break
;
}
...
...
@@ -949,7 +949,7 @@ TEST(tableMeta, normalTable) {
allDbNum
+=
dbNum
;
allStbNum
+=
stbNum
;
sleep
(
2
);
taosS
sleep
(
2
);
}
ASSERT_EQ
(
allDbNum
,
1
);
...
...
@@ -996,7 +996,7 @@ TEST(tableMeta, childTableCase) {
while
(
true
)
{
uint32_t
n
=
ctgDbgGetClusterCacheNum
(
pCtg
,
CTG_DBG_META_NUM
);
if
(
0
==
n
)
{
usleep
(
5000
0
);
taosMsleep
(
5
0
);
}
else
{
break
;
}
...
...
@@ -1058,7 +1058,7 @@ TEST(tableMeta, childTableCase) {
allDbNum
+=
dbNum
;
allStbNum
+=
stbNum
;
sleep
(
2
);
taosS
sleep
(
2
);
}
ASSERT_EQ
(
allDbNum
,
1
);
...
...
@@ -1105,7 +1105,7 @@ TEST(tableMeta, superTableCase) {
while
(
true
)
{
uint32_t
n
=
ctgDbgGetClusterCacheNum
(
pCtg
,
CTG_DBG_META_NUM
);
if
(
0
==
n
)
{
usleep
(
5000
0
);
taosMsleep
(
5
0
);
}
else
{
break
;
}
...
...
@@ -1132,7 +1132,7 @@ TEST(tableMeta, superTableCase) {
while
(
true
)
{
uint32_t
n
=
ctgDbgGetClusterCacheNum
(
pCtg
,
CTG_DBG_META_NUM
);
if
(
2
!=
n
)
{
usleep
(
5000
0
);
taosMsleep
(
5
0
);
}
else
{
break
;
}
...
...
@@ -1181,7 +1181,7 @@ TEST(tableMeta, superTableCase) {
allDbNum
+=
dbNum
;
allStbNum
+=
stbNum
;
sleep
(
2
);
taosS
sleep
(
2
);
}
ASSERT_EQ
(
allDbNum
,
1
);
...
...
@@ -1230,7 +1230,7 @@ TEST(tableMeta, rmStbMeta) {
while
(
true
)
{
uint32_t
n
=
ctgDbgGetClusterCacheNum
(
pCtg
,
CTG_DBG_META_NUM
);
if
(
0
==
n
)
{
usleep
(
5000
0
);
taosMsleep
(
5
0
);
}
else
{
break
;
}
...
...
@@ -1244,7 +1244,7 @@ TEST(tableMeta, rmStbMeta) {
int32_t
n
=
ctgDbgGetClusterCacheNum
(
pCtg
,
CTG_DBG_META_NUM
);
int32_t
m
=
ctgDbgGetClusterCacheNum
(
pCtg
,
CTG_DBG_STB_RENT_NUM
);
if
(
n
||
m
)
{
usleep
(
5000
0
);
taosMsleep
(
5
0
);
}
else
{
break
;
}
...
...
@@ -1300,7 +1300,7 @@ TEST(tableMeta, updateStbMeta) {
while
(
true
)
{
uint32_t
n
=
ctgDbgGetClusterCacheNum
(
pCtg
,
CTG_DBG_META_NUM
);
if
(
0
==
n
)
{
usleep
(
5000
0
);
taosMsleep
(
5
0
);
}
else
{
break
;
}
...
...
@@ -1320,7 +1320,7 @@ TEST(tableMeta, updateStbMeta) {
uint64_t
n
=
0
;
ctgDbgGetStatNum
(
"runtime.qDoneNum"
,
(
void
*
)
&
n
);
if
(
n
!=
3
)
{
usleep
(
5000
0
);
taosMsleep
(
5
0
);
}
else
{
break
;
}
...
...
@@ -1392,7 +1392,7 @@ TEST(refreshGetMeta, normal2normal) {
if
(
n
>
0
)
{
break
;
}
usleep
(
5000
0
);
taosMsleep
(
5
0
);
}
STableMeta
*
tableMeta
=
NULL
;
...
...
@@ -1410,7 +1410,7 @@ TEST(refreshGetMeta, normal2normal) {
tfree
(
tableMeta
);
while
(
0
==
ctgDbgGetClusterCacheNum
(
pCtg
,
CTG_DBG_META_NUM
))
{
usleep
(
5000
0
);
taosMsleep
(
5
0
);
}
code
=
catalogRefreshGetTableMeta
(
pCtg
,
mockPointer
,
(
const
SEpSet
*
)
mockPointer
,
&
n
,
&
tableMeta
,
0
);
...
...
@@ -1471,7 +1471,7 @@ TEST(refreshGetMeta, normal2notexist) {
if
(
n
>
0
)
{
break
;
}
usleep
(
5000
0
);
taosMsleep
(
5
0
);
}
STableMeta
*
tableMeta
=
NULL
;
...
...
@@ -1489,7 +1489,7 @@ TEST(refreshGetMeta, normal2notexist) {
tfree
(
tableMeta
);
while
(
0
==
ctgDbgGetClusterCacheNum
(
pCtg
,
CTG_DBG_META_NUM
))
{
usleep
(
5000
0
);
taosMsleep
(
5
0
);
}
code
=
catalogRefreshGetTableMeta
(
pCtg
,
mockPointer
,
(
const
SEpSet
*
)
mockPointer
,
&
n
,
&
tableMeta
,
0
);
...
...
@@ -1545,7 +1545,7 @@ TEST(refreshGetMeta, normal2child) {
if
(
n
>
0
)
{
break
;
}
usleep
(
5000
0
);
taosMsleep
(
5
0
);
}
STableMeta
*
tableMeta
=
NULL
;
...
...
@@ -1563,7 +1563,7 @@ TEST(refreshGetMeta, normal2child) {
tfree
(
tableMeta
);
while
(
0
==
ctgDbgGetClusterCacheNum
(
pCtg
,
CTG_DBG_META_NUM
))
{
usleep
(
5000
0
);
taosMsleep
(
5
0
);
}
code
=
catalogRefreshGetTableMeta
(
pCtg
,
mockPointer
,
(
const
SEpSet
*
)
mockPointer
,
&
n
,
&
tableMeta
,
0
);
...
...
@@ -1629,7 +1629,7 @@ TEST(refreshGetMeta, stable2child) {
if
(
n
>
0
)
{
break
;
}
usleep
(
5000
0
);
taosMsleep
(
5
0
);
}
STableMeta
*
tableMeta
=
NULL
;
...
...
@@ -1648,7 +1648,7 @@ TEST(refreshGetMeta, stable2child) {
tfree
(
tableMeta
);
while
(
0
==
ctgDbgGetClusterCacheNum
(
pCtg
,
CTG_DBG_META_NUM
))
{
usleep
(
5000
0
);
taosMsleep
(
5
0
);
}
ctgTestCurrentSTableName
=
ctgTestSTablename
;
...
...
@@ -1714,7 +1714,7 @@ TEST(refreshGetMeta, stable2stable) {
if
(
n
>
0
)
{
break
;
}
usleep
(
5000
0
);
taosMsleep
(
5
0
);
}
STableMeta
*
tableMeta
=
NULL
;
...
...
@@ -1733,7 +1733,7 @@ TEST(refreshGetMeta, stable2stable) {
tfree
(
tableMeta
);
while
(
0
==
ctgDbgGetClusterCacheNum
(
pCtg
,
CTG_DBG_META_NUM
))
{
usleep
(
5000
0
);
taosMsleep
(
5
0
);
}
code
=
catalogRefreshGetTableMeta
(
pCtg
,
mockPointer
,
(
const
SEpSet
*
)
mockPointer
,
&
n
,
&
tableMeta
,
0
);
...
...
@@ -1802,7 +1802,7 @@ TEST(refreshGetMeta, child2stable) {
if
(
n
>
0
)
{
break
;
}
usleep
(
5000
0
);
taosMsleep
(
5
0
);
}
STableMeta
*
tableMeta
=
NULL
;
...
...
@@ -1819,7 +1819,7 @@ TEST(refreshGetMeta, child2stable) {
tfree
(
tableMeta
);
while
(
2
!=
ctgDbgGetClusterCacheNum
(
pCtg
,
CTG_DBG_META_NUM
))
{
usleep
(
5000
0
);
taosMsleep
(
5
0
);
}
ctgTestCurrentSTableName
=
ctgTestTablename
;
...
...
@@ -2019,7 +2019,7 @@ TEST(dbVgroup, getSetDbVgroupCase) {
if
(
n
>
0
)
{
break
;
}
usleep
(
5000
0
);
taosMsleep
(
5
0
);
}
code
=
catalogGetTableHashVgroup
(
pCtg
,
mockPointer
,
(
const
SEpSet
*
)
mockPointer
,
&
n
,
&
vgInfo
);
...
...
@@ -2043,7 +2043,7 @@ TEST(dbVgroup, getSetDbVgroupCase) {
uint64_t
n
=
0
;
ctgDbgGetStatNum
(
"runtime.qDoneNum"
,
(
void
*
)
&
n
);
if
(
n
!=
3
)
{
usleep
(
5000
0
);
taosMsleep
(
5
0
);
}
else
{
break
;
}
...
...
@@ -2100,20 +2100,20 @@ TEST(multiThread, getSetRmSameDbVgroup) {
pthread_t
thread1
,
thread2
;
pthread_create
(
&
(
thread1
),
&
thattr
,
ctgTestSetSameDbVgroupThread
,
pCtg
);
sleep
(
1
);
taosS
sleep
(
1
);
pthread_create
(
&
(
thread2
),
&
thattr
,
ctgTestGetDbVgroupThread
,
pCtg
);
while
(
true
)
{
if
(
ctgTestDeadLoop
)
{
sleep
(
1
);
taosS
sleep
(
1
);
}
else
{
sleep
(
ctgTestMTRunSec
);
taosS
sleep
(
ctgTestMTRunSec
);
break
;
}
}
ctgTestStop
=
true
;
sleep
(
1
);
taosS
sleep
(
1
);
catalogDestroy
();
memset
(
&
gCtgMgmt
,
0
,
sizeof
(
gCtgMgmt
));
...
...
@@ -2152,20 +2152,20 @@ TEST(multiThread, getSetRmDiffDbVgroup) {
pthread_t
thread1
,
thread2
;
pthread_create
(
&
(
thread1
),
&
thattr
,
ctgTestSetDiffDbVgroupThread
,
pCtg
);
sleep
(
1
);
taosS
sleep
(
1
);
pthread_create
(
&
(
thread2
),
&
thattr
,
ctgTestGetDbVgroupThread
,
pCtg
);
while
(
true
)
{
if
(
ctgTestDeadLoop
)
{
sleep
(
1
);
taosS
sleep
(
1
);
}
else
{
sleep
(
ctgTestMTRunSec
);
taosS
sleep
(
ctgTestMTRunSec
);
break
;
}
}
ctgTestStop
=
true
;
sleep
(
1
);
taosS
sleep
(
1
);
catalogDestroy
();
memset
(
&
gCtgMgmt
,
0
,
sizeof
(
gCtgMgmt
));
...
...
@@ -2203,20 +2203,20 @@ TEST(multiThread, ctableMeta) {
pthread_t
thread1
,
thread2
;
pthread_create
(
&
(
thread1
),
&
thattr
,
ctgTestSetCtableMetaThread
,
pCtg
);
sleep
(
1
);
taosS
sleep
(
1
);
pthread_create
(
&
(
thread1
),
&
thattr
,
ctgTestGetCtableMetaThread
,
pCtg
);
while
(
true
)
{
if
(
ctgTestDeadLoop
)
{
sleep
(
1
);
taosS
sleep
(
1
);
}
else
{
sleep
(
ctgTestMTRunSec
);
taosS
sleep
(
ctgTestMTRunSec
);
break
;
}
}
ctgTestStop
=
true
;
sleep
(
2
);
taosS
sleep
(
2
);
catalogDestroy
();
memset
(
&
gCtgMgmt
,
0
,
sizeof
(
gCtgMgmt
));
...
...
@@ -2267,7 +2267,7 @@ TEST(rentTest, allRent) {
ASSERT_EQ
(
tableMeta
->
tableInfo
.
rowSize
,
12
);
while
(
ctgDbgGetClusterCacheNum
(
pCtg
,
CTG_DBG_META_NUM
)
<
i
)
{
usleep
(
5000
0
);
taosMsleep
(
5
0
);
}
code
=
catalogGetExpiredDBs
(
pCtg
,
&
dbs
,
&
num
);
...
...
@@ -2292,7 +2292,7 @@ TEST(rentTest, allRent) {
}
printf
(
"*************************************************
\n
"
);
sleep
(
2
);
taosS
sleep
(
2
);
}
catalogDestroy
();
...
...
source/libs/qcom/test/queryTest.cpp
浏览文件 @
651b3971
...
...
@@ -63,7 +63,7 @@ int main(int argc, char** argv) {
TEST
(
testCase
,
async_task_test
)
{
SParam
*
p
=
(
SParam
*
)
calloc
(
1
,
sizeof
(
SParam
));
taosAsyncExec
(
testPrint
,
p
,
NULL
);
usleep
(
5000
);
taosMsleep
(
5
);
}
TEST
(
testCase
,
many_async_task_test
)
{
...
...
@@ -73,14 +73,14 @@ TEST(testCase, many_async_task_test) {
taosAsyncExec
(
testPrint
,
p
,
NULL
);
}
usleep
(
1000
0
);
taosMsleep
(
1
0
);
}
TEST
(
testCase
,
error_in_async_test
)
{
int32_t
code
=
0
;
SParam
*
p
=
(
SParam
*
)
calloc
(
1
,
sizeof
(
SParam
));
taosAsyncExec
(
testPrintError
,
p
,
&
code
);
usleep
(
1000
);
taosMsleep
(
1
);
printf
(
"Error code:%d after asynchronously exec function
\n
"
,
code
);
}
...
...
source/libs/qworker/test/qworkerTests.cpp
浏览文件 @
651b3971
...
...
@@ -308,7 +308,7 @@ int32_t qwtExecTask(qTaskInfo_t tinfo, SSDataBlock** pRes, uint64_t *useconds) {
if
(
qwtTestEnableSleep
)
{
if
(
runTime
)
{
u
sleep
(
runTime
);
taosU
sleep
(
runTime
);
}
}
...
...
@@ -590,7 +590,7 @@ void *queryThread(void *param) {
qwtBuildQueryReqMsg
(
&
queryRpc
);
qWorkerProcessQueryMsg
(
mockPointer
,
mgmt
,
&
queryRpc
);
if
(
qwtTestEnableSleep
)
{
u
sleep
(
taosRand
()
%
5
);
taosU
sleep
(
taosRand
()
%
5
);
}
if
(
++
n
%
qwtTestPrintNum
==
0
)
{
printf
(
"query:%d
\n
"
,
n
);
...
...
@@ -612,7 +612,7 @@ void *readyThread(void *param) {
qwtBuildReadyReqMsg
(
&
readyMsg
,
&
readyRpc
);
code
=
qWorkerProcessReadyMsg
(
mockPointer
,
mgmt
,
&
readyRpc
);
if
(
qwtTestEnableSleep
)
{
u
sleep
(
taosRand
()
%
5
);
taosU
sleep
(
taosRand
()
%
5
);
}
if
(
++
n
%
qwtTestPrintNum
==
0
)
{
printf
(
"ready:%d
\n
"
,
n
);
...
...
@@ -634,7 +634,7 @@ void *fetchThread(void *param) {
qwtBuildFetchReqMsg
(
&
fetchMsg
,
&
fetchRpc
);
code
=
qWorkerProcessFetchMsg
(
mockPointer
,
mgmt
,
&
fetchRpc
);
if
(
qwtTestEnableSleep
)
{
u
sleep
(
taosRand
()
%
5
);
taosU
sleep
(
taosRand
()
%
5
);
}
if
(
++
n
%
qwtTestPrintNum
==
0
)
{
printf
(
"fetch:%d
\n
"
,
n
);
...
...
@@ -656,7 +656,7 @@ void *dropThread(void *param) {
qwtBuildDropReqMsg
(
&
dropMsg
,
&
dropRpc
);
code
=
qWorkerProcessDropMsg
(
mockPointer
,
mgmt
,
&
dropRpc
);
if
(
qwtTestEnableSleep
)
{
u
sleep
(
taosRand
()
%
5
);
taosU
sleep
(
taosRand
()
%
5
);
}
if
(
++
n
%
qwtTestPrintNum
==
0
)
{
printf
(
"drop:%d
\n
"
,
n
);
...
...
@@ -678,7 +678,7 @@ void *statusThread(void *param) {
qwtBuildStatusReqMsg
(
&
statusMsg
,
&
statusRpc
);
code
=
qWorkerProcessStatusMsg
(
mockPointer
,
mgmt
,
&
statusRpc
);
if
(
qwtTestEnableSleep
)
{
u
sleep
(
taosRand
()
%
5
);
taosU
sleep
(
taosRand
()
%
5
);
}
if
(
++
n
%
qwtTestPrintNum
==
0
)
{
printf
(
"status:%d
\n
"
,
n
);
...
...
@@ -696,7 +696,7 @@ void *qwtclientThread(void *param) {
void
*
mockPointer
=
(
void
*
)
0x1
;
SRpcMsg
queryRpc
=
{
0
};
sleep
(
1
);
taosS
sleep
(
1
);
while
(
!
qwtTestStop
)
{
qwtTestCaseFinished
=
false
;
...
...
@@ -705,7 +705,7 @@ void *qwtclientThread(void *param) {
qwtPutReqToQueue
((
void
*
)
0x1
,
&
queryRpc
);
while
(
!
qwtTestCaseFinished
)
{
u
sleep
(
1
);
taosU
sleep
(
1
);
}
...
...
@@ -751,7 +751,7 @@ void *queryQueueThread(void *param) {
int32_t
delay
=
taosRand
()
%
qwtTestReqMaxDelayUsec
;
if
(
delay
)
{
u
sleep
(
delay
);
taosU
sleep
(
delay
);
}
}
...
...
@@ -807,7 +807,7 @@ void *fetchQueueThread(void *param) {
int32_t
delay
=
taosRand
()
%
qwtTestReqMaxDelayUsec
;
if
(
delay
)
{
u
sleep
(
delay
);
taosU
sleep
(
delay
);
}
}
...
...
@@ -982,21 +982,21 @@ TEST(seqTest, randCase) {
qwtBuildReadyReqMsg(&readyMsg, &readyRpc);
code = qWorkerProcessReadyMsg(mockPointer, mgmt, &readyRpc);
if (qwtTestEnableSleep) {
u
sleep(1);
taosU
sleep(1);
}
} else if (r >= maxr * 2/5 && r < maxr* 3/5) {
printf("Fetch,%d\n", t++);
qwtBuildFetchReqMsg(&fetchMsg, &fetchRpc);
code = qWorkerProcessFetchMsg(mockPointer, mgmt, &fetchRpc);
if (qwtTestEnableSleep) {
u
sleep(1);
taosU
sleep(1);
}
} else if (r >= maxr * 3/5 && r < maxr * 4/5) {
printf("Drop,%d\n", t++);
qwtBuildDropReqMsg(&dropMsg, &dropRpc);
code = qWorkerProcessDropMsg(mockPointer, mgmt, &dropRpc);
if (qwtTestEnableSleep) {
u
sleep(1);
taosU
sleep(1);
}
} else if (r >= maxr * 4/5 && r < maxr-1) {
printf("Status,%d\n", t++);
...
...
@@ -1004,7 +1004,7 @@ TEST(seqTest, randCase) {
code = qWorkerProcessStatusMsg(mockPointer, mgmt, &statusRpc);
ASSERT_EQ(code, 0);
if (qwtTestEnableSleep) {
u
sleep(1);
taosU
sleep(1);
}
} else {
printf("QUIT RAND NOW");
...
...
@@ -1042,15 +1042,15 @@ TEST(seqTest, multithreadRand) {
while (true) {
if (qwtTestDeadLoop) {
sleep(1);
taosS
sleep(1);
} else {
sleep(qwtTestMTRunSec);
taosS
sleep(qwtTestMTRunSec);
break;
}
}
qwtTestStop = true;
sleep(3);
taosS
sleep(3);
qWorkerDestroy(&mgmt);
}
...
...
@@ -1099,9 +1099,9 @@ TEST(rcTest, shortExecshortDelay) {
while
(
true
)
{
if
(
qwtTestDeadLoop
)
{
sleep
(
1
);
taosS
sleep
(
1
);
}
else
{
sleep
(
qwtTestMTRunSec
);
taosS
sleep
(
qwtTestMTRunSec
);
break
;
}
}
...
...
@@ -1113,14 +1113,14 @@ TEST(rcTest, shortExecshortDelay) {
break
;
}
sleep
(
1
);
taosS
sleep
(
1
);
if
(
qwtTestCaseFinished
)
{
if
(
qwtTestQuitThreadNum
<
3
)
{
tsem_post
(
&
qwtTestQuerySem
);
tsem_post
(
&
qwtTestFetchSem
);
u
sleep
(
10
);
taosU
sleep
(
10
);
}
}
...
...
@@ -1180,9 +1180,9 @@ TEST(rcTest, longExecshortDelay) {
while
(
true
)
{
if
(
qwtTestDeadLoop
)
{
sleep
(
1
);
taosS
sleep
(
1
);
}
else
{
sleep
(
qwtTestMTRunSec
);
taosS
sleep
(
qwtTestMTRunSec
);
break
;
}
}
...
...
@@ -1195,14 +1195,14 @@ TEST(rcTest, longExecshortDelay) {
break
;
}
sleep
(
1
);
taosS
sleep
(
1
);
if
(
qwtTestCaseFinished
)
{
if
(
qwtTestQuitThreadNum
<
3
)
{
tsem_post
(
&
qwtTestQuerySem
);
tsem_post
(
&
qwtTestFetchSem
);
u
sleep
(
10
);
taosU
sleep
(
10
);
}
}
...
...
@@ -1263,9 +1263,9 @@ TEST(rcTest, shortExeclongDelay) {
while
(
true
)
{
if
(
qwtTestDeadLoop
)
{
sleep
(
1
);
taosS
sleep
(
1
);
}
else
{
sleep
(
qwtTestMTRunSec
);
taosS
sleep
(
qwtTestMTRunSec
);
break
;
}
}
...
...
@@ -1278,14 +1278,14 @@ TEST(rcTest, shortExeclongDelay) {
break
;
}
sleep
(
1
);
taosS
sleep
(
1
);
if
(
qwtTestCaseFinished
)
{
if
(
qwtTestQuitThreadNum
<
3
)
{
tsem_post
(
&
qwtTestQuerySem
);
tsem_post
(
&
qwtTestFetchSem
);
u
sleep
(
10
);
taosU
sleep
(
10
);
}
}
...
...
@@ -1342,15 +1342,15 @@ TEST(rcTest, dropTest) {
while (true) {
if (qwtTestDeadLoop) {
sleep(1);
taosS
sleep(1);
} else {
sleep(qwtTestMTRunSec);
taosS
sleep(qwtTestMTRunSec);
break;
}
}
qwtTestStop = true;
sleep(3);
taosS
sleep(3);
qWorkerDestroy(&mgmt);
}
...
...
source/libs/scheduler/test/schedulerTests.cpp
浏览文件 @
651b3971
...
...
@@ -278,7 +278,7 @@ void *schtSendRsp(void *param) {
break
;
}
usleep
(
1000
);
taosMsleep
(
1
);
}
pJob
=
schAcquireJob
(
job
);
...
...
@@ -303,7 +303,7 @@ void *schtCreateFetchRspThread(void *param) {
int64_t
job
=
*
(
int64_t
*
)
param
;
SSchJob
*
pJob
=
schAcquireJob
(
job
);
sleep
(
1
);
taosS
sleep
(
1
);
int32_t
code
=
0
;
SRetrieveTableRsp
*
rsp
=
(
SRetrieveTableRsp
*
)
calloc
(
1
,
sizeof
(
SRetrieveTableRsp
));
...
...
@@ -327,7 +327,7 @@ void *schtFetchRspThread(void *aa) {
continue
;
}
u
sleep
(
1
);
taosU
sleep
(
1
);
param
=
(
SSchCallbackParam
*
)
calloc
(
1
,
sizeof
(
*
param
));
...
...
@@ -532,7 +532,7 @@ void* schtRunJobThread(void *aa) {
void
*
schtFreeJobThread
(
void
*
aa
)
{
while
(
!
schtTestStop
)
{
u
sleep
(
taosRand
()
%
100
);
taosU
sleep
(
taosRand
()
%
100
);
schtFreeQueryJob
(
1
);
}
}
...
...
@@ -701,15 +701,15 @@ TEST(multiThread, forceFree) {
while
(
true
)
{
if
(
schtTestDeadLoop
)
{
sleep
(
1
);
taosS
sleep
(
1
);
}
else
{
sleep
(
schtTestMTRunSec
);
taosS
sleep
(
schtTestMTRunSec
);
break
;
}
}
schtTestStop
=
true
;
sleep
(
3
);
taosS
sleep
(
3
);
}
int
main
(
int
argc
,
char
**
argv
)
{
...
...
source/libs/sync/test/syncIOSendMsgClientTest.cpp
浏览文件 @
651b3971
...
...
@@ -39,11 +39,11 @@ int main() {
rpcMsg
.
msgType
=
77
;
syncIOSendMsg
(
gSyncIO
->
clientRpc
,
&
epSet
,
&
rpcMsg
);
sleep
(
1
);
taosS
sleep
(
1
);
}
while
(
1
)
{
sleep
(
1
);
taosS
sleep
(
1
);
}
return
0
;
...
...
source/libs/sync/test/syncIOSendMsgServerTest.cpp
浏览文件 @
651b3971
...
...
@@ -26,7 +26,7 @@ int main() {
assert
(
ret
==
0
);
while
(
1
)
{
sleep
(
1
);
taosS
sleep
(
1
);
}
return
0
;
...
...
source/libs/sync/test/syncIOSendMsgTest.cpp
浏览文件 @
651b3971
...
...
@@ -39,11 +39,11 @@ int main() {
rpcMsg
.
msgType
=
77
;
syncIOSendMsg
(
gSyncIO
->
clientRpc
,
&
epSet
,
&
rpcMsg
);
sleep
(
1
);
taosS
sleep
(
1
);
}
while
(
1
)
{
sleep
(
1
);
taosS
sleep
(
1
);
}
return
0
;
...
...
source/libs/sync/test/syncIOTickPingTest.cpp
浏览文件 @
651b3971
...
...
@@ -29,7 +29,7 @@ int main() {
assert
(
ret
==
0
);
while
(
1
)
{
sleep
(
1
);
taosS
sleep
(
1
);
}
return
0
;
}
source/libs/sync/test/syncIOTickQTest.cpp
浏览文件 @
651b3971
...
...
@@ -29,7 +29,7 @@ int main() {
assert
(
ret
==
0
);
while
(
1
)
{
sleep
(
1
);
taosS
sleep
(
1
);
}
return
0
;
}
source/libs/transport/test/pushClient.c
浏览文件 @
651b3971
...
...
@@ -107,7 +107,7 @@ static void *sendRequest(void *param) {
tDebug
(
"recv response succefully"
);
//
usleep(1000000
00);
//
taosSsleep(1
00);
}
tError
(
"send and recv sum: %d, %d, %d, %d"
,
u100
,
u500
,
u1000
,
u10000
);
...
...
@@ -223,7 +223,7 @@ int main(int argc, char *argv[]) {
}
do
{
u
sleep
(
1
);
taosU
sleep
(
1
);
}
while
(
tcount
<
appThreads
);
gettimeofday
(
&
systemTime
,
NULL
);
...
...
source/libs/transport/test/pushServer.c
浏览文件 @
651b3971
...
...
@@ -77,7 +77,7 @@ void processShellMsg() {
taosFreeQitem
(
pRpcMsg
);
{
// sleep(1);
//
taosS
sleep(1);
SRpcMsg
nRpcMsg
=
{
0
};
nRpcMsg
.
pCont
=
rpcMallocCont
(
msgSize
);
nRpcMsg
.
contLen
=
msgSize
;
...
...
@@ -176,7 +176,7 @@ int main(int argc, char *argv[]) {
tError
(
"failed to start RPC server"
);
return
-
1
;
}
// sleep(5);
//
taosS
sleep(5);
tInfo
(
"RPC server is running, ctrl-c to exit"
);
...
...
source/libs/transport/test/rclient.c
浏览文件 @
651b3971
...
...
@@ -84,7 +84,7 @@ static void *sendRequest(void *param) {
tDebug
(
"recv response succefully"
);
//
usleep(1000000
00);
//
taosSsleep(1
00);
}
tError
(
"send and recv sum: %d, %d, %d, %d"
,
u100
,
u500
,
u1000
,
u10000
);
...
...
@@ -200,7 +200,7 @@ int main(int argc, char *argv[]) {
}
do
{
u
sleep
(
1
);
taosU
sleep
(
1
);
}
while
(
tcount
<
appThreads
);
gettimeofday
(
&
systemTime
,
NULL
);
...
...
source/libs/transport/test/rsclient.c
浏览文件 @
651b3971
...
...
@@ -178,7 +178,7 @@ int main(int argc, char *argv[]) {
}
do
{
u
sleep
(
1
);
taosU
sleep
(
1
);
}
while
(
tcount
<
appThreads
);
gettimeofday
(
&
systemTime
,
NULL
);
...
...
source/libs/transport/test/syncClient.c
浏览文件 @
651b3971
...
...
@@ -85,7 +85,7 @@ static void *sendRequest(void *param) {
tDebug
(
"recv response succefully"
);
//
usleep(1000000
00);
//
taosSsleep(1
00);
}
tError
(
"send and recv sum: %d, %d, %d, %d"
,
u100
,
u500
,
u1000
,
u10000
);
...
...
@@ -201,7 +201,7 @@ int main(int argc, char *argv[]) {
}
do
{
u
sleep
(
1
);
taosU
sleep
(
1
);
}
while
(
tcount
<
appThreads
);
gettimeofday
(
&
systemTime
,
NULL
);
...
...
source/os/src/osSleep.c
浏览文件 @
651b3971
...
...
@@ -13,47 +13,35 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#define ALLOW_FORBID_FUNC
#define _DEFAULT_SOURCE
#include "os.h"
#if defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32)
void
taosMsleep
(
int32_t
ms
)
{
Sleep
(
ms
);
}
#else
#if !(defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32))
#include <unistd.h>
#endif
/*
to make taosMsleep work,
signal SIGALRM shall be blocked in the calling thread,
sigset_t set;
sigemptyset(&set);
sigaddset(&set, SIGALRM);
pthread_sigmask(SIG_BLOCK, &set, NULL);
*/
void
taosMsleep
(
int32_t
mseconds
)
{
#if 1
usleep
(
mseconds
*
1000
);
void
taosSsleep
(
int32_t
s
)
{
#if defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32)
Sleep
(
1000
*
s
);
#else
struct
timeval
timeout
;
int32_t
seconds
,
useconds
;
seconds
=
mseconds
/
1000
;
useconds
=
(
mseconds
%
1000
)
*
1000
;
timeout
.
tv_sec
=
seconds
;
timeout
.
tv_usec
=
useconds
;
/* sigset_t set; */
/* sigemptyset(&set); */
/* sigaddset(&set, SIGALRM); */
/* pthread_sigmask(SIG_BLOCK, &set, NULL); */
select
(
0
,
NULL
,
NULL
,
NULL
,
&
timeout
);
sleep
(
s
);
#endif
}
/* pthread_sigmask(SIG_UNBLOCK, &set, NULL); */
void
taosMsleep
(
int32_t
ms
)
{
#if defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32)
Sleep
(
ms
);
#else
usleep
(
ms
*
1000
);
#endif
}
void
taosUsleep
(
int32_t
us
)
{
#if defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32)
nanosleep
(
1000
*
us
);
#else
usleep
(
us
);
#endif
}
source/os/src/osString.c
浏览文件 @
651b3971
...
...
@@ -291,11 +291,10 @@ int32_t twcslen(const wchar_t *wcs) {
return
n
;
}
int32_t
tasoUcs4Compare
(
void
*
f1_ucs4
,
void
*
f2_ucs4
,
int32_t
bytes
)
{
for
(
int32_t
i
=
0
;
i
<
bytes
;
++
i
)
{
int32_t
f1
=
*
(
int32_t
*
)((
char
*
)
f1_ucs4
+
i
*
4
);
int32_t
f2
=
*
(
int32_t
*
)((
char
*
)
f2_ucs4
+
i
*
4
);
for
(
int32_t
i
=
0
;
i
<
bytes
;
i
+=
TSDB_NCHAR_SIZE
)
{
int32_t
f1
=
*
(
int32_t
*
)((
char
*
)
f1_ucs4
+
i
);
int32_t
f2
=
*
(
int32_t
*
)((
char
*
)
f2_ucs4
+
i
);
if
((
f1
==
0
&&
f2
!=
0
)
||
(
f1
!=
0
&&
f2
==
0
))
{
return
f1
-
f2
;
...
...
source/util/test/cacheTest.cpp
浏览文件 @
651b3971
...
...
@@ -14,7 +14,7 @@ TEST(cacheTest, client_cache_test) {
char
data1
[]
=
"test11"
;
char
*
cachedObj
=
(
char
*
)
taosCachePut
(
tscMetaCache
,
key1
,
strlen
(
key1
),
data1
,
strlen
(
data1
)
+
1
,
1
);
sleep
(
REFRESH_TIME_IN_SEC
+
1
);
taosS
sleep
(
REFRESH_TIME_IN_SEC
+
1
);
printf
(
"obj is still valid: %s
\n
"
,
cachedObj
);
...
...
@@ -37,7 +37,7 @@ TEST(cacheTest, client_cache_test) {
taosCacheRelease
(
tscMetaCache
,
(
void
**
)
&
cachedObj2
,
false
);
sleep
(
3
);
taosS
sleep
(
3
);
char
*
d
=
(
char
*
)
taosCacheAcquireByKey
(
tscMetaCache
,
key3
,
strlen
(
key3
));
assert
(
d
==
NULL
);
...
...
source/util/test/trefTest.c
浏览文件 @
651b3971
...
...
@@ -42,7 +42,7 @@ void *addRef(void *param) {
pSpace
->
p
[
id
]
=
malloc
(
128
);
pSpace
->
rid
[
id
]
=
taosAddRef
(
pSpace
->
rsetId
,
pSpace
->
p
[
id
]);
}
u
sleep
(
100
);
taosU
sleep
(
100
);
}
return
NULL
;
...
...
@@ -60,7 +60,7 @@ void *removeRef(void *param) {
if
(
code
==
0
)
pSpace
->
rid
[
id
]
=
0
;
}
u
sleep
(
100
);
taosU
sleep
(
100
);
}
return
NULL
;
...
...
@@ -76,7 +76,7 @@ void *acquireRelease(void *param) {
id
=
random
()
%
pSpace
->
refNum
;
void
*
p
=
taosAcquireRef
(
pSpace
->
rsetId
,
(
int64_t
)
pSpace
->
p
[
id
]);
if
(
p
)
{
u
sleep
(
id
%
5
+
1
);
taosU
sleep
(
id
%
5
+
1
);
taosReleaseRef
(
pSpace
->
rsetId
,
(
int64_t
)
pSpace
->
p
[
id
]);
}
}
...
...
tests/script/api/batchprepare.c
浏览文件 @
651b3971
...
...
@@ -5089,7 +5089,7 @@ int main(int argc, char *argv[])
//pthread_create(&(pThreadList[3]), &thattr, runcase, (void *)&par[3]);
while
(
1
)
{
sleep
(
1
);
taosS
sleep
(
1
);
}
return
0
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录