Merge pull request #10669 from taosdata/fix/ZhiqiangWang/TD-13766-redefine-sleep-api
[TD-13766]<fix>: redefine sleep api.
This commit is contained in:
commit
13e1d70eea
|
@ -20,7 +20,17 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#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 taosMsleep(int32_t ms);
|
||||||
|
void taosUsleep(int32_t us);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -449,7 +449,7 @@ static void hbStopThread() {
|
||||||
}
|
}
|
||||||
|
|
||||||
while (2 != atomic_load_8(&clientHbMgr.threadStop)) {
|
while (2 != atomic_load_8(&clientHbMgr.threadStop)) {
|
||||||
usleep(10);
|
taosUsleep(10);
|
||||||
}
|
}
|
||||||
|
|
||||||
tscDebug("hb thread stopped");
|
tscDebug("hb thread stopped");
|
||||||
|
|
|
@ -1146,13 +1146,13 @@ tmq_message_t* tmq_consumer_poll(tmq_t* tmq, int64_t blocking_time) {
|
||||||
if (taosArrayGetSize(tmq->clientTopics) == 0) {
|
if (taosArrayGetSize(tmq->clientTopics) == 0) {
|
||||||
tscDebug("consumer:%ld poll but not assigned", tmq->consumerId);
|
tscDebug("consumer:%ld poll but not assigned", tmq->consumerId);
|
||||||
/*printf("over1\n");*/
|
/*printf("over1\n");*/
|
||||||
usleep(blocking_time * 1000);
|
taosMsleep(blocking_time);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
SMqClientTopic* pTopic = taosArrayGet(tmq->clientTopics, tmq->nextTopicIdx);
|
SMqClientTopic* pTopic = taosArrayGet(tmq->clientTopics, tmq->nextTopicIdx);
|
||||||
if (taosArrayGetSize(pTopic->vgs) == 0) {
|
if (taosArrayGetSize(pTopic->vgs) == 0) {
|
||||||
/*printf("over2\n");*/
|
/*printf("over2\n");*/
|
||||||
usleep(blocking_time * 1000);
|
taosMsleep(blocking_time);
|
||||||
return NULL;
|
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);
|
SMqConsumeReq* pReq = tmqBuildConsumeReqImpl(tmq, blocking_time, pTopic, pVg);
|
||||||
if (pReq == NULL) {
|
if (pReq == NULL) {
|
||||||
ASSERT(false);
|
ASSERT(false);
|
||||||
usleep(blocking_time * 1000);
|
taosMsleep(blocking_time);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
SMqPollCbParam* param = malloc(sizeof(SMqPollCbParam));
|
SMqPollCbParam* param = malloc(sizeof(SMqPollCbParam));
|
||||||
if (param == NULL) {
|
if (param == NULL) {
|
||||||
ASSERT(false);
|
ASSERT(false);
|
||||||
usleep(blocking_time * 1000);
|
taosMsleep(blocking_time);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
param->tmq = tmq;
|
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 (tmq_message == NULL) {
|
||||||
if (beginVgIdx == pTopic->nextVgIdx) {
|
if (beginVgIdx == pTopic->nextVgIdx) {
|
||||||
usleep(blocking_time * 1000);
|
taosMsleep(blocking_time);
|
||||||
} else {
|
} else {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2635,7 +2635,7 @@ void catalogDestroy(void) {
|
||||||
tsem_post(&gCtgMgmt.sem);
|
tsem_post(&gCtgMgmt.sem);
|
||||||
|
|
||||||
while (CTG_IS_LOCKED(&gCtgMgmt.lock)) {
|
while (CTG_IS_LOCKED(&gCtgMgmt.lock)) {
|
||||||
usleep(1);
|
taosUsleep(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
CTG_LOCK(CTG_WRITE, &gCtgMgmt.lock);
|
CTG_LOCK(CTG_WRITE, &gCtgMgmt.lock);
|
||||||
|
|
|
@ -723,7 +723,7 @@ void *ctgTestGetDbVgroupThread(void *param) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ctgTestEnableSleep) {
|
if (ctgTestEnableSleep) {
|
||||||
usleep(taosRand() % 5);
|
taosUsleep(taosRand() % 5);
|
||||||
}
|
}
|
||||||
if (++n % ctgTestPrintNum == 0) {
|
if (++n % ctgTestPrintNum == 0) {
|
||||||
printf("Get:%d\n", n);
|
printf("Get:%d\n", n);
|
||||||
|
@ -747,7 +747,7 @@ void *ctgTestSetSameDbVgroupThread(void *param) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ctgTestEnableSleep) {
|
if (ctgTestEnableSleep) {
|
||||||
usleep(taosRand() % 5);
|
taosUsleep(taosRand() % 5);
|
||||||
}
|
}
|
||||||
if (++n % ctgTestPrintNum == 0) {
|
if (++n % ctgTestPrintNum == 0) {
|
||||||
printf("Set:%d\n", n);
|
printf("Set:%d\n", n);
|
||||||
|
@ -771,7 +771,7 @@ void *ctgTestSetDiffDbVgroupThread(void *param) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ctgTestEnableSleep) {
|
if (ctgTestEnableSleep) {
|
||||||
usleep(taosRand() % 5);
|
taosUsleep(taosRand() % 5);
|
||||||
}
|
}
|
||||||
if (++n % ctgTestPrintNum == 0) {
|
if (++n % ctgTestPrintNum == 0) {
|
||||||
printf("Set:%d\n", n);
|
printf("Set:%d\n", n);
|
||||||
|
@ -801,7 +801,7 @@ void *ctgTestGetCtableMetaThread(void *param) {
|
||||||
tfree(tbMeta);
|
tfree(tbMeta);
|
||||||
|
|
||||||
if (ctgTestEnableSleep) {
|
if (ctgTestEnableSleep) {
|
||||||
usleep(taosRand() % 5);
|
taosUsleep(taosRand() % 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (++n % ctgTestPrintNum == 0) {
|
if (++n % ctgTestPrintNum == 0) {
|
||||||
|
@ -838,7 +838,7 @@ void *ctgTestSetCtableMetaThread(void *param) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ctgTestEnableSleep) {
|
if (ctgTestEnableSleep) {
|
||||||
usleep(taosRand() % 5);
|
taosUsleep(taosRand() % 5);
|
||||||
}
|
}
|
||||||
if (++n % ctgTestPrintNum == 0) {
|
if (++n % ctgTestPrintNum == 0) {
|
||||||
printf("Set:%d\n", n);
|
printf("Set:%d\n", n);
|
||||||
|
@ -880,7 +880,7 @@ TEST(tableMeta, normalTable) {
|
||||||
ASSERT_EQ(vgInfo.epSet.numOfEps, 3);
|
ASSERT_EQ(vgInfo.epSet.numOfEps, 3);
|
||||||
|
|
||||||
while (0 == ctgDbgGetClusterCacheNum(pCtg, CTG_DBG_DB_NUM)) {
|
while (0 == ctgDbgGetClusterCacheNum(pCtg, CTG_DBG_DB_NUM)) {
|
||||||
usleep(50000);
|
taosMsleep(50);
|
||||||
}
|
}
|
||||||
|
|
||||||
ctgTestSetRspTableMeta();
|
ctgTestSetRspTableMeta();
|
||||||
|
@ -901,7 +901,7 @@ TEST(tableMeta, normalTable) {
|
||||||
while (true) {
|
while (true) {
|
||||||
uint32_t n = ctgDbgGetClusterCacheNum(pCtg, CTG_DBG_META_NUM);
|
uint32_t n = ctgDbgGetClusterCacheNum(pCtg, CTG_DBG_META_NUM);
|
||||||
if (0 == n) {
|
if (0 == n) {
|
||||||
usleep(50000);
|
taosMsleep(50);
|
||||||
} else {
|
} else {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -949,7 +949,7 @@ TEST(tableMeta, normalTable) {
|
||||||
|
|
||||||
allDbNum += dbNum;
|
allDbNum += dbNum;
|
||||||
allStbNum += stbNum;
|
allStbNum += stbNum;
|
||||||
sleep(2);
|
taosSsleep(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT_EQ(allDbNum, 1);
|
ASSERT_EQ(allDbNum, 1);
|
||||||
|
@ -996,7 +996,7 @@ TEST(tableMeta, childTableCase) {
|
||||||
while (true) {
|
while (true) {
|
||||||
uint32_t n = ctgDbgGetClusterCacheNum(pCtg, CTG_DBG_META_NUM);
|
uint32_t n = ctgDbgGetClusterCacheNum(pCtg, CTG_DBG_META_NUM);
|
||||||
if (0 == n) {
|
if (0 == n) {
|
||||||
usleep(50000);
|
taosMsleep(50);
|
||||||
} else {
|
} else {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1058,7 +1058,7 @@ TEST(tableMeta, childTableCase) {
|
||||||
|
|
||||||
allDbNum += dbNum;
|
allDbNum += dbNum;
|
||||||
allStbNum += stbNum;
|
allStbNum += stbNum;
|
||||||
sleep(2);
|
taosSsleep(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT_EQ(allDbNum, 1);
|
ASSERT_EQ(allDbNum, 1);
|
||||||
|
@ -1105,7 +1105,7 @@ TEST(tableMeta, superTableCase) {
|
||||||
while (true) {
|
while (true) {
|
||||||
uint32_t n = ctgDbgGetClusterCacheNum(pCtg, CTG_DBG_META_NUM);
|
uint32_t n = ctgDbgGetClusterCacheNum(pCtg, CTG_DBG_META_NUM);
|
||||||
if (0 == n) {
|
if (0 == n) {
|
||||||
usleep(50000);
|
taosMsleep(50);
|
||||||
} else {
|
} else {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1132,7 +1132,7 @@ TEST(tableMeta, superTableCase) {
|
||||||
while (true) {
|
while (true) {
|
||||||
uint32_t n = ctgDbgGetClusterCacheNum(pCtg, CTG_DBG_META_NUM);
|
uint32_t n = ctgDbgGetClusterCacheNum(pCtg, CTG_DBG_META_NUM);
|
||||||
if (2 != n) {
|
if (2 != n) {
|
||||||
usleep(50000);
|
taosMsleep(50);
|
||||||
} else {
|
} else {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1181,7 +1181,7 @@ TEST(tableMeta, superTableCase) {
|
||||||
|
|
||||||
allDbNum += dbNum;
|
allDbNum += dbNum;
|
||||||
allStbNum += stbNum;
|
allStbNum += stbNum;
|
||||||
sleep(2);
|
taosSsleep(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT_EQ(allDbNum, 1);
|
ASSERT_EQ(allDbNum, 1);
|
||||||
|
@ -1230,7 +1230,7 @@ TEST(tableMeta, rmStbMeta) {
|
||||||
while (true) {
|
while (true) {
|
||||||
uint32_t n = ctgDbgGetClusterCacheNum(pCtg, CTG_DBG_META_NUM);
|
uint32_t n = ctgDbgGetClusterCacheNum(pCtg, CTG_DBG_META_NUM);
|
||||||
if (0 == n) {
|
if (0 == n) {
|
||||||
usleep(50000);
|
taosMsleep(50);
|
||||||
} else {
|
} else {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1244,7 +1244,7 @@ TEST(tableMeta, rmStbMeta) {
|
||||||
int32_t n = ctgDbgGetClusterCacheNum(pCtg, CTG_DBG_META_NUM);
|
int32_t n = ctgDbgGetClusterCacheNum(pCtg, CTG_DBG_META_NUM);
|
||||||
int32_t m = ctgDbgGetClusterCacheNum(pCtg, CTG_DBG_STB_RENT_NUM);
|
int32_t m = ctgDbgGetClusterCacheNum(pCtg, CTG_DBG_STB_RENT_NUM);
|
||||||
if (n || m) {
|
if (n || m) {
|
||||||
usleep(50000);
|
taosMsleep(50);
|
||||||
} else {
|
} else {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1300,7 +1300,7 @@ TEST(tableMeta, updateStbMeta) {
|
||||||
while (true) {
|
while (true) {
|
||||||
uint32_t n = ctgDbgGetClusterCacheNum(pCtg, CTG_DBG_META_NUM);
|
uint32_t n = ctgDbgGetClusterCacheNum(pCtg, CTG_DBG_META_NUM);
|
||||||
if (0 == n) {
|
if (0 == n) {
|
||||||
usleep(50000);
|
taosMsleep(50);
|
||||||
} else {
|
} else {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1320,7 +1320,7 @@ TEST(tableMeta, updateStbMeta) {
|
||||||
uint64_t n = 0;
|
uint64_t n = 0;
|
||||||
ctgDbgGetStatNum("runtime.qDoneNum", (void *)&n);
|
ctgDbgGetStatNum("runtime.qDoneNum", (void *)&n);
|
||||||
if (n != 3) {
|
if (n != 3) {
|
||||||
usleep(50000);
|
taosMsleep(50);
|
||||||
} else {
|
} else {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1392,7 +1392,7 @@ TEST(refreshGetMeta, normal2normal) {
|
||||||
if (n > 0) {
|
if (n > 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
usleep(50000);
|
taosMsleep(50);
|
||||||
}
|
}
|
||||||
|
|
||||||
STableMeta *tableMeta = NULL;
|
STableMeta *tableMeta = NULL;
|
||||||
|
@ -1410,7 +1410,7 @@ TEST(refreshGetMeta, normal2normal) {
|
||||||
tfree(tableMeta);
|
tfree(tableMeta);
|
||||||
|
|
||||||
while (0 == ctgDbgGetClusterCacheNum(pCtg, CTG_DBG_META_NUM)) {
|
while (0 == ctgDbgGetClusterCacheNum(pCtg, CTG_DBG_META_NUM)) {
|
||||||
usleep(50000);
|
taosMsleep(50);
|
||||||
}
|
}
|
||||||
|
|
||||||
code = catalogRefreshGetTableMeta(pCtg, mockPointer, (const SEpSet *)mockPointer, &n, &tableMeta, 0);
|
code = catalogRefreshGetTableMeta(pCtg, mockPointer, (const SEpSet *)mockPointer, &n, &tableMeta, 0);
|
||||||
|
@ -1471,7 +1471,7 @@ TEST(refreshGetMeta, normal2notexist) {
|
||||||
if (n > 0) {
|
if (n > 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
usleep(50000);
|
taosMsleep(50);
|
||||||
}
|
}
|
||||||
|
|
||||||
STableMeta *tableMeta = NULL;
|
STableMeta *tableMeta = NULL;
|
||||||
|
@ -1489,7 +1489,7 @@ TEST(refreshGetMeta, normal2notexist) {
|
||||||
tfree(tableMeta);
|
tfree(tableMeta);
|
||||||
|
|
||||||
while (0 == ctgDbgGetClusterCacheNum(pCtg, CTG_DBG_META_NUM)) {
|
while (0 == ctgDbgGetClusterCacheNum(pCtg, CTG_DBG_META_NUM)) {
|
||||||
usleep(50000);
|
taosMsleep(50);
|
||||||
}
|
}
|
||||||
|
|
||||||
code = catalogRefreshGetTableMeta(pCtg, mockPointer, (const SEpSet *)mockPointer, &n, &tableMeta, 0);
|
code = catalogRefreshGetTableMeta(pCtg, mockPointer, (const SEpSet *)mockPointer, &n, &tableMeta, 0);
|
||||||
|
@ -1545,7 +1545,7 @@ TEST(refreshGetMeta, normal2child) {
|
||||||
if (n > 0) {
|
if (n > 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
usleep(50000);
|
taosMsleep(50);
|
||||||
}
|
}
|
||||||
|
|
||||||
STableMeta *tableMeta = NULL;
|
STableMeta *tableMeta = NULL;
|
||||||
|
@ -1563,7 +1563,7 @@ TEST(refreshGetMeta, normal2child) {
|
||||||
tfree(tableMeta);
|
tfree(tableMeta);
|
||||||
|
|
||||||
while (0 == ctgDbgGetClusterCacheNum(pCtg, CTG_DBG_META_NUM)) {
|
while (0 == ctgDbgGetClusterCacheNum(pCtg, CTG_DBG_META_NUM)) {
|
||||||
usleep(50000);
|
taosMsleep(50);
|
||||||
}
|
}
|
||||||
|
|
||||||
code = catalogRefreshGetTableMeta(pCtg, mockPointer, (const SEpSet *)mockPointer, &n, &tableMeta, 0);
|
code = catalogRefreshGetTableMeta(pCtg, mockPointer, (const SEpSet *)mockPointer, &n, &tableMeta, 0);
|
||||||
|
@ -1629,7 +1629,7 @@ TEST(refreshGetMeta, stable2child) {
|
||||||
if (n > 0) {
|
if (n > 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
usleep(50000);
|
taosMsleep(50);
|
||||||
}
|
}
|
||||||
|
|
||||||
STableMeta *tableMeta = NULL;
|
STableMeta *tableMeta = NULL;
|
||||||
|
@ -1648,7 +1648,7 @@ TEST(refreshGetMeta, stable2child) {
|
||||||
tfree(tableMeta);
|
tfree(tableMeta);
|
||||||
|
|
||||||
while (0 == ctgDbgGetClusterCacheNum(pCtg, CTG_DBG_META_NUM)) {
|
while (0 == ctgDbgGetClusterCacheNum(pCtg, CTG_DBG_META_NUM)) {
|
||||||
usleep(50000);
|
taosMsleep(50);
|
||||||
}
|
}
|
||||||
|
|
||||||
ctgTestCurrentSTableName = ctgTestSTablename;
|
ctgTestCurrentSTableName = ctgTestSTablename;
|
||||||
|
@ -1714,7 +1714,7 @@ TEST(refreshGetMeta, stable2stable) {
|
||||||
if (n > 0) {
|
if (n > 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
usleep(50000);
|
taosMsleep(50);
|
||||||
}
|
}
|
||||||
|
|
||||||
STableMeta *tableMeta = NULL;
|
STableMeta *tableMeta = NULL;
|
||||||
|
@ -1733,7 +1733,7 @@ TEST(refreshGetMeta, stable2stable) {
|
||||||
tfree(tableMeta);
|
tfree(tableMeta);
|
||||||
|
|
||||||
while (0 == ctgDbgGetClusterCacheNum(pCtg, CTG_DBG_META_NUM)) {
|
while (0 == ctgDbgGetClusterCacheNum(pCtg, CTG_DBG_META_NUM)) {
|
||||||
usleep(50000);
|
taosMsleep(50);
|
||||||
}
|
}
|
||||||
|
|
||||||
code = catalogRefreshGetTableMeta(pCtg, mockPointer, (const SEpSet *)mockPointer, &n, &tableMeta, 0);
|
code = catalogRefreshGetTableMeta(pCtg, mockPointer, (const SEpSet *)mockPointer, &n, &tableMeta, 0);
|
||||||
|
@ -1802,7 +1802,7 @@ TEST(refreshGetMeta, child2stable) {
|
||||||
if (n > 0) {
|
if (n > 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
usleep(50000);
|
taosMsleep(50);
|
||||||
}
|
}
|
||||||
|
|
||||||
STableMeta *tableMeta = NULL;
|
STableMeta *tableMeta = NULL;
|
||||||
|
@ -1819,7 +1819,7 @@ TEST(refreshGetMeta, child2stable) {
|
||||||
tfree(tableMeta);
|
tfree(tableMeta);
|
||||||
|
|
||||||
while (2 != ctgDbgGetClusterCacheNum(pCtg, CTG_DBG_META_NUM)) {
|
while (2 != ctgDbgGetClusterCacheNum(pCtg, CTG_DBG_META_NUM)) {
|
||||||
usleep(50000);
|
taosMsleep(50);
|
||||||
}
|
}
|
||||||
|
|
||||||
ctgTestCurrentSTableName = ctgTestTablename;
|
ctgTestCurrentSTableName = ctgTestTablename;
|
||||||
|
@ -2019,7 +2019,7 @@ TEST(dbVgroup, getSetDbVgroupCase) {
|
||||||
if (n > 0) {
|
if (n > 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
usleep(50000);
|
taosMsleep(50);
|
||||||
}
|
}
|
||||||
|
|
||||||
code = catalogGetTableHashVgroup(pCtg, mockPointer, (const SEpSet *)mockPointer, &n, &vgInfo);
|
code = catalogGetTableHashVgroup(pCtg, mockPointer, (const SEpSet *)mockPointer, &n, &vgInfo);
|
||||||
|
@ -2043,7 +2043,7 @@ TEST(dbVgroup, getSetDbVgroupCase) {
|
||||||
uint64_t n = 0;
|
uint64_t n = 0;
|
||||||
ctgDbgGetStatNum("runtime.qDoneNum", (void *)&n);
|
ctgDbgGetStatNum("runtime.qDoneNum", (void *)&n);
|
||||||
if (n != 3) {
|
if (n != 3) {
|
||||||
usleep(50000);
|
taosMsleep(50);
|
||||||
} else {
|
} else {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -2100,20 +2100,20 @@ TEST(multiThread, getSetRmSameDbVgroup) {
|
||||||
pthread_t thread1, thread2;
|
pthread_t thread1, thread2;
|
||||||
pthread_create(&(thread1), &thattr, ctgTestSetSameDbVgroupThread, pCtg);
|
pthread_create(&(thread1), &thattr, ctgTestSetSameDbVgroupThread, pCtg);
|
||||||
|
|
||||||
sleep(1);
|
taosSsleep(1);
|
||||||
pthread_create(&(thread2), &thattr, ctgTestGetDbVgroupThread, pCtg);
|
pthread_create(&(thread2), &thattr, ctgTestGetDbVgroupThread, pCtg);
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
if (ctgTestDeadLoop) {
|
if (ctgTestDeadLoop) {
|
||||||
sleep(1);
|
taosSsleep(1);
|
||||||
} else {
|
} else {
|
||||||
sleep(ctgTestMTRunSec);
|
taosSsleep(ctgTestMTRunSec);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ctgTestStop = true;
|
ctgTestStop = true;
|
||||||
sleep(1);
|
taosSsleep(1);
|
||||||
|
|
||||||
catalogDestroy();
|
catalogDestroy();
|
||||||
memset(&gCtgMgmt, 0, sizeof(gCtgMgmt));
|
memset(&gCtgMgmt, 0, sizeof(gCtgMgmt));
|
||||||
|
@ -2152,20 +2152,20 @@ TEST(multiThread, getSetRmDiffDbVgroup) {
|
||||||
pthread_t thread1, thread2;
|
pthread_t thread1, thread2;
|
||||||
pthread_create(&(thread1), &thattr, ctgTestSetDiffDbVgroupThread, pCtg);
|
pthread_create(&(thread1), &thattr, ctgTestSetDiffDbVgroupThread, pCtg);
|
||||||
|
|
||||||
sleep(1);
|
taosSsleep(1);
|
||||||
pthread_create(&(thread2), &thattr, ctgTestGetDbVgroupThread, pCtg);
|
pthread_create(&(thread2), &thattr, ctgTestGetDbVgroupThread, pCtg);
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
if (ctgTestDeadLoop) {
|
if (ctgTestDeadLoop) {
|
||||||
sleep(1);
|
taosSsleep(1);
|
||||||
} else {
|
} else {
|
||||||
sleep(ctgTestMTRunSec);
|
taosSsleep(ctgTestMTRunSec);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ctgTestStop = true;
|
ctgTestStop = true;
|
||||||
sleep(1);
|
taosSsleep(1);
|
||||||
|
|
||||||
catalogDestroy();
|
catalogDestroy();
|
||||||
memset(&gCtgMgmt, 0, sizeof(gCtgMgmt));
|
memset(&gCtgMgmt, 0, sizeof(gCtgMgmt));
|
||||||
|
@ -2203,20 +2203,20 @@ TEST(multiThread, ctableMeta) {
|
||||||
|
|
||||||
pthread_t thread1, thread2;
|
pthread_t thread1, thread2;
|
||||||
pthread_create(&(thread1), &thattr, ctgTestSetCtableMetaThread, pCtg);
|
pthread_create(&(thread1), &thattr, ctgTestSetCtableMetaThread, pCtg);
|
||||||
sleep(1);
|
taosSsleep(1);
|
||||||
pthread_create(&(thread1), &thattr, ctgTestGetCtableMetaThread, pCtg);
|
pthread_create(&(thread1), &thattr, ctgTestGetCtableMetaThread, pCtg);
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
if (ctgTestDeadLoop) {
|
if (ctgTestDeadLoop) {
|
||||||
sleep(1);
|
taosSsleep(1);
|
||||||
} else {
|
} else {
|
||||||
sleep(ctgTestMTRunSec);
|
taosSsleep(ctgTestMTRunSec);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ctgTestStop = true;
|
ctgTestStop = true;
|
||||||
sleep(2);
|
taosSsleep(2);
|
||||||
|
|
||||||
catalogDestroy();
|
catalogDestroy();
|
||||||
memset(&gCtgMgmt, 0, sizeof(gCtgMgmt));
|
memset(&gCtgMgmt, 0, sizeof(gCtgMgmt));
|
||||||
|
@ -2267,7 +2267,7 @@ TEST(rentTest, allRent) {
|
||||||
ASSERT_EQ(tableMeta->tableInfo.rowSize, 12);
|
ASSERT_EQ(tableMeta->tableInfo.rowSize, 12);
|
||||||
|
|
||||||
while (ctgDbgGetClusterCacheNum(pCtg, CTG_DBG_META_NUM) < i) {
|
while (ctgDbgGetClusterCacheNum(pCtg, CTG_DBG_META_NUM) < i) {
|
||||||
usleep(50000);
|
taosMsleep(50);
|
||||||
}
|
}
|
||||||
|
|
||||||
code = catalogGetExpiredDBs(pCtg, &dbs, &num);
|
code = catalogGetExpiredDBs(pCtg, &dbs, &num);
|
||||||
|
@ -2292,7 +2292,7 @@ TEST(rentTest, allRent) {
|
||||||
}
|
}
|
||||||
printf("*************************************************\n");
|
printf("*************************************************\n");
|
||||||
|
|
||||||
sleep(2);
|
taosSsleep(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
catalogDestroy();
|
catalogDestroy();
|
||||||
|
|
|
@ -63,7 +63,7 @@ int main(int argc, char** argv) {
|
||||||
TEST(testCase, async_task_test) {
|
TEST(testCase, async_task_test) {
|
||||||
SParam* p = (SParam*)calloc(1, sizeof(SParam));
|
SParam* p = (SParam*)calloc(1, sizeof(SParam));
|
||||||
taosAsyncExec(testPrint, p, NULL);
|
taosAsyncExec(testPrint, p, NULL);
|
||||||
usleep(5000);
|
taosMsleep(5);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(testCase, many_async_task_test) {
|
TEST(testCase, many_async_task_test) {
|
||||||
|
@ -73,14 +73,14 @@ TEST(testCase, many_async_task_test) {
|
||||||
taosAsyncExec(testPrint, p, NULL);
|
taosAsyncExec(testPrint, p, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
usleep(10000);
|
taosMsleep(10);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(testCase, error_in_async_test) {
|
TEST(testCase, error_in_async_test) {
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
SParam* p = (SParam*) calloc(1, sizeof(SParam));
|
SParam* p = (SParam*) calloc(1, sizeof(SParam));
|
||||||
taosAsyncExec(testPrintError, p, &code);
|
taosAsyncExec(testPrintError, p, &code);
|
||||||
usleep(1000);
|
taosMsleep(1);
|
||||||
printf("Error code:%d after asynchronously exec function\n", code);
|
printf("Error code:%d after asynchronously exec function\n", code);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -308,7 +308,7 @@ int32_t qwtExecTask(qTaskInfo_t tinfo, SSDataBlock** pRes, uint64_t *useconds) {
|
||||||
|
|
||||||
if (qwtTestEnableSleep) {
|
if (qwtTestEnableSleep) {
|
||||||
if (runTime) {
|
if (runTime) {
|
||||||
usleep(runTime);
|
taosUsleep(runTime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -590,7 +590,7 @@ void *queryThread(void *param) {
|
||||||
qwtBuildQueryReqMsg(&queryRpc);
|
qwtBuildQueryReqMsg(&queryRpc);
|
||||||
qWorkerProcessQueryMsg(mockPointer, mgmt, &queryRpc);
|
qWorkerProcessQueryMsg(mockPointer, mgmt, &queryRpc);
|
||||||
if (qwtTestEnableSleep) {
|
if (qwtTestEnableSleep) {
|
||||||
usleep(taosRand()%5);
|
taosUsleep(taosRand()%5);
|
||||||
}
|
}
|
||||||
if (++n % qwtTestPrintNum == 0) {
|
if (++n % qwtTestPrintNum == 0) {
|
||||||
printf("query:%d\n", n);
|
printf("query:%d\n", n);
|
||||||
|
@ -612,7 +612,7 @@ void *readyThread(void *param) {
|
||||||
qwtBuildReadyReqMsg(&readyMsg, &readyRpc);
|
qwtBuildReadyReqMsg(&readyMsg, &readyRpc);
|
||||||
code = qWorkerProcessReadyMsg(mockPointer, mgmt, &readyRpc);
|
code = qWorkerProcessReadyMsg(mockPointer, mgmt, &readyRpc);
|
||||||
if (qwtTestEnableSleep) {
|
if (qwtTestEnableSleep) {
|
||||||
usleep(taosRand()%5);
|
taosUsleep(taosRand()%5);
|
||||||
}
|
}
|
||||||
if (++n % qwtTestPrintNum == 0) {
|
if (++n % qwtTestPrintNum == 0) {
|
||||||
printf("ready:%d\n", n);
|
printf("ready:%d\n", n);
|
||||||
|
@ -634,7 +634,7 @@ void *fetchThread(void *param) {
|
||||||
qwtBuildFetchReqMsg(&fetchMsg, &fetchRpc);
|
qwtBuildFetchReqMsg(&fetchMsg, &fetchRpc);
|
||||||
code = qWorkerProcessFetchMsg(mockPointer, mgmt, &fetchRpc);
|
code = qWorkerProcessFetchMsg(mockPointer, mgmt, &fetchRpc);
|
||||||
if (qwtTestEnableSleep) {
|
if (qwtTestEnableSleep) {
|
||||||
usleep(taosRand()%5);
|
taosUsleep(taosRand()%5);
|
||||||
}
|
}
|
||||||
if (++n % qwtTestPrintNum == 0) {
|
if (++n % qwtTestPrintNum == 0) {
|
||||||
printf("fetch:%d\n", n);
|
printf("fetch:%d\n", n);
|
||||||
|
@ -656,7 +656,7 @@ void *dropThread(void *param) {
|
||||||
qwtBuildDropReqMsg(&dropMsg, &dropRpc);
|
qwtBuildDropReqMsg(&dropMsg, &dropRpc);
|
||||||
code = qWorkerProcessDropMsg(mockPointer, mgmt, &dropRpc);
|
code = qWorkerProcessDropMsg(mockPointer, mgmt, &dropRpc);
|
||||||
if (qwtTestEnableSleep) {
|
if (qwtTestEnableSleep) {
|
||||||
usleep(taosRand()%5);
|
taosUsleep(taosRand()%5);
|
||||||
}
|
}
|
||||||
if (++n % qwtTestPrintNum == 0) {
|
if (++n % qwtTestPrintNum == 0) {
|
||||||
printf("drop:%d\n", n);
|
printf("drop:%d\n", n);
|
||||||
|
@ -678,7 +678,7 @@ void *statusThread(void *param) {
|
||||||
qwtBuildStatusReqMsg(&statusMsg, &statusRpc);
|
qwtBuildStatusReqMsg(&statusMsg, &statusRpc);
|
||||||
code = qWorkerProcessStatusMsg(mockPointer, mgmt, &statusRpc);
|
code = qWorkerProcessStatusMsg(mockPointer, mgmt, &statusRpc);
|
||||||
if (qwtTestEnableSleep) {
|
if (qwtTestEnableSleep) {
|
||||||
usleep(taosRand()%5);
|
taosUsleep(taosRand()%5);
|
||||||
}
|
}
|
||||||
if (++n % qwtTestPrintNum == 0) {
|
if (++n % qwtTestPrintNum == 0) {
|
||||||
printf("status:%d\n", n);
|
printf("status:%d\n", n);
|
||||||
|
@ -696,7 +696,7 @@ void *qwtclientThread(void *param) {
|
||||||
void *mockPointer = (void *)0x1;
|
void *mockPointer = (void *)0x1;
|
||||||
SRpcMsg queryRpc = {0};
|
SRpcMsg queryRpc = {0};
|
||||||
|
|
||||||
sleep(1);
|
taosSsleep(1);
|
||||||
|
|
||||||
while (!qwtTestStop) {
|
while (!qwtTestStop) {
|
||||||
qwtTestCaseFinished = false;
|
qwtTestCaseFinished = false;
|
||||||
|
@ -705,7 +705,7 @@ void *qwtclientThread(void *param) {
|
||||||
qwtPutReqToQueue((void *)0x1, &queryRpc);
|
qwtPutReqToQueue((void *)0x1, &queryRpc);
|
||||||
|
|
||||||
while (!qwtTestCaseFinished) {
|
while (!qwtTestCaseFinished) {
|
||||||
usleep(1);
|
taosUsleep(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -751,7 +751,7 @@ void *queryQueueThread(void *param) {
|
||||||
int32_t delay = taosRand() % qwtTestReqMaxDelayUsec;
|
int32_t delay = taosRand() % qwtTestReqMaxDelayUsec;
|
||||||
|
|
||||||
if (delay) {
|
if (delay) {
|
||||||
usleep(delay);
|
taosUsleep(delay);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -807,7 +807,7 @@ void *fetchQueueThread(void *param) {
|
||||||
int32_t delay = taosRand() % qwtTestReqMaxDelayUsec;
|
int32_t delay = taosRand() % qwtTestReqMaxDelayUsec;
|
||||||
|
|
||||||
if (delay) {
|
if (delay) {
|
||||||
usleep(delay);
|
taosUsleep(delay);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -982,21 +982,21 @@ TEST(seqTest, randCase) {
|
||||||
qwtBuildReadyReqMsg(&readyMsg, &readyRpc);
|
qwtBuildReadyReqMsg(&readyMsg, &readyRpc);
|
||||||
code = qWorkerProcessReadyMsg(mockPointer, mgmt, &readyRpc);
|
code = qWorkerProcessReadyMsg(mockPointer, mgmt, &readyRpc);
|
||||||
if (qwtTestEnableSleep) {
|
if (qwtTestEnableSleep) {
|
||||||
usleep(1);
|
taosUsleep(1);
|
||||||
}
|
}
|
||||||
} else if (r >= maxr * 2/5 && r < maxr* 3/5) {
|
} else if (r >= maxr * 2/5 && r < maxr* 3/5) {
|
||||||
printf("Fetch,%d\n", t++);
|
printf("Fetch,%d\n", t++);
|
||||||
qwtBuildFetchReqMsg(&fetchMsg, &fetchRpc);
|
qwtBuildFetchReqMsg(&fetchMsg, &fetchRpc);
|
||||||
code = qWorkerProcessFetchMsg(mockPointer, mgmt, &fetchRpc);
|
code = qWorkerProcessFetchMsg(mockPointer, mgmt, &fetchRpc);
|
||||||
if (qwtTestEnableSleep) {
|
if (qwtTestEnableSleep) {
|
||||||
usleep(1);
|
taosUsleep(1);
|
||||||
}
|
}
|
||||||
} else if (r >= maxr * 3/5 && r < maxr * 4/5) {
|
} else if (r >= maxr * 3/5 && r < maxr * 4/5) {
|
||||||
printf("Drop,%d\n", t++);
|
printf("Drop,%d\n", t++);
|
||||||
qwtBuildDropReqMsg(&dropMsg, &dropRpc);
|
qwtBuildDropReqMsg(&dropMsg, &dropRpc);
|
||||||
code = qWorkerProcessDropMsg(mockPointer, mgmt, &dropRpc);
|
code = qWorkerProcessDropMsg(mockPointer, mgmt, &dropRpc);
|
||||||
if (qwtTestEnableSleep) {
|
if (qwtTestEnableSleep) {
|
||||||
usleep(1);
|
taosUsleep(1);
|
||||||
}
|
}
|
||||||
} else if (r >= maxr * 4/5 && r < maxr-1) {
|
} else if (r >= maxr * 4/5 && r < maxr-1) {
|
||||||
printf("Status,%d\n", t++);
|
printf("Status,%d\n", t++);
|
||||||
|
@ -1004,7 +1004,7 @@ TEST(seqTest, randCase) {
|
||||||
code = qWorkerProcessStatusMsg(mockPointer, mgmt, &statusRpc);
|
code = qWorkerProcessStatusMsg(mockPointer, mgmt, &statusRpc);
|
||||||
ASSERT_EQ(code, 0);
|
ASSERT_EQ(code, 0);
|
||||||
if (qwtTestEnableSleep) {
|
if (qwtTestEnableSleep) {
|
||||||
usleep(1);
|
taosUsleep(1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
printf("QUIT RAND NOW");
|
printf("QUIT RAND NOW");
|
||||||
|
@ -1042,15 +1042,15 @@ TEST(seqTest, multithreadRand) {
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
if (qwtTestDeadLoop) {
|
if (qwtTestDeadLoop) {
|
||||||
sleep(1);
|
taosSsleep(1);
|
||||||
} else {
|
} else {
|
||||||
sleep(qwtTestMTRunSec);
|
taosSsleep(qwtTestMTRunSec);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
qwtTestStop = true;
|
qwtTestStop = true;
|
||||||
sleep(3);
|
taosSsleep(3);
|
||||||
|
|
||||||
qWorkerDestroy(&mgmt);
|
qWorkerDestroy(&mgmt);
|
||||||
}
|
}
|
||||||
|
@ -1099,9 +1099,9 @@ TEST(rcTest, shortExecshortDelay) {
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
if (qwtTestDeadLoop) {
|
if (qwtTestDeadLoop) {
|
||||||
sleep(1);
|
taosSsleep(1);
|
||||||
} else {
|
} else {
|
||||||
sleep(qwtTestMTRunSec);
|
taosSsleep(qwtTestMTRunSec);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1113,14 +1113,14 @@ TEST(rcTest, shortExecshortDelay) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
sleep(1);
|
taosSsleep(1);
|
||||||
|
|
||||||
if (qwtTestCaseFinished) {
|
if (qwtTestCaseFinished) {
|
||||||
if (qwtTestQuitThreadNum < 3) {
|
if (qwtTestQuitThreadNum < 3) {
|
||||||
tsem_post(&qwtTestQuerySem);
|
tsem_post(&qwtTestQuerySem);
|
||||||
tsem_post(&qwtTestFetchSem);
|
tsem_post(&qwtTestFetchSem);
|
||||||
|
|
||||||
usleep(10);
|
taosUsleep(10);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1180,9 +1180,9 @@ TEST(rcTest, longExecshortDelay) {
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
if (qwtTestDeadLoop) {
|
if (qwtTestDeadLoop) {
|
||||||
sleep(1);
|
taosSsleep(1);
|
||||||
} else {
|
} else {
|
||||||
sleep(qwtTestMTRunSec);
|
taosSsleep(qwtTestMTRunSec);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1195,14 +1195,14 @@ TEST(rcTest, longExecshortDelay) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
sleep(1);
|
taosSsleep(1);
|
||||||
|
|
||||||
if (qwtTestCaseFinished) {
|
if (qwtTestCaseFinished) {
|
||||||
if (qwtTestQuitThreadNum < 3) {
|
if (qwtTestQuitThreadNum < 3) {
|
||||||
tsem_post(&qwtTestQuerySem);
|
tsem_post(&qwtTestQuerySem);
|
||||||
tsem_post(&qwtTestFetchSem);
|
tsem_post(&qwtTestFetchSem);
|
||||||
|
|
||||||
usleep(10);
|
taosUsleep(10);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1263,9 +1263,9 @@ TEST(rcTest, shortExeclongDelay) {
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
if (qwtTestDeadLoop) {
|
if (qwtTestDeadLoop) {
|
||||||
sleep(1);
|
taosSsleep(1);
|
||||||
} else {
|
} else {
|
||||||
sleep(qwtTestMTRunSec);
|
taosSsleep(qwtTestMTRunSec);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1278,14 +1278,14 @@ TEST(rcTest, shortExeclongDelay) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
sleep(1);
|
taosSsleep(1);
|
||||||
|
|
||||||
if (qwtTestCaseFinished) {
|
if (qwtTestCaseFinished) {
|
||||||
if (qwtTestQuitThreadNum < 3) {
|
if (qwtTestQuitThreadNum < 3) {
|
||||||
tsem_post(&qwtTestQuerySem);
|
tsem_post(&qwtTestQuerySem);
|
||||||
tsem_post(&qwtTestFetchSem);
|
tsem_post(&qwtTestFetchSem);
|
||||||
|
|
||||||
usleep(10);
|
taosUsleep(10);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1342,15 +1342,15 @@ TEST(rcTest, dropTest) {
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
if (qwtTestDeadLoop) {
|
if (qwtTestDeadLoop) {
|
||||||
sleep(1);
|
taosSsleep(1);
|
||||||
} else {
|
} else {
|
||||||
sleep(qwtTestMTRunSec);
|
taosSsleep(qwtTestMTRunSec);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
qwtTestStop = true;
|
qwtTestStop = true;
|
||||||
sleep(3);
|
taosSsleep(3);
|
||||||
|
|
||||||
qWorkerDestroy(&mgmt);
|
qWorkerDestroy(&mgmt);
|
||||||
}
|
}
|
||||||
|
|
|
@ -278,7 +278,7 @@ void *schtSendRsp(void *param) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
usleep(1000);
|
taosMsleep(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
pJob = schAcquireJob(job);
|
pJob = schAcquireJob(job);
|
||||||
|
@ -303,7 +303,7 @@ void *schtCreateFetchRspThread(void *param) {
|
||||||
int64_t job = *(int64_t *)param;
|
int64_t job = *(int64_t *)param;
|
||||||
SSchJob* pJob = schAcquireJob(job);
|
SSchJob* pJob = schAcquireJob(job);
|
||||||
|
|
||||||
sleep(1);
|
taosSsleep(1);
|
||||||
|
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
SRetrieveTableRsp *rsp = (SRetrieveTableRsp *)calloc(1, sizeof(SRetrieveTableRsp));
|
SRetrieveTableRsp *rsp = (SRetrieveTableRsp *)calloc(1, sizeof(SRetrieveTableRsp));
|
||||||
|
@ -327,7 +327,7 @@ void *schtFetchRspThread(void *aa) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
usleep(1);
|
taosUsleep(1);
|
||||||
|
|
||||||
param = (SSchCallbackParam *)calloc(1, sizeof(*param));
|
param = (SSchCallbackParam *)calloc(1, sizeof(*param));
|
||||||
|
|
||||||
|
@ -532,7 +532,7 @@ void* schtRunJobThread(void *aa) {
|
||||||
|
|
||||||
void* schtFreeJobThread(void *aa) {
|
void* schtFreeJobThread(void *aa) {
|
||||||
while (!schtTestStop) {
|
while (!schtTestStop) {
|
||||||
usleep(taosRand() % 100);
|
taosUsleep(taosRand() % 100);
|
||||||
schtFreeQueryJob(1);
|
schtFreeQueryJob(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -701,15 +701,15 @@ TEST(multiThread, forceFree) {
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
if (schtTestDeadLoop) {
|
if (schtTestDeadLoop) {
|
||||||
sleep(1);
|
taosSsleep(1);
|
||||||
} else {
|
} else {
|
||||||
sleep(schtTestMTRunSec);
|
taosSsleep(schtTestMTRunSec);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
schtTestStop = true;
|
schtTestStop = true;
|
||||||
sleep(3);
|
taosSsleep(3);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
|
|
|
@ -39,11 +39,11 @@ int main() {
|
||||||
rpcMsg.msgType = 77;
|
rpcMsg.msgType = 77;
|
||||||
|
|
||||||
syncIOSendMsg(gSyncIO->clientRpc, &epSet, &rpcMsg);
|
syncIOSendMsg(gSyncIO->clientRpc, &epSet, &rpcMsg);
|
||||||
sleep(1);
|
taosSsleep(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
sleep(1);
|
taosSsleep(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -26,7 +26,7 @@ int main() {
|
||||||
assert(ret == 0);
|
assert(ret == 0);
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
sleep(1);
|
taosSsleep(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -39,11 +39,11 @@ int main() {
|
||||||
rpcMsg.msgType = 77;
|
rpcMsg.msgType = 77;
|
||||||
|
|
||||||
syncIOSendMsg(gSyncIO->clientRpc, &epSet, &rpcMsg);
|
syncIOSendMsg(gSyncIO->clientRpc, &epSet, &rpcMsg);
|
||||||
sleep(1);
|
taosSsleep(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
sleep(1);
|
taosSsleep(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -29,7 +29,7 @@ int main() {
|
||||||
assert(ret == 0);
|
assert(ret == 0);
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
sleep(1);
|
taosSsleep(1);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ int main() {
|
||||||
assert(ret == 0);
|
assert(ret == 0);
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
sleep(1);
|
taosSsleep(1);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,7 +107,7 @@ static void *sendRequest(void *param) {
|
||||||
|
|
||||||
tDebug("recv response succefully");
|
tDebug("recv response succefully");
|
||||||
|
|
||||||
// usleep(100000000);
|
// taosSsleep(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
tError("send and recv sum: %d, %d, %d, %d", u100, u500, u1000, u10000);
|
tError("send and recv sum: %d, %d, %d, %d", u100, u500, u1000, u10000);
|
||||||
|
@ -223,7 +223,7 @@ int main(int argc, char *argv[]) {
|
||||||
}
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
usleep(1);
|
taosUsleep(1);
|
||||||
} while (tcount < appThreads);
|
} while (tcount < appThreads);
|
||||||
|
|
||||||
gettimeofday(&systemTime, NULL);
|
gettimeofday(&systemTime, NULL);
|
||||||
|
|
|
@ -77,7 +77,7 @@ void processShellMsg() {
|
||||||
taosFreeQitem(pRpcMsg);
|
taosFreeQitem(pRpcMsg);
|
||||||
|
|
||||||
{
|
{
|
||||||
// sleep(1);
|
// taosSsleep(1);
|
||||||
SRpcMsg nRpcMsg = {0};
|
SRpcMsg nRpcMsg = {0};
|
||||||
nRpcMsg.pCont = rpcMallocCont(msgSize);
|
nRpcMsg.pCont = rpcMallocCont(msgSize);
|
||||||
nRpcMsg.contLen = msgSize;
|
nRpcMsg.contLen = msgSize;
|
||||||
|
@ -176,7 +176,7 @@ int main(int argc, char *argv[]) {
|
||||||
tError("failed to start RPC server");
|
tError("failed to start RPC server");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
// sleep(5);
|
// taosSsleep(5);
|
||||||
|
|
||||||
tInfo("RPC server is running, ctrl-c to exit");
|
tInfo("RPC server is running, ctrl-c to exit");
|
||||||
|
|
||||||
|
|
|
@ -84,7 +84,7 @@ static void *sendRequest(void *param) {
|
||||||
|
|
||||||
tDebug("recv response succefully");
|
tDebug("recv response succefully");
|
||||||
|
|
||||||
// usleep(100000000);
|
// taosSsleep(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
tError("send and recv sum: %d, %d, %d, %d", u100, u500, u1000, u10000);
|
tError("send and recv sum: %d, %d, %d, %d", u100, u500, u1000, u10000);
|
||||||
|
@ -200,7 +200,7 @@ int main(int argc, char *argv[]) {
|
||||||
}
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
usleep(1);
|
taosUsleep(1);
|
||||||
} while (tcount < appThreads);
|
} while (tcount < appThreads);
|
||||||
|
|
||||||
gettimeofday(&systemTime, NULL);
|
gettimeofday(&systemTime, NULL);
|
||||||
|
|
|
@ -178,7 +178,7 @@ int main(int argc, char *argv[]) {
|
||||||
}
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
usleep(1);
|
taosUsleep(1);
|
||||||
} while ( tcount < appThreads);
|
} while ( tcount < appThreads);
|
||||||
|
|
||||||
gettimeofday(&systemTime, NULL);
|
gettimeofday(&systemTime, NULL);
|
||||||
|
|
|
@ -85,7 +85,7 @@ static void *sendRequest(void *param) {
|
||||||
|
|
||||||
tDebug("recv response succefully");
|
tDebug("recv response succefully");
|
||||||
|
|
||||||
// usleep(100000000);
|
// taosSsleep(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
tError("send and recv sum: %d, %d, %d, %d", u100, u500, u1000, u10000);
|
tError("send and recv sum: %d, %d, %d, %d", u100, u500, u1000, u10000);
|
||||||
|
@ -201,7 +201,7 @@ int main(int argc, char *argv[]) {
|
||||||
}
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
usleep(1);
|
taosUsleep(1);
|
||||||
} while (tcount < appThreads);
|
} while (tcount < appThreads);
|
||||||
|
|
||||||
gettimeofday(&systemTime, NULL);
|
gettimeofday(&systemTime, NULL);
|
||||||
|
|
|
@ -13,47 +13,35 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define ALLOW_FORBID_FUNC
|
||||||
#define _DEFAULT_SOURCE
|
#define _DEFAULT_SOURCE
|
||||||
#include "os.h"
|
#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>
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
void taosSsleep(int32_t s) {
|
||||||
to make taosMsleep work,
|
#if defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32)
|
||||||
signal SIGALRM shall be blocked in the calling thread,
|
Sleep(1000 * s);
|
||||||
|
|
||||||
sigset_t set;
|
|
||||||
sigemptyset(&set);
|
|
||||||
sigaddset(&set, SIGALRM);
|
|
||||||
pthread_sigmask(SIG_BLOCK, &set, NULL);
|
|
||||||
*/
|
|
||||||
void taosMsleep(int32_t mseconds) {
|
|
||||||
#if 1
|
|
||||||
usleep(mseconds * 1000);
|
|
||||||
#else
|
#else
|
||||||
struct timeval timeout;
|
sleep(s);
|
||||||
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);
|
|
||||||
|
|
||||||
/* pthread_sigmask(SIG_UNBLOCK, &set, NULL); */
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void taosMsleep(int32_t ms) {
|
||||||
|
#if defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32)
|
||||||
|
Sleep(ms);
|
||||||
|
#else
|
||||||
|
usleep(ms * 1000);
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void taosUsleep(int32_t us) {
|
||||||
|
#if defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32)
|
||||||
|
nanosleep(1000 * us);
|
||||||
|
#else
|
||||||
|
usleep(us);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
|
@ -291,11 +291,10 @@ int32_t twcslen(const wchar_t *wcs) {
|
||||||
|
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tasoUcs4Compare(void *f1_ucs4, void *f2_ucs4, int32_t bytes) {
|
int32_t tasoUcs4Compare(void *f1_ucs4, void *f2_ucs4, int32_t bytes) {
|
||||||
for (int32_t i = 0; i < bytes; ++i) {
|
for (int32_t i = 0; i < bytes; i += TSDB_NCHAR_SIZE) {
|
||||||
int32_t f1 = *(int32_t *)((char *)f1_ucs4 + i * 4);
|
int32_t f1 = *(int32_t *)((char *)f1_ucs4 + i);
|
||||||
int32_t f2 = *(int32_t *)((char *)f2_ucs4 + i * 4);
|
int32_t f2 = *(int32_t *)((char *)f2_ucs4 + i);
|
||||||
|
|
||||||
if ((f1 == 0 && f2 != 0) || (f1 != 0 && f2 == 0)) {
|
if ((f1 == 0 && f2 != 0) || (f1 != 0 && f2 == 0)) {
|
||||||
return f1 - f2;
|
return f1 - f2;
|
||||||
|
|
|
@ -14,7 +14,7 @@ TEST(cacheTest, client_cache_test) {
|
||||||
char data1[] = "test11";
|
char data1[] = "test11";
|
||||||
|
|
||||||
char* cachedObj = (char*) taosCachePut(tscMetaCache, key1, strlen(key1), data1, strlen(data1)+1, 1);
|
char* cachedObj = (char*) taosCachePut(tscMetaCache, key1, strlen(key1), data1, strlen(data1)+1, 1);
|
||||||
sleep(REFRESH_TIME_IN_SEC+1);
|
taosSsleep(REFRESH_TIME_IN_SEC+1);
|
||||||
|
|
||||||
printf("obj is still valid: %s\n", cachedObj);
|
printf("obj is still valid: %s\n", cachedObj);
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ TEST(cacheTest, client_cache_test) {
|
||||||
|
|
||||||
taosCacheRelease(tscMetaCache, (void**) &cachedObj2, false);
|
taosCacheRelease(tscMetaCache, (void**) &cachedObj2, false);
|
||||||
|
|
||||||
sleep(3);
|
taosSsleep(3);
|
||||||
char* d = (char*) taosCacheAcquireByKey(tscMetaCache, key3, strlen(key3));
|
char* d = (char*) taosCacheAcquireByKey(tscMetaCache, key3, strlen(key3));
|
||||||
assert(d == NULL);
|
assert(d == NULL);
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ void *addRef(void *param) {
|
||||||
pSpace->p[id] = malloc(128);
|
pSpace->p[id] = malloc(128);
|
||||||
pSpace->rid[id] = taosAddRef(pSpace->rsetId, pSpace->p[id]);
|
pSpace->rid[id] = taosAddRef(pSpace->rsetId, pSpace->p[id]);
|
||||||
}
|
}
|
||||||
usleep(100);
|
taosUsleep(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -60,7 +60,7 @@ void *removeRef(void *param) {
|
||||||
if (code == 0) pSpace->rid[id] = 0;
|
if (code == 0) pSpace->rid[id] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
usleep(100);
|
taosUsleep(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -76,7 +76,7 @@ void *acquireRelease(void *param) {
|
||||||
id = random() % pSpace->refNum;
|
id = random() % pSpace->refNum;
|
||||||
void *p = taosAcquireRef(pSpace->rsetId, (int64_t) pSpace->p[id]);
|
void *p = taosAcquireRef(pSpace->rsetId, (int64_t) pSpace->p[id]);
|
||||||
if (p) {
|
if (p) {
|
||||||
usleep(id % 5 + 1);
|
taosUsleep(id % 5 + 1);
|
||||||
taosReleaseRef(pSpace->rsetId, (int64_t) pSpace->p[id]);
|
taosReleaseRef(pSpace->rsetId, (int64_t) pSpace->p[id]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5089,7 +5089,7 @@ int main(int argc, char *argv[])
|
||||||
//pthread_create(&(pThreadList[3]), &thattr, runcase, (void *)&par[3]);
|
//pthread_create(&(pThreadList[3]), &thattr, runcase, (void *)&par[3]);
|
||||||
|
|
||||||
while(1) {
|
while(1) {
|
||||||
sleep(1);
|
taosSsleep(1);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue