Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
2ac9a78d
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
2ac9a78d
编写于
6月 30, 2022
作者:
X
Xiaoyu Wang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: support 'select *, expr from ...' syntax
上级
dc769a28
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
19 addition
and
22 deletion
+19
-22
tests/test/c/tmqSim.c
tests/test/c/tmqSim.c
+19
-22
未找到文件。
tests/test/c/tmqSim.c
浏览文件 @
2ac9a78d
...
...
@@ -124,15 +124,13 @@ char* getCurrentTimeString(char* timeString) {
return
timeString
;
}
static
void
tmqStop
(
int
signum
,
void
*
info
,
void
*
ctx
)
{
static
void
tmqStop
(
int
signum
,
void
*
info
,
void
*
ctx
)
{
running
=
0
;
char
tmpString
[
128
];
taosFprintfFile
(
g_fp
,
"%s tmqStop() receive stop signal[%d]
\n
"
,
getCurrentTimeString
(
tmpString
),
signum
);
taosFprintfFile
(
g_fp
,
"%s tmqStop() receive stop signal[%d]
\n
"
,
getCurrentTimeString
(
tmpString
),
signum
);
}
static
void
tmqSetSignalHandle
()
{
taosSetSignal
(
SIGINT
,
tmqStop
);
}
static
void
tmqSetSignalHandle
()
{
taosSetSignal
(
SIGINT
,
tmqStop
);
}
void
initLogFile
()
{
char
filename
[
256
];
...
...
@@ -433,7 +431,7 @@ static void dumpToFileForCheck(TdFilePtr pFile, TAOS_ROW row, TAOS_FIELD* fields
int32_t
precision
)
{
for
(
int32_t
i
=
0
;
i
<
num_fields
;
i
++
)
{
if
(
i
>
0
)
{
taosFprintfFile
(
pFile
,
"
\n
"
);
taosFprintfFile
(
pFile
,
"
,
"
);
}
shellDumpFieldToFile
(
pFile
,
(
const
char
*
)
row
[
i
],
fields
+
i
,
length
[
i
],
precision
);
}
...
...
@@ -463,16 +461,16 @@ static int32_t msg_process(TAOS_RES* msg, SThreadInfo* pInfo, int32_t msgIndex)
int32_t
precision
=
taos_result_precision
(
msg
);
const
char
*
tbName
=
tmq_get_table_name
(
msg
);
#if 0
#if 0
// get schema
//============================== stub =================================================//
for (int32_t i = 0; i < numOfFields; i++) {
taosFprintfFile(g_fp, "%02d: name: %s, type: %d, len: %d\n", i, fields[i].name, fields[i].type, fields[i].bytes);
}
//============================== stub =================================================//
#endif
#endif
dumpToFileForCheck
(
pInfo
->
pConsumeRowsFile
,
row
,
fields
,
length
,
numOfFields
,
precision
);
dumpToFileForCheck
(
pInfo
->
pConsumeRowsFile
,
row
,
fields
,
length
,
numOfFields
,
precision
);
taos_print_row
(
buf
,
row
,
fields
,
numOfFields
);
...
...
@@ -523,15 +521,15 @@ int32_t notifyMainScript(SThreadInfo* pInfo, int32_t cmdId) {
static
int32_t
g_once_commit_flag
=
0
;
static
void
tmq_commit_cb_print
(
tmq_t
*
tmq
,
int32_t
code
,
void
*
param
)
{
pError
(
"tmq_commit_cb_print() commit %d
\n
"
,
code
);
pError
(
"tmq_commit_cb_print() commit %d
\n
"
,
code
);
if
(
0
==
g_once_commit_flag
)
{
g_once_commit_flag
=
1
;
notifyMainScript
((
SThreadInfo
*
)
param
,
(
int32_t
)
NOTIFY_CMD_START_COMMIT
);
if
(
0
==
g_once_commit_flag
)
{
g_once_commit_flag
=
1
;
notifyMainScript
((
SThreadInfo
*
)
param
,
(
int32_t
)
NOTIFY_CMD_START_COMMIT
);
}
char
tmpString
[
128
];
taosFprintfFile
(
g_fp
,
"%s tmq_commit_cb_print() be called
\n
"
,
getCurrentTimeString
(
tmpString
));
char
tmpString
[
128
];
taosFprintfFile
(
g_fp
,
"%s tmq_commit_cb_print() be called
\n
"
,
getCurrentTimeString
(
tmpString
));
}
void
build_consumer
(
SThreadInfo
*
pInfo
)
{
...
...
@@ -683,13 +681,13 @@ void* consumeThreadFunc(void* param) {
pInfo
->
taos
=
taos_connect
(
NULL
,
"root"
,
"taosdata"
,
NULL
,
0
);
if
(
pInfo
->
taos
==
NULL
)
{
taosFprintfFile
(
g_fp
,
"taos_connect() fail, can not notify and save consume result to main scripte
\n
"
);
return
NULL
;
return
NULL
;
}
build_consumer
(
pInfo
);
build_topic_list
(
pInfo
);
if
((
NULL
==
pInfo
->
tmq
)
||
(
NULL
==
pInfo
->
topicList
))
{
taosFprintfFile
(
g_fp
,
"create consumer fail! tmq is null or topicList is null
\n
"
);
taosFprintfFile
(
g_fp
,
"create consumer fail! tmq is null or topicList is null
\n
"
);
assert
(
0
);
return
NULL
;
}
...
...
@@ -697,7 +695,7 @@ void* consumeThreadFunc(void* param) {
int32_t
err
=
tmq_subscribe
(
pInfo
->
tmq
,
pInfo
->
topicList
);
if
(
err
!=
0
)
{
pError
(
"tmq_subscribe() fail, reason: %s
\n
"
,
tmq_err2str
(
err
));
taosFprintfFile
(
g_fp
,
"tmq_subscribe() fail! reason: %s
\n
"
,
tmq_err2str
(
err
));
taosFprintfFile
(
g_fp
,
"tmq_subscribe() fail! reason: %s
\n
"
,
tmq_err2str
(
err
));
assert
(
0
);
return
NULL
;
}
...
...
@@ -718,13 +716,13 @@ void* consumeThreadFunc(void* param) {
err
=
tmq_unsubscribe
(
pInfo
->
tmq
);
if
(
err
!=
0
)
{
pError
(
"tmq_unsubscribe() fail, reason: %s
\n
"
,
tmq_err2str
(
err
));
taosFprintfFile
(
g_fp
,
"tmq_unsubscribe()! reason: %s
\n
"
,
tmq_err2str
(
err
));
taosFprintfFile
(
g_fp
,
"tmq_unsubscribe()! reason: %s
\n
"
,
tmq_err2str
(
err
));
}
err
=
tmq_consumer_close
(
pInfo
->
tmq
);
if
(
err
!=
0
)
{
pError
(
"tmq_consumer_close() fail, reason: %s
\n
"
,
tmq_err2str
(
err
));
taosFprintfFile
(
g_fp
,
"tmq_consumer_close()! reason: %s
\n
"
,
tmq_err2str
(
err
));
taosFprintfFile
(
g_fp
,
"tmq_consumer_close()! reason: %s
\n
"
,
tmq_err2str
(
err
));
}
pInfo
->
tmq
=
NULL
;
...
...
@@ -871,4 +869,3 @@ int main(int32_t argc, char* argv[]) {
return
0
;
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录