Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
eead619f
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看板
提交
eead619f
编写于
9月 27, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: coverity issues
上级
73ea8990
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
93 addition
and
47 deletion
+93
-47
include/common/tmsg.h
include/common/tmsg.h
+4
-5
source/common/src/tglobal.c
source/common/src/tglobal.c
+15
-4
source/dnode/mgmt/mgmt_qnode/src/qmWorker.c
source/dnode/mgmt/mgmt_qnode/src/qmWorker.c
+1
-0
source/dnode/mgmt/mgmt_vnode/src/vmFile.c
source/dnode/mgmt/mgmt_vnode/src/vmFile.c
+12
-3
source/util/src/tqueue.c
source/util/src/tqueue.c
+4
-4
source/util/src/tuuid.c
source/util/src/tuuid.c
+2
-2
source/util/src/tworker.c
source/util/src/tworker.c
+4
-4
tools/shell/src/shellArguments.c
tools/shell/src/shellArguments.c
+1
-1
utils/tsim/src/simExe.c
utils/tsim/src/simExe.c
+41
-18
utils/tsim/src/simMain.c
utils/tsim/src/simMain.c
+1
-1
utils/tsim/src/simParse.c
utils/tsim/src/simParse.c
+8
-5
未找到文件。
include/common/tmsg.h
浏览文件 @
eead619f
...
@@ -55,11 +55,10 @@ extern int32_t tMsgDict[];
...
@@ -55,11 +55,10 @@ extern int32_t tMsgDict[];
#define TMSG_SEG_CODE(TYPE) (((TYPE)&0xff00) >> 8)
#define TMSG_SEG_CODE(TYPE) (((TYPE)&0xff00) >> 8)
#define TMSG_SEG_SEQ(TYPE) ((TYPE)&0xff)
#define TMSG_SEG_SEQ(TYPE) ((TYPE)&0xff)
#define TMSG_INFO(TYPE) \
#define TMSG_INFO(TYPE) \
((TYPE) >= 0 && ((TYPE) < TDMT_DND_MAX_MSG || (TYPE) < TDMT_MND_MAX_MSG || (TYPE) < TDMT_VND_MAX_MSG || \
((TYPE) < TDMT_DND_MAX_MSG || (TYPE) < TDMT_MND_MAX_MSG || (TYPE) < TDMT_VND_MAX_MSG || (TYPE) < TDMT_SCH_MAX_MSG || \
(TYPE) < TDMT_SCH_MAX_MSG || (TYPE) < TDMT_STREAM_MAX_MSG || (TYPE) < TDMT_MON_MAX_MSG || \
(TYPE) < TDMT_STREAM_MAX_MSG || (TYPE) < TDMT_MON_MAX_MSG || (TYPE) < TDMT_SYNC_MAX_MSG) \
(TYPE) < TDMT_SYNC_MAX_MSG)) \
? tMsgInfo[tMsgDict[TMSG_SEG_CODE(TYPE)] + TMSG_SEG_SEQ(TYPE)] \
? tMsgInfo[tMsgDict[TMSG_SEG_CODE(TYPE)] + TMSG_SEG_SEQ(TYPE)] \
: 0
: 0
#define TMSG_INDEX(TYPE) (tMsgDict[TMSG_SEG_CODE(TYPE)] + TMSG_SEG_SEQ(TYPE))
#define TMSG_INDEX(TYPE) (tMsgDict[TMSG_SEG_CODE(TYPE)] + TMSG_SEG_SEQ(TYPE))
...
...
source/common/src/tglobal.c
浏览文件 @
eead619f
...
@@ -205,7 +205,9 @@ static int32_t taosLoadCfg(SConfig *pCfg, const char **envCmd, const char *input
...
@@ -205,7 +205,9 @@ static int32_t taosLoadCfg(SConfig *pCfg, const char **envCmd, const char *input
tstrncpy
(
cfgFile
,
cfgDir
,
sizeof
(
cfgDir
));
tstrncpy
(
cfgFile
,
cfgDir
,
sizeof
(
cfgDir
));
}
}
if
(
apolloUrl
==
NULL
||
apolloUrl
[
0
]
==
'\0'
)
cfgGetApollUrl
(
envCmd
,
envFile
,
apolloUrl
);
if
(
apolloUrl
!=
NULL
&&
apolloUrl
[
0
]
==
'\0'
)
{
cfgGetApollUrl
(
envCmd
,
envFile
,
apolloUrl
);
}
if
(
cfgLoad
(
pCfg
,
CFG_STYPE_APOLLO_URL
,
apolloUrl
)
!=
0
)
{
if
(
cfgLoad
(
pCfg
,
CFG_STYPE_APOLLO_URL
,
apolloUrl
)
!=
0
)
{
uError
(
"failed to load from apollo url:%s since %s"
,
apolloUrl
,
terrstr
());
uError
(
"failed to load from apollo url:%s since %s"
,
apolloUrl
,
terrstr
());
...
@@ -1126,11 +1128,20 @@ int32_t taosCreateLog(const char *logname, int32_t logFileNum, const char *cfgDi
...
@@ -1126,11 +1128,20 @@ int32_t taosCreateLog(const char *logname, int32_t logFileNum, const char *cfgDi
if
(
tsc
)
{
if
(
tsc
)
{
tsLogEmbedded
=
0
;
tsLogEmbedded
=
0
;
if
(
taosAddClientLogCfg
(
pCfg
)
!=
0
)
return
-
1
;
if
(
taosAddClientLogCfg
(
pCfg
)
!=
0
)
{
cfgCleanup
(
pCfg
);
return
-
1
;
}
}
else
{
}
else
{
tsLogEmbedded
=
1
;
tsLogEmbedded
=
1
;
if
(
taosAddClientLogCfg
(
pCfg
)
!=
0
)
return
-
1
;
if
(
taosAddClientLogCfg
(
pCfg
)
!=
0
)
{
if
(
taosAddServerLogCfg
(
pCfg
)
!=
0
)
return
-
1
;
cfgCleanup
(
pCfg
);
return
-
1
;
}
if
(
taosAddServerLogCfg
(
pCfg
)
!=
0
)
{
cfgCleanup
(
pCfg
);
return
-
1
;
}
}
}
if
(
taosLoadCfg
(
pCfg
,
envCmd
,
cfgDir
,
envFile
,
apolloUrl
)
!=
0
)
{
if
(
taosLoadCfg
(
pCfg
,
envCmd
,
cfgDir
,
envFile
,
apolloUrl
)
!=
0
)
{
...
...
source/dnode/mgmt/mgmt_qnode/src/qmWorker.c
浏览文件 @
eead619f
...
@@ -87,6 +87,7 @@ int32_t qmPutRpcMsgToQueue(SQnodeMgmt *pMgmt, EQueueType qtype, SRpcMsg *pRpc) {
...
@@ -87,6 +87,7 @@ int32_t qmPutRpcMsgToQueue(SQnodeMgmt *pMgmt, EQueueType qtype, SRpcMsg *pRpc) {
return
0
;
return
0
;
default:
default:
terrno
=
TSDB_CODE_INVALID_PARA
;
terrno
=
TSDB_CODE_INVALID_PARA
;
taosFreeQitem
(
pMsg
);
return
-
1
;
return
-
1
;
}
}
}
}
...
...
source/dnode/mgmt/mgmt_vnode/src/vmFile.c
浏览文件 @
eead619f
...
@@ -141,6 +141,7 @@ _OVER:
...
@@ -141,6 +141,7 @@ _OVER:
}
}
int32_t
vmWriteVnodeListToFile
(
SVnodeMgmt
*
pMgmt
)
{
int32_t
vmWriteVnodeListToFile
(
SVnodeMgmt
*
pMgmt
)
{
int32_t
ret
=
0
;
char
file
[
PATH_MAX
]
=
{
0
};
char
file
[
PATH_MAX
]
=
{
0
};
char
realfile
[
PATH_MAX
]
=
{
0
};
char
realfile
[
PATH_MAX
]
=
{
0
};
snprintf
(
file
,
sizeof
(
file
),
"%s%svnodes.json.bak"
,
pMgmt
->
path
,
TD_DIRSEP
);
snprintf
(
file
,
sizeof
(
file
),
"%s%svnodes.json.bak"
,
pMgmt
->
path
,
TD_DIRSEP
);
...
@@ -159,15 +160,18 @@ int32_t vmWriteVnodeListToFile(SVnodeMgmt *pMgmt) {
...
@@ -159,15 +160,18 @@ int32_t vmWriteVnodeListToFile(SVnodeMgmt *pMgmt) {
int32_t
len
=
0
;
int32_t
len
=
0
;
int32_t
maxLen
=
MAX_CONTENT_LEN
;
int32_t
maxLen
=
MAX_CONTENT_LEN
;
char
*
content
=
taosMemoryCalloc
(
1
,
maxLen
+
1
);
char
*
content
=
taosMemoryCalloc
(
1
,
maxLen
+
1
);
if
(
content
=
=
NULL
)
{
if
(
content
!
=
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
ret
=
-
1
;
goto
_OVER
;
}
}
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"{
\n
"
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"{
\n
"
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
vnodes
\"
: [
\n
"
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
vnodes
\"
: [
\n
"
);
for
(
int32_t
i
=
0
;
i
<
numOfVnodes
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfVnodes
;
++
i
)
{
SVnodeObj
*
pVnode
=
pVnodes
[
i
];
SVnodeObj
*
pVnode
=
pVnodes
[
i
];
if
(
pVnode
==
NULL
)
continue
;
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
" {
\n
"
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
" {
\n
"
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
vgId
\"
: %d,
\n
"
,
pVnode
->
vgId
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
vgId
\"
: %d,
\n
"
,
pVnode
->
vgId
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
dropped
\"
: %d,
\n
"
,
pVnode
->
dropped
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
dropped
\"
: %d,
\n
"
,
pVnode
->
dropped
);
...
@@ -181,11 +185,14 @@ int32_t vmWriteVnodeListToFile(SVnodeMgmt *pMgmt) {
...
@@ -181,11 +185,14 @@ int32_t vmWriteVnodeListToFile(SVnodeMgmt *pMgmt) {
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
" ]
\n
"
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
" ]
\n
"
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"}
\n
"
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"}
\n
"
);
terrno
=
0
;
_OVER:
taosWriteFile
(
pFile
,
content
,
len
);
taosWriteFile
(
pFile
,
content
,
len
);
taosFsyncFile
(
pFile
);
taosFsyncFile
(
pFile
);
taosCloseFile
(
&
pFile
);
taosCloseFile
(
&
pFile
);
taosMemoryFree
(
content
);
taosMemoryFree
(
content
);
terrno
=
0
;
for
(
int32_t
i
=
0
;
i
<
numOfVnodes
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfVnodes
;
++
i
)
{
SVnodeObj
*
pVnode
=
pVnodes
[
i
];
SVnodeObj
*
pVnode
=
pVnodes
[
i
];
...
@@ -196,6 +203,8 @@ int32_t vmWriteVnodeListToFile(SVnodeMgmt *pMgmt) {
...
@@ -196,6 +203,8 @@ int32_t vmWriteVnodeListToFile(SVnodeMgmt *pMgmt) {
taosMemoryFree
(
pVnodes
);
taosMemoryFree
(
pVnodes
);
}
}
if
(
ret
!=
0
)
return
-
1
;
dDebug
(
"successed to write %s, numOfVnodes:%d"
,
realfile
,
numOfVnodes
);
dDebug
(
"successed to write %s, numOfVnodes:%d"
,
realfile
,
numOfVnodes
);
return
taosRenameFile
(
file
,
realfile
);
return
taosRenameFile
(
file
,
realfile
);
}
}
\ No newline at end of file
source/util/src/tqueue.c
浏览文件 @
eead619f
...
@@ -151,15 +151,15 @@ int64_t taosQueueMemorySize(STaosQueue *queue) {
...
@@ -151,15 +151,15 @@ int64_t taosQueueMemorySize(STaosQueue *queue) {
void
*
taosAllocateQitem
(
int32_t
size
,
EQItype
itype
)
{
void
*
taosAllocateQitem
(
int32_t
size
,
EQItype
itype
)
{
STaosQnode
*
pNode
=
taosMemoryCalloc
(
1
,
sizeof
(
STaosQnode
)
+
size
);
STaosQnode
*
pNode
=
taosMemoryCalloc
(
1
,
sizeof
(
STaosQnode
)
+
size
);
pNode
->
size
=
size
;
pNode
->
itype
=
itype
;
pNode
->
timestamp
=
taosGetTimestampUs
();
if
(
pNode
==
NULL
)
{
if
(
pNode
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
NULL
;
return
NULL
;
}
}
pNode
->
size
=
size
;
pNode
->
itype
=
itype
;
pNode
->
timestamp
=
taosGetTimestampUs
();
if
(
itype
==
RPC_QITEM
)
{
if
(
itype
==
RPC_QITEM
)
{
int64_t
alloced
=
atomic_add_fetch_64
(
&
tsRpcQueueMemoryUsed
,
size
);
int64_t
alloced
=
atomic_add_fetch_64
(
&
tsRpcQueueMemoryUsed
,
size
);
if
(
alloced
>
tsRpcQueueMemoryAllowed
)
{
if
(
alloced
>
tsRpcQueueMemoryAllowed
)
{
...
...
source/util/src/tuuid.c
浏览文件 @
eead619f
...
@@ -20,8 +20,8 @@ static int32_t tUUIDSerialNo = 0;
...
@@ -20,8 +20,8 @@ static int32_t tUUIDSerialNo = 0;
int32_t
tGenIdPI32
(
void
)
{
int32_t
tGenIdPI32
(
void
)
{
if
(
tUUIDHashId
==
0
)
{
if
(
tUUIDHashId
==
0
)
{
char
uid
[
6
4
]
;
char
uid
[
6
5
]
=
{
0
}
;
int32_t
code
=
taosGetSystemUUID
(
uid
,
tListLen
(
uid
));
int32_t
code
=
taosGetSystemUUID
(
uid
,
sizeof
(
uid
));
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
}
else
{
}
else
{
...
...
source/util/src/tworker.c
浏览文件 @
eead619f
...
@@ -46,7 +46,7 @@ int32_t tQWorkerInit(SQWorkerPool *pool) {
...
@@ -46,7 +46,7 @@ int32_t tQWorkerInit(SQWorkerPool *pool) {
void
tQWorkerCleanup
(
SQWorkerPool
*
pool
)
{
void
tQWorkerCleanup
(
SQWorkerPool
*
pool
)
{
for
(
int32_t
i
=
0
;
i
<
pool
->
max
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
pool
->
max
;
++
i
)
{
SQWorker
*
worker
=
pool
->
workers
+
i
;
SQWorker
*
worker
=
pool
->
workers
+
i
;
if
(
worker
==
NULL
)
continue
;
//
if (worker == NULL) continue;
if
(
taosCheckPthreadValid
(
worker
->
thread
))
{
if
(
taosCheckPthreadValid
(
worker
->
thread
))
{
taosQsetThreadResume
(
pool
->
qset
);
taosQsetThreadResume
(
pool
->
qset
);
}
}
...
@@ -54,7 +54,7 @@ void tQWorkerCleanup(SQWorkerPool *pool) {
...
@@ -54,7 +54,7 @@ void tQWorkerCleanup(SQWorkerPool *pool) {
for
(
int32_t
i
=
0
;
i
<
pool
->
max
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
pool
->
max
;
++
i
)
{
SQWorker
*
worker
=
pool
->
workers
+
i
;
SQWorker
*
worker
=
pool
->
workers
+
i
;
if
(
worker
==
NULL
)
continue
;
//
if (worker == NULL) continue;
if
(
taosCheckPthreadValid
(
worker
->
thread
))
{
if
(
taosCheckPthreadValid
(
worker
->
thread
))
{
taosThreadJoin
(
worker
->
thread
,
NULL
);
taosThreadJoin
(
worker
->
thread
,
NULL
);
taosThreadClear
(
&
worker
->
thread
);
taosThreadClear
(
&
worker
->
thread
);
...
@@ -138,8 +138,8 @@ STaosQueue *tQWorkerAllocQueue(SQWorkerPool *pool, void *ahandle, FItem fp) {
...
@@ -138,8 +138,8 @@ STaosQueue *tQWorkerAllocQueue(SQWorkerPool *pool, void *ahandle, FItem fp) {
}
}
void
tQWorkerFreeQueue
(
SQWorkerPool
*
pool
,
STaosQueue
*
queue
)
{
void
tQWorkerFreeQueue
(
SQWorkerPool
*
pool
,
STaosQueue
*
queue
)
{
taosCloseQueue
(
queue
);
uDebug
(
"worker:%s, queue:%p is freed"
,
pool
->
name
,
queue
);
uDebug
(
"worker:%s, queue:%p is freed"
,
pool
->
name
,
queue
);
taosCloseQueue
(
queue
);
}
}
int32_t
tWWorkerInit
(
SWWorkerPool
*
pool
)
{
int32_t
tWWorkerInit
(
SWWorkerPool
*
pool
)
{
...
@@ -283,8 +283,8 @@ STaosQueue *tWWorkerAllocQueue(SWWorkerPool *pool, void *ahandle, FItems fp) {
...
@@ -283,8 +283,8 @@ STaosQueue *tWWorkerAllocQueue(SWWorkerPool *pool, void *ahandle, FItems fp) {
}
}
void
tWWorkerFreeQueue
(
SWWorkerPool
*
pool
,
STaosQueue
*
queue
)
{
void
tWWorkerFreeQueue
(
SWWorkerPool
*
pool
,
STaosQueue
*
queue
)
{
taosCloseQueue
(
queue
);
uDebug
(
"worker:%s, queue:%p is freed"
,
pool
->
name
,
queue
);
uDebug
(
"worker:%s, queue:%p is freed"
,
pool
->
name
,
queue
);
taosCloseQueue
(
queue
);
}
}
int32_t
tSingleWorkerInit
(
SSingleWorker
*
pWorker
,
const
SSingleWorkerCfg
*
pCfg
)
{
int32_t
tSingleWorkerInit
(
SSingleWorker
*
pWorker
,
const
SSingleWorkerCfg
*
pCfg
)
{
...
...
tools/shell/src/shellArguments.c
浏览文件 @
eead619f
...
@@ -358,7 +358,7 @@ static int32_t shellCheckArgs() {
...
@@ -358,7 +358,7 @@ static int32_t shellCheckArgs() {
return
-
1
;
return
-
1
;
}
}
if
(
pArgs
->
password
!=
NULL
&&
(
strlen
(
pArgs
->
password
)
<=
0
))
{
if
(
/*pArgs->password != NULL && */
(
strlen
(
pArgs
->
password
)
<=
0
))
{
printf
(
"Invalid password
\r\n
"
);
printf
(
"Invalid password
\r\n
"
);
return
-
1
;
return
-
1
;
}
}
...
...
utils/tsim/src/simExe.c
浏览文件 @
eead619f
...
@@ -224,10 +224,24 @@ char *simGetVariable(SScript *script, char *varName, int32_t varLen) {
...
@@ -224,10 +224,24 @@ char *simGetVariable(SScript *script, char *varName, int32_t varLen) {
}
}
int32_t
simExecuteExpression
(
SScript
*
script
,
char
*
exp
)
{
int32_t
simExecuteExpression
(
SScript
*
script
,
char
*
exp
)
{
char
*
op1
,
*
op2
,
*
var1
,
*
var2
,
*
var3
,
*
rest
;
char
*
op1
=
NULL
;
int32_t
op1Len
,
op2Len
,
var1Len
,
var2Len
,
var3Len
,
val0
,
val1
;
char
*
op2
=
NULL
;
char
t0
[
1024
],
t1
[
1024
],
t2
[
1024
],
t3
[
2048
];
char
*
var1
=
NULL
;
int32_t
result
;
char
*
var2
=
NULL
;
char
*
var3
=
NULL
;
char
*
rest
=
NULL
;
int32_t
op1Len
=
0
;
int32_t
op2Len
=
0
;
int32_t
var1Len
=
0
;
int32_t
var2Len
=
0
;
int32_t
var3Len
=
0
;
int32_t
val0
=
0
;
int32_t
val1
=
0
;
char
t0
[
1024
]
=
{
0
};
char
t1
[
1024
]
=
{
0
};
char
t2
[
1024
]
=
{
0
};
char
t3
[
2048
]
=
{
0
};
int32_t
result
=
0
;
rest
=
paGetToken
(
exp
,
&
var1
,
&
var1Len
);
rest
=
paGetToken
(
exp
,
&
var1
,
&
var1Len
);
rest
=
paGetToken
(
rest
,
&
op1
,
&
op1Len
);
rest
=
paGetToken
(
rest
,
&
op1
,
&
op1Len
);
...
@@ -241,9 +255,9 @@ int32_t simExecuteExpression(SScript *script, char *exp) {
...
@@ -241,9 +255,9 @@ int32_t simExecuteExpression(SScript *script, char *exp) {
t0
[
var1Len
]
=
0
;
t0
[
var1Len
]
=
0
;
}
}
if
(
var2
[
0
]
==
'$'
)
if
(
var2
[
0
]
==
'$'
)
{
strcpy
(
t1
,
simGetVariable
(
script
,
var2
+
1
,
var2Len
-
1
)
);
tstrncpy
(
t1
,
simGetVariable
(
script
,
var2
+
1
,
var2Len
-
1
),
1024
);
else
{
}
else
{
memcpy
(
t1
,
var2
,
var2Len
);
memcpy
(
t1
,
var2
,
var2Len
);
t1
[
var2Len
]
=
0
;
t1
[
var2Len
]
=
0
;
}
}
...
@@ -258,14 +272,21 @@ int32_t simExecuteExpression(SScript *script, char *exp) {
...
@@ -258,14 +272,21 @@ int32_t simExecuteExpression(SScript *script, char *exp) {
t2
[
var3Len
]
=
0
;
t2
[
var3Len
]
=
0
;
}
}
int64_t
t1l
=
atoll
(
t1
);
int64_t
t2l
=
atoll
(
t2
);
if
(
op2
[
0
]
==
'+'
)
{
if
(
op2
[
0
]
==
'+'
)
{
sprintf
(
t3
,
"%
lld"
,
atoll
(
t1
)
+
atoll
(
t2
)
);
sprintf
(
t3
,
"%
"
PRId64
,
t1l
+
t2l
);
}
else
if
(
op2
[
0
]
==
'-'
)
{
}
else
if
(
op2
[
0
]
==
'-'
)
{
sprintf
(
t3
,
"%
lld"
,
atoll
(
t1
)
-
atoll
(
t2
)
);
sprintf
(
t3
,
"%
"
PRId64
,
t1l
-
t2l
);
}
else
if
(
op2
[
0
]
==
'*'
)
{
}
else
if
(
op2
[
0
]
==
'*'
)
{
sprintf
(
t3
,
"%
lld"
,
atoll
(
t1
)
*
atoll
(
t2
)
);
sprintf
(
t3
,
"%
"
PRId64
,
t1l
*
t2l
);
}
else
if
(
op2
[
0
]
==
'/'
)
{
}
else
if
(
op2
[
0
]
==
'/'
)
{
sprintf
(
t3
,
"%lld"
,
atoll
(
t1
)
/
atoll
(
t2
));
if
(
t2l
==
0
)
{
sprintf
(
t3
,
"%"
PRId64
,
INT64_MAX
);
}
else
{
sprintf
(
t3
,
"%"
PRId64
,
t1l
/
t2l
);
}
}
else
if
(
op2
[
0
]
==
'.'
)
{
}
else
if
(
op2
[
0
]
==
'.'
)
{
sprintf
(
t3
,
"%s%s"
,
t1
,
t2
);
sprintf
(
t3
,
"%s%s"
,
t1
,
t2
);
}
}
...
@@ -636,7 +657,7 @@ bool simCreateTaosdConnect(SScript *script, char *rest) {
...
@@ -636,7 +657,7 @@ bool simCreateTaosdConnect(SScript *script, char *rest) {
}
}
bool
simExecuteNativeSqlCommand
(
SScript
*
script
,
char
*
rest
,
bool
isSlow
)
{
bool
simExecuteNativeSqlCommand
(
SScript
*
script
,
char
*
rest
,
bool
isSlow
)
{
char
timeStr
[
3
0
]
=
{
0
};
char
timeStr
[
8
0
]
=
{
0
};
time_t
tt
;
time_t
tt
;
struct
tm
tp
;
struct
tm
tp
;
SCmdLine
*
line
=
&
script
->
lines
[
script
->
linePos
];
SCmdLine
*
line
=
&
script
->
lines
[
script
->
linePos
];
...
@@ -943,7 +964,7 @@ bool simExecuteSqlErrorCmd(SScript *script, char *rest) {
...
@@ -943,7 +964,7 @@ bool simExecuteSqlErrorCmd(SScript *script, char *rest) {
return
true
;
return
true
;
}
}
TAOS_RES
*
pSql
=
pSql
=
taos_query
(
script
->
taos
,
rest
);
TAOS_RES
*
pSql
=
taos_query
(
script
->
taos
,
rest
);
int32_t
ret
=
taos_errno
(
pSql
);
int32_t
ret
=
taos_errno
(
pSql
);
taos_free_result
(
pSql
);
taos_free_result
(
pSql
);
...
@@ -961,7 +982,7 @@ bool simExecuteSqlErrorCmd(SScript *script, char *rest) {
...
@@ -961,7 +982,7 @@ bool simExecuteSqlErrorCmd(SScript *script, char *rest) {
}
}
bool
simExecuteLineInsertCmd
(
SScript
*
script
,
char
*
rest
)
{
bool
simExecuteLineInsertCmd
(
SScript
*
script
,
char
*
rest
)
{
char
buf
[
TSDB_MAX_BINARY_LEN
];
char
buf
[
TSDB_MAX_BINARY_LEN
]
=
{
0
}
;
simVisuallizeOption
(
script
,
rest
,
buf
);
simVisuallizeOption
(
script
,
rest
,
buf
);
rest
=
buf
;
rest
=
buf
;
...
@@ -973,10 +994,7 @@ bool simExecuteLineInsertCmd(SScript *script, char *rest) {
...
@@ -973,10 +994,7 @@ bool simExecuteLineInsertCmd(SScript *script, char *rest) {
char
*
lines
[]
=
{
rest
};
char
*
lines
[]
=
{
rest
};
#if 0
#if 0
int32_t ret = taos_insert_lines(script->taos, lines, 1);
int32_t ret = taos_insert_lines(script->taos, lines, 1);
#else
if (ret == TSDB_CODE_SUCCESS) {
int32_t
ret
=
0
;
#endif
if
(
ret
==
TSDB_CODE_SUCCESS
)
{
simDebug("script:%s, taos:%p, %s executed. success.", script->fileName, script->taos, rest);
simDebug("script:%s, taos:%p, %s executed. success.", script->fileName, script->taos, rest);
script->linePos++;
script->linePos++;
return true;
return true;
...
@@ -985,6 +1003,11 @@ bool simExecuteLineInsertCmd(SScript *script, char *rest) {
...
@@ -985,6 +1003,11 @@ bool simExecuteLineInsertCmd(SScript *script, char *rest) {
tstrerror(ret));
tstrerror(ret));
return false;
return false;
}
}
#else
simDebug
(
"script:%s, taos:%p, %s executed. success."
,
script
->
fileName
,
script
->
taos
,
rest
);
script
->
linePos
++
;
return
true
;
#endif
}
}
bool
simExecuteLineInsertErrorCmd
(
SScript
*
script
,
char
*
rest
)
{
bool
simExecuteLineInsertErrorCmd
(
SScript
*
script
,
char
*
rest
)
{
...
...
utils/tsim/src/simMain.c
浏览文件 @
eead619f
...
@@ -33,7 +33,7 @@ int32_t main(int32_t argc, char *argv[]) {
...
@@ -33,7 +33,7 @@ int32_t main(int32_t argc, char *argv[]) {
if
(
strcmp
(
argv
[
i
],
"-c"
)
==
0
&&
i
<
argc
-
1
)
{
if
(
strcmp
(
argv
[
i
],
"-c"
)
==
0
&&
i
<
argc
-
1
)
{
tstrncpy
(
configDir
,
argv
[
++
i
],
128
);
tstrncpy
(
configDir
,
argv
[
++
i
],
128
);
}
else
if
(
strcmp
(
argv
[
i
],
"-f"
)
==
0
&&
i
<
argc
-
1
)
{
}
else
if
(
strcmp
(
argv
[
i
],
"-f"
)
==
0
&&
i
<
argc
-
1
)
{
strcpy
(
scriptFile
,
argv
[
++
i
]
);
tstrncpy
(
scriptFile
,
argv
[
++
i
],
MAX_FILE_NAME_LEN
);
}
else
if
(
strcmp
(
argv
[
i
],
"-m"
)
==
0
)
{
}
else
if
(
strcmp
(
argv
[
i
],
"-m"
)
==
0
)
{
useMultiProcess
=
true
;
useMultiProcess
=
true
;
}
else
if
(
strcmp
(
argv
[
i
],
"-v"
)
==
0
)
{
}
else
if
(
strcmp
(
argv
[
i
],
"-v"
)
==
0
)
{
...
...
utils/tsim/src/simParse.c
浏览文件 @
eead619f
...
@@ -175,14 +175,17 @@ SScript *simBuildScriptObj(char *fileName) {
...
@@ -175,14 +175,17 @@ SScript *simBuildScriptObj(char *fileName) {
SScript
*
simParseScript
(
char
*
fileName
)
{
SScript
*
simParseScript
(
char
*
fileName
)
{
TdFilePtr
pFile
;
TdFilePtr
pFile
;
int32_t
tokenLen
,
lineNum
=
0
;
int32_t
tokenLen
,
lineNum
=
0
;
char
buffer
[
10
*
1024
],
name
[
128
],
*
token
,
*
rest
;
char
buffer
[
10
*
1024
]
=
{
0
};
SCommand
*
pCmd
;
char
name
[
PATH_MAX
]
=
{
9
};
SScript
*
script
;
char
*
token
=
NULL
;
char
*
rest
=
NULL
;
SCommand
*
pCmd
=
NULL
;
SScript
*
script
=
NULL
;
if
((
fileName
[
0
]
==
'.'
)
||
(
fileName
[
0
]
==
'/'
))
{
if
((
fileName
[
0
]
==
'.'
)
||
(
fileName
[
0
]
==
'/'
))
{
strcpy
(
name
,
fileName
);
tstrncpy
(
name
,
fileName
,
PATH_MAX
);
}
else
{
}
else
{
s
printf
(
name
,
"%s"
TD_DIRSEP
"%s"
,
simScriptDir
,
fileName
);
s
nprintf
(
name
,
PATH_MAX
,
"%s"
TD_DIRSEP
"%s"
,
simScriptDir
,
fileName
);
taosRealPath
(
name
,
NULL
,
sizeof
(
name
));
taosRealPath
(
name
,
NULL
,
sizeof
(
name
));
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录