Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
41d97eee
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看板
提交
41d97eee
编写于
8月 09, 2020
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TD-1057
上级
a9cabb54
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
55 addition
and
55 deletion
+55
-55
src/client/src/tscSql.c
src/client/src/tscSql.c
+7
-7
src/client/src/tscSub.c
src/client/src/tscSub.c
+4
-4
src/client/src/tscSubquery.c
src/client/src/tscSubquery.c
+2
-2
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+1
-1
src/dnode/src/dnodeSystem.c
src/dnode/src/dnodeSystem.c
+4
-4
src/dnode/src/dnodeTelemetry.c
src/dnode/src/dnodeTelemetry.c
+4
-4
src/kit/taosdemo/taosdemo.c
src/kit/taosdemo/taosdemo.c
+15
-15
src/query/inc/qExecutor.h
src/query/inc/qExecutor.h
+1
-1
src/rpc/test/rclient.c
src/rpc/test/rclient.c
+5
-5
src/rpc/test/rsclient.c
src/rpc/test/rsclient.c
+3
-3
src/sync/src/tarbitrator.c
src/sync/src/tarbitrator.c
+4
-4
src/sync/test/syncClient.c
src/sync/test/syncClient.c
+5
-5
未找到文件。
src/client/src/tscSql.c
浏览文件 @
41d97eee
...
...
@@ -141,7 +141,7 @@ static void syncConnCallback(void *param, TAOS_RES *tres, int code) {
SSqlObj
*
pSql
=
(
SSqlObj
*
)
tres
;
assert
(
pSql
!=
NULL
);
sem_post
(
&
pSql
->
rspSem
);
t
sem_post
(
&
pSql
->
rspSem
);
}
TAOS
*
taos_connect
(
const
char
*
ip
,
const
char
*
user
,
const
char
*
pass
,
const
char
*
db
,
uint16_t
port
)
{
...
...
@@ -156,7 +156,7 @@ TAOS *taos_connect(const char *ip, const char *user, const char *pass, const cha
pSql
->
param
=
pSql
;
tscProcessSql
(
pSql
);
sem_wait
(
&
pSql
->
rspSem
);
t
sem_wait
(
&
pSql
->
rspSem
);
if
(
pSql
->
res
.
code
!=
TSDB_CODE_SUCCESS
)
{
terrno
=
pSql
->
res
.
code
;
...
...
@@ -225,12 +225,12 @@ void waitForQueryRsp(void *param, TAOS_RES *tres, int code) {
assert
(
tres
!=
NULL
);
SSqlObj
*
pSql
=
(
SSqlObj
*
)
tres
;
sem_post
(
&
pSql
->
rspSem
);
t
sem_post
(
&
pSql
->
rspSem
);
}
static
void
waitForRetrieveRsp
(
void
*
param
,
TAOS_RES
*
tres
,
int
numOfRows
)
{
SSqlObj
*
pSql
=
(
SSqlObj
*
)
tres
;
sem_post
(
&
pSql
->
rspSem
);
t
sem_post
(
&
pSql
->
rspSem
);
}
TAOS_RES
*
taos_query
(
TAOS
*
taos
,
const
char
*
sqlstr
)
{
...
...
@@ -439,7 +439,7 @@ TAOS_ROW taos_fetch_row(TAOS_RES *res) {
pCmd
->
command
==
TSDB_SQL_CLI_VERSION
||
pCmd
->
command
==
TSDB_SQL_CURRENT_USER
))
{
taos_fetch_rows_a
(
res
,
waitForRetrieveRsp
,
pSql
->
pTscObj
);
sem_wait
(
&
pSql
->
rspSem
);
t
sem_wait
(
&
pSql
->
rspSem
);
}
return
doSetResultRowData
(
pSql
,
true
);
...
...
@@ -729,7 +729,7 @@ static void asyncCallback(void *param, TAOS_RES *tres, int code) {
assert
(
param
!=
NULL
);
SSqlObj
*
pSql
=
((
SSqlObj
*
)
param
);
pSql
->
res
.
code
=
code
;
sem_post
(
&
pSql
->
rspSem
);
t
sem_post
(
&
pSql
->
rspSem
);
}
int
taos_validate_sql
(
TAOS
*
taos
,
const
char
*
sql
)
{
...
...
@@ -780,7 +780,7 @@ int taos_validate_sql(TAOS *taos, const char *sql) {
pSql
->
param
=
pSql
;
int
code
=
tsParseSql
(
pSql
,
true
);
if
(
code
==
TSDB_CODE_TSC_ACTION_IN_PROGRESS
)
{
sem_wait
(
&
pSql
->
rspSem
);
t
sem_wait
(
&
pSql
->
rspSem
);
code
=
pSql
->
res
.
code
;
}
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
...
...
src/client/src/tscSub.c
浏览文件 @
41d97eee
...
...
@@ -33,7 +33,7 @@ typedef struct SSubscriptionProgress {
typedef
struct
SSub
{
void
*
signature
;
char
topic
[
32
];
sem_t
sem
;
tsem_t
sem
;
int64_t
lastSyncTime
;
int64_t
lastConsumeTime
;
TAOS
*
taos
;
...
...
@@ -85,7 +85,7 @@ static void asyncCallback(void *param, TAOS_RES *tres, int code) {
assert
(
param
!=
NULL
);
SSub
*
pSub
=
((
SSub
*
)
param
);
pSub
->
pSql
->
res
.
code
=
code
;
sem_post
(
&
pSub
->
sem
);
t
sem_post
(
&
pSub
->
sem
);
}
...
...
@@ -154,7 +154,7 @@ static SSub* tscCreateSubscription(STscObj* pObj, const char* topic, const char*
code
=
tsParseSql
(
pSql
,
false
);
if
(
code
==
TSDB_CODE_TSC_ACTION_IN_PROGRESS
)
{
sem_wait
(
&
pSub
->
sem
);
t
sem_wait
(
&
pSub
->
sem
);
code
=
pSql
->
res
.
code
;
}
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
...
...
@@ -451,7 +451,7 @@ TAOS_RES *taos_consume(TAOS_SUB *tsub) {
pSql
->
fetchFp
=
asyncCallback
;
pSql
->
param
=
pSub
;
tscDoQuery
(
pSql
);
sem_wait
(
&
pSub
->
sem
);
t
sem_wait
(
&
pSub
->
sem
);
if
(
pRes
->
code
!=
TSDB_CODE_SUCCESS
)
{
continue
;
...
...
src/client/src/tscSubquery.c
浏览文件 @
41d97eee
...
...
@@ -2057,7 +2057,7 @@ void tscBuildResFromSubqueries(SSqlObj *pSql) {
}
doBuildResFromSubqueries
(
pSql
);
sem_post
(
&
pSql
->
rspSem
);
t
sem_post
(
&
pSql
->
rspSem
);
return
;
...
...
@@ -2083,7 +2083,7 @@ void tscBuildResFromSubqueries(SSqlObj *pSql) {
// free(pState);
//
// pRes->completed = true; // set query completed
// sem_post(&pSql->rspSem);
//
t
sem_post(&pSql->rspSem);
// return;
// }
...
...
src/client/src/tscUtil.c
浏览文件 @
41d97eee
...
...
@@ -387,7 +387,7 @@ void tscFreeSqlObj(SSqlObj* pSql) {
pCmd
->
allocSize
=
0
;
taosTFree
(
pSql
->
sqlstr
);
sem_destroy
(
&
pSql
->
rspSem
);
t
sem_destroy
(
&
pSql
->
rspSem
);
free
(
pSql
);
}
...
...
src/dnode/src/dnodeSystem.c
浏览文件 @
41d97eee
...
...
@@ -22,7 +22,7 @@
#include "dnodeMain.h"
static
void
signal_handler
(
int32_t
signum
,
siginfo_t
*
sigInfo
,
void
*
context
);
static
sem_t
exitSem
;
static
t
sem_t
exitSem
;
int32_t
main
(
int32_t
argc
,
char
*
argv
[])
{
// Set global configuration file
...
...
@@ -88,7 +88,7 @@ int32_t main(int32_t argc, char *argv[]) {
#endif
}
if
(
sem_init
(
&
exitSem
,
0
,
0
)
!=
0
)
{
if
(
t
sem_init
(
&
exitSem
,
0
,
0
)
!=
0
)
{
printf
(
"failed to create exit semphore
\n
"
);
exit
(
EXIT_FAILURE
);
}
...
...
@@ -117,7 +117,7 @@ int32_t main(int32_t argc, char *argv[]) {
syslog
(
LOG_INFO
,
"Started TDengine service successfully."
);
for
(
int
res
=
sem_wait
(
&
exitSem
);
res
!=
0
;
res
=
sem_wait
(
&
exitSem
))
{
for
(
int
res
=
tsem_wait
(
&
exitSem
);
res
!=
0
;
res
=
t
sem_wait
(
&
exitSem
))
{
if
(
res
!=
EINTR
)
{
syslog
(
LOG_ERR
,
"failed to wait exit semphore: %d"
,
res
);
break
;
...
...
@@ -157,5 +157,5 @@ static void signal_handler(int32_t signum, siginfo_t *sigInfo, void *context) {
sigaction
(
SIGUSR2
,
&
act
,
NULL
);
// inform main thread to exit
sem_post
(
&
exitSem
);
t
sem_post
(
&
exitSem
);
}
src/dnode/src/dnodeTelemetry.c
浏览文件 @
41d97eee
...
...
@@ -36,7 +36,7 @@
#include "dnodeInt.h"
#include "dnodeTelemetry.h"
static
sem_t
tsExitSem
;
static
t
sem_t
tsExitSem
;
static
pthread_t
tsTelemetryThread
;
#define TELEMETRY_SERVER "telemetry.taosdata.com"
...
...
@@ -266,7 +266,7 @@ int32_t dnodeInitTelemetry() {
return
0
;
}
if
(
sem_init
(
&
tsExitSem
,
0
,
0
)
==
-
1
)
{
if
(
t
sem_init
(
&
tsExitSem
,
0
,
0
)
==
-
1
)
{
// just log the error, it is ok for telemetry to fail
dTrace
(
"failed to create semaphore for telemetry, reason:%s"
,
strerror
(
errno
));
return
0
;
...
...
@@ -291,8 +291,8 @@ void dnodeCleanupTelemetry() {
}
if
(
tsTelemetryThread
)
{
sem_post
(
&
tsExitSem
);
t
sem_post
(
&
tsExitSem
);
pthread_join
(
tsTelemetryThread
,
NULL
);
sem_destroy
(
&
tsExitSem
);
t
sem_destroy
(
&
tsExitSem
);
}
}
src/kit/taosdemo/taosdemo.c
浏览文件 @
41d97eee
...
...
@@ -440,9 +440,9 @@ typedef struct {
char
*
cols
;
bool
use_metric
;
sem_t
mutex_sem
;
t
sem_t
mutex_sem
;
int
notFinished
;
sem_t
lock_sem
;
t
sem_t
lock_sem
;
}
info
;
typedef
struct
{
...
...
@@ -459,9 +459,9 @@ typedef struct {
int
data_of_order
;
int
data_of_rate
;
sem_t
*
mutex_sem
;
int
*
notFinished
;
sem_t
*
lock_sem
;
t
sem_t
*
mutex_sem
;
int
*
notFinished
;
t
sem_t
*
lock_sem
;
}
sTable
;
/* ******************************* Global
...
...
@@ -729,9 +729,9 @@ int main(int argc, char *argv[]) {
t_info
->
end_table_id
=
i
<
b
?
last
+
a
:
last
+
a
-
1
;
last
=
t_info
->
end_table_id
+
1
;
sem_init
(
&
(
t_info
->
mutex_sem
),
0
,
1
);
t
sem_init
(
&
(
t_info
->
mutex_sem
),
0
,
1
);
t_info
->
notFinished
=
t_info
->
end_table_id
-
t_info
->
start_table_id
+
1
;
sem_init
(
&
(
t_info
->
lock_sem
),
0
,
0
);
t
sem_init
(
&
(
t_info
->
lock_sem
),
0
,
0
);
if
(
query_mode
==
SYNC
)
{
pthread_create
(
pids
+
i
,
NULL
,
syncWrite
,
t_info
);
...
...
@@ -762,8 +762,8 @@ int main(int argc, char *argv[]) {
for
(
int
i
=
0
;
i
<
threads
;
i
++
)
{
info
*
t_info
=
infos
+
i
;
taos_close
(
t_info
->
taos
);
sem_destroy
(
&
(
t_info
->
mutex_sem
));
sem_destroy
(
&
(
t_info
->
lock_sem
));
t
sem_destroy
(
&
(
t_info
->
mutex_sem
));
t
sem_destroy
(
&
(
t_info
->
lock_sem
));
}
free
(
pids
);
...
...
@@ -1021,8 +1021,8 @@ void multiThreadCreateTable(char* cols, bool use_metric, int threads, int ntable
for
(
int
i
=
0
;
i
<
threads
;
i
++
)
{
info
*
t_info
=
infos
+
i
;
sem_destroy
(
&
(
t_info
->
mutex_sem
));
sem_destroy
(
&
(
t_info
->
lock_sem
));
t
sem_destroy
(
&
(
t_info
->
mutex_sem
));
t
sem_destroy
(
&
(
t_info
->
lock_sem
));
}
free
(
pids
);
...
...
@@ -1272,7 +1272,7 @@ void *asyncWrite(void *sarg) {
taos_query_a
(
winfo
->
taos
,
"show databases"
,
callBack
,
tb_info
);
}
sem_wait
(
&
(
winfo
->
lock_sem
));
t
sem_wait
(
&
(
winfo
->
lock_sem
));
free
(
tb_infos
);
return
NULL
;
...
...
@@ -1292,10 +1292,10 @@ void callBack(void *param, TAOS_RES *res, int code) {
// If finished;
if
(
tb_info
->
counter
>=
tb_info
->
target
)
{
sem_wait
(
tb_info
->
mutex_sem
);
t
sem_wait
(
tb_info
->
mutex_sem
);
(
*
(
tb_info
->
notFinished
))
--
;
if
(
*
(
tb_info
->
notFinished
)
==
0
)
sem_post
(
tb_info
->
lock_sem
);
sem_post
(
tb_info
->
mutex_sem
);
if
(
*
(
tb_info
->
notFinished
)
==
0
)
t
sem_post
(
tb_info
->
lock_sem
);
t
sem_post
(
tb_info
->
mutex_sem
);
return
;
}
...
...
src/query/inc/qExecutor.h
浏览文件 @
41d97eee
...
...
@@ -186,7 +186,7 @@ typedef struct SQInfo {
void
*
signature
;
int32_t
pointsInterpo
;
int32_t
code
;
// error code to returned to client
//
sem_t
dataReady;
//
tsem_t
dataReady;
void
*
tsdb
;
int32_t
vgId
;
...
...
src/rpc/test/rclient.c
浏览文件 @
41d97eee
...
...
@@ -26,8 +26,8 @@ typedef struct {
int
num
;
int
numOfReqs
;
int
msgSize
;
sem_t
rspSem
;
sem_t
*
pOverSem
;
tsem_t
rspSem
;
tsem_t
*
pOverSem
;
pthread_t
thread
;
void
*
pRpc
;
}
SInfo
;
...
...
@@ -39,7 +39,7 @@ static void processResponse(SRpcMsg *pMsg, SRpcEpSet *pEpSet) {
if
(
pEpSet
)
pInfo
->
epSet
=
*
pEpSet
;
rpcFreeCont
(
pMsg
->
pCont
);
sem_post
(
&
pInfo
->
rspSem
);
t
sem_post
(
&
pInfo
->
rspSem
);
}
static
int
tcount
=
0
;
...
...
@@ -60,7 +60,7 @@ static void *sendRequest(void *param) {
rpcSendRequest
(
pInfo
->
pRpc
,
&
pInfo
->
epSet
,
&
rpcMsg
);
if
(
pInfo
->
num
%
20000
==
0
)
tInfo
(
"thread:%d, %d requests have been sent"
,
pInfo
->
index
,
pInfo
->
num
);
sem_wait
(
&
pInfo
->
rspSem
);
t
sem_wait
(
&
pInfo
->
rspSem
);
}
tDebug
(
"thread:%d, it is over"
,
pInfo
->
index
);
...
...
@@ -171,7 +171,7 @@ int main(int argc, char *argv[]) {
pInfo
->
epSet
=
epSet
;
pInfo
->
numOfReqs
=
numOfReqs
;
pInfo
->
msgSize
=
msgSize
;
sem_init
(
&
pInfo
->
rspSem
,
0
,
0
);
t
sem_init
(
&
pInfo
->
rspSem
,
0
,
0
);
pInfo
->
pRpc
=
pRpc
;
pthread_create
(
&
pInfo
->
thread
,
&
thattr
,
sendRequest
,
pInfo
);
pInfo
++
;
...
...
src/rpc/test/rsclient.c
浏览文件 @
41d97eee
...
...
@@ -27,8 +27,8 @@ typedef struct {
int
num
;
int
numOfReqs
;
int
msgSize
;
sem_t
rspSem
;
sem_t
*
pOverSem
;
tsem_t
rspSem
;
tsem_t
*
pOverSem
;
pthread_t
thread
;
void
*
pRpc
;
}
SInfo
;
...
...
@@ -171,7 +171,7 @@ int main(int argc, char *argv[]) {
pInfo
->
epSet
=
epSet
;
pInfo
->
numOfReqs
=
numOfReqs
;
pInfo
->
msgSize
=
msgSize
;
sem_init
(
&
pInfo
->
rspSem
,
0
,
0
);
t
sem_init
(
&
pInfo
->
rspSem
,
0
,
0
);
pInfo
->
pRpc
=
pRpc
;
pthread_create
(
&
pInfo
->
thread
,
&
thattr
,
sendRequest
,
pInfo
);
pInfo
++
;
...
...
src/sync/src/tarbitrator.c
浏览文件 @
41d97eee
...
...
@@ -31,7 +31,7 @@ static void arbSignalHandler(int32_t signum, siginfo_t *sigInfo, void *context);
static
void
arbProcessIncommingConnection
(
int
connFd
,
uint32_t
sourceIp
);
static
void
arbProcessBrokenLink
(
void
*
param
);
static
int
arbProcessPeerMsg
(
void
*
param
,
void
*
buffer
);
static
sem_t
tsArbSem
;
static
tsem_t
tsArbSem
;
static
ttpool_h
tsArbTcpPool
;
typedef
struct
{
...
...
@@ -61,7 +61,7 @@ int main(int argc, char *argv[]) {
}
}
if
(
sem_init
(
&
tsArbSem
,
0
,
0
)
!=
0
)
{
if
(
t
sem_init
(
&
tsArbSem
,
0
,
0
)
!=
0
)
{
printf
(
"failed to create exit semphore
\n
"
);
exit
(
EXIT_FAILURE
);
}
...
...
@@ -98,7 +98,7 @@ int main(int argc, char *argv[]) {
sInfo
(
"TAOS arbitrator: %s:%d is running"
,
tsNodeFqdn
,
tsServerPort
);
for
(
int
res
=
sem_wait
(
&
tsArbSem
);
res
!=
0
;
res
=
sem_wait
(
&
tsArbSem
))
{
for
(
int
res
=
tsem_wait
(
&
tsArbSem
);
res
!=
0
;
res
=
t
sem_wait
(
&
tsArbSem
))
{
if
(
res
!=
EINTR
)
break
;
}
...
...
@@ -185,6 +185,6 @@ static void arbSignalHandler(int32_t signum, siginfo_t *sigInfo, void *context)
sInfo
(
"shut down signal is %d, sender PID:%d"
,
signum
,
sigInfo
->
si_pid
);
// inform main thread to exit
sem_post
(
&
tsArbSem
);
t
sem_post
(
&
tsArbSem
);
}
src/sync/test/syncClient.c
浏览文件 @
41d97eee
...
...
@@ -25,8 +25,8 @@ typedef struct {
int
num
;
int
numOfReqs
;
int
msgSize
;
sem_t
rspSem
;
sem_t
*
pOverSem
;
tsem_t
rspSem
;
tsem_t
*
pOverSem
;
pthread_t
thread
;
void
*
pRpc
;
}
SInfo
;
...
...
@@ -38,7 +38,7 @@ void processResponse(SRpcMsg *pMsg, SRpcEpSet *pEpSet) {
if
(
pEpSet
)
pInfo
->
epSet
=
*
pEpSet
;
rpcFreeCont
(
pMsg
->
pCont
);
sem_post
(
&
pInfo
->
rspSem
);
t
sem_post
(
&
pInfo
->
rspSem
);
}
int
tcount
=
0
;
...
...
@@ -59,7 +59,7 @@ void *sendRequest(void *param) {
rpcSendRequest
(
pInfo
->
pRpc
,
&
pInfo
->
epSet
,
&
rpcMsg
);
if
(
pInfo
->
num
%
20000
==
0
)
uInfo
(
"thread:%d, %d requests have been sent"
,
pInfo
->
index
,
pInfo
->
num
);
sem_wait
(
&
pInfo
->
rspSem
);
t
sem_wait
(
&
pInfo
->
rspSem
);
}
uDebug
(
"thread:%d, it is over"
,
pInfo
->
index
);
...
...
@@ -169,7 +169,7 @@ int main(int argc, char *argv[]) {
pInfo
->
epSet
=
epSet
;
pInfo
->
numOfReqs
=
numOfReqs
;
pInfo
->
msgSize
=
msgSize
;
sem_init
(
&
pInfo
->
rspSem
,
0
,
0
);
t
sem_init
(
&
pInfo
->
rspSem
,
0
,
0
);
pInfo
->
pRpc
=
pRpc
;
pthread_create
(
&
pInfo
->
thread
,
&
thattr
,
sendRequest
,
pInfo
);
pInfo
++
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录