Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
395d9e8b
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1193
Star
22018
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看板
提交
395d9e8b
编写于
4月 21, 2022
作者:
C
cpwu
浏览文件
操作
浏览文件
下载
差异文件
Merge branch '3.0' into cpwu/3.0
上级
b713b255
06247e1e
变更
95
展开全部
隐藏空白更改
内联
并排
Showing
95 changed file
with
6822 addition
and
3734 deletion
+6822
-3734
Jenkinsfile2
Jenkinsfile2
+12
-0
example/src/demoapi.c
example/src/demoapi.c
+1
-1
example/src/tmq.c
example/src/tmq.c
+2
-1
include/client/taos.h
include/client/taos.h
+31
-55
include/common/tdatablock.h
include/common/tdatablock.h
+28
-12
include/common/tdataformat.h
include/common/tdataformat.h
+2
-3
include/common/tmsg.h
include/common/tmsg.h
+129
-10
include/common/tmsgdef.h
include/common/tmsgdef.h
+2
-0
include/common/trow.h
include/common/trow.h
+37
-0
include/common/ttypes.h
include/common/ttypes.h
+2
-2
include/dnode/mnode/sdb/sdb.h
include/dnode/mnode/sdb/sdb.h
+7
-1
include/libs/nodes/querynodes.h
include/libs/nodes/querynodes.h
+6
-6
include/libs/parser/parser.h
include/libs/parser/parser.h
+26
-0
include/libs/planner/planner.h
include/libs/planner/planner.h
+0
-1
include/libs/scalar/scalar.h
include/libs/scalar/scalar.h
+1
-0
include/util/talgo.h
include/util/talgo.h
+5
-0
include/util/taoserror.h
include/util/taoserror.h
+5
-0
include/util/tarray.h
include/util/tarray.h
+14
-14
include/util/tcompare.h
include/util/tcompare.h
+2
-0
include/util/tdef.h
include/util/tdef.h
+2
-0
include/util/tjson.h
include/util/tjson.h
+1
-0
include/util/tlog.h
include/util/tlog.h
+1
-0
include/util/tutil.h
include/util/tutil.h
+0
-2
source/client/inc/clientInt.h
source/client/inc/clientInt.h
+39
-30
source/client/inc/clientStmt.h
source/client/inc/clientStmt.h
+62
-12
source/client/src/clientEnv.c
source/client/src/clientEnv.c
+1
-0
source/client/src/clientImpl.c
source/client/src/clientImpl.c
+93
-12
source/client/src/clientMain.c
source/client/src/clientMain.c
+85
-53
source/client/src/clientStmt.c
source/client/src/clientStmt.c
+492
-43
source/client/src/tmq.c
source/client/src/tmq.c
+74
-143
source/common/src/tdatablock.c
source/common/src/tdatablock.c
+17
-4
source/common/src/tglobal.c
source/common/src/tglobal.c
+2
-0
source/common/src/tmsg.c
source/common/src/tmsg.c
+2
-4
source/common/src/trow.c
source/common/src/trow.c
+2
-1
source/common/src/ttypes.c
source/common/src/ttypes.c
+2
-1
source/common/src/tvariant.c
source/common/src/tvariant.c
+1
-1
source/dnode/mgmt/mgmt_mnode/src/mmHandle.c
source/dnode/mgmt/mgmt_mnode/src/mmHandle.c
+1
-0
source/dnode/mgmt/mgmt_vnode/src/vmHandle.c
source/dnode/mgmt/mgmt_vnode/src/vmHandle.c
+6
-5
source/dnode/mnode/impl/inc/mndConsumer.h
source/dnode/mnode/impl/inc/mndConsumer.h
+10
-7
source/dnode/mnode/impl/inc/mndDef.h
source/dnode/mnode/impl/inc/mndDef.h
+132
-2
source/dnode/mnode/impl/inc/mndOffset.h
source/dnode/mnode/impl/inc/mndOffset.h
+1
-1
source/dnode/mnode/impl/inc/mndSubscribe.h
source/dnode/mnode/impl/inc/mndSubscribe.h
+3
-1
source/dnode/mnode/impl/src/mndConsumer.c
source/dnode/mnode/impl/src/mndConsumer.c
+523
-14
source/dnode/mnode/impl/src/mndDef.c
source/dnode/mnode/impl/src/mndDef.c
+397
-0
source/dnode/mnode/impl/src/mndOffset.c
source/dnode/mnode/impl/src/mndOffset.c
+13
-5
source/dnode/mnode/impl/src/mndScheduler.c
source/dnode/mnode/impl/src/mndScheduler.c
+30
-5
source/dnode/mnode/impl/src/mndStb.c
source/dnode/mnode/impl/src/mndStb.c
+1
-1
source/dnode/mnode/impl/src/mndSubscribe.c
source/dnode/mnode/impl/src/mndSubscribe.c
+510
-24
source/dnode/mnode/impl/src/mnode.c
source/dnode/mnode/impl/src/mnode.c
+3
-3
source/dnode/vnode/src/inc/tq.h
source/dnode/vnode/src/inc/tq.h
+26
-23
source/dnode/vnode/src/tq/tq.c
source/dnode/vnode/src/tq/tq.c
+117
-133
source/dnode/vnode/src/tq/tqMetaStore.c
source/dnode/vnode/src/tq/tqMetaStore.c
+0
-1
source/dnode/vnode/src/vnd/vnodeSvr.c
source/dnode/vnode/src/vnd/vnodeSvr.c
+9
-1
source/libs/function/inc/fnLog.h
source/libs/function/inc/fnLog.h
+24
-0
source/libs/function/inc/tudf.h
source/libs/function/inc/tudf.h
+18
-5
source/libs/function/inc/udfc.h
source/libs/function/inc/udfc.h
+2
-2
source/libs/function/src/builtins.c
source/libs/function/src/builtins.c
+1
-1
source/libs/function/src/tudf.c
source/libs/function/src/tudf.c
+11
-14
source/libs/function/src/udfd.c
source/libs/function/src/udfd.c
+451
-300
source/libs/function/test/runUdf.c
source/libs/function/test/runUdf.c
+2
-2
source/libs/nodes/src/nodesUtilFuncs.c
source/libs/nodes/src/nodesUtilFuncs.c
+1
-1
source/libs/parser/inc/parInsertData.h
source/libs/parser/inc/parInsertData.h
+3
-2
source/libs/parser/inc/parInt.h
source/libs/parser/inc/parInt.h
+2
-0
source/libs/parser/inc/parUtil.h
source/libs/parser/inc/parUtil.h
+1
-0
source/libs/parser/src/parAstCreater.c
source/libs/parser/src/parAstCreater.c
+1
-0
source/libs/parser/src/parInsert.c
source/libs/parser/src/parInsert.c
+522
-118
source/libs/parser/src/parInsertData.c
source/libs/parser/src/parInsertData.c
+112
-2
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+36
-10
source/libs/parser/src/parUtil.c
source/libs/parser/src/parUtil.c
+162
-5
source/libs/parser/src/parser.c
source/libs/parser/src/parser.c
+6
-2
source/libs/scalar/inc/filterInt.h
source/libs/scalar/inc/filterInt.h
+0
-2
source/libs/scalar/inc/sclvector.h
source/libs/scalar/inc/sclvector.h
+4
-0
source/libs/scalar/src/filter.c
source/libs/scalar/src/filter.c
+39
-59
source/libs/scalar/src/scalar.c
source/libs/scalar/src/scalar.c
+24
-12
source/libs/scalar/src/sclfunc.c
source/libs/scalar/src/sclfunc.c
+54
-0
source/libs/scalar/src/sclvector.c
source/libs/scalar/src/sclvector.c
+369
-158
source/libs/scalar/test/scalar/CMakeLists.txt
source/libs/scalar/test/scalar/CMakeLists.txt
+2
-1
source/libs/scalar/test/scalar/scalarTests.cpp
source/libs/scalar/test/scalar/scalarTests.cpp
+262
-1
source/os/src/osFile.c
source/os/src/osFile.c
+20
-20
source/util/src/tarray.c
source/util/src/tarray.c
+43
-3
source/util/src/tcompare.c
source/util/src/tcompare.c
+5
-0
source/util/src/terror.c
source/util/src/terror.c
+3
-0
source/util/src/tjson.c
source/util/src/tjson.c
+34
-0
source/util/src/tlog.c
source/util/src/tlog.c
+2
-0
source/util/src/tutil.c
source/util/src/tutil.c
+0
-59
tests/pytest/insert/binary.py
tests/pytest/insert/binary.py
+15
-13
tests/script/api/batchprepare.c
tests/script/api/batchprepare.c
+1464
-2244
tests/script/api/makefile
tests/script/api/makefile
+2
-6
tests/script/jenkins/basic.txt
tests/script/jenkins/basic.txt
+3
-0
tests/script/sh/checkValgrind.sh
tests/script/sh/checkValgrind.sh
+38
-0
tests/script/tsim/tmq/basic1.sim
tests/script/tsim/tmq/basic1.sim
+2
-2
tests/script/tsim/valgrind/checkError.sim
tests/script/tsim/valgrind/checkError.sim
+83
-0
tests/system-test/fulltest.sh
tests/system-test/fulltest.sh
+1
-0
tests/tsim/src/simExe.c
tests/tsim/src/simExe.c
+6
-0
tools/shell/src/shellEngine.c
tools/shell/src/shellEngine.c
+22
-52
未找到文件。
Jenkinsfile2
浏览文件 @
395d9e8b
...
@@ -88,6 +88,12 @@ def pre_test(){
...
@@ -88,6 +88,12 @@ def pre_test(){
cmake .. > /dev/null
cmake .. > /dev/null
make -j4> /dev/null
make -j4> /dev/null
'''
'''
sh'''
cd ${WKPY}
git reset --hard
git pull
pip3 install .
'''
return 1
return 1
}
}
...
@@ -97,6 +103,7 @@ pipeline {
...
@@ -97,6 +103,7 @@ pipeline {
environment{
environment{
WK = '/var/lib/jenkins/workspace/TDinternal'
WK = '/var/lib/jenkins/workspace/TDinternal'
WKC= '/var/lib/jenkins/workspace/TDengine'
WKC= '/var/lib/jenkins/workspace/TDengine'
WKPY= '/var/lib/jenkins/workspace/taos-connector-python'
}
}
stages {
stages {
stage('pre_build'){
stage('pre_build'){
...
@@ -117,6 +124,11 @@ pipeline {
...
@@ -117,6 +124,11 @@ pipeline {
./test-all.sh b1fq
./test-all.sh b1fq
'''
'''
sh'''
sh'''
export LD_LIBRARY_PATH=${WKC}/debug/build/lib
cd ${WKC}/tests/system-test
./fulltest.sh
'''
sh'''
cd ${WKC}/debug
cd ${WKC}/debug
ctest
ctest
'''
'''
...
...
example/src/demoapi.c
浏览文件 @
395d9e8b
...
@@ -176,7 +176,7 @@ static int print_result(char *tbname, TAOS_RES* res, int block) {
...
@@ -176,7 +176,7 @@ static int print_result(char *tbname, TAOS_RES* res, int block) {
}
}
if
(
block
)
{
if
(
block
)
{
warnPrint
(
"%s"
,
"call taos_fetch_block()
\n
"
);
warnPrint
(
"%s"
,
"call taos_fetch_block()
, don't call taos_fetch_lengths()
\n
"
);
int
rows
=
0
;
int
rows
=
0
;
while
((
rows
=
taos_fetch_block
(
res
,
&
row
)))
{
while
((
rows
=
taos_fetch_block
(
res
,
&
row
)))
{
int
*
lengths
=
taos_fetch_lengths
(
res
);
int
*
lengths
=
taos_fetch_lengths
(
res
);
...
...
example/src/tmq.c
浏览文件 @
395d9e8b
...
@@ -22,6 +22,7 @@
...
@@ -22,6 +22,7 @@
static
int
running
=
1
;
static
int
running
=
1
;
static
void
msg_process
(
TAOS_RES
*
msg
)
{
static
void
msg_process
(
TAOS_RES
*
msg
)
{
char
buf
[
1024
];
char
buf
[
1024
];
memset
(
buf
,
0
,
1024
);
printf
(
"topic: %s
\n
"
,
tmq_get_topic_name
(
msg
));
printf
(
"topic: %s
\n
"
,
tmq_get_topic_name
(
msg
));
printf
(
"vg:%d
\n
"
,
tmq_get_vgroup_id
(
msg
));
printf
(
"vg:%d
\n
"
,
tmq_get_vgroup_id
(
msg
));
while
(
1
)
{
while
(
1
)
{
...
@@ -220,7 +221,7 @@ void sync_consume_loop(tmq_t* tmq, tmq_list_t* topics) {
...
@@ -220,7 +221,7 @@ void sync_consume_loop(tmq_t* tmq, tmq_list_t* topics) {
msg_process
(
tmqmessage
);
msg_process
(
tmqmessage
);
tmq_message_destroy
(
tmqmessage
);
tmq_message_destroy
(
tmqmessage
);
if
((
++
msg_count
%
MIN_COMMIT_COUNT
)
==
0
)
tmq_commit
(
tmq
,
NULL
,
0
);
/*if ((++msg_count % MIN_COMMIT_COUNT) == 0) tmq_commit(tmq, NULL, 0);*/
}
}
}
}
...
...
include/client/taos.h
浏览文件 @
395d9e8b
...
@@ -92,38 +92,14 @@ typedef struct taosField {
...
@@ -92,38 +92,14 @@ typedef struct taosField {
typedef
void
(
*
__taos_async_fn_t
)(
void
*
param
,
TAOS_RES
*
,
int
code
);
typedef
void
(
*
__taos_async_fn_t
)(
void
*
param
,
TAOS_RES
*
,
int
code
);
typedef
struct
TAOS_BIND
{
typedef
struct
TAOS_BIND_v2
{
int
buffer_type
;
void
*
buffer
;
uintptr_t
buffer_length
;
// unused
uintptr_t
*
length
;
int
*
is_null
;
int
is_unsigned
;
// unused
int
*
error
;
// unused
union
{
int64_t
ts
;
int8_t
b
;
int8_t
v1
;
int16_t
v2
;
int32_t
v4
;
int64_t
v8
;
float
f4
;
double
f8
;
unsigned
char
*
bin
;
char
*
nchar
;
}
u
;
unsigned
int
allocated
;
}
TAOS_BIND
;
typedef
struct
TAOS_MULTI_BIND
{
int
buffer_type
;
int
buffer_type
;
void
*
buffer
;
void
*
buffer
;
uintptr_t
buffer_length
;
int32_t
buffer_length
;
int32_t
*
length
;
int32_t
*
length
;
char
*
is_null
;
char
*
is_null
;
int
num
;
int
num
;
}
TAOS_
MULTI_BIND
;
}
TAOS_
BIND_v2
;
typedef
enum
{
typedef
enum
{
SET_CONF_RET_SUCC
=
0
,
SET_CONF_RET_SUCC
=
0
,
...
@@ -152,34 +128,34 @@ DLL_EXPORT void taos_close(TAOS *taos);
...
@@ -152,34 +128,34 @@ DLL_EXPORT void taos_close(TAOS *taos);
const
char
*
taos_data_type
(
int
type
);
const
char
*
taos_data_type
(
int
type
);
DLL_EXPORT
TAOS_STMT
*
taos_stmt_init
(
TAOS
*
taos
);
DLL_EXPORT
TAOS_STMT
*
taos_stmt_init
(
TAOS
*
taos
);
DLL_EXPORT
int
taos_stmt_prepare
(
TAOS_STMT
*
stmt
,
const
char
*
sql
,
unsigned
long
length
);
DLL_EXPORT
int
taos_stmt_prepare
(
TAOS_STMT
*
stmt
,
const
char
*
sql
,
unsigned
long
length
);
DLL_EXPORT
int
taos_stmt_set_tbname_tags
(
TAOS_STMT
*
stmt
,
const
char
*
name
,
TAOS_BIND
*
tags
);
DLL_EXPORT
int
taos_stmt_set_tbname_tags
(
TAOS_STMT
*
stmt
,
const
char
*
name
,
TAOS_BIND_v2
*
tags
);
DLL_EXPORT
int
taos_stmt_set_tbname
(
TAOS_STMT
*
stmt
,
const
char
*
name
);
DLL_EXPORT
int
taos_stmt_set_tbname
(
TAOS_STMT
*
stmt
,
const
char
*
name
);
DLL_EXPORT
int
taos_stmt_set_sub_tbname
(
TAOS_STMT
*
stmt
,
const
char
*
name
);
DLL_EXPORT
int
taos_stmt_set_sub_tbname
(
TAOS_STMT
*
stmt
,
const
char
*
name
);
DLL_EXPORT
int
taos_stmt_is_insert
(
TAOS_STMT
*
stmt
,
int
*
insert
);
DLL_EXPORT
int
taos_stmt_is_insert
(
TAOS_STMT
*
stmt
,
int
*
insert
);
DLL_EXPORT
int
taos_stmt_num_params
(
TAOS_STMT
*
stmt
,
int
*
nums
);
DLL_EXPORT
int
taos_stmt_num_params
(
TAOS_STMT
*
stmt
,
int
*
nums
);
DLL_EXPORT
int
taos_stmt_get_param
(
TAOS_STMT
*
stmt
,
int
idx
,
int
*
type
,
int
*
bytes
);
DLL_EXPORT
int
taos_stmt_get_param
(
TAOS_STMT
*
stmt
,
int
idx
,
int
*
type
,
int
*
bytes
);
DLL_EXPORT
int
taos_stmt_bind_param
(
TAOS_STMT
*
stmt
,
TAOS_BIND
*
bind
);
DLL_EXPORT
int
taos_stmt_bind_param
(
TAOS_STMT
*
stmt
,
TAOS_BIND_v2
*
bind
);
DLL_EXPORT
int
taos_stmt_bind_param_batch
(
TAOS_STMT
*
stmt
,
TAOS_MULTI_BIND
*
bind
);
DLL_EXPORT
int
taos_stmt_bind_param_batch
(
TAOS_STMT
*
stmt
,
TAOS_BIND_v2
*
bind
);
DLL_EXPORT
int
taos_stmt_bind_single_param_batch
(
TAOS_STMT
*
stmt
,
TAOS_MULTI_BIND
*
bind
,
int
colIdx
);
DLL_EXPORT
int
taos_stmt_bind_single_param_batch
(
TAOS_STMT
*
stmt
,
TAOS_BIND_v2
*
bind
,
int
colIdx
);
DLL_EXPORT
int
taos_stmt_add_batch
(
TAOS_STMT
*
stmt
);
DLL_EXPORT
int
taos_stmt_add_batch
(
TAOS_STMT
*
stmt
);
DLL_EXPORT
int
taos_stmt_execute
(
TAOS_STMT
*
stmt
);
DLL_EXPORT
int
taos_stmt_execute
(
TAOS_STMT
*
stmt
);
DLL_EXPORT
TAOS_RES
*
taos_stmt_use_result
(
TAOS_STMT
*
stmt
);
DLL_EXPORT
TAOS_RES
*
taos_stmt_use_result
(
TAOS_STMT
*
stmt
);
DLL_EXPORT
int
taos_stmt_close
(
TAOS_STMT
*
stmt
);
DLL_EXPORT
int
taos_stmt_close
(
TAOS_STMT
*
stmt
);
DLL_EXPORT
char
*
taos_stmt_errstr
(
TAOS_STMT
*
stmt
);
DLL_EXPORT
char
*
taos_stmt_errstr
(
TAOS_STMT
*
stmt
);
DLL_EXPORT
int
taos_stmt_affected_rows
(
TAOS_STMT
*
stmt
);
DLL_EXPORT
int
taos_stmt_affected_rows
(
TAOS_STMT
*
stmt
);
DLL_EXPORT
TAOS_RES
*
taos_query
(
TAOS
*
taos
,
const
char
*
sql
);
DLL_EXPORT
TAOS_RES
*
taos_query
(
TAOS
*
taos
,
const
char
*
sql
);
DLL_EXPORT
TAOS_RES
*
taos_query_l
(
TAOS
*
taos
,
const
char
*
sql
,
int
sqlLen
);
DLL_EXPORT
TAOS_RES
*
taos_query_l
(
TAOS
*
taos
,
const
char
*
sql
,
int
sqlLen
);
DLL_EXPORT
TAOS_ROW
taos_fetch_row
(
TAOS_RES
*
res
);
DLL_EXPORT
TAOS_ROW
taos_fetch_row
(
TAOS_RES
*
res
);
DLL_EXPORT
int
taos_result_precision
(
TAOS_RES
*
res
);
// get the time precision of result
DLL_EXPORT
int
taos_result_precision
(
TAOS_RES
*
res
);
// get the time precision of result
DLL_EXPORT
void
taos_free_result
(
TAOS_RES
*
res
);
DLL_EXPORT
void
taos_free_result
(
TAOS_RES
*
res
);
DLL_EXPORT
int
taos_field_count
(
TAOS_RES
*
res
);
DLL_EXPORT
int
taos_field_count
(
TAOS_RES
*
res
);
DLL_EXPORT
int
taos_num_fields
(
TAOS_RES
*
res
);
DLL_EXPORT
int
taos_num_fields
(
TAOS_RES
*
res
);
DLL_EXPORT
int
taos_affected_rows
(
TAOS_RES
*
res
);
DLL_EXPORT
int
taos_affected_rows
(
TAOS_RES
*
res
);
DLL_EXPORT
TAOS_FIELD
*
taos_fetch_fields
(
TAOS_RES
*
res
);
DLL_EXPORT
TAOS_FIELD
*
taos_fetch_fields
(
TAOS_RES
*
res
);
DLL_EXPORT
int
taos_select_db
(
TAOS
*
taos
,
const
char
*
db
);
DLL_EXPORT
int
taos_select_db
(
TAOS
*
taos
,
const
char
*
db
);
...
...
include/common/tdatablock.h
浏览文件 @
395d9e8b
...
@@ -54,12 +54,34 @@ SEpSet getEpSet_s(SCorEpSet* pEpSet);
...
@@ -54,12 +54,34 @@ SEpSet getEpSet_s(SCorEpSet* pEpSet);
BMCharPos(bm_, r_) |= (1u << (7u - BitPos(r_))); \
BMCharPos(bm_, r_) |= (1u << (7u - BitPos(r_))); \
} while (0)
} while (0)
#define colDataIsNull_var(pColumnInfoData, row) (pColumnInfoData->varmeta.offset[row] == -1)
#define colDataSetNull_var(pColumnInfoData, row) (pColumnInfoData->varmeta.offset[row] = -1)
#define BitmapLen(_n) (((_n) + ((1 << NBIT) - 1)) >> NBIT)
#define colDataGetVarData(p1_, r_) ((p1_)->pData + (p1_)->varmeta.offset[(r_)])
#define colDataGetNumData(p1_, r_) ((p1_)->pData + ((r_) * (p1_)->info.bytes))
// SColumnInfoData, rowNumber
#define colDataGetData(p1_, r_) \
((IS_VAR_DATA_TYPE((p1_)->info.type)) ? colDataGetVarData(p1_, r_) \
: colDataGetNumData(p1_, r_))
static
FORCE_INLINE
bool
colDataIsNull_s
(
const
SColumnInfoData
*
pColumnInfoData
,
uint32_t
row
)
{
static
FORCE_INLINE
bool
colDataIsNull_s
(
const
SColumnInfoData
*
pColumnInfoData
,
uint32_t
row
)
{
if
(
pColumnInfoData
->
info
.
type
==
TSDB_DATA_TYPE_JSON
){
if
(
colDataIsNull_var
(
pColumnInfoData
,
row
)){
return
true
;
}
char
*
data
=
colDataGetVarData
(
pColumnInfoData
,
row
);
return
(
*
data
==
TSDB_DATA_TYPE_NULL
);
}
if
(
!
pColumnInfoData
->
hasNull
)
{
if
(
!
pColumnInfoData
->
hasNull
)
{
return
false
;
return
false
;
}
}
if
(
IS_VAR_DATA_TYPE
(
pColumnInfoData
->
info
.
type
))
{
return
pColumnInfoData
->
varmeta
.
offset
[
row
]
==
-
1
;
if
(
pColumnInfoData
->
info
.
type
==
TSDB_DATA_TYPE_VARCHAR
||
pColumnInfoData
->
info
.
type
==
TSDB_DATA_TYPE_NCHAR
)
{
return
colDataIsNull_var
(
pColumnInfoData
,
row
);
}
else
{
}
else
{
if
(
pColumnInfoData
->
nullbitmap
==
NULL
)
{
if
(
pColumnInfoData
->
nullbitmap
==
NULL
)
{
return
false
;
return
false
;
...
@@ -86,7 +108,7 @@ static FORCE_INLINE bool colDataIsNull(const SColumnInfoData* pColumnInfoData, u
...
@@ -86,7 +108,7 @@ static FORCE_INLINE bool colDataIsNull(const SColumnInfoData* pColumnInfoData, u
}
}
if
(
IS_VAR_DATA_TYPE
(
pColumnInfoData
->
info
.
type
))
{
if
(
IS_VAR_DATA_TYPE
(
pColumnInfoData
->
info
.
type
))
{
return
pColumnInfoData
->
varmeta
.
offset
[
row
]
==
-
1
;
return
colDataIsNull_var
(
pColumnInfoData
,
row
)
;
}
else
{
}
else
{
if
(
pColumnInfoData
->
nullbitmap
==
NULL
)
{
if
(
pColumnInfoData
->
nullbitmap
==
NULL
)
{
return
false
;
return
false
;
...
@@ -96,17 +118,10 @@ static FORCE_INLINE bool colDataIsNull(const SColumnInfoData* pColumnInfoData, u
...
@@ -96,17 +118,10 @@ static FORCE_INLINE bool colDataIsNull(const SColumnInfoData* pColumnInfoData, u
}
}
}
}
#define BitmapLen(_n) (((_n) + ((1 << NBIT) - 1)) >> NBIT)
// SColumnInfoData, rowNumber
#define colDataGetData(p1_, r_) \
((IS_VAR_DATA_TYPE((p1_)->info.type)) ? ((p1_)->pData + (p1_)->varmeta.offset[(r_)]) \
: ((p1_)->pData + ((r_) * (p1_)->info.bytes)))
static
FORCE_INLINE
void
colDataAppendNULL
(
SColumnInfoData
*
pColumnInfoData
,
uint32_t
currentRow
)
{
static
FORCE_INLINE
void
colDataAppendNULL
(
SColumnInfoData
*
pColumnInfoData
,
uint32_t
currentRow
)
{
// There is a placehold for each NULL value of binary or nchar type.
// There is a placehold for each NULL value of binary or nchar type.
if
(
IS_VAR_DATA_TYPE
(
pColumnInfoData
->
info
.
type
))
{
if
(
IS_VAR_DATA_TYPE
(
pColumnInfoData
->
info
.
type
))
{
pColumnInfoData
->
varmeta
.
offset
[
currentRow
]
=
-
1
;
// it is a null value of VAR type.
colDataSetNull_var
(
pColumnInfoData
,
currentRow
)
;
// it is a null value of VAR type.
}
else
{
}
else
{
colDataSetNull_f
(
pColumnInfoData
->
nullbitmap
,
currentRow
);
colDataSetNull_f
(
pColumnInfoData
->
nullbitmap
,
currentRow
);
}
}
...
@@ -117,7 +132,7 @@ static FORCE_INLINE void colDataAppendNULL(SColumnInfoData* pColumnInfoData, uin
...
@@ -117,7 +132,7 @@ static FORCE_INLINE void colDataAppendNULL(SColumnInfoData* pColumnInfoData, uin
static
FORCE_INLINE
void
colDataAppendNNULL
(
SColumnInfoData
*
pColumnInfoData
,
uint32_t
start
,
size_t
nRows
)
{
static
FORCE_INLINE
void
colDataAppendNNULL
(
SColumnInfoData
*
pColumnInfoData
,
uint32_t
start
,
size_t
nRows
)
{
if
(
IS_VAR_DATA_TYPE
(
pColumnInfoData
->
info
.
type
))
{
if
(
IS_VAR_DATA_TYPE
(
pColumnInfoData
->
info
.
type
))
{
for
(
int32_t
i
=
start
;
i
<
start
+
nRows
;
++
i
)
{
for
(
int32_t
i
=
start
;
i
<
start
+
nRows
;
++
i
)
{
pColumnInfoData
->
varmeta
.
offset
[
i
]
=
-
1
;
// it is a null value of VAR type.
colDataSetNull_var
(
pColumnInfoData
,
i
)
;
// it is a null value of VAR type.
}
}
}
else
{
}
else
{
for
(
int32_t
i
=
start
;
i
<
start
+
nRows
;
++
i
)
{
for
(
int32_t
i
=
start
;
i
<
start
+
nRows
;
++
i
)
{
...
@@ -265,3 +280,4 @@ static FORCE_INLINE void blockCompressEncode(const SSDataBlock* pBlock, char* da
...
@@ -265,3 +280,4 @@ static FORCE_INLINE void blockCompressEncode(const SSDataBlock* pBlock, char* da
#endif
#endif
#endif
/*_TD_COMMON_EP_H_*/
#endif
/*_TD_COMMON_EP_H_*/
include/common/tdataformat.h
浏览文件 @
395d9e8b
...
@@ -502,7 +502,7 @@ typedef struct {
...
@@ -502,7 +502,7 @@ typedef struct {
#define TD_KV_ROW_HEAD_SIZE (sizeof(uint16_t) + sizeof(int16_t))
#define TD_KV_ROW_HEAD_SIZE (sizeof(uint16_t) + sizeof(int16_t))
#define kvRowLen(r) (*(
TDRowLenT
*)(r))
#define kvRowLen(r) (*(
uint16_t
*)(r))
#define kvRowNCols(r) (*(int16_t *)POINTER_SHIFT(r, sizeof(uint16_t)))
#define kvRowNCols(r) (*(int16_t *)POINTER_SHIFT(r, sizeof(uint16_t)))
#define kvRowSetLen(r, len) kvRowLen(r) = (len)
#define kvRowSetLen(r, len) kvRowLen(r) = (len)
#define kvRowSetNCols(r, n) kvRowNCols(r) = (n)
#define kvRowSetNCols(r, n) kvRowNCols(r) = (n)
...
@@ -608,7 +608,7 @@ void tdDestroyKVRowBuilder(SKVRowBuilder *pBuilder);
...
@@ -608,7 +608,7 @@ void tdDestroyKVRowBuilder(SKVRowBuilder *pBuilder);
void
tdResetKVRowBuilder
(
SKVRowBuilder
*
pBuilder
);
void
tdResetKVRowBuilder
(
SKVRowBuilder
*
pBuilder
);
SKVRow
tdGetKVRowFromBuilder
(
SKVRowBuilder
*
pBuilder
);
SKVRow
tdGetKVRowFromBuilder
(
SKVRowBuilder
*
pBuilder
);
static
FORCE_INLINE
int32_t
tdAddColToKVRow
(
SKVRowBuilder
*
pBuilder
,
col_id_t
colId
,
int8_t
type
,
const
void
*
value
)
{
static
FORCE_INLINE
int32_t
tdAddColToKVRow
(
SKVRowBuilder
*
pBuilder
,
col_id_t
colId
,
const
void
*
value
,
int32_t
tlen
)
{
if
(
pBuilder
->
nCols
>=
pBuilder
->
tCols
)
{
if
(
pBuilder
->
nCols
>=
pBuilder
->
tCols
)
{
pBuilder
->
tCols
*=
2
;
pBuilder
->
tCols
*=
2
;
SColIdx
*
pColIdx
=
(
SColIdx
*
)
taosMemoryRealloc
((
void
*
)(
pBuilder
->
pColIdx
),
sizeof
(
SColIdx
)
*
pBuilder
->
tCols
);
SColIdx
*
pColIdx
=
(
SColIdx
*
)
taosMemoryRealloc
((
void
*
)(
pBuilder
->
pColIdx
),
sizeof
(
SColIdx
)
*
pBuilder
->
tCols
);
...
@@ -621,7 +621,6 @@ static FORCE_INLINE int32_t tdAddColToKVRow(SKVRowBuilder *pBuilder, col_id_t co
...
@@ -621,7 +621,6 @@ static FORCE_INLINE int32_t tdAddColToKVRow(SKVRowBuilder *pBuilder, col_id_t co
pBuilder
->
nCols
++
;
pBuilder
->
nCols
++
;
int32_t
tlen
=
IS_VAR_DATA_TYPE
(
type
)
?
varDataTLen
(
value
)
:
TYPE_BYTES
[
type
];
if
(
tlen
>
pBuilder
->
alloc
-
pBuilder
->
size
)
{
if
(
tlen
>
pBuilder
->
alloc
-
pBuilder
->
size
)
{
while
(
tlen
>
pBuilder
->
alloc
-
pBuilder
->
size
)
{
while
(
tlen
>
pBuilder
->
alloc
-
pBuilder
->
size
)
{
pBuilder
->
alloc
*=
2
;
pBuilder
->
alloc
*=
2
;
...
...
include/common/tmsg.h
浏览文件 @
395d9e8b
...
@@ -324,7 +324,7 @@ typedef struct SEpSet {
...
@@ -324,7 +324,7 @@ typedef struct SEpSet {
int32_t
tEncodeSEpSet
(
SCoder
*
pEncoder
,
const
SEpSet
*
pEp
);
int32_t
tEncodeSEpSet
(
SCoder
*
pEncoder
,
const
SEpSet
*
pEp
);
int32_t
tDecodeSEpSet
(
SCoder
*
pDecoder
,
SEpSet
*
pEp
);
int32_t
tDecodeSEpSet
(
SCoder
*
pDecoder
,
SEpSet
*
pEp
);
int32_t
taosEncodeSEpSet
(
void
**
buf
,
const
SEpSet
*
pEp
);
int32_t
taosEncodeSEpSet
(
void
**
buf
,
const
SEpSet
*
pEp
);
void
*
taosDecodeSEpSet
(
void
*
buf
,
SEpSet
*
pEp
);
void
*
taosDecodeSEpSet
(
const
void
*
buf
,
SEpSet
*
pEp
);
typedef
struct
{
typedef
struct
{
int8_t
connType
;
int8_t
connType
;
...
@@ -1291,10 +1291,14 @@ typedef struct {
...
@@ -1291,10 +1291,14 @@ typedef struct {
int32_t
tSerializeSCMCreateTopicRsp
(
void
*
buf
,
int32_t
bufLen
,
const
SCMCreateTopicRsp
*
pRsp
);
int32_t
tSerializeSCMCreateTopicRsp
(
void
*
buf
,
int32_t
bufLen
,
const
SCMCreateTopicRsp
*
pRsp
);
int32_t
tDeserializeSCMCreateTopicRsp
(
void
*
buf
,
int32_t
bufLen
,
SCMCreateTopicRsp
*
pRsp
);
int32_t
tDeserializeSCMCreateTopicRsp
(
void
*
buf
,
int32_t
bufLen
,
SCMCreateTopicRsp
*
pRsp
);
typedef
struct
{
int64_t
consumerId
;
}
SMqConsumerLostMsg
;
typedef
struct
{
typedef
struct
{
int32_t
topicNum
;
int32_t
topicNum
;
int64_t
consumerId
;
int64_t
consumerId
;
char
*
consumerGroup
;
char
cgroup
[
TSDB_CGROUP_LEN
]
;
SArray
*
topicNames
;
// SArray<char*>
SArray
*
topicNames
;
// SArray<char*>
}
SCMSubscribeReq
;
}
SCMSubscribeReq
;
...
@@ -1302,7 +1306,7 @@ static FORCE_INLINE int32_t tSerializeSCMSubscribeReq(void** buf, const SCMSubsc
...
@@ -1302,7 +1306,7 @@ static FORCE_INLINE int32_t tSerializeSCMSubscribeReq(void** buf, const SCMSubsc
int32_t
tlen
=
0
;
int32_t
tlen
=
0
;
tlen
+=
taosEncodeFixedI32
(
buf
,
pReq
->
topicNum
);
tlen
+=
taosEncodeFixedI32
(
buf
,
pReq
->
topicNum
);
tlen
+=
taosEncodeFixedI64
(
buf
,
pReq
->
consumerId
);
tlen
+=
taosEncodeFixedI64
(
buf
,
pReq
->
consumerId
);
tlen
+=
taosEncodeString
(
buf
,
pReq
->
c
onsumerG
roup
);
tlen
+=
taosEncodeString
(
buf
,
pReq
->
c
g
roup
);
for
(
int32_t
i
=
0
;
i
<
pReq
->
topicNum
;
i
++
)
{
for
(
int32_t
i
=
0
;
i
<
pReq
->
topicNum
;
i
++
)
{
tlen
+=
taosEncodeString
(
buf
,
(
char
*
)
taosArrayGetP
(
pReq
->
topicNames
,
i
));
tlen
+=
taosEncodeString
(
buf
,
(
char
*
)
taosArrayGetP
(
pReq
->
topicNames
,
i
));
...
@@ -1313,7 +1317,7 @@ static FORCE_INLINE int32_t tSerializeSCMSubscribeReq(void** buf, const SCMSubsc
...
@@ -1313,7 +1317,7 @@ static FORCE_INLINE int32_t tSerializeSCMSubscribeReq(void** buf, const SCMSubsc
static
FORCE_INLINE
void
*
tDeserializeSCMSubscribeReq
(
void
*
buf
,
SCMSubscribeReq
*
pReq
)
{
static
FORCE_INLINE
void
*
tDeserializeSCMSubscribeReq
(
void
*
buf
,
SCMSubscribeReq
*
pReq
)
{
buf
=
taosDecodeFixedI32
(
buf
,
&
pReq
->
topicNum
);
buf
=
taosDecodeFixedI32
(
buf
,
&
pReq
->
topicNum
);
buf
=
taosDecodeFixedI64
(
buf
,
&
pReq
->
consumerId
);
buf
=
taosDecodeFixedI64
(
buf
,
&
pReq
->
consumerId
);
buf
=
taosDecodeString
(
buf
,
&
pReq
->
consumerG
roup
);
buf
=
taosDecodeString
To
(
buf
,
pReq
->
cg
roup
);
pReq
->
topicNames
=
taosArrayInit
(
pReq
->
topicNum
,
sizeof
(
void
*
));
pReq
->
topicNames
=
taosArrayInit
(
pReq
->
topicNum
,
sizeof
(
void
*
));
for
(
int32_t
i
=
0
;
i
<
pReq
->
topicNum
;
i
++
)
{
for
(
int32_t
i
=
0
;
i
<
pReq
->
topicNum
;
i
++
)
{
char
*
name
;
char
*
name
;
...
@@ -1389,10 +1393,10 @@ static FORCE_INLINE void* tDeserializeSMVSubscribeReq(void* buf, SMVSubscribeReq
...
@@ -1389,10 +1393,10 @@ static FORCE_INLINE void* tDeserializeSMVSubscribeReq(void* buf, SMVSubscribeReq
}
}
typedef
struct
{
typedef
struct
{
c
onst
char
*
key
;
c
har
key
[
TSDB_SUBSCRIBE_KEY_LEN
]
;
SArray
*
lostConsumers
;
// SArray<int64_t>
SArray
*
lostConsumers
;
// SArray<int64_t>
SArray
*
removedConsumers
;
// SArray<int64_t>
SArray
*
removedConsumers
;
// SArray<int64_t>
SArray
*
newConsumers
;
// SArray<int64_t>
SArray
*
newConsumers
;
// SArray<int64_t>
}
SMqRebSubscribe
;
}
SMqRebSubscribe
;
static
FORCE_INLINE
SMqRebSubscribe
*
tNewSMqRebSubscribe
(
const
char
*
key
)
{
static
FORCE_INLINE
SMqRebSubscribe
*
tNewSMqRebSubscribe
(
const
char
*
key
)
{
...
@@ -1400,7 +1404,7 @@ static FORCE_INLINE SMqRebSubscribe* tNewSMqRebSubscribe(const char* key) {
...
@@ -1400,7 +1404,7 @@ static FORCE_INLINE SMqRebSubscribe* tNewSMqRebSubscribe(const char* key) {
if
(
pRebSub
==
NULL
)
{
if
(
pRebSub
==
NULL
)
{
goto
_err
;
goto
_err
;
}
}
pRebSub
->
key
=
strdup
(
key
);
strcpy
(
pRebSub
->
key
,
key
);
pRebSub
->
lostConsumers
=
taosArrayInit
(
0
,
sizeof
(
int64_t
));
pRebSub
->
lostConsumers
=
taosArrayInit
(
0
,
sizeof
(
int64_t
));
if
(
pRebSub
->
lostConsumers
==
NULL
)
{
if
(
pRebSub
->
lostConsumers
==
NULL
)
{
goto
_err
;
goto
_err
;
...
@@ -1425,6 +1429,7 @@ _err:
...
@@ -1425,6 +1429,7 @@ _err:
// this message is sent from mnode to mnode(read thread to write thread), so there is no need for serialization or
// this message is sent from mnode to mnode(read thread to write thread), so there is no need for serialization or
// deserialization
// deserialization
typedef
struct
{
typedef
struct
{
int8_t
*
mqInReb
;
SHashObj
*
rebSubHash
;
// SHashObj<key, SMqRebSubscribe>
SHashObj
*
rebSubHash
;
// SHashObj<key, SMqRebSubscribe>
}
SMqDoRebalanceMsg
;
}
SMqDoRebalanceMsg
;
...
@@ -1927,6 +1932,40 @@ static FORCE_INLINE void* taosDecodeSMqMsg(void* buf, SMqHbMsg* pMsg) {
...
@@ -1927,6 +1932,40 @@ static FORCE_INLINE void* taosDecodeSMqMsg(void* buf, SMqHbMsg* pMsg) {
return
buf
;
return
buf
;
}
}
typedef
struct
{
int64_t
leftForVer
;
int32_t
vgId
;
int64_t
oldConsumerId
;
int64_t
newConsumerId
;
char
subKey
[
TSDB_SUBSCRIBE_KEY_LEN
];
char
*
qmsg
;
}
SMqRebVgReq
;
static
FORCE_INLINE
int32_t
tEncodeSMqRebVgReq
(
void
**
buf
,
const
SMqRebVgReq
*
pReq
)
{
int32_t
tlen
=
0
;
tlen
+=
taosEncodeFixedI64
(
buf
,
pReq
->
leftForVer
);
tlen
+=
taosEncodeFixedI32
(
buf
,
pReq
->
vgId
);
tlen
+=
taosEncodeFixedI64
(
buf
,
pReq
->
oldConsumerId
);
tlen
+=
taosEncodeFixedI64
(
buf
,
pReq
->
newConsumerId
);
tlen
+=
taosEncodeString
(
buf
,
pReq
->
subKey
);
tlen
+=
taosEncodeString
(
buf
,
pReq
->
qmsg
);
return
tlen
;
}
static
FORCE_INLINE
void
*
tDecodeSMqRebVgReq
(
const
void
*
buf
,
SMqRebVgReq
*
pReq
)
{
buf
=
taosDecodeFixedI64
(
buf
,
&
pReq
->
leftForVer
);
buf
=
taosDecodeFixedI32
(
buf
,
&
pReq
->
vgId
);
buf
=
taosDecodeFixedI64
(
buf
,
&
pReq
->
oldConsumerId
);
buf
=
taosDecodeFixedI64
(
buf
,
&
pReq
->
newConsumerId
);
buf
=
taosDecodeStringTo
(
buf
,
pReq
->
subKey
);
buf
=
taosDecodeString
(
buf
,
&
pReq
->
qmsg
);
return
(
void
*
)
buf
;
}
typedef
struct
{
int8_t
reserved
;
}
SMqRebVgRsp
;
typedef
struct
{
typedef
struct
{
int64_t
leftForVer
;
int64_t
leftForVer
;
int32_t
vgId
;
int32_t
vgId
;
...
@@ -2397,6 +2436,7 @@ typedef struct {
...
@@ -2397,6 +2436,7 @@ typedef struct {
int64_t
consumerId
;
int64_t
consumerId
;
}
SMqRspHead
;
}
SMqRspHead
;
#if 0
typedef struct {
typedef struct {
SMsgHead head;
SMsgHead head;
...
@@ -2410,6 +2450,17 @@ typedef struct {
...
@@ -2410,6 +2450,17 @@ typedef struct {
uint64_t reqId;
uint64_t reqId;
char topic[TSDB_TOPIC_FNAME_LEN];
char topic[TSDB_TOPIC_FNAME_LEN];
} SMqPollReq;
} SMqPollReq;
#endif
typedef
struct
{
SMsgHead
head
;
char
subKey
[
TSDB_SUBSCRIBE_KEY_LEN
];
int32_t
epoch
;
uint64_t
reqId
;
int64_t
consumerId
;
int64_t
blockingTime
;
int64_t
currentOffset
;
}
SMqPollReqV2
;
typedef
struct
{
typedef
struct
{
int32_t
vgId
;
int32_t
vgId
;
...
@@ -2483,13 +2534,81 @@ static FORCE_INLINE void* tDecodeSMqPollRspV2(const void* buf, SMqPollRspV2* pRs
...
@@ -2483,13 +2534,81 @@ static FORCE_INLINE void* tDecodeSMqPollRspV2(const void* buf, SMqPollRspV2* pRs
return
(
void
*
)
buf
;
return
(
void
*
)
buf
;
}
}
typedef
struct
{
SMqRspHead
head
;
int64_t
reqOffset
;
int64_t
rspOffset
;
int32_t
skipLogNum
;
int32_t
blockNum
;
int8_t
withTbName
;
int8_t
withSchema
;
int8_t
withTag
;
int8_t
withTagSchema
;
SArray
*
blockDataLen
;
// SArray<int32_t>
SArray
*
blockData
;
// SArray<SRetrieveTableRsp*>
SArray
*
blockTbName
;
// SArray<char*>
SArray
*
blockSchema
;
// SArray<SSchemaWrapper>
SArray
*
blockTags
;
// SArray<kvrow>
SArray
*
blockTagSchema
;
// SArray<kvrow>
}
SMqDataBlkRsp
;
static
FORCE_INLINE
int32_t
tEncodeSMqDataBlkRsp
(
void
**
buf
,
const
SMqDataBlkRsp
*
pRsp
)
{
int32_t
tlen
=
0
;
tlen
+=
taosEncodeFixedI64
(
buf
,
pRsp
->
reqOffset
);
tlen
+=
taosEncodeFixedI64
(
buf
,
pRsp
->
rspOffset
);
tlen
+=
taosEncodeFixedI32
(
buf
,
pRsp
->
skipLogNum
);
tlen
+=
taosEncodeFixedI32
(
buf
,
pRsp
->
blockNum
);
if
(
pRsp
->
blockNum
!=
0
)
{
tlen
+=
taosEncodeFixedI8
(
buf
,
pRsp
->
withTbName
);
tlen
+=
taosEncodeFixedI8
(
buf
,
pRsp
->
withSchema
);
tlen
+=
taosEncodeFixedI8
(
buf
,
pRsp
->
withTag
);
tlen
+=
taosEncodeFixedI8
(
buf
,
pRsp
->
withTagSchema
);
for
(
int32_t
i
=
0
;
i
<
pRsp
->
blockNum
;
i
++
)
{
int32_t
bLen
=
*
(
int32_t
*
)
taosArrayGet
(
pRsp
->
blockDataLen
,
i
);
void
*
data
=
taosArrayGetP
(
pRsp
->
blockData
,
i
);
tlen
+=
taosEncodeFixedI32
(
buf
,
bLen
);
tlen
+=
taosEncodeBinary
(
buf
,
data
,
bLen
);
}
}
return
tlen
;
}
static
FORCE_INLINE
void
*
tDecodeSMqDataBlkRsp
(
const
void
*
buf
,
SMqDataBlkRsp
*
pRsp
)
{
buf
=
taosDecodeFixedI64
(
buf
,
&
pRsp
->
reqOffset
);
buf
=
taosDecodeFixedI64
(
buf
,
&
pRsp
->
rspOffset
);
buf
=
taosDecodeFixedI32
(
buf
,
&
pRsp
->
skipLogNum
);
buf
=
taosDecodeFixedI32
(
buf
,
&
pRsp
->
blockNum
);
pRsp
->
blockData
=
taosArrayInit
(
pRsp
->
blockNum
,
sizeof
(
void
*
));
pRsp
->
blockDataLen
=
taosArrayInit
(
pRsp
->
blockNum
,
sizeof
(
void
*
));
if
(
pRsp
->
blockNum
!=
0
)
{
buf
=
taosDecodeFixedI8
(
buf
,
&
pRsp
->
withTbName
);
buf
=
taosDecodeFixedI8
(
buf
,
&
pRsp
->
withSchema
);
buf
=
taosDecodeFixedI8
(
buf
,
&
pRsp
->
withTag
);
buf
=
taosDecodeFixedI8
(
buf
,
&
pRsp
->
withTagSchema
);
for
(
int32_t
i
=
0
;
i
<
pRsp
->
blockNum
;
i
++
)
{
int32_t
bLen
=
0
;
void
*
data
=
NULL
;
buf
=
taosDecodeFixedI32
(
buf
,
&
bLen
);
buf
=
taosDecodeBinary
(
buf
,
&
data
,
bLen
);
taosArrayPush
(
pRsp
->
blockDataLen
,
&
bLen
);
taosArrayPush
(
pRsp
->
blockData
,
&
data
);
}
}
return
(
void
*
)
buf
;
}
typedef
struct
{
typedef
struct
{
SMqRspHead
head
;
SMqRspHead
head
;
char
cgroup
[
TSDB_CGROUP_LEN
];
char
cgroup
[
TSDB_CGROUP_LEN
];
SArray
*
topics
;
// SArray<SMqSubTopicEp>
SArray
*
topics
;
// SArray<SMqSubTopicEp>
}
SMqCMGetSubEpRsp
;
}
SMqCMGetSubEpRsp
;
static
FORCE_INLINE
void
tDeleteSMqSubTopicEp
(
SMqSubTopicEp
*
pSubTopicEp
)
{
taosArrayDestroy
(
pSubTopicEp
->
vgs
);
}
static
FORCE_INLINE
void
tDeleteSMqSubTopicEp
(
SMqSubTopicEp
*
pSubTopicEp
)
{
// taosMemoryFree(pSubTopicEp->schema.pSchema);
taosArrayDestroy
(
pSubTopicEp
->
vgs
);
}
static
FORCE_INLINE
int32_t
tEncodeSMqSubVgEp
(
void
**
buf
,
const
SMqSubVgEp
*
pVgEp
)
{
static
FORCE_INLINE
int32_t
tEncodeSMqSubVgEp
(
void
**
buf
,
const
SMqSubVgEp
*
pVgEp
)
{
int32_t
tlen
=
0
;
int32_t
tlen
=
0
;
...
...
include/common/tmsgdef.h
浏览文件 @
395d9e8b
...
@@ -146,6 +146,7 @@ enum {
...
@@ -146,6 +146,7 @@ enum {
TD_DEF_MSG_TYPE
(
TDMT_MND_SUBSCRIBE
,
"mnode-subscribe"
,
SCMSubscribeReq
,
SCMSubscribeRsp
)
TD_DEF_MSG_TYPE
(
TDMT_MND_SUBSCRIBE
,
"mnode-subscribe"
,
SCMSubscribeReq
,
SCMSubscribeRsp
)
TD_DEF_MSG_TYPE
(
TDMT_MND_GET_SUB_EP
,
"mnode-get-sub-ep"
,
SMqCMGetSubEpReq
,
SMqCMGetSubEpRsp
)
TD_DEF_MSG_TYPE
(
TDMT_MND_GET_SUB_EP
,
"mnode-get-sub-ep"
,
SMqCMGetSubEpReq
,
SMqCMGetSubEpRsp
)
TD_DEF_MSG_TYPE
(
TDMT_MND_MQ_TIMER
,
"mnode-mq-tmr"
,
SMTimerReq
,
SMTimerReq
)
TD_DEF_MSG_TYPE
(
TDMT_MND_MQ_TIMER
,
"mnode-mq-tmr"
,
SMTimerReq
,
SMTimerReq
)
TD_DEF_MSG_TYPE
(
TDMT_MND_MQ_CONSUMER_LOST
,
"mnode-mq-consumer-lost"
,
SMTimerReq
,
SMTimerReq
)
TD_DEF_MSG_TYPE
(
TDMT_MND_MQ_DO_REBALANCE
,
"mnode-mq-do-rebalance"
,
SMqDoRebalanceMsg
,
SMqDoRebalanceMsg
)
TD_DEF_MSG_TYPE
(
TDMT_MND_MQ_DO_REBALANCE
,
"mnode-mq-do-rebalance"
,
SMqDoRebalanceMsg
,
SMqDoRebalanceMsg
)
TD_DEF_MSG_TYPE
(
TDMT_MND_MQ_COMMIT_OFFSET
,
"mnode-mq-commit-offset"
,
SMqCMCommitOffsetReq
,
SMqCMCommitOffsetRsp
)
TD_DEF_MSG_TYPE
(
TDMT_MND_MQ_COMMIT_OFFSET
,
"mnode-mq-commit-offset"
,
SMqCMCommitOffsetReq
,
SMqCMCommitOffsetRsp
)
TD_DEF_MSG_TYPE
(
TDMT_MND_CREATE_STREAM
,
"mnode-create-stream"
,
SCMCreateStreamReq
,
SCMCreateStreamRsp
)
TD_DEF_MSG_TYPE
(
TDMT_MND_CREATE_STREAM
,
"mnode-create-stream"
,
SCMCreateStreamReq
,
SCMCreateStreamRsp
)
...
@@ -177,6 +178,7 @@ enum {
...
@@ -177,6 +178,7 @@ enum {
TD_DEF_MSG_TYPE
(
TDMT_VND_MQ_SET_CONN
,
"vnode-mq-set-conn"
,
SMqSetCVgReq
,
SMqSetCVgRsp
)
TD_DEF_MSG_TYPE
(
TDMT_VND_MQ_SET_CONN
,
"vnode-mq-set-conn"
,
SMqSetCVgReq
,
SMqSetCVgRsp
)
TD_DEF_MSG_TYPE
(
TDMT_VND_MQ_REB
,
"vnode-mq-mv-rebalance"
,
SMqMVRebReq
,
SMqMVRebRsp
)
TD_DEF_MSG_TYPE
(
TDMT_VND_MQ_REB
,
"vnode-mq-mv-rebalance"
,
SMqMVRebReq
,
SMqMVRebRsp
)
TD_DEF_MSG_TYPE
(
TDMT_VND_MQ_CANCEL_CONN
,
"vnode-mq-mv-cancel-conn"
,
SMqCancelConnReq
,
SMqCancelConnRsp
)
TD_DEF_MSG_TYPE
(
TDMT_VND_MQ_CANCEL_CONN
,
"vnode-mq-mv-cancel-conn"
,
SMqCancelConnReq
,
SMqCancelConnRsp
)
TD_DEF_MSG_TYPE
(
TDMT_VND_MQ_VG_CHANGE
,
"vnode-mq-vg-change"
,
SMqRebVgReq
,
SMqRebVgRsp
)
TD_DEF_MSG_TYPE
(
TDMT_VND_MQ_SET_CUR
,
"vnode-mq-set-cur"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_VND_MQ_SET_CUR
,
"vnode-mq-set-cur"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_VND_RES_READY
,
"vnode-res-ready"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_VND_RES_READY
,
"vnode-res-ready"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_VND_TASKS_STATUS
,
"vnode-tasks-status"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_VND_TASKS_STATUS
,
"vnode-tasks-status"
,
NULL
,
NULL
)
...
...
include/common/trow.h
浏览文件 @
395d9e8b
...
@@ -684,6 +684,43 @@ static int32_t tdSRowResetBuf(SRowBuilder *pBuilder, void *pBuf) {
...
@@ -684,6 +684,43 @@ static int32_t tdSRowResetBuf(SRowBuilder *pBuilder, void *pBuf) {
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
/**
* @brief The invoker is responsible for memory alloc/dealloc.
*
* @param pBuilder
* @param pBuf Output buffer of STSRow
*/
static
int32_t
tdSRowGetBuf
(
SRowBuilder
*
pBuilder
,
void
*
pBuf
)
{
pBuilder
->
pBuf
=
(
STSRow
*
)
pBuf
;
if
(
!
pBuilder
->
pBuf
)
{
TASSERT
(
0
);
terrno
=
TSDB_CODE_INVALID_PARA
;
return
terrno
;
}
TASSERT
(
pBuilder
->
nBitmaps
>
0
&&
pBuilder
->
flen
>
0
);
uint32_t
len
=
0
;
switch
(
pBuilder
->
rowType
)
{
case
TD_ROW_TP
:
#ifdef TD_SUPPORT_BITMAP
pBuilder
->
pBitmap
=
tdGetBitmapAddrTp
(
pBuilder
->
pBuf
,
pBuilder
->
flen
);
#endif
break
;
case
TD_ROW_KV
:
#ifdef TD_SUPPORT_BITMAP
pBuilder
->
pBitmap
=
tdGetBitmapAddrKv
(
pBuilder
->
pBuf
,
pBuilder
->
nBoundCols
);
#endif
break
;
default:
TASSERT
(
0
);
terrno
=
TSDB_CODE_INVALID_PARA
;
return
terrno
;
}
return
TSDB_CODE_SUCCESS
;
}
/**
/**
* @brief 由调用方管理存储空间的分配及释放,一次输入多个参数
* @brief 由调用方管理存储空间的分配及释放,一次输入多个参数
*
*
...
...
include/common/ttypes.h
浏览文件 @
395d9e8b
...
@@ -49,7 +49,7 @@ typedef struct {
...
@@ -49,7 +49,7 @@ typedef struct {
#define varDataCopy(dst, v) memcpy((dst), (void *)(v), varDataTLen(v))
#define varDataCopy(dst, v) memcpy((dst), (void *)(v), varDataTLen(v))
#define varDataLenByData(v) (*(VarDataLenT *)(((char *)(v)) - VARSTR_HEADER_SIZE))
#define varDataLenByData(v) (*(VarDataLenT *)(((char *)(v)) - VARSTR_HEADER_SIZE))
#define varDataSetLen(v, _len) (((VarDataLenT *)(v))[0] = (VarDataLenT)(_len))
#define varDataSetLen(v, _len) (((VarDataLenT *)(v))[0] = (VarDataLenT)(_len))
#define IS_VAR_DATA_TYPE(t) (((t) == TSDB_DATA_TYPE_VARCHAR) || ((t) == TSDB_DATA_TYPE_NCHAR))
#define IS_VAR_DATA_TYPE(t) (((t) == TSDB_DATA_TYPE_VARCHAR) || ((t) == TSDB_DATA_TYPE_NCHAR)
|| ((t) == TSDB_DATA_TYPE_JSON)
)
#define varDataNetLen(v) (htons(((VarDataLenT *)(v))[0]))
#define varDataNetLen(v) (htons(((VarDataLenT *)(v))[0]))
#define varDataNetTLen(v) (sizeof(VarDataLenT) + varDataNetLen(v))
#define varDataNetTLen(v) (sizeof(VarDataLenT) + varDataNetLen(v))
...
@@ -252,7 +252,7 @@ typedef struct tDataTypeDescriptor {
...
@@ -252,7 +252,7 @@ typedef struct tDataTypeDescriptor {
int64_t
*
max
,
int64_t
*
sum
,
int16_t
*
minindex
,
int16_t
*
maxindex
,
int16_t
*
numofnull
);
int64_t
*
max
,
int64_t
*
sum
,
int16_t
*
minindex
,
int16_t
*
maxindex
,
int16_t
*
numofnull
);
}
tDataTypeDescriptor
;
}
tDataTypeDescriptor
;
extern
tDataTypeDescriptor
tDataTypes
[
15
];
extern
tDataTypeDescriptor
tDataTypes
[
TSDB_DATA_TYPE_MAX
];
bool
isValidDataType
(
int32_t
type
);
bool
isValidDataType
(
int32_t
type
);
...
...
include/dnode/mnode/sdb/sdb.h
浏览文件 @
395d9e8b
...
@@ -92,7 +92,13 @@ extern "C" {
...
@@ -92,7 +92,13 @@ extern "C" {
typedef
struct
SMnode
SMnode
;
typedef
struct
SMnode
SMnode
;
typedef
struct
SSdbRaw
SSdbRaw
;
typedef
struct
SSdbRaw
SSdbRaw
;
typedef
struct
SSdbRow
SSdbRow
;
typedef
struct
SSdbRow
SSdbRow
;
typedef
enum
{
SDB_KEY_BINARY
=
1
,
SDB_KEY_INT32
=
2
,
SDB_KEY_INT64
=
3
}
EKeyType
;
typedef
enum
{
SDB_KEY_BINARY
=
1
,
SDB_KEY_INT32
=
2
,
SDB_KEY_INT64
=
3
,
}
EKeyType
;
typedef
enum
{
typedef
enum
{
SDB_STATUS_INIT
=
0
,
SDB_STATUS_INIT
=
0
,
SDB_STATUS_CREATING
=
1
,
SDB_STATUS_CREATING
=
1
,
...
...
include/libs/nodes/querynodes.h
浏览文件 @
395d9e8b
...
@@ -283,12 +283,12 @@ typedef struct SVgDataBlocks {
...
@@ -283,12 +283,12 @@ typedef struct SVgDataBlocks {
}
SVgDataBlocks
;
}
SVgDataBlocks
;
typedef
struct
SVnodeModifOpStmt
{
typedef
struct
SVnodeModifOpStmt
{
ENodeType
nodeType
;
ENodeType
nodeType
;
ENodeType
sqlNodeType
;
ENodeType
sqlNodeType
;
SArray
*
pDataBlocks
;
// data block for each vgroup, SArray<SVgDataBlocks*>.
SArray
*
pDataBlocks
;
// data block for each vgroup, SArray<SVgDataBlocks*>.
uint8_t
payloadType
;
// EPayloadType. 0: K-V payload for non-prepare insert, 1: rawPayload for prepare insert
uint8_t
payloadType
;
// EPayloadType. 0: K-V payload for non-prepare insert, 1: rawPayload for prepare insert
uint32_t
insertType
;
// insert data from [file|sql statement| bound statement]
uint32_t
insertType
;
// insert data from [file|sql statement| bound statement]
const
char
*
sql
;
// current sql statement position
const
char
*
sql
;
// current sql statement position
}
SVnodeModifOpStmt
;
}
SVnodeModifOpStmt
;
typedef
struct
SExplainOptions
{
typedef
struct
SExplainOptions
{
...
...
include/libs/parser/parser.h
浏览文件 @
395d9e8b
...
@@ -21,6 +21,15 @@ extern "C" {
...
@@ -21,6 +21,15 @@ extern "C" {
#endif
#endif
#include "querynodes.h"
#include "querynodes.h"
#include "query.h"
typedef
struct
SStmtCallback
{
TAOS_STMT
*
pStmt
;
int32_t
(
*
getTbNameFn
)(
TAOS_STMT
*
,
char
**
);
int32_t
(
*
setBindInfoFn
)(
TAOS_STMT
*
,
STableMeta
*
,
void
*
);
int32_t
(
*
setExecInfoFn
)(
TAOS_STMT
*
,
SHashObj
*
,
SHashObj
*
);
int32_t
(
*
getExecInfoFn
)(
TAOS_STMT
*
,
SHashObj
**
,
SHashObj
**
);
}
SStmtCallback
;
typedef
struct
SParseContext
{
typedef
struct
SParseContext
{
uint64_t
requestId
;
uint64_t
requestId
;
...
@@ -34,6 +43,7 @@ typedef struct SParseContext {
...
@@ -34,6 +43,7 @@ typedef struct SParseContext {
char
*
pMsg
;
// extended error message if exists to help identifying the problem in sql statement.
char
*
pMsg
;
// extended error message if exists to help identifying the problem in sql statement.
int32_t
msgLen
;
// max length of the msg
int32_t
msgLen
;
// max length of the msg
struct
SCatalog
*
pCatalog
;
struct
SCatalog
*
pCatalog
;
SStmtCallback
*
pStmtCb
;
}
SParseContext
;
}
SParseContext
;
typedef
struct
SCmdMsgInfo
{
typedef
struct
SCmdMsgInfo
{
...
@@ -66,11 +76,27 @@ typedef struct SQuery {
...
@@ -66,11 +76,27 @@ typedef struct SQuery {
}
SQuery
;
}
SQuery
;
int32_t
qParseQuerySql
(
SParseContext
*
pCxt
,
SQuery
**
pQuery
);
int32_t
qParseQuerySql
(
SParseContext
*
pCxt
,
SQuery
**
pQuery
);
bool
isInsertSql
(
const
char
*
pStr
,
size_t
length
);
void
qDestroyQuery
(
SQuery
*
pQueryNode
);
void
qDestroyQuery
(
SQuery
*
pQueryNode
);
int32_t
qExtractResultSchema
(
const
SNode
*
pRoot
,
int32_t
*
numOfCols
,
SSchema
**
pSchema
);
int32_t
qExtractResultSchema
(
const
SNode
*
pRoot
,
int32_t
*
numOfCols
,
SSchema
**
pSchema
);
int32_t
qBuildStmtOutput
(
SQuery
*
pQuery
,
SHashObj
*
pVgHash
,
SHashObj
*
pBlockHash
);
int32_t
qResetStmtDataBlock
(
void
*
block
,
bool
keepBuf
);
int32_t
qCloneStmtDataBlock
(
void
**
pDst
,
void
*
pSrc
);
void
qFreeStmtDataBlock
(
void
*
pDataBlock
);
int32_t
qRebuildStmtDataBlock
(
void
**
pDst
,
void
*
pSrc
);
void
qDestroyStmtDataBlock
(
void
*
pBlock
);
int32_t
qBindStmtColsValue
(
void
*
pBlock
,
TAOS_BIND_v2
*
bind
,
char
*
msgBuf
,
int32_t
msgBufLen
);
int32_t
qBindStmtSingleColValue
(
void
*
pBlock
,
TAOS_BIND_v2
*
bind
,
char
*
msgBuf
,
int32_t
msgBufLen
,
int32_t
colIdx
,
int32_t
rowNum
);
int32_t
qBuildStmtColFields
(
void
*
pDataBlock
,
int32_t
*
fieldNum
,
TAOS_FIELD
**
fields
);
int32_t
qBuildStmtTagFields
(
void
*
pBlock
,
void
*
boundTags
,
int32_t
*
fieldNum
,
TAOS_FIELD
**
fields
);
int32_t
qBindStmtTagsValue
(
void
*
pBlock
,
void
*
boundTags
,
int64_t
suid
,
SName
*
pName
,
TAOS_BIND_v2
*
bind
,
char
*
msgBuf
,
int32_t
msgBufLen
);
void
destroyBoundColumnInfo
(
void
*
pBoundInfo
);
int32_t
qCreateSName
(
SName
*
pName
,
const
char
*
pTableName
,
int32_t
acctId
,
char
*
dbName
,
char
*
msgBuf
,
int32_t
msgBufLen
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
#endif
#endif
...
...
include/libs/planner/planner.h
浏览文件 @
395d9e8b
...
@@ -45,7 +45,6 @@ int32_t qCreateQueryPlan(SPlanContext* pCxt, SQueryPlan** pPlan, SArray* pExecNo
...
@@ -45,7 +45,6 @@ int32_t qCreateQueryPlan(SPlanContext* pCxt, SQueryPlan** pPlan, SArray* pExecNo
// @pSource one execution location of this group of datasource subplans
// @pSource one execution location of this group of datasource subplans
int32_t
qSetSubplanExecutionNode
(
SSubplan
*
pSubplan
,
int32_t
groupId
,
SDownstreamSourceNode
*
pSource
);
int32_t
qSetSubplanExecutionNode
(
SSubplan
*
pSubplan
,
int32_t
groupId
,
SDownstreamSourceNode
*
pSource
);
typedef
TAOS_MULTI_BIND
TAOS_BIND_v2
;
// todo remove
int32_t
qStmtBindParam
(
SQueryPlan
*
pPlan
,
TAOS_BIND_v2
*
pParams
);
int32_t
qStmtBindParam
(
SQueryPlan
*
pPlan
,
TAOS_BIND_v2
*
pParams
);
// Convert to subplan to string for the scheduler to send to the executor
// Convert to subplan to string for the scheduler to send to the executor
...
...
include/libs/scalar/scalar.h
浏览文件 @
395d9e8b
...
@@ -76,6 +76,7 @@ int32_t castFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutp
...
@@ -76,6 +76,7 @@ int32_t castFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutp
/* Time related functions */
/* Time related functions */
int32_t
toISO8601Function
(
SScalarParam
*
pInput
,
int32_t
inputNum
,
SScalarParam
*
pOutput
);
int32_t
toISO8601Function
(
SScalarParam
*
pInput
,
int32_t
inputNum
,
SScalarParam
*
pOutput
);
int32_t
toUnixtimestampFunction
(
SScalarParam
*
pInput
,
int32_t
inputNum
,
SScalarParam
*
pOutput
);
int32_t
toUnixtimestampFunction
(
SScalarParam
*
pInput
,
int32_t
inputNum
,
SScalarParam
*
pOutput
);
int32_t
toJsonFunction
(
SScalarParam
*
pInput
,
int32_t
inputNum
,
SScalarParam
*
pOutput
);
int32_t
timeTruncateFunction
(
SScalarParam
*
pInput
,
int32_t
inputNum
,
SScalarParam
*
pOutput
);
int32_t
timeTruncateFunction
(
SScalarParam
*
pInput
,
int32_t
inputNum
,
SScalarParam
*
pOutput
);
int32_t
timeDiffFunction
(
SScalarParam
*
pInput
,
int32_t
inputNum
,
SScalarParam
*
pOutput
);
int32_t
timeDiffFunction
(
SScalarParam
*
pInput
,
int32_t
inputNum
,
SScalarParam
*
pOutput
);
int32_t
nowFunction
(
SScalarParam
*
pInput
,
int32_t
inputNum
,
SScalarParam
*
pOutput
);
int32_t
nowFunction
(
SScalarParam
*
pInput
,
int32_t
inputNum
,
SScalarParam
*
pOutput
);
...
...
include/util/talgo.h
浏览文件 @
395d9e8b
...
@@ -27,6 +27,11 @@ extern "C" {
...
@@ -27,6 +27,11 @@ extern "C" {
typedef
int32_t
(
*
__compar_fn_t
)(
const
void
*
,
const
void
*
);
typedef
int32_t
(
*
__compar_fn_t
)(
const
void
*
,
const
void
*
);
#endif
#endif
typedef
void
*
(
*
FCopy
)(
void
*
);
typedef
void
(
*
FDelete
)(
void
*
);
typedef
int32_t
(
*
FEncode
)(
void
**
buf
,
const
void
*
dst
);
typedef
void
*
(
*
FDecode
)(
const
void
*
buf
,
void
*
dst
);
#define TD_EQ 0x1
#define TD_EQ 0x1
#define TD_GT 0x2
#define TD_GT 0x2
#define TD_LT 0x4
#define TD_LT 0x4
...
...
include/util/taoserror.h
浏览文件 @
395d9e8b
...
@@ -132,6 +132,9 @@ int32_t* taosGetErrno();
...
@@ -132,6 +132,9 @@ int32_t* taosGetErrno();
#define TSDB_CODE_TSC_INVALID_JSON_TYPE TAOS_DEF_ERROR_CODE(0, 0x0222)
#define TSDB_CODE_TSC_INVALID_JSON_TYPE TAOS_DEF_ERROR_CODE(0, 0x0222)
#define TSDB_CODE_TSC_VALUE_OUT_OF_RANGE TAOS_DEF_ERROR_CODE(0, 0x0223)
#define TSDB_CODE_TSC_VALUE_OUT_OF_RANGE TAOS_DEF_ERROR_CODE(0, 0x0223)
#define TSDB_CODE_TSC_INVALID_INPUT TAOS_DEF_ERROR_CODE(0, 0X0224)
#define TSDB_CODE_TSC_INVALID_INPUT TAOS_DEF_ERROR_CODE(0, 0X0224)
#define TSDB_CODE_TSC_STMT_API_ERROR TAOS_DEF_ERROR_CODE(0, 0X0225)
#define TSDB_CODE_TSC_STMT_TBNAME_ERROR TAOS_DEF_ERROR_CODE(0, 0X0226)
#define TSDB_CODE_TSC_STMT_CLAUSE_ERROR TAOS_DEF_ERROR_CODE(0, 0X0227)
// mnode-common
// mnode-common
#define TSDB_CODE_MND_APP_ERROR TAOS_DEF_ERROR_CODE(0, 0x0300)
#define TSDB_CODE_MND_APP_ERROR TAOS_DEF_ERROR_CODE(0, 0x0300)
...
@@ -279,6 +282,7 @@ int32_t* taosGetErrno();
...
@@ -279,6 +282,7 @@ int32_t* taosGetErrno();
#define TSDB_CODE_MND_UNSUPPORTED_TOPIC TAOS_DEF_ERROR_CODE(0, 0x03E8)
#define TSDB_CODE_MND_UNSUPPORTED_TOPIC TAOS_DEF_ERROR_CODE(0, 0x03E8)
#define TSDB_CODE_MND_SUBSCRIBE_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x03E9)
#define TSDB_CODE_MND_SUBSCRIBE_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x03E9)
#define TSDB_CODE_MND_OFFSET_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x03EA)
#define TSDB_CODE_MND_OFFSET_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x03EA)
#define TSDB_CODE_MND_CONSUMER_NOT_READY TAOS_DEF_ERROR_CODE(0, 0x03EB)
// mnode-stream
// mnode-stream
#define TSDB_CODE_MND_STREAM_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x03F0)
#define TSDB_CODE_MND_STREAM_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x03F0)
...
@@ -609,6 +613,7 @@ int32_t* taosGetErrno();
...
@@ -609,6 +613,7 @@ int32_t* taosGetErrno();
#define TSDB_CODE_PAR_INTER_SLIDING_UNIT TAOS_DEF_ERROR_CODE(0, 0x2630)
#define TSDB_CODE_PAR_INTER_SLIDING_UNIT TAOS_DEF_ERROR_CODE(0, 0x2630)
#define TSDB_CODE_PAR_INTER_SLIDING_TOO_BIG TAOS_DEF_ERROR_CODE(0, 0x2631)
#define TSDB_CODE_PAR_INTER_SLIDING_TOO_BIG TAOS_DEF_ERROR_CODE(0, 0x2631)
#define TSDB_CODE_PAR_INTER_SLIDING_TOO_SMALL TAOS_DEF_ERROR_CODE(0, 0x2632)
#define TSDB_CODE_PAR_INTER_SLIDING_TOO_SMALL TAOS_DEF_ERROR_CODE(0, 0x2632)
#define TSDB_CODE_PAR_ONLY_ONE_JSON_TAG TAOS_DEF_ERROR_CODE(0, 0x2633)
//planner
//planner
#define TSDB_CODE_PLAN_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x2700)
#define TSDB_CODE_PLAN_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x2700)
...
...
include/util/tarray.h
浏览文件 @
395d9e8b
...
@@ -41,10 +41,10 @@ extern "C" {
...
@@ -41,10 +41,10 @@ extern "C" {
#define TARRAY_GET_START(array) ((array)->pData)
#define TARRAY_GET_START(array) ((array)->pData)
typedef
struct
SArray
{
typedef
struct
SArray
{
size_t
size
;
size_t
size
;
uint32_t
capacity
;
uint32_t
capacity
;
uint32_t
elemSize
;
uint32_t
elemSize
;
void
*
pData
;
void
*
pData
;
}
SArray
;
}
SArray
;
/**
/**
...
@@ -199,6 +199,13 @@ SArray* taosArrayFromList(const void* src, size_t size, size_t elemSize);
...
@@ -199,6 +199,13 @@ SArray* taosArrayFromList(const void* src, size_t size, size_t elemSize);
*/
*/
SArray
*
taosArrayDup
(
const
SArray
*
pSrc
);
SArray
*
taosArrayDup
(
const
SArray
*
pSrc
);
/**
* deep copy a new array
* @param pSrc
*/
SArray
*
taosArrayDeepCopy
(
const
SArray
*
pSrc
,
FCopy
deepCopy
);
/**
/**
* clear the array (remove all element)
* clear the array (remove all element)
* @param pArray
* @param pArray
...
@@ -212,19 +219,9 @@ void taosArrayClear(SArray* pArray);
...
@@ -212,19 +219,9 @@ void taosArrayClear(SArray* pArray);
*/
*/
void
taosArrayClearEx
(
SArray
*
pArray
,
void
(
*
fp
)(
void
*
));
void
taosArrayClearEx
(
SArray
*
pArray
,
void
(
*
fp
)(
void
*
));
/**
* destroy array list
* @param pArray
*/
void
*
taosArrayDestroy
(
SArray
*
pArray
);
void
*
taosArrayDestroy
(
SArray
*
pArray
);
void
taosArrayDestroyP
(
SArray
*
pArray
,
FDelete
fp
);
/**
void
taosArrayDestroyEx
(
SArray
*
pArray
,
FDelete
fp
);
*
* @param pArray
* @param fp
*/
void
taosArrayDestroyEx
(
SArray
*
pArray
,
void
(
*
fp
)(
void
*
));
/**
/**
* sort the array
* sort the array
...
@@ -272,6 +269,9 @@ char* taosArraySearchString(const SArray* pArray, const char* key, __compar_fn_t
...
@@ -272,6 +269,9 @@ char* taosArraySearchString(const SArray* pArray, const char* key, __compar_fn_t
void
taosArraySortPWithExt
(
SArray
*
pArray
,
__ext_compar_fn_t
fn
,
const
void
*
param
);
void
taosArraySortPWithExt
(
SArray
*
pArray
,
__ext_compar_fn_t
fn
,
const
void
*
param
);
int32_t
taosEncodeArray
(
void
**
buf
,
const
SArray
*
pArray
,
FEncode
encode
);
void
*
taosDecodeArray
(
const
void
*
buf
,
SArray
**
pArray
,
FDecode
decode
,
int32_t
dataSz
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
#endif
#endif
...
...
include/util/tcompare.h
浏览文件 @
395d9e8b
...
@@ -105,6 +105,8 @@ int32_t compareStrPatternNotMatch(const void *pLeft, const void *pRight);
...
@@ -105,6 +105,8 @@ int32_t compareStrPatternNotMatch(const void *pLeft, const void *pRight);
int32_t
compareWStrPatternMatch
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareWStrPatternMatch
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareWStrPatternNotMatch
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareWStrPatternNotMatch
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareJsonContainsKey
(
const
void
*
pLeft
,
const
void
*
pRight
);
__compar_fn_t
getComparFunc
(
int32_t
type
,
int32_t
optr
);
__compar_fn_t
getComparFunc
(
int32_t
type
,
int32_t
optr
);
__compar_fn_t
getKeyComparFunc
(
int32_t
keyType
,
int32_t
order
);
__compar_fn_t
getKeyComparFunc
(
int32_t
keyType
,
int32_t
order
);
int32_t
doCompare
(
const
char
*
a
,
const
char
*
b
,
int32_t
type
,
size_t
size
);
int32_t
doCompare
(
const
char
*
a
,
const
char
*
b
,
int32_t
type
,
size_t
size
);
...
...
include/util/tdef.h
浏览文件 @
395d9e8b
...
@@ -273,6 +273,8 @@ typedef enum ELogicConditionType {
...
@@ -273,6 +273,8 @@ typedef enum ELogicConditionType {
#define TSDB_MAX_TAGS 128
#define TSDB_MAX_TAGS 128
#define TSDB_MAX_TAG_CONDITIONS 1024
#define TSDB_MAX_TAG_CONDITIONS 1024
#define TSDB_MAX_JSON_TAG_LEN 16384
#define TSDB_AUTH_LEN 16
#define TSDB_AUTH_LEN 16
#define TSDB_PASSWORD_LEN 32
#define TSDB_PASSWORD_LEN 32
#define TSDB_USET_PASSWORD_LEN 129
#define TSDB_USET_PASSWORD_LEN 129
...
...
include/util/tjson.h
浏览文件 @
395d9e8b
...
@@ -76,6 +76,7 @@ char* tjsonToString(const SJson* pJson);
...
@@ -76,6 +76,7 @@ char* tjsonToString(const SJson* pJson);
char
*
tjsonToUnformattedString
(
const
SJson
*
pJson
);
char
*
tjsonToUnformattedString
(
const
SJson
*
pJson
);
SJson
*
tjsonParse
(
const
char
*
pStr
);
SJson
*
tjsonParse
(
const
char
*
pStr
);
bool
tjsonValidateJson
(
const
char
*
pJson
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
include/util/tlog.h
浏览文件 @
395d9e8b
...
@@ -59,6 +59,7 @@ extern int32_t sDebugFlag;
...
@@ -59,6 +59,7 @@ extern int32_t sDebugFlag;
extern
int32_t
tsdbDebugFlag
;
extern
int32_t
tsdbDebugFlag
;
extern
int32_t
tqDebugFlag
;
extern
int32_t
tqDebugFlag
;
extern
int32_t
fsDebugFlag
;
extern
int32_t
fsDebugFlag
;
extern
int32_t
fnDebugFlag
;
int32_t
taosInitLog
(
const
char
*
logName
,
int32_t
maxFiles
);
int32_t
taosInitLog
(
const
char
*
logName
,
int32_t
maxFiles
);
void
taosCloseLog
();
void
taosCloseLog
();
...
...
include/util/tutil.h
浏览文件 @
395d9e8b
...
@@ -26,8 +26,6 @@ extern "C" {
...
@@ -26,8 +26,6 @@ extern "C" {
#endif
#endif
int32_t
strdequote
(
char
*
src
);
int32_t
strdequote
(
char
*
src
);
int32_t
strndequote
(
char
*
dst
,
const
char
*
z
,
int32_t
len
);
int32_t
strRmquote
(
char
*
z
,
int32_t
len
);
size_t
strtrim
(
char
*
src
);
size_t
strtrim
(
char
*
src
);
char
*
strnchr
(
const
char
*
haystack
,
char
needle
,
int32_t
len
,
bool
skipquote
);
char
*
strnchr
(
const
char
*
haystack
,
char
needle
,
int32_t
len
,
bool
skipquote
);
char
**
strsplit
(
char
*
src
,
const
char
*
delim
,
int32_t
*
num
);
char
**
strsplit
(
char
*
src
,
const
char
*
delim
,
int32_t
*
num
);
...
...
source/client/inc/clientInt.h
浏览文件 @
395d9e8b
...
@@ -44,7 +44,7 @@ extern "C" {
...
@@ -44,7 +44,7 @@ extern "C" {
} while (0)
} while (0)
#define ERROR_MSG_BUF_DEFAULT_SIZE 512
#define ERROR_MSG_BUF_DEFAULT_SIZE 512
#define HEARTBEAT_INTERVAL 1500 // ms
#define HEARTBEAT_INTERVAL
1500 // ms
enum
{
enum
{
RES_TYPE__QUERY
=
1
,
RES_TYPE__QUERY
=
1
,
...
@@ -187,11 +187,13 @@ typedef struct SRequestSendRecvBody {
...
@@ -187,11 +187,13 @@ typedef struct SRequestSendRecvBody {
}
SRequestSendRecvBody
;
}
SRequestSendRecvBody
;
typedef
struct
{
typedef
struct
{
int8_t
resType
;
int8_t
resType
;
char
*
topic
;
char
topic
[
TSDB_TOPIC_FNAME_LEN
];
SArray
*
res
;
// SArray<SReqResultInfo>
int32_t
vgId
;
int32_t
resIter
;
SSchemaWrapper
schema
;
int32_t
vgId
;
int32_t
resIter
;
SMqDataBlkRsp
rsp
;
SReqResultInfo
resInfo
;
}
SMqRspObj
;
}
SMqRspObj
;
typedef
struct
SRequestObj
{
typedef
struct
SRequestObj
{
...
@@ -203,7 +205,8 @@ typedef struct SRequestObj {
...
@@ -203,7 +205,8 @@ typedef struct SRequestObj {
char
*
sqlstr
;
// sql string
char
*
sqlstr
;
// sql string
int32_t
sqlLen
;
int32_t
sqlLen
;
int64_t
self
;
int64_t
self
;
char
*
msgBuf
;
// error msg buffer
char
*
msgBuf
;
int32_t
msgBufLen
;
int32_t
code
;
int32_t
code
;
SArray
*
dbList
;
SArray
*
dbList
;
SArray
*
tableList
;
SArray
*
tableList
;
...
@@ -211,16 +214,24 @@ typedef struct SRequestObj {
...
@@ -211,16 +214,24 @@ typedef struct SRequestObj {
SRequestSendRecvBody
body
;
SRequestSendRecvBody
body
;
}
SRequestObj
;
}
SRequestObj
;
void
*
doFetchRows
(
SRequestObj
*
pRequest
,
bool
setupOneRowPtr
,
bool
convertUcs4
);
void
doSetOneRowPtr
(
SReqResultInfo
*
pResultInfo
);
void
setResPrecision
(
SReqResultInfo
*
pResInfo
,
int32_t
precision
);
int32_t
setQueryResultFromRsp
(
SReqResultInfo
*
pResultInfo
,
const
SRetrieveTableRsp
*
pRsp
,
bool
convertUcs4
);
void
setResSchemaInfo
(
SReqResultInfo
*
pResInfo
,
const
SSchema
*
pSchema
,
int32_t
numOfCols
);
static
FORCE_INLINE
SReqResultInfo
*
tmqGetCurResInfo
(
TAOS_RES
*
res
)
{
static
FORCE_INLINE
SReqResultInfo
*
tmqGetCurResInfo
(
TAOS_RES
*
res
)
{
SMqRspObj
*
msg
=
(
SMqRspObj
*
)
res
;
SMqRspObj
*
msg
=
(
SMqRspObj
*
)
res
;
int32_t
resIter
=
msg
->
resIter
==
-
1
?
0
:
msg
->
resIter
;
return
(
SReqResultInfo
*
)
&
msg
->
resInfo
;
return
(
SReqResultInfo
*
)
taosArrayGet
(
msg
->
res
,
resIter
);
}
}
static
FORCE_INLINE
SReqResultInfo
*
tmqGetNextResInfo
(
TAOS_RES
*
res
)
{
static
FORCE_INLINE
SReqResultInfo
*
tmqGetNextResInfo
(
TAOS_RES
*
res
,
bool
convertUcs4
)
{
SMqRspObj
*
msg
=
(
SMqRspObj
*
)
res
;
SMqRspObj
*
msg
=
(
SMqRspObj
*
)
res
;
if
(
++
msg
->
resIter
<
taosArrayGetSize
(
msg
->
res
))
{
msg
->
resIter
++
;
return
(
SReqResultInfo
*
)
taosArrayGet
(
msg
->
res
,
msg
->
resIter
);
if
(
msg
->
resIter
<
msg
->
rsp
.
blockNum
)
{
SRetrieveTableRsp
*
pRetrieve
=
(
SRetrieveTableRsp
*
)
taosArrayGetP
(
msg
->
rsp
.
blockData
,
msg
->
resIter
);
setQueryResultFromRsp
(
&
msg
->
resInfo
,
pRetrieve
,
convertUcs4
);
return
&
msg
->
resInfo
;
}
}
return
NULL
;
return
NULL
;
}
}
...
@@ -238,25 +249,25 @@ extern int (*handleRequestRspFp[TDMT_MAX])(void*, const SDataBuf* pMsg, int32_t
...
@@ -238,25 +249,25 @@ extern int (*handleRequestRspFp[TDMT_MAX])(void*, const SDataBuf* pMsg, int32_t
int
genericRspCallback
(
void
*
param
,
const
SDataBuf
*
pMsg
,
int32_t
code
);
int
genericRspCallback
(
void
*
param
,
const
SDataBuf
*
pMsg
,
int32_t
code
);
SMsgSendInfo
*
buildMsgInfoImpl
(
SRequestObj
*
pReqObj
);
SMsgSendInfo
*
buildMsgInfoImpl
(
SRequestObj
*
pReqObj
);
int
taos_init
();
int
taos_init
();
void
*
createTscObj
(
const
char
*
user
,
const
char
*
auth
,
const
char
*
db
,
SAppInstInfo
*
pAppInfo
);
void
*
createTscObj
(
const
char
*
user
,
const
char
*
auth
,
const
char
*
db
,
SAppInstInfo
*
pAppInfo
);
void
destroyTscObj
(
void
*
pObj
);
void
destroyTscObj
(
void
*
pObj
);
STscObj
*
acquireTscObj
(
int64_t
rid
);
STscObj
*
acquireTscObj
(
int64_t
rid
);
int32_t
releaseTscObj
(
int64_t
rid
);
int32_t
releaseTscObj
(
int64_t
rid
);
uint64_t
generateRequestId
();
uint64_t
generateRequestId
();
void
*
createRequest
(
STscObj
*
pObj
,
__taos_async_fn_t
fp
,
void
*
param
,
int32_t
type
);
void
*
createRequest
(
STscObj
*
pObj
,
__taos_async_fn_t
fp
,
void
*
param
,
int32_t
type
);
void
destroyRequest
(
SRequestObj
*
pRequest
);
void
destroyRequest
(
SRequestObj
*
pRequest
);
SRequestObj
*
acquireRequest
(
int64_t
rid
);
SRequestObj
*
acquireRequest
(
int64_t
rid
);
int32_t
releaseRequest
(
int64_t
rid
);
int32_t
releaseRequest
(
int64_t
rid
);
char
*
getDbOfConnection
(
STscObj
*
pObj
);
char
*
getDbOfConnection
(
STscObj
*
pObj
);
void
setConnectionDB
(
STscObj
*
pTscObj
,
const
char
*
db
);
void
setConnectionDB
(
STscObj
*
pTscObj
,
const
char
*
db
);
void
resetConnectDB
(
STscObj
*
pTscObj
);
void
resetConnectDB
(
STscObj
*
pTscObj
);
int
taos_options_imp
(
TSDB_OPTION
option
,
const
char
*
str
);
int
taos_options_imp
(
TSDB_OPTION
option
,
const
char
*
str
);
void
*
openTransporter
(
const
char
*
user
,
const
char
*
auth
,
int32_t
numOfThreads
);
void
*
openTransporter
(
const
char
*
user
,
const
char
*
auth
,
int32_t
numOfThreads
);
...
@@ -268,17 +279,12 @@ void initMsgHandleFp();
...
@@ -268,17 +279,12 @@ void initMsgHandleFp();
TAOS
*
taos_connect_internal
(
const
char
*
ip
,
const
char
*
user
,
const
char
*
pass
,
const
char
*
auth
,
const
char
*
db
,
TAOS
*
taos_connect_internal
(
const
char
*
ip
,
const
char
*
user
,
const
char
*
pass
,
const
char
*
auth
,
const
char
*
db
,
uint16_t
port
,
int
connType
);
uint16_t
port
,
int
connType
);
int32_t
parseSql
(
SRequestObj
*
pRequest
,
bool
topicQuery
,
SQuery
**
pQuery
);
int32_t
parseSql
(
SRequestObj
*
pRequest
,
bool
topicQuery
,
SQuery
**
pQuery
,
SStmtCallback
*
pStmtCb
);
int32_t
getPlan
(
SRequestObj
*
pRequest
,
SQuery
*
pQuery
,
SQueryPlan
**
pPlan
,
SArray
*
pNodeList
);
int32_t
getPlan
(
SRequestObj
*
pRequest
,
SQuery
*
pQuery
,
SQueryPlan
**
pPlan
,
SArray
*
pNodeList
);
int32_t
buildRequest
(
STscObj
*
pTscObj
,
const
char
*
sql
,
int
sqlLen
,
SRequestObj
**
pRequest
);
int32_t
buildRequest
(
STscObj
*
pTscObj
,
const
char
*
sql
,
int
sqlLen
,
SRequestObj
**
pRequest
);
void
*
doFetchRows
(
SRequestObj
*
pRequest
,
bool
setupOneRowPtr
,
bool
convertUcs4
);
void
doSetOneRowPtr
(
SReqResultInfo
*
pResultInfo
);
void
setResSchemaInfo
(
SReqResultInfo
*
pResInfo
,
const
SSchema
*
pSchema
,
int32_t
numOfCols
);
void
setResPrecision
(
SReqResultInfo
*
pResInfo
,
int32_t
precision
);
int32_t
setQueryResultFromRsp
(
SReqResultInfo
*
pResultInfo
,
const
SRetrieveTableRsp
*
pRsp
,
bool
convertUcs4
);
// --- heartbeat
// --- heartbeat
// global, called by mgmt
// global, called by mgmt
int
hbMgrInit
();
int
hbMgrInit
();
...
@@ -290,7 +296,7 @@ SAppHbMgr* appHbMgrInit(SAppInstInfo* pAppInstInfo, char* key);
...
@@ -290,7 +296,7 @@ SAppHbMgr* appHbMgrInit(SAppInstInfo* pAppInstInfo, char* key);
void
appHbMgrCleanup
(
void
);
void
appHbMgrCleanup
(
void
);
// conn level
// conn level
int
hbRegisterConn
(
SAppHbMgr
*
pAppHbMgr
,
int64_t
tscRefId
,
int64_t
clusterId
,
int8_t
connType
);
int
hbRegisterConn
(
SAppHbMgr
*
pAppHbMgr
,
int64_t
tscRefId
,
int64_t
clusterId
,
int8_t
connType
);
void
hbDeregisterConn
(
SAppHbMgr
*
pAppHbMgr
,
SClientHbKey
connKey
);
void
hbDeregisterConn
(
SAppHbMgr
*
pAppHbMgr
,
SClientHbKey
connKey
);
int
hbAddConnInfo
(
SAppHbMgr
*
pAppHbMgr
,
SClientHbKey
connKey
,
void
*
key
,
void
*
value
,
int32_t
keyLen
,
int32_t
valueLen
);
int
hbAddConnInfo
(
SAppHbMgr
*
pAppHbMgr
,
SClientHbKey
connKey
,
void
*
key
,
void
*
value
,
int32_t
keyLen
,
int32_t
valueLen
);
...
@@ -298,6 +304,9 @@ int hbAddConnInfo(SAppHbMgr* pAppHbMgr, SClientHbKey connKey, void* key, void* v
...
@@ -298,6 +304,9 @@ int hbAddConnInfo(SAppHbMgr* pAppHbMgr, SClientHbKey connKey, void* key, void* v
// --- mq
// --- mq
void
hbMgrInitMqHbRspHandle
();
void
hbMgrInitMqHbRspHandle
();
SRequestObj
*
launchQueryImpl
(
SRequestObj
*
pRequest
,
SQuery
*
pQuery
,
int32_t
code
,
bool
keepQuery
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
#endif
#endif
...
...
source/client/inc/clientStmt.h
浏览文件 @
395d9e8b
...
@@ -19,6 +19,9 @@
...
@@ -19,6 +19,9 @@
#ifdef __cplusplus
#ifdef __cplusplus
extern
"C"
{
extern
"C"
{
#endif
#endif
#include "catalog.h"
typedef
void
STableDataBlocks
;
typedef
enum
{
typedef
enum
{
STMT_TYPE_INSERT
=
1
,
STMT_TYPE_INSERT
=
1
,
...
@@ -26,17 +29,64 @@ typedef enum {
...
@@ -26,17 +29,64 @@ typedef enum {
STMT_TYPE_QUERY
,
STMT_TYPE_QUERY
,
}
STMT_TYPE
;
}
STMT_TYPE
;
typedef
enum
{
STMT_INIT
=
1
,
STMT_PREPARE
,
STMT_SETTBNAME
,
STMT_SETTAGS
,
STMT_FETCH_TAG_FIELDS
,
STMT_FETCH_COL_FIELDS
,
STMT_BIND
,
STMT_BIND_COL
,
STMT_ADD_BATCH
,
STMT_EXECUTE
,
}
STMT_STATUS
;
typedef
struct
SStmtTableCache
{
STableDataBlocks
*
pDataBlock
;
void
*
boundTags
;
}
SStmtTableCache
;
typedef
struct
SStmtBindInfo
{
bool
needParse
;
uint64_t
tbUid
;
uint64_t
tbSuid
;
int32_t
sBindRowNum
;
int32_t
sBindLastIdx
;
int8_t
tbType
;
void
*
boundTags
;
char
*
tbName
;
SName
sname
;
}
SStmtBindInfo
;
typedef
struct
SStmtExecInfo
{
SRequestObj
*
pRequest
;
SHashObj
*
pVgHash
;
SHashObj
*
pBlockHash
;
}
SStmtExecInfo
;
typedef
struct
SStmtSQLInfo
{
STMT_TYPE
type
;
STMT_STATUS
status
;
bool
autoCreate
;
uint64_t
runTimes
;
SHashObj
*
pTableCache
;
//SHash<SStmtTableCache>
SQuery
*
pQuery
;
char
*
sqlStr
;
int32_t
sqlLen
;
}
SStmtSQLInfo
;
typedef
struct
STscStmt
{
typedef
struct
STscStmt
{
STMT_TYPE
type
;
STscObj
*
taos
;
//int16_t last;
SCatalog
*
pCatalog
;
//STscObj* taos;
int32_t
affectedRows
;
//SSqlObj* pSql;
//SMultiTbStmt mtb;
SStmtSQLInfo
sql
;
//SNormalStmt normal;
SStmtExecInfo
exec
;
SStmtBindInfo
bInfo
;
//int numOfRows;
}
STscStmt
;
}
STscStmt
;
#define STMT_ERR_RET(c) do { int32_t _code = c; if (_code != TSDB_CODE_SUCCESS) { terrno = _code; return _code; } } while (0)
#define STMT_ERR_RET(c) do { int32_t _code = c; if (_code != TSDB_CODE_SUCCESS) { terrno = _code; return _code; } } while (0)
#define STMT_RET(c) do { int32_t _code = c; if (_code != TSDB_CODE_SUCCESS) { terrno = _code; } return _code; } while (0)
#define STMT_RET(c) do { int32_t _code = c; if (_code != TSDB_CODE_SUCCESS) { terrno = _code; } return _code; } while (0)
#define STMT_ERR_JRET(c) do { code = c; if (code != TSDB_CODE_SUCCESS) { terrno = code; goto _return; } } while (0)
#define STMT_ERR_JRET(c) do { code = c; if (code != TSDB_CODE_SUCCESS) { terrno = code; goto _return; } } while (0)
...
@@ -44,16 +94,16 @@ typedef struct STscStmt {
...
@@ -44,16 +94,16 @@ typedef struct STscStmt {
TAOS_STMT
*
stmtInit
(
TAOS
*
taos
);
TAOS_STMT
*
stmtInit
(
TAOS
*
taos
);
int
stmtClose
(
TAOS_STMT
*
stmt
);
int
stmtClose
(
TAOS_STMT
*
stmt
);
int
stmtExec
(
TAOS_STMT
*
stmt
);
int
stmtExec
(
TAOS_STMT
*
stmt
);
char
*
stmtErrstr
(
TAOS_STMT
*
stmt
);
c
onst
c
har
*
stmtErrstr
(
TAOS_STMT
*
stmt
);
int
stmtAffectedRows
(
TAOS_STMT
*
stmt
);
int
stmtAffectedRows
(
TAOS_STMT
*
stmt
);
int
stmtBind
(
TAOS_STMT
*
stmt
,
TAOS_BIND
*
bind
);
int
stmtPrepare
(
TAOS_STMT
*
stmt
,
const
char
*
sql
,
unsigned
long
length
);
int
stmtPrepare
(
TAOS_STMT
*
stmt
,
const
char
*
sql
,
unsigned
long
length
);
int
stmtSetTbNameTags
(
TAOS_STMT
*
stmt
,
const
char
*
name
,
TAOS_BIND
*
tags
);
int
stmtSetTbName
(
TAOS_STMT
*
stmt
,
const
char
*
tbName
);
int
stmtSetTbTags
(
TAOS_STMT
*
stmt
,
TAOS_BIND_v2
*
tags
);
int
stmtIsInsert
(
TAOS_STMT
*
stmt
,
int
*
insert
);
int
stmtIsInsert
(
TAOS_STMT
*
stmt
,
int
*
insert
);
int
stmtGetParamNum
(
TAOS_STMT
*
stmt
,
int
*
nums
);
int
stmtGetParamNum
(
TAOS_STMT
*
stmt
,
int
*
nums
);
int
stmtAddBatch
(
TAOS_STMT
*
stmt
);
int
stmtAddBatch
(
TAOS_STMT
*
stmt
);
TAOS_RES
*
stmtUseResult
(
TAOS_STMT
*
stmt
);
TAOS_RES
*
stmtUseResult
(
TAOS_STMT
*
stmt
);
int
stmtBindBatch
(
TAOS_STMT
*
stmt
,
TAOS_
MULTI_BIND
*
bind
);
int
stmtBindBatch
(
TAOS_STMT
*
stmt
,
TAOS_
BIND_v2
*
bind
,
int32_t
colIdx
);
#ifdef __cplusplus
#ifdef __cplusplus
...
...
source/client/src/clientEnv.c
浏览文件 @
395d9e8b
...
@@ -186,6 +186,7 @@ void *createRequest(STscObj *pObj, __taos_async_fn_t fp, void *param, int32_t ty
...
@@ -186,6 +186,7 @@ void *createRequest(STscObj *pObj, __taos_async_fn_t fp, void *param, int32_t ty
pRequest
->
pTscObj
=
pObj
;
pRequest
->
pTscObj
=
pObj
;
pRequest
->
body
.
fp
=
fp
;
// not used it yet
pRequest
->
body
.
fp
=
fp
;
// not used it yet
pRequest
->
msgBuf
=
taosMemoryCalloc
(
1
,
ERROR_MSG_BUF_DEFAULT_SIZE
);
pRequest
->
msgBuf
=
taosMemoryCalloc
(
1
,
ERROR_MSG_BUF_DEFAULT_SIZE
);
pRequest
->
msgBufLen
=
ERROR_MSG_BUF_DEFAULT_SIZE
;
tsem_init
(
&
pRequest
->
body
.
rspSem
,
0
,
0
);
tsem_init
(
&
pRequest
->
body
.
rspSem
,
0
,
0
);
registerRequest
(
pRequest
);
registerRequest
(
pRequest
);
...
...
source/client/src/clientImpl.c
浏览文件 @
395d9e8b
...
@@ -157,7 +157,7 @@ int32_t buildRequest(STscObj* pTscObj, const char* sql, int sqlLen, SRequestObj*
...
@@ -157,7 +157,7 @@ int32_t buildRequest(STscObj* pTscObj, const char* sql, int sqlLen, SRequestObj*
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
int32_t
parseSql
(
SRequestObj
*
pRequest
,
bool
topicQuery
,
SQuery
**
pQuery
)
{
int32_t
parseSql
(
SRequestObj
*
pRequest
,
bool
topicQuery
,
SQuery
**
pQuery
,
SStmtCallback
*
pStmtCb
)
{
STscObj
*
pTscObj
=
pRequest
->
pTscObj
;
STscObj
*
pTscObj
=
pRequest
->
pTscObj
;
SParseContext
cxt
=
{
SParseContext
cxt
=
{
...
@@ -170,6 +170,7 @@ int32_t parseSql(SRequestObj* pRequest, bool topicQuery, SQuery** pQuery) {
...
@@ -170,6 +170,7 @@ int32_t parseSql(SRequestObj* pRequest, bool topicQuery, SQuery** pQuery) {
.
pMsg
=
pRequest
->
msgBuf
,
.
pMsg
=
pRequest
->
msgBuf
,
.
msgLen
=
ERROR_MSG_BUF_DEFAULT_SIZE
,
.
msgLen
=
ERROR_MSG_BUF_DEFAULT_SIZE
,
.
pTransporter
=
pTscObj
->
pAppInfo
->
pTransporter
,
.
pTransporter
=
pTscObj
->
pAppInfo
->
pTransporter
,
.
pStmtCb
=
pStmtCb
,
};
};
cxt
.
mgmtEpSet
=
getEpSet_s
(
&
pTscObj
->
pAppInfo
->
mgmtEp
);
cxt
.
mgmtEpSet
=
getEpSet_s
(
&
pTscObj
->
pAppInfo
->
mgmtEp
);
...
@@ -298,16 +299,9 @@ int32_t scheduleQuery(SRequestObj* pRequest, SQueryPlan* pDag, SArray* pNodeList
...
@@ -298,16 +299,9 @@ int32_t scheduleQuery(SRequestObj* pRequest, SQueryPlan* pDag, SArray* pNodeList
return
pRequest
->
code
;
return
pRequest
->
code
;
}
}
SRequestObj
*
execQueryImpl
(
STscObj
*
pTscObj
,
const
char
*
sql
,
int
sqlLen
)
{
SRequestObj
*
launchQueryImpl
(
SRequestObj
*
pRequest
,
SQuery
*
pQuery
,
int32_t
code
,
bool
keepQuery
)
{
SRequestObj
*
pRequest
=
NULL
;
SQuery
*
pQuery
=
NULL
;
SArray
*
pNodeList
=
taosArrayInit
(
4
,
sizeof
(
struct
SQueryNodeAddr
));
SArray
*
pNodeList
=
taosArrayInit
(
4
,
sizeof
(
struct
SQueryNodeAddr
));
int32_t
code
=
buildRequest
(
pTscObj
,
sql
,
sqlLen
,
&
pRequest
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
parseSql
(
pRequest
,
false
,
&
pQuery
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
switch
(
pQuery
->
execMode
)
{
switch
(
pQuery
->
execMode
)
{
case
QUERY_EXEC_MODE_LOCAL
:
case
QUERY_EXEC_MODE_LOCAL
:
...
@@ -331,7 +325,10 @@ SRequestObj* execQueryImpl(STscObj* pTscObj, const char* sql, int sqlLen) {
...
@@ -331,7 +325,10 @@ SRequestObj* execQueryImpl(STscObj* pTscObj, const char* sql, int sqlLen) {
}
}
taosArrayDestroy
(
pNodeList
);
taosArrayDestroy
(
pNodeList
);
qDestroyQuery
(
pQuery
);
if
(
!
keepQuery
)
{
qDestroyQuery
(
pQuery
);
}
if
(
NULL
!=
pRequest
&&
TSDB_CODE_SUCCESS
!=
code
)
{
if
(
NULL
!=
pRequest
&&
TSDB_CODE_SUCCESS
!=
code
)
{
pRequest
->
code
=
terrno
;
pRequest
->
code
=
terrno
;
}
}
...
@@ -339,6 +336,19 @@ SRequestObj* execQueryImpl(STscObj* pTscObj, const char* sql, int sqlLen) {
...
@@ -339,6 +336,19 @@ SRequestObj* execQueryImpl(STscObj* pTscObj, const char* sql, int sqlLen) {
return
pRequest
;
return
pRequest
;
}
}
SRequestObj
*
launchQuery
(
STscObj
*
pTscObj
,
const
char
*
sql
,
int
sqlLen
)
{
SRequestObj
*
pRequest
=
NULL
;
SQuery
*
pQuery
=
NULL
;
int32_t
code
=
buildRequest
(
pTscObj
,
sql
,
sqlLen
,
&
pRequest
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
parseSql
(
pRequest
,
false
,
&
pQuery
,
NULL
);
}
return
launchQueryImpl
(
pRequest
,
pQuery
,
code
,
false
);
}
int32_t
refreshMeta
(
STscObj
*
pTscObj
,
SRequestObj
*
pRequest
)
{
int32_t
refreshMeta
(
STscObj
*
pTscObj
,
SRequestObj
*
pRequest
)
{
SCatalog
*
pCatalog
=
NULL
;
SCatalog
*
pCatalog
=
NULL
;
int32_t
code
=
0
;
int32_t
code
=
0
;
...
@@ -383,7 +393,7 @@ SRequestObj* execQuery(STscObj* pTscObj, const char* sql, int sqlLen) {
...
@@ -383,7 +393,7 @@ SRequestObj* execQuery(STscObj* pTscObj, const char* sql, int sqlLen) {
int32_t
code
=
0
;
int32_t
code
=
0
;
while
(
retryNum
++
<
REQUEST_MAX_TRY_TIMES
)
{
while
(
retryNum
++
<
REQUEST_MAX_TRY_TIMES
)
{
pRequest
=
execQueryImpl
(
pTscObj
,
sql
,
sqlLen
);
pRequest
=
launchQuery
(
pTscObj
,
sql
,
sqlLen
);
if
(
TSDB_CODE_SUCCESS
==
pRequest
->
code
||
!
NEED_CLIENT_HANDLE_ERROR
(
pRequest
->
code
))
{
if
(
TSDB_CODE_SUCCESS
==
pRequest
->
code
||
!
NEED_CLIENT_HANDLE_ERROR
(
pRequest
->
code
))
{
break
;
break
;
}
}
...
@@ -715,7 +725,8 @@ static int32_t doConvertUCS4(SReqResultInfo* pResultInfo, int32_t numOfRows, int
...
@@ -715,7 +725,8 @@ static int32_t doConvertUCS4(SReqResultInfo* pResultInfo, int32_t numOfRows, int
int32_t
len
=
taosUcs4ToMbs
((
TdUcs4
*
)
varDataVal
(
pStart
),
varDataLen
(
pStart
),
varDataVal
(
p
));
int32_t
len
=
taosUcs4ToMbs
((
TdUcs4
*
)
varDataVal
(
pStart
),
varDataLen
(
pStart
),
varDataVal
(
p
));
ASSERT
(
len
<=
bytes
);
ASSERT
(
len
<=
bytes
);
ASSERT
((
p
+
len
)
<
(
pResultInfo
->
convertBuf
[
i
]
+
colLength
[
i
]));
varDataSetLen
(
p
,
len
);
varDataSetLen
(
p
,
len
);
pCol
->
offset
[
j
]
=
(
p
-
pResultInfo
->
convertBuf
[
i
]);
pCol
->
offset
[
j
]
=
(
p
-
pResultInfo
->
convertBuf
[
i
]);
p
+=
(
len
+
VARSTR_HEADER_SIZE
);
p
+=
(
len
+
VARSTR_HEADER_SIZE
);
...
@@ -725,6 +736,76 @@ static int32_t doConvertUCS4(SReqResultInfo* pResultInfo, int32_t numOfRows, int
...
@@ -725,6 +736,76 @@ static int32_t doConvertUCS4(SReqResultInfo* pResultInfo, int32_t numOfRows, int
pResultInfo
->
pCol
[
i
].
pData
=
pResultInfo
->
convertBuf
[
i
];
pResultInfo
->
pCol
[
i
].
pData
=
pResultInfo
->
convertBuf
[
i
];
pResultInfo
->
row
[
i
]
=
pResultInfo
->
pCol
[
i
].
pData
;
pResultInfo
->
row
[
i
]
=
pResultInfo
->
pCol
[
i
].
pData
;
}
}
if
(
type
==
TSDB_DATA_TYPE_JSON
)
{
char
*
p
=
taosMemoryRealloc
(
pResultInfo
->
convertBuf
[
i
],
colLength
[
i
]);
if
(
p
==
NULL
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
pResultInfo
->
convertBuf
[
i
]
=
p
;
int32_t
len
=
0
;
SResultColumn
*
pCol
=
&
pResultInfo
->
pCol
[
i
];
for
(
int32_t
j
=
0
;
j
<
numOfRows
;
++
j
)
{
if
(
pCol
->
offset
[
j
]
!=
-
1
)
{
char
*
pStart
=
pCol
->
offset
[
j
]
+
pCol
->
pData
;
int32_t
jsonInnerType
=
*
pStart
;
char
*
jsonInnerData
=
pStart
+
CHAR_BYTES
;
char
dst
[
TSDB_MAX_JSON_TAG_LEN
]
=
{
0
};
if
(
jsonInnerType
==
TSDB_DATA_TYPE_NULL
){
sprintf
(
varDataVal
(
dst
),
"%s"
,
TSDB_DATA_NULL_STR_L
);
varDataSetLen
(
dst
,
strlen
(
varDataVal
(
dst
)));
}
else
if
(
jsonInnerType
==
TSDB_DATA_TYPE_JSON
){
int32_t
length
=
taosUcs4ToMbs
((
TdUcs4
*
)
varDataVal
(
jsonInnerData
),
varDataLen
(
jsonInnerData
),
varDataVal
(
dst
));
if
(
length
<=
0
)
{
tscError
(
"charset:%s to %s. val:%s convert failed."
,
DEFAULT_UNICODE_ENCODEC
,
tsCharset
,
varDataVal
(
jsonInnerData
));
length
=
0
;
}
varDataSetLen
(
dst
,
length
);
}
else
if
(
jsonInnerType
==
TSDB_DATA_TYPE_NCHAR
)
{
// value -> "value"
*
(
char
*
)
varDataVal
(
dst
)
=
'\"'
;
int32_t
length
=
taosUcs4ToMbs
((
TdUcs4
*
)
varDataVal
(
jsonInnerData
),
varDataLen
(
jsonInnerData
),
varDataVal
(
dst
)
+
CHAR_BYTES
);
if
(
length
<=
0
)
{
tscError
(
"charset:%s to %s. val:%s convert failed."
,
DEFAULT_UNICODE_ENCODEC
,
tsCharset
,
varDataVal
(
jsonInnerData
));
length
=
0
;
}
varDataSetLen
(
dst
,
length
+
CHAR_BYTES
*
2
);
*
(
char
*
)(
varDataVal
(
dst
),
length
+
CHAR_BYTES
)
=
'\"'
;
}
else
if
(
jsonInnerType
==
TSDB_DATA_TYPE_DOUBLE
){
double
jsonVd
=
*
(
double
*
)(
jsonInnerData
);
sprintf
(
varDataVal
(
dst
),
"%.9lf"
,
jsonVd
);
varDataSetLen
(
dst
,
strlen
(
varDataVal
(
dst
)));
}
else
if
(
jsonInnerType
==
TSDB_DATA_TYPE_BIGINT
){
int64_t
jsonVd
=
*
(
int64_t
*
)(
jsonInnerData
);
sprintf
(
varDataVal
(
dst
),
"%"
PRId64
,
jsonVd
);
varDataSetLen
(
dst
,
strlen
(
varDataVal
(
dst
)));
}
else
if
(
jsonInnerType
==
TSDB_DATA_TYPE_BOOL
){
sprintf
(
varDataVal
(
dst
),
"%s"
,
(
*
((
char
*
)
jsonInnerData
)
==
1
)
?
"true"
:
"false"
);
varDataSetLen
(
dst
,
strlen
(
varDataVal
(
dst
)));
}
else
{
ASSERT
(
0
);
}
if
(
len
+
varDataTLen
(
dst
)
>
colLength
[
i
]){
p
=
taosMemoryRealloc
(
pResultInfo
->
convertBuf
[
i
],
len
+
varDataTLen
(
dst
));
if
(
p
==
NULL
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
pResultInfo
->
convertBuf
[
i
]
=
p
;
}
p
=
pResultInfo
->
convertBuf
[
i
]
+
len
;
memcpy
(
p
,
dst
,
varDataTLen
(
dst
));
pCol
->
offset
[
j
]
=
len
;
len
+=
varDataTLen
(
dst
);
}
}
pResultInfo
->
pCol
[
i
].
pData
=
pResultInfo
->
convertBuf
[
i
];
pResultInfo
->
row
[
i
]
=
pResultInfo
->
pCol
[
i
].
pData
;
}
}
}
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
...
...
source/client/src/clientMain.c
浏览文件 @
395d9e8b
...
@@ -14,12 +14,12 @@
...
@@ -14,12 +14,12 @@
*/
*/
#include "catalog.h"
#include "catalog.h"
#include "scheduler.h"
#include "clientInt.h"
#include "clientInt.h"
#include "clientStmt.h"
#include "clientLog.h"
#include "clientLog.h"
#include "clientStmt.h"
#include "os.h"
#include "os.h"
#include "query.h"
#include "query.h"
#include "scheduler.h"
#include "tglobal.h"
#include "tglobal.h"
#include "tmsg.h"
#include "tmsg.h"
#include "tref.h"
#include "tref.h"
...
@@ -128,6 +128,10 @@ const char *taos_errstr(TAOS_RES *res) {
...
@@ -128,6 +128,10 @@ const char *taos_errstr(TAOS_RES *res) {
}
}
void
taos_free_result
(
TAOS_RES
*
res
)
{
void
taos_free_result
(
TAOS_RES
*
res
)
{
if
(
NULL
==
res
)
{
return
;
}
if
(
TD_RES_QUERY
(
res
))
{
if
(
TD_RES_QUERY
(
res
))
{
SRequestObj
*
pRequest
=
(
SRequestObj
*
)
res
;
SRequestObj
*
pRequest
=
(
SRequestObj
*
)
res
;
destroyRequest
(
pRequest
);
destroyRequest
(
pRequest
);
...
@@ -177,25 +181,24 @@ TAOS_ROW taos_fetch_row(TAOS_RES *res) {
...
@@ -177,25 +181,24 @@ TAOS_ROW taos_fetch_row(TAOS_RES *res) {
return
doFetchRows
(
pRequest
,
true
,
true
);
return
doFetchRows
(
pRequest
,
true
,
true
);
}
else
if
(
TD_RES_TMQ
(
res
))
{
}
else
if
(
TD_RES_TMQ
(
res
))
{
SMqRspObj
*
msg
=
((
SMqRspObj
*
)
res
);
SMqRspObj
*
msg
=
((
SMqRspObj
*
)
res
);
if
(
msg
->
resIter
==
-
1
)
msg
->
resIter
++
;
SReqResultInfo
*
pResultInfo
;
SReqResultInfo
*
pResultInfo
=
taosArrayGet
(
msg
->
res
,
msg
->
resIter
);
if
(
msg
->
resIter
==
-
1
)
{
pResultInfo
=
tmqGetNextResInfo
(
res
,
true
);
}
else
{
pResultInfo
=
tmqGetCurResInfo
(
res
);
}
if
(
pResultInfo
->
current
<
pResultInfo
->
numOfRows
)
{
if
(
pResultInfo
->
current
<
pResultInfo
->
numOfRows
)
{
doSetOneRowPtr
(
pResultInfo
);
doSetOneRowPtr
(
pResultInfo
);
pResultInfo
->
current
+=
1
;
pResultInfo
->
current
+=
1
;
return
pResultInfo
->
row
;
return
pResultInfo
->
row
;
}
else
{
}
else
{
msg
->
resIter
++
;
pResultInfo
=
tmqGetNextResInfo
(
res
,
true
);
if
(
msg
->
resIter
<
taosArrayGetSize
(
msg
->
res
))
{
if
(
pResultInfo
==
NULL
)
return
NULL
;
pResultInfo
=
taosArrayGet
(
msg
->
res
,
msg
->
resIter
);
doSetOneRowPtr
(
pResultInfo
);
doSetOneRowPtr
(
pResultInfo
);
pResultInfo
->
current
+=
1
;
pResultInfo
->
current
+=
1
;
return
pResultInfo
->
row
;
return
pResultInfo
->
row
;
}
else
{
return
NULL
;
}
}
}
}
else
{
}
else
{
// assert to avoid un-initialization error
// assert to avoid un-initialization error
ASSERT
(
0
);
ASSERT
(
0
);
...
@@ -455,7 +458,7 @@ int taos_fetch_block_s(TAOS_RES *res, int *numOfRows, TAOS_ROW *rows) {
...
@@ -455,7 +458,7 @@ int taos_fetch_block_s(TAOS_RES *res, int *numOfRows, TAOS_ROW *rows) {
(
*
numOfRows
)
=
pResultInfo
->
numOfRows
;
(
*
numOfRows
)
=
pResultInfo
->
numOfRows
;
return
pRequest
->
code
;
return
pRequest
->
code
;
}
else
if
(
TD_RES_TMQ
(
res
))
{
}
else
if
(
TD_RES_TMQ
(
res
))
{
SReqResultInfo
*
pResultInfo
=
tmqGetNextResInfo
(
res
);
SReqResultInfo
*
pResultInfo
=
tmqGetNextResInfo
(
res
,
true
);
if
(
pResultInfo
==
NULL
)
return
-
1
;
if
(
pResultInfo
==
NULL
)
return
-
1
;
pResultInfo
->
current
=
pResultInfo
->
numOfRows
;
pResultInfo
->
current
=
pResultInfo
->
numOfRows
;
...
@@ -474,7 +477,7 @@ int taos_fetch_raw_block(TAOS_RES *res, int *numOfRows, void **pData) {
...
@@ -474,7 +477,7 @@ int taos_fetch_raw_block(TAOS_RES *res, int *numOfRows, void **pData) {
}
}
if
(
TD_RES_TMQ
(
res
))
{
if
(
TD_RES_TMQ
(
res
))
{
SReqResultInfo
*
pResultInfo
=
tmqGetNextResInfo
(
res
);
SReqResultInfo
*
pResultInfo
=
tmqGetNextResInfo
(
res
,
false
);
if
(
pResultInfo
==
NULL
)
{
if
(
pResultInfo
==
NULL
)
{
(
*
numOfRows
)
=
0
;
(
*
numOfRows
)
=
0
;
return
0
;
return
0
;
...
@@ -580,84 +583,111 @@ TAOS_STMT *taos_stmt_init(TAOS *taos) {
...
@@ -580,84 +583,111 @@ TAOS_STMT *taos_stmt_init(TAOS *taos) {
return
stmtInit
(
taos
);
return
stmtInit
(
taos
);
}
}
int
taos_stmt_
close
(
TAOS_STMT
*
stmt
)
{
int
taos_stmt_
prepare
(
TAOS_STMT
*
stmt
,
const
char
*
sql
,
unsigned
long
length
)
{
if
(
stmt
==
NULL
)
{
if
(
stmt
==
NULL
||
sql
==
NULL
)
{
tscError
(
"NULL parameter for %s"
,
__FUNCTION__
);
tscError
(
"NULL parameter for %s"
,
__FUNCTION__
);
terrno
=
TSDB_CODE_INVALID_PARA
;
terrno
=
TSDB_CODE_INVALID_PARA
;
return
terrno
;
return
terrno
;
}
}
return
stmt
Close
(
stmt
);
return
stmt
Prepare
(
stmt
,
sql
,
length
);
}
}
int
taos_stmt_
execute
(
TAOS_STMT
*
stmt
)
{
int
taos_stmt_
set_tbname_tags
(
TAOS_STMT
*
stmt
,
const
char
*
name
,
TAOS_BIND_v2
*
tags
)
{
if
(
stmt
==
NULL
)
{
if
(
stmt
==
NULL
||
name
==
NULL
)
{
tscError
(
"NULL parameter for %s"
,
__FUNCTION__
);
tscError
(
"NULL parameter for %s"
,
__FUNCTION__
);
terrno
=
TSDB_CODE_INVALID_PARA
;
terrno
=
TSDB_CODE_INVALID_PARA
;
return
terrno
;
return
terrno
;
}
}
return
stmtExec
(
stmt
);
int32_t
code
=
stmtSetTbName
(
stmt
,
name
);
if
(
code
)
{
return
code
;
}
if
(
tags
)
{
return
stmtSetTbTags
(
stmt
,
tags
);
}
return
TSDB_CODE_SUCCESS
;
}
}
char
*
taos_stmt_errstr
(
TAOS_STMT
*
stmt
)
{
int
taos_stmt_set_tbname
(
TAOS_STMT
*
stmt
,
const
char
*
name
)
{
if
(
stmt
==
NULL
)
{
if
(
stmt
==
NULL
||
name
==
NULL
)
{
tscError
(
"NULL parameter for %s"
,
__FUNCTION__
);
tscError
(
"NULL parameter for %s"
,
__FUNCTION__
);
terrno
=
TSDB_CODE_INVALID_PARA
;
terrno
=
TSDB_CODE_INVALID_PARA
;
return
NULL
;
return
terrno
;
}
}
return
stmt
Errstr
(
stmt
);
return
stmt
SetTbName
(
stmt
,
name
);
}
}
int
taos_stmt_
affected_rows
(
TAOS_STMT
*
stmt
)
{
int
taos_stmt_
bind_param
(
TAOS_STMT
*
stmt
,
TAOS_BIND_v2
*
bind
)
{
if
(
stmt
==
NULL
)
{
if
(
stmt
==
NULL
||
bind
==
NULL
)
{
tscError
(
"NULL parameter for %s"
,
__FUNCTION__
);
tscError
(
"NULL parameter for %s"
,
__FUNCTION__
);
terrno
=
TSDB_CODE_INVALID_PARA
;
terrno
=
TSDB_CODE_INVALID_PARA
;
return
0
;
return
terrno
;
}
}
return
stmtAffectedRows
(
stmt
);
if
(
bind
->
num
>
1
)
{
tscError
(
"invalid bind number %d for %s"
,
bind
->
num
,
__FUNCTION__
);
terrno
=
TSDB_CODE_INVALID_PARA
;
return
terrno
;
}
return
stmtBindBatch
(
stmt
,
bind
,
-
1
);
}
}
int
taos_stmt_bind_param
(
TAOS_STMT
*
stmt
,
TAOS_BIND
*
bind
)
{
int
taos_stmt_bind_param
_batch
(
TAOS_STMT
*
stmt
,
TAOS_BIND_v2
*
bind
)
{
if
(
stmt
==
NULL
||
bind
==
NULL
)
{
if
(
stmt
==
NULL
||
bind
==
NULL
)
{
tscError
(
"NULL parameter for %s"
,
__FUNCTION__
);
tscError
(
"NULL parameter for %s"
,
__FUNCTION__
);
terrno
=
TSDB_CODE_INVALID_PARA
;
terrno
=
TSDB_CODE_INVALID_PARA
;
return
terrno
;
return
terrno
;
}
}
return
stmtBind
(
stmt
,
bind
);
if
(
bind
->
num
<=
0
||
bind
->
num
>
INT16_MAX
)
{
tscError
(
"invalid bind num %d"
,
bind
->
num
);
terrno
=
TSDB_CODE_INVALID_PARA
;
return
terrno
;
}
return
stmtBindBatch
(
stmt
,
bind
,
-
1
);
}
}
int
taos_stmt_
prepare
(
TAOS_STMT
*
stmt
,
const
char
*
sql
,
unsigned
long
length
)
{
int
taos_stmt_
bind_single_param_batch
(
TAOS_STMT
*
stmt
,
TAOS_BIND_v2
*
bind
,
int
colIdx
)
{
if
(
stmt
==
NULL
||
sql
==
NULL
)
{
if
(
stmt
==
NULL
||
bind
==
NULL
)
{
tscError
(
"NULL parameter for %s"
,
__FUNCTION__
);
tscError
(
"NULL parameter for %s"
,
__FUNCTION__
);
terrno
=
TSDB_CODE_INVALID_PARA
;
terrno
=
TSDB_CODE_INVALID_PARA
;
return
terrno
;
return
terrno
;
}
}
return
stmtPrepare
(
stmt
,
sql
,
length
);
if
(
colIdx
<
0
)
{
tscError
(
"invalid bind column idx %d"
,
colIdx
);
terrno
=
TSDB_CODE_INVALID_PARA
;
return
terrno
;
}
return
stmtBindBatch
(
stmt
,
bind
,
colIdx
);
}
}
int
taos_stmt_
set_tbname_tags
(
TAOS_STMT
*
stmt
,
const
char
*
name
,
TAOS_BIND
*
tags
)
{
int
taos_stmt_
add_batch
(
TAOS_STMT
*
stmt
)
{
if
(
stmt
==
NULL
||
name
==
NULL
||
tags
==
NULL
)
{
if
(
stmt
==
NULL
)
{
tscError
(
"NULL parameter for %s"
,
__FUNCTION__
);
tscError
(
"NULL parameter for %s"
,
__FUNCTION__
);
terrno
=
TSDB_CODE_INVALID_PARA
;
terrno
=
TSDB_CODE_INVALID_PARA
;
return
terrno
;
return
terrno
;
}
}
return
stmt
SetTbNameTags
(
stmt
,
name
,
tags
);
return
stmt
AddBatch
(
stmt
);
}
}
int
taos_stmt_
set_tbname
(
TAOS_STMT
*
stmt
,
const
char
*
name
)
{
int
taos_stmt_
execute
(
TAOS_STMT
*
stmt
)
{
if
(
stmt
==
NULL
||
name
==
NULL
)
{
if
(
stmt
==
NULL
)
{
tscError
(
"NULL parameter for %s"
,
__FUNCTION__
);
tscError
(
"NULL parameter for %s"
,
__FUNCTION__
);
terrno
=
TSDB_CODE_INVALID_PARA
;
terrno
=
TSDB_CODE_INVALID_PARA
;
return
terrno
;
return
terrno
;
}
}
return
stmt
SetTbNameTags
(
stmt
,
name
,
NULL
);
return
stmt
Exec
(
stmt
);
}
}
int
taos_stmt_is_insert
(
TAOS_STMT
*
stmt
,
int
*
insert
)
{
int
taos_stmt_is_insert
(
TAOS_STMT
*
stmt
,
int
*
insert
)
{
...
@@ -680,40 +710,42 @@ int taos_stmt_num_params(TAOS_STMT *stmt, int *nums) {
...
@@ -680,40 +710,42 @@ int taos_stmt_num_params(TAOS_STMT *stmt, int *nums) {
return
stmtGetParamNum
(
stmt
,
nums
);
return
stmtGetParamNum
(
stmt
,
nums
);
}
}
int
taos_stmt_add_batch
(
TAOS_STMT
*
stmt
)
{
TAOS_RES
*
taos_stmt_use_result
(
TAOS_STMT
*
stmt
)
{
if
(
stmt
==
NULL
)
{
if
(
stmt
==
NULL
)
{
tscError
(
"NULL parameter for %s"
,
__FUNCTION__
);
tscError
(
"NULL parameter for %s"
,
__FUNCTION__
);
terrno
=
TSDB_CODE_INVALID_PARA
;
terrno
=
TSDB_CODE_INVALID_PARA
;
return
terrno
;
return
NULL
;
}
}
return
stmt
AddBatch
(
stmt
);
return
stmt
UseResult
(
stmt
);
}
}
TAOS_RES
*
taos_stmt_use_result
(
TAOS_STMT
*
stmt
)
{
char
*
taos_stmt_errstr
(
TAOS_STMT
*
stmt
)
{
return
(
char
*
)
stmtErrstr
(
stmt
);
}
int
taos_stmt_affected_rows
(
TAOS_STMT
*
stmt
)
{
if
(
stmt
==
NULL
)
{
if
(
stmt
==
NULL
)
{
tscError
(
"NULL parameter for %s"
,
__FUNCTION__
);
tscError
(
"NULL parameter for %s"
,
__FUNCTION__
);
terrno
=
TSDB_CODE_INVALID_PARA
;
terrno
=
TSDB_CODE_INVALID_PARA
;
return
NULL
;
return
0
;
}
}
return
stmt
UseResult
(
stmt
);
return
stmt
AffectedRows
(
stmt
);
}
}
int
taos_stmt_
bind_param_batch
(
TAOS_STMT
*
stmt
,
TAOS_MULTI_BIND
*
bind
)
{
int
taos_stmt_
close
(
TAOS_STMT
*
stmt
)
{
if
(
stmt
==
NULL
||
bind
==
NULL
)
{
if
(
stmt
==
NULL
)
{
tscError
(
"NULL parameter for %s"
,
__FUNCTION__
);
tscError
(
"NULL parameter for %s"
,
__FUNCTION__
);
terrno
=
TSDB_CODE_INVALID_PARA
;
terrno
=
TSDB_CODE_INVALID_PARA
;
return
terrno
;
return
terrno
;
}
}
return
stmt
BindBatch
(
stmt
,
bind
);
return
stmt
Close
(
stmt
);
}
}
TAOS_RES
*
taos_schemaless_insert
(
TAOS
*
taos
,
char
*
lines
[],
int
numLines
,
int
protocol
,
int
precision
)
{
TAOS_RES
*
taos_schemaless_insert
(
TAOS
*
taos
,
char
*
lines
[],
int
numLines
,
int
protocol
,
int
precision
)
{
// TODO
// TODO
return
NULL
;
return
NULL
;
}
}
source/client/src/clientStmt.c
浏览文件 @
395d9e8b
...
@@ -4,86 +4,539 @@
...
@@ -4,86 +4,539 @@
#include "clientStmt.h"
#include "clientStmt.h"
#include "tdef.h"
#include "tdef.h"
int32_t
stmtSwitchStatus
(
STscStmt
*
pStmt
,
STMT_STATUS
newStatus
)
{
switch
(
newStatus
)
{
case
STMT_SETTBNAME
:
break
;
default:
break
;
}
//STMT_ERR_RET(TSDB_CODE_TSC_STMT_API_ERROR);
pStmt
->
sql
.
status
=
newStatus
;
return
TSDB_CODE_SUCCESS
;
}
int32_t
stmtGetTbName
(
TAOS_STMT
*
stmt
,
char
**
tbName
)
{
STscStmt
*
pStmt
=
(
STscStmt
*
)
stmt
;
pStmt
->
sql
.
type
=
STMT_TYPE_MULTI_INSERT
;
if
(
NULL
==
pStmt
->
bInfo
.
tbName
)
{
tscError
(
"no table name set"
);
STMT_ERR_RET
(
TSDB_CODE_TSC_STMT_TBNAME_ERROR
);
}
*
tbName
=
pStmt
->
bInfo
.
tbName
;
return
TSDB_CODE_SUCCESS
;
}
int32_t
stmtSetBindInfo
(
TAOS_STMT
*
stmt
,
STableMeta
*
pTableMeta
,
void
*
tags
)
{
STscStmt
*
pStmt
=
(
STscStmt
*
)
stmt
;
pStmt
->
bInfo
.
tbUid
=
pTableMeta
->
uid
;
pStmt
->
bInfo
.
tbSuid
=
pTableMeta
->
suid
;
pStmt
->
bInfo
.
tbType
=
pTableMeta
->
tableType
;
pStmt
->
bInfo
.
boundTags
=
tags
;
return
TSDB_CODE_SUCCESS
;
}
int32_t
stmtSetExecInfo
(
TAOS_STMT
*
stmt
,
SHashObj
*
pVgHash
,
SHashObj
*
pBlockHash
)
{
STscStmt
*
pStmt
=
(
STscStmt
*
)
stmt
;
pStmt
->
exec
.
pVgHash
=
pVgHash
;
pStmt
->
exec
.
pBlockHash
=
pBlockHash
;
return
TSDB_CODE_SUCCESS
;
}
int32_t
stmtGetExecInfo
(
TAOS_STMT
*
stmt
,
SHashObj
**
pVgHash
,
SHashObj
**
pBlockHash
)
{
STscStmt
*
pStmt
=
(
STscStmt
*
)
stmt
;
*
pVgHash
=
pStmt
->
exec
.
pVgHash
;
*
pBlockHash
=
pStmt
->
exec
.
pBlockHash
;
return
TSDB_CODE_SUCCESS
;
}
int32_t
stmtCacheBlock
(
STscStmt
*
pStmt
)
{
if
(
pStmt
->
sql
.
type
!=
STMT_TYPE_MULTI_INSERT
)
{
return
TSDB_CODE_SUCCESS
;
}
uint64_t
uid
;
if
(
TSDB_CHILD_TABLE
==
pStmt
->
bInfo
.
tbType
)
{
uid
=
pStmt
->
bInfo
.
tbSuid
;
}
else
{
ASSERT
(
TSDB_NORMAL_TABLE
==
pStmt
->
bInfo
.
tbType
);
uid
=
pStmt
->
bInfo
.
tbUid
;
}
if
(
taosHashGet
(
pStmt
->
sql
.
pTableCache
,
&
uid
,
sizeof
(
uid
)))
{
return
TSDB_CODE_SUCCESS
;
}
STableDataBlocks
**
pSrc
=
taosHashGet
(
pStmt
->
exec
.
pBlockHash
,
&
uid
,
sizeof
(
uid
));
STableDataBlocks
*
pDst
=
NULL
;
STMT_ERR_RET
(
qCloneStmtDataBlock
(
&
pDst
,
*
pSrc
));
SStmtTableCache
cache
=
{
.
pDataBlock
=
pDst
,
.
boundTags
=
pStmt
->
bInfo
.
boundTags
,
};
if
(
taosHashPut
(
pStmt
->
sql
.
pTableCache
,
&
uid
,
sizeof
(
uid
),
&
cache
,
sizeof
(
cache
)))
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
pStmt
->
bInfo
.
boundTags
=
NULL
;
return
TSDB_CODE_SUCCESS
;
}
int32_t
stmtParseSql
(
STscStmt
*
pStmt
)
{
SStmtCallback
stmtCb
=
{
.
pStmt
=
pStmt
,
.
getTbNameFn
=
stmtGetTbName
,
.
setBindInfoFn
=
stmtSetBindInfo
,
.
setExecInfoFn
=
stmtSetExecInfo
,
.
getExecInfoFn
=
stmtGetExecInfo
,
};
if
(
NULL
==
pStmt
->
exec
.
pRequest
)
{
STMT_ERR_RET
(
buildRequest
(
pStmt
->
taos
,
pStmt
->
sql
.
sqlStr
,
pStmt
->
sql
.
sqlLen
,
&
pStmt
->
exec
.
pRequest
));
}
STMT_ERR_RET
(
parseSql
(
pStmt
->
exec
.
pRequest
,
false
,
&
pStmt
->
sql
.
pQuery
,
&
stmtCb
));
pStmt
->
bInfo
.
needParse
=
false
;
switch
(
nodeType
(
pStmt
->
sql
.
pQuery
->
pRoot
))
{
case
QUERY_NODE_VNODE_MODIF_STMT
:
if
(
0
==
pStmt
->
sql
.
type
)
{
pStmt
->
sql
.
type
=
STMT_TYPE_INSERT
;
}
break
;
case
QUERY_NODE_SELECT_STMT
:
pStmt
->
sql
.
type
=
STMT_TYPE_QUERY
;
break
;
default:
tscError
(
"not supported stmt type %d"
,
nodeType
(
pStmt
->
sql
.
pQuery
->
pRoot
));
STMT_ERR_RET
(
TSDB_CODE_TSC_STMT_CLAUSE_ERROR
);
}
STMT_ERR_RET
(
stmtCacheBlock
(
pStmt
));
return
TSDB_CODE_SUCCESS
;
}
int32_t
stmtCleanBindInfo
(
STscStmt
*
pStmt
)
{
pStmt
->
bInfo
.
tbUid
=
0
;
pStmt
->
bInfo
.
tbSuid
=
0
;
pStmt
->
bInfo
.
tbType
=
0
;
pStmt
->
bInfo
.
needParse
=
true
;
taosMemoryFreeClear
(
pStmt
->
bInfo
.
tbName
);
destroyBoundColumnInfo
(
pStmt
->
bInfo
.
boundTags
);
taosMemoryFreeClear
(
pStmt
->
bInfo
.
boundTags
);
return
TSDB_CODE_SUCCESS
;
}
int32_t
stmtCleanExecInfo
(
STscStmt
*
pStmt
,
bool
keepTable
)
{
taos_free_result
(
pStmt
->
exec
.
pRequest
);
pStmt
->
exec
.
pRequest
=
NULL
;
void
*
pIter
=
taosHashIterate
(
pStmt
->
exec
.
pBlockHash
,
NULL
);
while
(
pIter
)
{
STableDataBlocks
*
pBlocks
=
*
(
STableDataBlocks
**
)
pIter
;
uint64_t
*
key
=
taosHashGetKey
(
pIter
,
NULL
);
if
(
keepTable
&&
(
*
key
==
pStmt
->
bInfo
.
tbUid
))
{
STMT_ERR_RET
(
qResetStmtDataBlock
(
pBlocks
,
true
));
pIter
=
taosHashIterate
(
pStmt
->
exec
.
pBlockHash
,
pIter
);
continue
;
}
qFreeStmtDataBlock
(
pBlocks
);
taosHashRemove
(
pStmt
->
exec
.
pBlockHash
,
key
,
sizeof
(
*
key
));
pIter
=
taosHashIterate
(
pStmt
->
exec
.
pBlockHash
,
pIter
);
}
if
(
keepTable
)
{
return
TSDB_CODE_SUCCESS
;
}
taosHashCleanup
(
pStmt
->
exec
.
pBlockHash
);
pStmt
->
exec
.
pBlockHash
=
NULL
;
STMT_ERR_RET
(
stmtCleanBindInfo
(
pStmt
));
return
TSDB_CODE_SUCCESS
;
}
int32_t
stmtCleanSQLInfo
(
STscStmt
*
pStmt
)
{
taosMemoryFree
(
pStmt
->
sql
.
sqlStr
);
qDestroyQuery
(
pStmt
->
sql
.
pQuery
);
void
*
pIter
=
taosHashIterate
(
pStmt
->
sql
.
pTableCache
,
NULL
);
while
(
pIter
)
{
SStmtTableCache
*
pCache
=
(
SStmtTableCache
*
)
pIter
;
qDestroyStmtDataBlock
(
pCache
->
pDataBlock
);
destroyBoundColumnInfo
(
pCache
->
boundTags
);
pIter
=
taosHashIterate
(
pStmt
->
sql
.
pTableCache
,
pIter
);
}
taosHashCleanup
(
pStmt
->
sql
.
pTableCache
);
pStmt
->
sql
.
pTableCache
=
NULL
;
memset
(
&
pStmt
->
sql
,
0
,
sizeof
(
pStmt
->
sql
));
STMT_ERR_RET
(
stmtCleanExecInfo
(
pStmt
,
false
));
STMT_ERR_RET
(
stmtCleanBindInfo
(
pStmt
));
return
TSDB_CODE_SUCCESS
;
}
int32_t
stmtGetFromCache
(
STscStmt
*
pStmt
)
{
pStmt
->
bInfo
.
needParse
=
true
;
if
(
NULL
==
pStmt
->
sql
.
pTableCache
||
taosHashGetSize
(
pStmt
->
sql
.
pTableCache
)
<=
0
)
{
return
TSDB_CODE_SUCCESS
;
}
if
(
NULL
==
pStmt
->
pCatalog
)
{
STMT_ERR_RET
(
catalogGetHandle
(
pStmt
->
taos
->
pAppInfo
->
clusterId
,
&
pStmt
->
pCatalog
));
}
STableMeta
*
pTableMeta
=
NULL
;
SEpSet
ep
=
getEpSet_s
(
&
pStmt
->
taos
->
pAppInfo
->
mgmtEp
);
STMT_ERR_RET
(
catalogGetTableMeta
(
pStmt
->
pCatalog
,
pStmt
->
taos
->
pAppInfo
->
pTransporter
,
&
ep
,
&
pStmt
->
bInfo
.
sname
,
&
pTableMeta
));
if
(
pTableMeta
->
uid
==
pStmt
->
bInfo
.
tbUid
)
{
pStmt
->
bInfo
.
needParse
=
false
;
return
TSDB_CODE_SUCCESS
;
}
if
(
taosHashGet
(
pStmt
->
exec
.
pBlockHash
,
&
pTableMeta
->
uid
,
sizeof
(
pTableMeta
->
uid
)))
{
SStmtTableCache
*
pCache
=
taosHashGet
(
pStmt
->
sql
.
pTableCache
,
&
pTableMeta
->
uid
,
sizeof
(
pTableMeta
->
uid
));
if
(
NULL
==
pCache
)
{
tscError
(
"table uid %"
PRIx64
"found in exec blockHash, but not in sql blockHash"
,
pTableMeta
->
uid
);
STMT_ERR_RET
(
TSDB_CODE_TSC_APP_ERROR
);
}
pStmt
->
bInfo
.
needParse
=
false
;
pStmt
->
bInfo
.
tbUid
=
pTableMeta
->
uid
;
pStmt
->
bInfo
.
tbSuid
=
pTableMeta
->
suid
;
pStmt
->
bInfo
.
tbType
=
pTableMeta
->
tableType
;
pStmt
->
bInfo
.
boundTags
=
pCache
->
boundTags
;
return
TSDB_CODE_SUCCESS
;
}
SStmtTableCache
*
pCache
=
taosHashGet
(
pStmt
->
sql
.
pTableCache
,
&
pTableMeta
->
uid
,
sizeof
(
pTableMeta
->
uid
));
if
(
pCache
)
{
pStmt
->
bInfo
.
needParse
=
false
;
pStmt
->
bInfo
.
tbUid
=
pTableMeta
->
uid
;
pStmt
->
bInfo
.
tbSuid
=
pTableMeta
->
suid
;
pStmt
->
bInfo
.
tbType
=
pTableMeta
->
tableType
;
pStmt
->
bInfo
.
boundTags
=
pCache
->
boundTags
;
STableDataBlocks
*
pNewBlock
=
NULL
;
STMT_ERR_RET
(
qRebuildStmtDataBlock
(
&
pNewBlock
,
pCache
->
pDataBlock
));
if
(
taosHashPut
(
pStmt
->
exec
.
pBlockHash
,
&
pStmt
->
bInfo
.
tbUid
,
sizeof
(
pStmt
->
bInfo
.
tbUid
),
&
pNewBlock
,
POINTER_BYTES
))
{
STMT_ERR_RET
(
TSDB_CODE_OUT_OF_MEMORY
);
}
return
TSDB_CODE_SUCCESS
;
}
STMT_ERR_RET
(
stmtCleanBindInfo
(
pStmt
));
return
TSDB_CODE_SUCCESS
;
}
int32_t
stmtResetStmt
(
STscStmt
*
pStmt
)
{
STMT_ERR_RET
(
stmtCleanSQLInfo
(
pStmt
));
pStmt
->
sql
.
pTableCache
=
taosHashInit
(
100
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BIGINT
),
false
,
HASH_NO_LOCK
);
if
(
NULL
==
pStmt
->
sql
.
pTableCache
)
{
terrno
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
STMT_ERR_RET
(
terrno
);
}
pStmt
->
sql
.
status
=
STMT_INIT
;
return
TSDB_CODE_SUCCESS
;
}
TAOS_STMT
*
stmtInit
(
TAOS
*
taos
)
{
TAOS_STMT
*
stmtInit
(
TAOS
*
taos
)
{
STscObj
*
pObj
=
(
STscObj
*
)
taos
;
STscObj
*
pObj
=
(
STscObj
*
)
taos
;
STscStmt
*
pStmt
=
NULL
;
STscStmt
*
pStmt
=
NULL
;
#if 0
pStmt
=
taosMemoryCalloc
(
1
,
sizeof
(
STscStmt
));
pStmt
=
taosMemoryCalloc
(
1
,
sizeof
(
STscStmt
));
if (
pStmt == NULL
) {
if
(
NULL
==
pStmt
)
{
terrno
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
terrno
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
tscError("failed to allocate memory for statement");
return
NULL
;
return
NULL
;
}
}
pStmt->taos = pObj;
SSqlObj* pSql = calloc(1, sizeof(SSqlObj));
if (pSql == NULL) {
pStmt
->
sql
.
pTableCache
=
taosHashInit
(
100
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BIGINT
),
false
,
HASH_NO_LOCK
);
free(pStmt);
if
(
NULL
==
pStmt
->
sql
.
pTableCache
)
{
terrno
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
terrno
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
t
scError("failed to allocate memory for statement"
);
t
aosMemoryFree
(
pStmt
);
return
NULL
;
return
NULL
;
}
}
if (TSDB_CODE_SUCCESS != tscAllocPayload(&pSql->cmd, TSDB_DEFAULT_PAYLOAD_SIZE)) {
pStmt
->
taos
=
pObj
;
free(pSql);
pStmt
->
bInfo
.
needParse
=
true
;
free(pStmt);
pStmt
->
sql
.
status
=
STMT_INIT
;
terrno = TSDB_CODE_TSC_OUT_OF_MEMORY;
tscError("failed to malloc payload buffer");
return
pStmt
;
return NULL;
}
int
stmtPrepare
(
TAOS_STMT
*
stmt
,
const
char
*
sql
,
unsigned
long
length
)
{
STscStmt
*
pStmt
=
(
STscStmt
*
)
stmt
;
if
(
pStmt
->
sql
.
status
>=
STMT_PREPARE
)
{
STMT_ERR_RET
(
stmtResetStmt
(
pStmt
));
}
}
tsem_init(&pSql->rspSem, 0, 0);
STMT_ERR_RET
(
stmtSwitchStatus
(
pStmt
,
STMT_PREPARE
));
pSql->signature = pSql;
pSql->pTscObj = pObj;
pSql->maxRetry = TSDB_MAX_REPLICA;
pStmt->pSql = pSql;
pStmt->last = STMT_INIT;
pStmt->numOfRows = 0;
registerSqlObj(pSql);
#endif
return
pStmt
;
if
(
length
<=
0
)
{
}
length
=
strlen
(
sql
);
}
pStmt
->
sql
.
sqlStr
=
strndup
(
sql
,
length
);
pStmt
->
sql
.
sqlLen
=
length
;
int
stmtClose
(
TAOS_STMT
*
stmt
)
{
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
int
stmtExec
(
TAOS_STMT
*
stmt
)
{
int
stmtSetTbName
(
TAOS_STMT
*
stmt
,
const
char
*
tbName
)
{
STscStmt
*
pStmt
=
(
STscStmt
*
)
stmt
;
STMT_ERR_RET
(
stmtSwitchStatus
(
pStmt
,
STMT_SETTBNAME
));
if
(
NULL
==
pStmt
->
exec
.
pRequest
)
{
STMT_ERR_RET
(
buildRequest
(
pStmt
->
taos
,
pStmt
->
sql
.
sqlStr
,
pStmt
->
sql
.
sqlLen
,
&
pStmt
->
exec
.
pRequest
));
}
STMT_ERR_RET
(
qCreateSName
(
&
pStmt
->
bInfo
.
sname
,
tbName
,
pStmt
->
taos
->
acctId
,
pStmt
->
exec
.
pRequest
->
pDb
,
pStmt
->
exec
.
pRequest
->
msgBuf
,
pStmt
->
exec
.
pRequest
->
msgBufLen
));
STMT_ERR_RET
(
stmtGetFromCache
(
pStmt
));
if
(
pStmt
->
bInfo
.
needParse
)
{
taosMemoryFree
(
pStmt
->
bInfo
.
tbName
);
pStmt
->
bInfo
.
tbName
=
strdup
(
tbName
);
}
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
char
*
stmtErrstr
(
TAOS_STMT
*
stmt
)
{
int
stmtSetTbTags
(
TAOS_STMT
*
stmt
,
TAOS_BIND_v2
*
tags
)
{
return
NULL
;
STscStmt
*
pStmt
=
(
STscStmt
*
)
stmt
;
}
STMT_ERR_RET
(
stmtSwitchStatus
(
pStmt
,
STMT_SETTAGS
));
if
(
pStmt
->
bInfo
.
needParse
)
{
STMT_ERR_RET
(
stmtParseSql
(
pStmt
));
}
STableDataBlocks
**
pDataBlock
=
(
STableDataBlocks
**
)
taosHashGet
(
pStmt
->
exec
.
pBlockHash
,
(
const
char
*
)
&
pStmt
->
bInfo
.
tbUid
,
sizeof
(
pStmt
->
bInfo
.
tbUid
));
if
(
NULL
==
pDataBlock
)
{
tscError
(
"table uid %"
PRIx64
"not found in exec blockHash"
,
pStmt
->
bInfo
.
tbUid
);
STMT_ERR_RET
(
TSDB_CODE_QRY_APP_ERROR
);
}
STMT_ERR_RET
(
qBindStmtTagsValue
(
*
pDataBlock
,
pStmt
->
bInfo
.
boundTags
,
pStmt
->
bInfo
.
tbSuid
,
&
pStmt
->
bInfo
.
sname
,
tags
,
pStmt
->
exec
.
pRequest
->
msgBuf
,
pStmt
->
exec
.
pRequest
->
msgBufLen
));
int
stmtAffectedRows
(
TAOS_STMT
*
stmt
)
{
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
int
stmtBind
(
TAOS_STMT
*
stmt
,
TAOS_BIND
*
bind
)
{
int32_t
stmtFetchTagFields
(
TAOS_STMT
*
stmt
,
int32_t
*
fieldNum
,
TAOS_FIELD
**
fields
)
{
STscStmt
*
pStmt
=
(
STscStmt
*
)
stmt
;
STMT_ERR_RET
(
stmtSwitchStatus
(
pStmt
,
STMT_FETCH_TAG_FIELDS
));
if
(
pStmt
->
bInfo
.
needParse
)
{
STMT_ERR_RET
(
stmtParseSql
(
pStmt
));
}
if
(
STMT_TYPE_QUERY
==
pStmt
->
sql
.
type
)
{
tscError
(
"invalid operation to get query tag fileds"
);
STMT_ERR_RET
(
TSDB_CODE_TSC_STMT_API_ERROR
);
}
STableDataBlocks
**
pDataBlock
=
(
STableDataBlocks
**
)
taosHashGet
(
pStmt
->
exec
.
pBlockHash
,
(
const
char
*
)
&
pStmt
->
bInfo
.
tbUid
,
sizeof
(
pStmt
->
bInfo
.
tbUid
));
if
(
NULL
==
pDataBlock
)
{
tscError
(
"table uid %"
PRIx64
"not found in exec blockHash"
,
pStmt
->
bInfo
.
tbUid
);
STMT_ERR_RET
(
TSDB_CODE_QRY_APP_ERROR
);
}
STMT_ERR_RET
(
qBuildStmtTagFields
(
*
pDataBlock
,
pStmt
->
bInfo
.
boundTags
,
fieldNum
,
fields
));
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
int
stmtPrepare
(
TAOS_STMT
*
stmt
,
const
char
*
sql
,
unsigned
long
length
)
{
int32_t
stmtFetchColFields
(
TAOS_STMT
*
stmt
,
int32_t
*
fieldNum
,
TAOS_FIELD
**
fields
)
{
return
TSDB_CODE_SUCCESS
;
STscStmt
*
pStmt
=
(
STscStmt
*
)
stmt
;
STMT_ERR_RET
(
stmtSwitchStatus
(
pStmt
,
STMT_FETCH_COL_FIELDS
));
if
(
pStmt
->
bInfo
.
needParse
)
{
STMT_ERR_RET
(
stmtParseSql
(
pStmt
));
}
if
(
STMT_TYPE_QUERY
==
pStmt
->
sql
.
type
)
{
tscError
(
"invalid operation to get query column fileds"
);
STMT_ERR_RET
(
TSDB_CODE_TSC_STMT_API_ERROR
);
}
STableDataBlocks
**
pDataBlock
=
(
STableDataBlocks
**
)
taosHashGet
(
pStmt
->
exec
.
pBlockHash
,
(
const
char
*
)
&
pStmt
->
bInfo
.
tbUid
,
sizeof
(
pStmt
->
bInfo
.
tbUid
));
if
(
NULL
==
pDataBlock
)
{
tscError
(
"table uid %"
PRIx64
"not found in exec blockHash"
,
pStmt
->
bInfo
.
tbUid
);
STMT_ERR_RET
(
TSDB_CODE_QRY_APP_ERROR
);
}
STMT_ERR_RET
(
qBuildStmtColFields
(
*
pDataBlock
,
fieldNum
,
fields
));
return
TSDB_CODE_SUCCESS
;
}
}
int
stmtSetTbNameTags
(
TAOS_STMT
*
stmt
,
const
char
*
name
,
TAOS_BIND
*
tags
)
{
int
stmtBindBatch
(
TAOS_STMT
*
stmt
,
TAOS_BIND_v2
*
bind
,
int32_t
colIdx
)
{
STscStmt
*
pStmt
=
(
STscStmt
*
)
stmt
;
STMT_ERR_RET
(
stmtSwitchStatus
(
pStmt
,
STMT_BIND
));
if
(
pStmt
->
bInfo
.
needParse
&&
pStmt
->
sql
.
runTimes
&&
pStmt
->
sql
.
type
>
0
&&
STMT_TYPE_MULTI_INSERT
!=
pStmt
->
sql
.
type
)
{
pStmt
->
bInfo
.
needParse
=
false
;
}
if
(
NULL
==
pStmt
->
exec
.
pRequest
)
{
STMT_ERR_RET
(
buildRequest
(
pStmt
->
taos
,
pStmt
->
sql
.
sqlStr
,
pStmt
->
sql
.
sqlLen
,
&
pStmt
->
exec
.
pRequest
));
}
if
(
pStmt
->
bInfo
.
needParse
)
{
STMT_ERR_RET
(
stmtParseSql
(
pStmt
));
}
STableDataBlocks
**
pDataBlock
=
(
STableDataBlocks
**
)
taosHashGet
(
pStmt
->
exec
.
pBlockHash
,
(
const
char
*
)
&
pStmt
->
bInfo
.
tbUid
,
sizeof
(
pStmt
->
bInfo
.
tbUid
));
if
(
NULL
==
pDataBlock
)
{
tscError
(
"table uid %"
PRIx64
"not found in exec blockHash"
,
pStmt
->
bInfo
.
tbUid
);
STMT_ERR_RET
(
TSDB_CODE_QRY_APP_ERROR
);
}
if
(
colIdx
<
0
)
{
qBindStmtColsValue
(
*
pDataBlock
,
bind
,
pStmt
->
exec
.
pRequest
->
msgBuf
,
pStmt
->
exec
.
pRequest
->
msgBufLen
);
}
else
{
if
(
colIdx
!=
(
pStmt
->
bInfo
.
sBindLastIdx
+
1
)
&&
colIdx
!=
0
)
{
tscError
(
"bind column index not in sequence"
);
STMT_ERR_RET
(
TSDB_CODE_QRY_APP_ERROR
);
}
pStmt
->
bInfo
.
sBindLastIdx
=
colIdx
;
if
(
0
==
colIdx
)
{
pStmt
->
bInfo
.
sBindRowNum
=
bind
->
num
;
}
qBindStmtSingleColValue
(
*
pDataBlock
,
bind
,
pStmt
->
exec
.
pRequest
->
msgBuf
,
pStmt
->
exec
.
pRequest
->
msgBufLen
,
colIdx
,
pStmt
->
bInfo
.
sBindRowNum
);
}
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
int
stmtIsInsert
(
TAOS_STMT
*
stmt
,
int
*
insert
)
{
int
stmtAddBatch
(
TAOS_STMT
*
stmt
)
{
STscStmt
*
pStmt
=
(
STscStmt
*
)
stmt
;
STMT_ERR_RET
(
stmtSwitchStatus
(
pStmt
,
STMT_ADD_BATCH
));
STMT_ERR_RET
(
stmtCacheBlock
(
pStmt
));
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
int
stmtGetParamNum
(
TAOS_STMT
*
stmt
,
int
*
nums
)
{
int
stmtExec
(
TAOS_STMT
*
stmt
)
{
STscStmt
*
pStmt
=
(
STscStmt
*
)
stmt
;
int32_t
code
=
0
;
STMT_ERR_RET
(
stmtSwitchStatus
(
pStmt
,
STMT_EXECUTE
));
STMT_ERR_RET
(
qBuildStmtOutput
(
pStmt
->
sql
.
pQuery
,
pStmt
->
exec
.
pVgHash
,
pStmt
->
exec
.
pBlockHash
));
launchQueryImpl
(
pStmt
->
exec
.
pRequest
,
pStmt
->
sql
.
pQuery
,
TSDB_CODE_SUCCESS
,
true
);
STMT_ERR_JRET
(
pStmt
->
exec
.
pRequest
->
code
);
pStmt
->
affectedRows
+=
taos_affected_rows
(
pStmt
->
exec
.
pRequest
);
_return:
stmtCleanExecInfo
(
pStmt
,
(
code
?
false
:
true
));
++
pStmt
->
sql
.
runTimes
;
STMT_RET
(
code
);
}
int
stmtClose
(
TAOS_STMT
*
stmt
)
{
STscStmt
*
pStmt
=
(
STscStmt
*
)
stmt
;
STMT_RET
(
stmtCleanSQLInfo
(
pStmt
));
}
const
char
*
stmtErrstr
(
TAOS_STMT
*
stmt
)
{
STscStmt
*
pStmt
=
(
STscStmt
*
)
stmt
;
if
(
stmt
==
NULL
)
{
return
(
char
*
)
tstrerror
(
terrno
);
}
if
(
pStmt
->
exec
.
pRequest
)
{
pStmt
->
exec
.
pRequest
->
code
=
terrno
;
}
return
taos_errstr
(
pStmt
->
exec
.
pRequest
);
}
int
stmtAffectedRows
(
TAOS_STMT
*
stmt
)
{
return
((
STscStmt
*
)
stmt
)
->
affectedRows
;
}
int
stmtIsInsert
(
TAOS_STMT
*
stmt
,
int
*
insert
)
{
STscStmt
*
pStmt
=
(
STscStmt
*
)
stmt
;
if
(
pStmt
->
sql
.
type
)
{
*
insert
=
(
STMT_TYPE_INSERT
==
pStmt
->
sql
.
type
||
STMT_TYPE_MULTI_INSERT
==
pStmt
->
sql
.
type
);
}
else
{
*
insert
=
isInsertSql
(
pStmt
->
sql
.
sqlStr
,
0
);
}
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
int
stmtAddBatch
(
TAOS_STMT
*
stmt
)
{
int
stmtGetParamNum
(
TAOS_STMT
*
stmt
,
int
*
nums
)
{
STMT_ERR_RET
(
stmtFetchColFields
(
stmt
,
nums
,
NULL
));
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
...
@@ -91,9 +544,5 @@ TAOS_RES *stmtUseResult(TAOS_STMT *stmt) {
...
@@ -91,9 +544,5 @@ TAOS_RES *stmtUseResult(TAOS_STMT *stmt) {
return
NULL
;
return
NULL
;
}
}
int
stmtBindBatch
(
TAOS_STMT
*
stmt
,
TAOS_MULTI_BIND
*
bind
)
{
return
TSDB_CODE_SUCCESS
;
}
source/client/src/tmq.c
浏览文件 @
395d9e8b
...
@@ -72,25 +72,25 @@ struct tmq_conf_t {
...
@@ -72,25 +72,25 @@ struct tmq_conf_t {
struct
tmq_t
{
struct
tmq_t
{
// conf
// conf
char
groupId
[
TSDB_CGROUP_LEN
];
char
groupId
[
TSDB_CGROUP_LEN
];
char
clientId
[
256
];
char
clientId
[
256
];
int8_t
autoCommit
;
int8_t
autoCommit
;
int8_t
inWaiting
;
/*int8_t inWaiting;*/
int64_t
consumerId
;
int64_t
consumerId
;
int32_t
epoch
;
int32_t
epoch
;
int32_t
resetOffsetCfg
;
int32_t
resetOffsetCfg
;
int64_t
status
;
int64_t
status
;
STscObj
*
pTscObj
;
STscObj
*
pTscObj
;
tmq_commit_cb
*
commit_cb
;
tmq_commit_cb
*
commit_cb
;
int32_t
nextTopicIdx
;
/*int32_t nextTopicIdx;*/
int8_t
epStatus
;
int8_t
epStatus
;
int32_t
epSkipCnt
;
int32_t
epSkipCnt
;
int32_t
waitingRequest
;
/*int32_t waitingRequest;*/
int32_t
readyRequest
;
/*int32_t readyRequest;*/
SArray
*
clientTopics
;
// SArray<SMqClientTopic>
SArray
*
clientTopics
;
// SArray<SMqClientTopic>
STaosQueue
*
mqueue
;
// queue of tmq_message_t
STaosQueue
*
mqueue
;
// queue of tmq_message_t
STaosQall
*
qall
;
STaosQall
*
qall
;
tsem_t
rspSem
;
tsem_t
rspSem
;
// stat
// stat
int64_t
pollCnt
;
int64_t
pollCnt
;
};
};
...
@@ -134,7 +134,7 @@ typedef struct {
...
@@ -134,7 +134,7 @@ typedef struct {
int32_t
epoch
;
int32_t
epoch
;
SMqClientVg
*
vgHandle
;
SMqClientVg
*
vgHandle
;
SMqClientTopic
*
topicHandle
;
SMqClientTopic
*
topicHandle
;
SMq
PollRspV2
msg
;
SMq
DataBlkRsp
msg
;
}
SMqPollRspWrapper
;
}
SMqPollRspWrapper
;
typedef
struct
{
typedef
struct
{
...
@@ -145,6 +145,7 @@ typedef struct {
...
@@ -145,6 +145,7 @@ typedef struct {
typedef
struct
{
typedef
struct
{
tmq_t
*
tmq
;
tmq_t
*
tmq
;
int32_t
code
;
int32_t
sync
;
int32_t
sync
;
tsem_t
rspSem
;
tsem_t
rspSem
;
}
SMqAskEpCbParam
;
}
SMqAskEpCbParam
;
...
@@ -255,7 +256,12 @@ int32_t tmq_list_append(tmq_list_t* list, const char* src) {
...
@@ -255,7 +256,12 @@ int32_t tmq_list_append(tmq_list_t* list, const char* src) {
void
tmq_list_destroy
(
tmq_list_t
*
list
)
{
void
tmq_list_destroy
(
tmq_list_t
*
list
)
{
SArray
*
container
=
&
list
->
container
;
SArray
*
container
=
&
list
->
container
;
/*taosArrayDestroy(container);*/
/*taosArrayDestroy(container);*/
taosArrayDestroyEx
(
container
,
(
void
(
*
)(
void
*
))
taosMemoryFree
);
int32_t
sz
=
taosArrayGetSize
(
container
);
for
(
int32_t
i
=
0
;
i
<
sz
;
i
++
)
{
char
*
str
=
taosArrayGetP
(
container
,
i
);
taosMemoryFree
(
str
);
}
taosArrayDestroy
(
container
);
}
}
static
int32_t
tmqMakeTopicVgKey
(
char
*
dst
,
const
char
*
topicName
,
int32_t
vg
)
{
static
int32_t
tmqMakeTopicVgKey
(
char
*
dst
,
const
char
*
topicName
,
int32_t
vg
)
{
...
@@ -322,12 +328,12 @@ tmq_t* tmq_consumer_new(void* conn, tmq_conf_t* conf, char* errstr, int32_t errs
...
@@ -322,12 +328,12 @@ tmq_t* tmq_consumer_new(void* conn, tmq_conf_t* conf, char* errstr, int32_t errs
return
NULL
;
return
NULL
;
}
}
pTmq
->
pTscObj
=
(
STscObj
*
)
conn
;
pTmq
->
pTscObj
=
(
STscObj
*
)
conn
;
pTmq
->
inWaiting
=
0
;
/*pTmq->inWaiting = 0;*/
pTmq
->
status
=
0
;
pTmq
->
status
=
0
;
pTmq
->
pollCnt
=
0
;
pTmq
->
pollCnt
=
0
;
pTmq
->
epoch
=
0
;
pTmq
->
epoch
=
0
;
pTmq
->
waitingRequest
=
0
;
/*pTmq->waitingRequest = 0;*/
pTmq
->
readyRequest
=
0
;
/*pTmq->readyRequest = 0;*/
pTmq
->
epStatus
=
0
;
pTmq
->
epStatus
=
0
;
pTmq
->
epSkipCnt
=
0
;
pTmq
->
epSkipCnt
=
0
;
// set conf
// set conf
...
@@ -367,12 +373,12 @@ tmq_t* tmq_consumer_new1(tmq_conf_t* conf, char* errstr, int32_t errstrLen) {
...
@@ -367,12 +373,12 @@ tmq_t* tmq_consumer_new1(tmq_conf_t* conf, char* errstr, int32_t errstrLen) {
pTmq
->
pTscObj
=
taos_connect_internal
(
conf
->
ip
,
user
,
pass
,
NULL
,
conf
->
db
,
conf
->
port
,
CONN_TYPE__TMQ
);
pTmq
->
pTscObj
=
taos_connect_internal
(
conf
->
ip
,
user
,
pass
,
NULL
,
conf
->
db
,
conf
->
port
,
CONN_TYPE__TMQ
);
if
(
pTmq
->
pTscObj
==
NULL
)
return
NULL
;
if
(
pTmq
->
pTscObj
==
NULL
)
return
NULL
;
pTmq
->
inWaiting
=
0
;
/*pTmq->inWaiting = 0;*/
pTmq
->
status
=
0
;
pTmq
->
status
=
0
;
pTmq
->
pollCnt
=
0
;
pTmq
->
pollCnt
=
0
;
pTmq
->
epoch
=
0
;
pTmq
->
epoch
=
0
;
pTmq
->
waitingRequest
=
0
;
/*pTmq->waitingRequest = 0;*/
pTmq
->
readyRequest
=
0
;
/*pTmq->readyRequest = 0;*/
pTmq
->
epStatus
=
0
;
pTmq
->
epStatus
=
0
;
pTmq
->
epSkipCnt
=
0
;
pTmq
->
epSkipCnt
=
0
;
// set conf
// set conf
...
@@ -496,7 +502,7 @@ tmq_resp_err_t tmq_subscribe(tmq_t* tmq, tmq_list_t* topic_list) {
...
@@ -496,7 +502,7 @@ tmq_resp_err_t tmq_subscribe(tmq_t* tmq, tmq_list_t* topic_list) {
SCMSubscribeReq
req
;
SCMSubscribeReq
req
;
req
.
topicNum
=
sz
;
req
.
topicNum
=
sz
;
req
.
consumerId
=
tmq
->
consumerId
;
req
.
consumerId
=
tmq
->
consumerId
;
req
.
consumerGroup
=
strdup
(
tmq
->
groupId
);
strcpy
(
req
.
cgroup
,
tmq
->
groupId
);
req
.
topicNames
=
taosArrayInit
(
sz
,
sizeof
(
void
*
));
req
.
topicNames
=
taosArrayInit
(
sz
,
sizeof
(
void
*
));
for
(
int
i
=
0
;
i
<
sz
;
i
++
)
{
for
(
int
i
=
0
;
i
<
sz
;
i
++
)
{
...
@@ -609,7 +615,7 @@ TAOS_RES* tmq_create_stream(TAOS* taos, const char* streamName, const char* tbNa
...
@@ -609,7 +615,7 @@ TAOS_RES* tmq_create_stream(TAOS* taos, const char* streamName, const char* tbNa
int32_t
code
=
0
;
int32_t
code
=
0
;
CHECK_CODE_GOTO
(
buildRequest
(
pTscObj
,
sql
,
sqlLen
,
&
pRequest
),
_return
);
CHECK_CODE_GOTO
(
buildRequest
(
pTscObj
,
sql
,
sqlLen
,
&
pRequest
),
_return
);
CHECK_CODE_GOTO
(
parseSql
(
pRequest
,
false
,
&
pQueryNode
),
_return
);
CHECK_CODE_GOTO
(
parseSql
(
pRequest
,
false
,
&
pQueryNode
,
NULL
),
_return
);
// todo check for invalid sql statement and return with error code
// todo check for invalid sql statement and return with error code
...
@@ -857,7 +863,6 @@ void tmqShowMsg(tmq_message_t* tmq_message) {
...
@@ -857,7 +863,6 @@ void tmqShowMsg(tmq_message_t* tmq_message) {
#endif
#endif
int32_t
tmqPollCb
(
void
*
param
,
const
SDataBuf
*
pMsg
,
int32_t
code
)
{
int32_t
tmqPollCb
(
void
*
param
,
const
SDataBuf
*
pMsg
,
int32_t
code
)
{
/*printf("recv poll\n");*/
SMqPollCbParam
*
pParam
=
(
SMqPollCbParam
*
)
param
;
SMqPollCbParam
*
pParam
=
(
SMqPollCbParam
*
)
param
;
SMqClientVg
*
pVg
=
pParam
->
pVg
;
SMqClientVg
*
pVg
=
pParam
->
pVg
;
SMqClientTopic
*
pTopic
=
pParam
->
pTopic
;
SMqClientTopic
*
pTopic
=
pParam
->
pTopic
;
...
@@ -870,17 +875,15 @@ int32_t tmqPollCb(void* param, const SDataBuf* pMsg, int32_t code) {
...
@@ -870,17 +875,15 @@ int32_t tmqPollCb(void* param, const SDataBuf* pMsg, int32_t code) {
int32_t
msgEpoch
=
((
SMqRspHead
*
)
pMsg
->
pData
)
->
epoch
;
int32_t
msgEpoch
=
((
SMqRspHead
*
)
pMsg
->
pData
)
->
epoch
;
int32_t
tmqEpoch
=
atomic_load_32
(
&
tmq
->
epoch
);
int32_t
tmqEpoch
=
atomic_load_32
(
&
tmq
->
epoch
);
if
(
msgEpoch
<
tmqEpoch
)
{
if
(
msgEpoch
<
tmqEpoch
)
{
/*printf("discard rsp epoch %d, current epoch %d\n", msgEpoch, tmqEpoch);*/
// do not write into queue since updating epoch reset
/*tsem_post(&tmq->rspSem);*/
tscWarn
(
"msg discard from vg %d since from earlier epoch, rsp epoch %d, current epoch %d"
,
pParam
->
vgId
,
msgEpoch
,
tscWarn
(
"msg discard from vg %d since from earlier epoch, rsp epoch %d, current epoch %d"
,
pParam
->
vgId
,
msgEpoch
,
tmqEpoch
);
tmqEpoch
);
/*tsem_post(&tmq->rspSem);*/
return
0
;
return
0
;
}
}
if
(
msgEpoch
!=
tmqEpoch
)
{
if
(
msgEpoch
!=
tmqEpoch
)
{
tscWarn
(
"mismatch rsp from vg %d, epoch %d, current epoch %d"
,
pParam
->
vgId
,
msgEpoch
,
tmqEpoch
);
tscWarn
(
"mismatch rsp from vg %d, epoch %d, current epoch %d"
,
pParam
->
vgId
,
msgEpoch
,
tmqEpoch
);
}
else
{
atomic_sub_fetch_32
(
&
tmq
->
waitingRequest
,
1
);
}
}
#if 0
#if 0
...
@@ -902,45 +905,33 @@ int32_t tmqPollCb(void* param, const SDataBuf* pMsg, int32_t code) {
...
@@ -902,45 +905,33 @@ int32_t tmqPollCb(void* param, const SDataBuf* pMsg, int32_t code) {
}
}
#endif
#endif
/*SMqConsumeRsp* pRsp = taosMemoryCalloc(1, sizeof(SMqConsumeRsp));*/
/*tmq_message_t* pRsp = taosAllocateQitem(sizeof(tmq_message_t));*/
SMqPollRspWrapper
*
pRspWrapper
=
taosAllocateQitem
(
sizeof
(
SMqPollRspWrapper
));
SMqPollRspWrapper
*
pRspWrapper
=
taosAllocateQitem
(
sizeof
(
SMqPollRspWrapper
));
if
(
pRspWrapper
==
NULL
)
{
if
(
pRspWrapper
==
NULL
)
{
tscWarn
(
"msg discard from vg %d, epoch %d since out of memory"
,
pParam
->
vgId
,
pParam
->
epoch
);
tscWarn
(
"msg discard from vg %d, epoch %d since out of memory"
,
pParam
->
vgId
,
pParam
->
epoch
);
goto
CREATE_MSG_FAIL
;
goto
CREATE_MSG_FAIL
;
}
}
pRspWrapper
->
tmqRspType
=
TMQ_MSG_TYPE__POLL_RSP
;
pRspWrapper
->
tmqRspType
=
TMQ_MSG_TYPE__POLL_RSP
;
pRspWrapper
->
vgHandle
=
pVg
;
pRspWrapper
->
vgHandle
=
pVg
;
pRspWrapper
->
topicHandle
=
pTopic
;
pRspWrapper
->
topicHandle
=
pTopic
;
/*memcpy(pRsp, pMsg->pData, sizeof(SMqRspHead));*/
memcpy
(
&
pRspWrapper
->
msg
,
pMsg
->
pData
,
sizeof
(
SMqRspHead
));
memcpy
(
&
pRspWrapper
->
msg
,
pMsg
->
pData
,
sizeof
(
SMqRspHead
));
tDecodeSMqPollRspV2
(
POINTER_SHIFT
(
pMsg
->
pData
,
sizeof
(
SMqRspHead
)),
&
pRspWrapper
->
msg
);
// TODO: alloc mem
/*pRsp->*/
/*printf("rsp commit off:%ld rsp off:%ld has data:%d\n", pRsp->committedOffset, pRsp->rspOffset, pRsp->numOfTopics);*/
#if 0
tDecodeSMqDataBlkRsp
(
POINTER_SHIFT
(
pMsg
->
pData
,
sizeof
(
SMqRspHead
)),
&
pRspWrapper
->
msg
);
if (pRsp->msg.numOfTopics == 0) {
/*printf("no data\n");*/
taosFreeQitem(pRsp);
goto CREATE_MSG_FAIL;
}
#endif
tscDebug
(
"consumer %ld recv poll: vg %d, req offset %ld, rsp offset %ld"
,
tmq
->
consumerId
,
pVg
->
vgId
,
tscDebug
(
"consumer %ld recv poll: vg %d, req offset %ld, rsp offset %ld"
,
tmq
->
consumerId
,
pVg
->
vgId
,
pRspWrapper
->
msg
.
reqOffset
,
pRspWrapper
->
msg
.
rspOffset
);
pRspWrapper
->
msg
.
reqOffset
,
pRspWrapper
->
msg
.
rspOffset
);
taosWriteQitem
(
tmq
->
mqueue
,
pRspWrapper
);
taosWriteQitem
(
tmq
->
mqueue
,
pRspWrapper
);
atomic_add_fetch_32
(
&
tmq
->
readyRequest
,
1
);
/*tsem_post(&tmq->rspSem);*/
/*tsem_post(&tmq->rspSem);*/
return
0
;
return
0
;
CREATE_MSG_FAIL:
CREATE_MSG_FAIL:
if
(
pParam
->
epoch
==
tmq
->
epoch
)
{
if
(
pParam
->
epoch
==
tmq
->
epoch
)
{
atomic_store_32
(
&
pVg
->
vgStatus
,
TMQ_VG_STATUS__IDLE
);
atomic_store_32
(
&
pVg
->
vgStatus
,
TMQ_VG_STATUS__IDLE
);
}
}
/*tsem_post(&tmq->rspSem);*/
/*tsem_post(&tmq->rspSem);*/
return
code
;
return
-
1
;
}
}
bool
tmqUpdateEp
(
tmq_t
*
tmq
,
int32_t
epoch
,
SMqCMGetSubEpRsp
*
pRsp
)
{
bool
tmqUpdateEp
(
tmq_t
*
tmq
,
int32_t
epoch
,
SMqCMGetSubEpRsp
*
pRsp
)
{
...
@@ -1023,6 +1014,7 @@ bool tmqUpdateEp(tmq_t* tmq, int32_t epoch, SMqCMGetSubEpRsp* pRsp) {
...
@@ -1023,6 +1014,7 @@ bool tmqUpdateEp(tmq_t* tmq, int32_t epoch, SMqCMGetSubEpRsp* pRsp) {
int32_t
tmqAskEpCb
(
void
*
param
,
const
SDataBuf
*
pMsg
,
int32_t
code
)
{
int32_t
tmqAskEpCb
(
void
*
param
,
const
SDataBuf
*
pMsg
,
int32_t
code
)
{
SMqAskEpCbParam
*
pParam
=
(
SMqAskEpCbParam
*
)
param
;
SMqAskEpCbParam
*
pParam
=
(
SMqAskEpCbParam
*
)
param
;
tmq_t
*
tmq
=
pParam
->
tmq
;
tmq_t
*
tmq
=
pParam
->
tmq
;
pParam
->
code
=
code
;
if
(
code
!=
0
)
{
if
(
code
!=
0
)
{
tscError
(
"consumer %ld get topic endpoint error, not ready, wait:%d"
,
tmq
->
consumerId
,
pParam
->
sync
);
tscError
(
"consumer %ld get topic endpoint error, not ready, wait:%d"
,
tmq
->
consumerId
,
pParam
->
sync
);
goto
END
;
goto
END
;
...
@@ -1062,6 +1054,7 @@ int32_t tmqAskEpCb(void* param, const SDataBuf* pMsg, int32_t code) {
...
@@ -1062,6 +1054,7 @@ int32_t tmqAskEpCb(void* param, const SDataBuf* pMsg, int32_t code) {
taosWriteQitem
(
tmq
->
mqueue
,
pWrapper
);
taosWriteQitem
(
tmq
->
mqueue
,
pWrapper
);
/*tsem_post(&tmq->rspSem);*/
/*tsem_post(&tmq->rspSem);*/
taosMemoryFree
(
pParam
);
}
}
END:
END:
...
@@ -1073,7 +1066,8 @@ END:
...
@@ -1073,7 +1066,8 @@ END:
}
}
int32_t
tmqAskEp
(
tmq_t
*
tmq
,
bool
sync
)
{
int32_t
tmqAskEp
(
tmq_t
*
tmq
,
bool
sync
)
{
int8_t
epStatus
=
atomic_val_compare_exchange_8
(
&
tmq
->
epStatus
,
0
,
1
);
int32_t
code
=
0
;
int8_t
epStatus
=
atomic_val_compare_exchange_8
(
&
tmq
->
epStatus
,
0
,
1
);
if
(
epStatus
==
1
)
{
if
(
epStatus
==
1
)
{
int32_t
epSkipCnt
=
atomic_add_fetch_32
(
&
tmq
->
epSkipCnt
,
1
);
int32_t
epSkipCnt
=
atomic_add_fetch_32
(
&
tmq
->
epSkipCnt
,
1
);
tscTrace
(
"consumer %ld skip ask ep cnt %d"
,
tmq
->
consumerId
,
epSkipCnt
);
tscTrace
(
"consumer %ld skip ask ep cnt %d"
,
tmq
->
consumerId
,
epSkipCnt
);
...
@@ -1130,8 +1124,12 @@ int32_t tmqAskEp(tmq_t* tmq, bool sync) {
...
@@ -1130,8 +1124,12 @@ int32_t tmqAskEp(tmq_t* tmq, bool sync) {
int64_t
transporterId
=
0
;
int64_t
transporterId
=
0
;
asyncSendMsgToServer
(
tmq
->
pTscObj
->
pAppInfo
->
pTransporter
,
&
epSet
,
&
transporterId
,
sendInfo
);
asyncSendMsgToServer
(
tmq
->
pTscObj
->
pAppInfo
->
pTransporter
,
&
epSet
,
&
transporterId
,
sendInfo
);
if
(
sync
)
tsem_wait
(
&
pParam
->
rspSem
);
if
(
sync
)
{
return
0
;
tsem_wait
(
&
pParam
->
rspSem
);
code
=
pParam
->
code
;
taosMemoryFree
(
pParam
);
}
return
code
;
}
}
tmq_resp_err_t
tmq_seek
(
tmq_t
*
tmq
,
const
tmq_topic_vgroup_t
*
offset
)
{
tmq_resp_err_t
tmq_seek
(
tmq_t
*
tmq
,
const
tmq_topic_vgroup_t
*
offset
)
{
...
@@ -1157,7 +1155,7 @@ tmq_resp_err_t tmq_seek(tmq_t* tmq, const tmq_topic_vgroup_t* offset) {
...
@@ -1157,7 +1155,7 @@ tmq_resp_err_t tmq_seek(tmq_t* tmq, const tmq_topic_vgroup_t* offset) {
return
TMQ_RESP_ERR__FAIL
;
return
TMQ_RESP_ERR__FAIL
;
}
}
SMqPollReq
*
tmqBuildConsumeReqImpl
(
tmq_t
*
tmq
,
int64_t
blockingTime
,
SMqClientTopic
*
pTopic
,
SMqClientVg
*
pVg
)
{
SMqPollReq
V2
*
tmqBuildConsumeReqImpl
(
tmq_t
*
tmq
,
int64_t
blockingTime
,
SMqClientTopic
*
pTopic
,
SMqClientVg
*
pVg
)
{
int64_t
reqOffset
;
int64_t
reqOffset
;
if
(
pVg
->
currentOffset
>=
0
)
{
if
(
pVg
->
currentOffset
>=
0
)
{
reqOffset
=
pVg
->
currentOffset
;
reqOffset
=
pVg
->
currentOffset
;
...
@@ -1169,13 +1167,18 @@ SMqPollReq* tmqBuildConsumeReqImpl(tmq_t* tmq, int64_t blockingTime, SMqClientTo
...
@@ -1169,13 +1167,18 @@ SMqPollReq* tmqBuildConsumeReqImpl(tmq_t* tmq, int64_t blockingTime, SMqClientTo
reqOffset
=
tmq
->
resetOffsetCfg
;
reqOffset
=
tmq
->
resetOffsetCfg
;
}
}
SMqPollReq
*
pReq
=
taosMemoryMalloc
(
sizeof
(
SMqPollReq
));
SMqPollReq
V2
*
pReq
=
taosMemoryMalloc
(
sizeof
(
SMqPollReqV2
));
if
(
pReq
==
NULL
)
{
if
(
pReq
==
NULL
)
{
return
NULL
;
return
NULL
;
}
}
strcpy
(
pReq
->
topic
,
pTopic
->
topicName
);
/*strcpy(pReq->topic, pTopic->topicName);*/
strcpy
(
pReq
->
cgroup
,
tmq
->
groupId
);
/*strcpy(pReq->cgroup, tmq->groupId);*/
int32_t
tlen
=
strlen
(
tmq
->
groupId
);
memcpy
(
pReq
->
subKey
,
tmq
->
groupId
,
tlen
);
pReq
->
subKey
[
tlen
]
=
TMQ_SEPARATOR
;
strcpy
(
pReq
->
subKey
+
tlen
+
1
,
pTopic
->
topicName
);
pReq
->
blockingTime
=
blockingTime
;
pReq
->
blockingTime
=
blockingTime
;
pReq
->
consumerId
=
tmq
->
consumerId
;
pReq
->
consumerId
=
tmq
->
consumerId
;
...
@@ -1184,101 +1187,26 @@ SMqPollReq* tmqBuildConsumeReqImpl(tmq_t* tmq, int64_t blockingTime, SMqClientTo
...
@@ -1184,101 +1187,26 @@ SMqPollReq* tmqBuildConsumeReqImpl(tmq_t* tmq, int64_t blockingTime, SMqClientTo
pReq
->
reqId
=
generateRequestId
();
pReq
->
reqId
=
generateRequestId
();
pReq
->
head
.
vgId
=
htonl
(
pVg
->
vgId
);
pReq
->
head
.
vgId
=
htonl
(
pVg
->
vgId
);
pReq
->
head
.
contLen
=
htonl
(
sizeof
(
SMqPollReq
));
pReq
->
head
.
contLen
=
htonl
(
sizeof
(
SMqPollReq
V2
));
return
pReq
;
return
pReq
;
}
}
SMqRspObj
*
tmqBuildRspFromWrapper
(
SMqPollRspWrapper
*
pWrapper
)
{
SMqRspObj
*
tmqBuildRspFromWrapper
(
SMqPollRspWrapper
*
pWrapper
)
{
SMqRspObj
*
pRspObj
=
taosMemoryCalloc
(
1
,
sizeof
(
SMqRspObj
));
SMqRspObj
*
pRspObj
=
taosMemoryCalloc
(
1
,
sizeof
(
SMqRspObj
));
pRspObj
->
resType
=
RES_TYPE__TMQ
;
pRspObj
->
resType
=
RES_TYPE__TMQ
;
pRspObj
->
topic
=
strdup
(
pWrapper
->
topicHandle
->
topicName
);
strncpy
(
pRspObj
->
topic
,
pWrapper
->
topicHandle
->
topicName
,
TSDB_TOPIC_FNAME_LEN
);
pRspObj
->
resIter
=
-
1
;
pRspObj
->
vgId
=
pWrapper
->
vgHandle
->
vgId
;
pRspObj
->
vgId
=
pWrapper
->
vgHandle
->
vgId
;
SMqPollRspV2
*
pRsp
=
&
pWrapper
->
msg
;
pRspObj
->
resIter
=
-
1
;
int32_t
blockNum
=
taosArrayGetSize
(
pRsp
->
blockPos
);
memcpy
(
&
pRspObj
->
rsp
,
&
pWrapper
->
msg
,
sizeof
(
SMqDataBlkRsp
));
pRspObj
->
res
=
taosArrayInit
(
blockNum
,
sizeof
(
SReqResultInfo
));
for
(
int32_t
i
=
0
;
i
<
blockNum
;
i
++
)
{
int32_t
pos
=
*
(
int32_t
*
)
taosArrayGet
(
pRsp
->
blockPos
,
i
);
SRetrieveTableRsp
*
pRetrieve
=
POINTER_SHIFT
(
pRsp
->
blockData
,
pos
);
SReqResultInfo
resInfo
=
{
0
};
resInfo
.
totalRows
=
0
;
resInfo
.
precision
=
TSDB_TIME_PRECISION_MILLI
;
setResSchemaInfo
(
&
resInfo
,
pWrapper
->
topicHandle
->
schema
.
pSchema
,
pWrapper
->
topicHandle
->
schema
.
nCols
);
setQueryResultFromRsp
(
&
resInfo
,
pRetrieve
,
true
);
taosArrayPush
(
pRspObj
->
res
,
&
resInfo
);
}
return
pRspObj
;
}
#if 0
tmq_message_t* tmqSyncPollImpl(tmq_t* tmq, int64_t blockingTime) {
tmq_message_t* msg = NULL;
for (int i = 0; i < taosArrayGetSize(tmq->clientTopics); i++) {
SMqClientTopic* pTopic = taosArrayGet(tmq->clientTopics, i);
for (int j = 0; j < taosArrayGetSize(pTopic->vgs); j++) {
SMqClientVg* pVg = taosArrayGet(pTopic->vgs, j);
int32_t vgStatus = atomic_val_compare_exchange_32(&pVg->vgStatus, TMQ_VG_STATUS__IDLE, TMQ_VG_STATUS__WAIT);
/*if (vgStatus != TMQ_VG_STATUS__IDLE) {*/
/*continue;*/
/*}*/
SMqPollReq* pReq = tmqBuildConsumeReqImpl(tmq, blockingTime, pTopic, pVg);
if (pReq == NULL) {
atomic_store_32(&pVg->vgStatus, TMQ_VG_STATUS__IDLE);
// TODO: out of mem
return NULL;
}
SMqPollCbParam* pParam = taosMemoryMalloc(sizeof(SMqPollCbParam));
if (pParam == NULL) {
atomic_store_32(&pVg->vgStatus, TMQ_VG_STATUS__IDLE);
// TODO: out of mem
return NULL;
}
pParam->tmq = tmq;
pParam->pVg = pVg;
pParam->epoch = tmq->epoch;
pParam->sync = 1;
pParam->msg = &msg;
tsem_init(&pParam->rspSem, 0, 0);
SMsgSendInfo* sendInfo = taosMemoryMalloc(sizeof(SMsgSendInfo));
if (sendInfo == NULL) {
return NULL;
}
sendInfo->msgInfo = (SDataBuf){
.pData = pReq,
.len = sizeof(SMqPollReq),
.handle = NULL,
};
sendInfo->requestId = generateRequestId();
sendInfo->requestObjRefId = 0;
sendInfo->param = pParam;
sendInfo->fp = tmqPollCb;
sendInfo->msgType = TDMT_VND_CONSUME;
int64_t transporterId = 0;
/*SRetrieveTableRsp* pRetrieve = taosArrayGetP(pWrapper->msg.blockData, 0);*/
/*printf("send poll\n");*/
pRspObj
->
resInfo
.
totalRows
=
0
;
atomic_add_fetch_32(&tmq->waitingRequest, 1);
pRspObj
->
resInfo
.
precision
=
TSDB_TIME_PRECISION_MILLI
;
asyncSendMsgToServer(tmq->pTscObj->pAppInfo->pTransporter, &pVg->epSet, &transporterId, sendInfo);
setResSchemaInfo
(
&
pRspObj
->
resInfo
,
pWrapper
->
topicHandle
->
schema
.
pSchema
,
pWrapper
->
topicHandle
->
schema
.
nCols
);
pVg->pollCnt++;
tmq->pollCnt++;
tsem_wait(&pParam->rspSem);
taosFreeQitem
(
pWrapper
);
tmq_message_t* nmsg = NULL;
return
pRspObj
;
while (1) {
taosReadQitem(tmq->mqueue, (void**)&nmsg);
if (nmsg == NULL) continue;
while (nmsg->head.mqMsgType != TMQ_MSG_TYPE__POLL_RSP) {
taosReadQitem(tmq->mqueue, (void**)&nmsg);
}
return nmsg;
}
}
}
return NULL;
}
}
#endif
int32_t
tmqPollImpl
(
tmq_t
*
tmq
,
int64_t
blockingTime
)
{
int32_t
tmqPollImpl
(
tmq_t
*
tmq
,
int64_t
blockingTime
)
{
/*printf("call poll\n");*/
/*printf("call poll\n");*/
...
@@ -1301,7 +1229,7 @@ int32_t tmqPollImpl(tmq_t* tmq, int64_t blockingTime) {
...
@@ -1301,7 +1229,7 @@ int32_t tmqPollImpl(tmq_t* tmq, int64_t blockingTime) {
#endif
#endif
}
}
atomic_store_32
(
&
pVg
->
vgSkipCnt
,
0
);
atomic_store_32
(
&
pVg
->
vgSkipCnt
,
0
);
SMqPollReq
*
pReq
=
tmqBuildConsumeReqImpl
(
tmq
,
blockingTime
,
pTopic
,
pVg
);
SMqPollReq
V2
*
pReq
=
tmqBuildConsumeReqImpl
(
tmq
,
blockingTime
,
pTopic
,
pVg
);
if
(
pReq
==
NULL
)
{
if
(
pReq
==
NULL
)
{
atomic_store_32
(
&
pVg
->
vgStatus
,
TMQ_VG_STATUS__IDLE
);
atomic_store_32
(
&
pVg
->
vgStatus
,
TMQ_VG_STATUS__IDLE
);
/*tsem_post(&tmq->rspSem);*/
/*tsem_post(&tmq->rspSem);*/
...
@@ -1332,7 +1260,7 @@ int32_t tmqPollImpl(tmq_t* tmq, int64_t blockingTime) {
...
@@ -1332,7 +1260,7 @@ int32_t tmqPollImpl(tmq_t* tmq, int64_t blockingTime) {
sendInfo
->
msgInfo
=
(
SDataBuf
){
sendInfo
->
msgInfo
=
(
SDataBuf
){
.
pData
=
pReq
,
.
pData
=
pReq
,
.
len
=
sizeof
(
SMqPollReq
),
.
len
=
sizeof
(
SMqPollReq
V2
),
.
handle
=
NULL
,
.
handle
=
NULL
,
};
};
sendInfo
->
requestId
=
pReq
->
reqId
;
sendInfo
->
requestId
=
pReq
->
reqId
;
...
@@ -1343,7 +1271,7 @@ int32_t tmqPollImpl(tmq_t* tmq, int64_t blockingTime) {
...
@@ -1343,7 +1271,7 @@ int32_t tmqPollImpl(tmq_t* tmq, int64_t blockingTime) {
int64_t
transporterId
=
0
;
int64_t
transporterId
=
0
;
/*printf("send poll\n");*/
/*printf("send poll\n");*/
atomic_add_fetch_32
(
&
tmq
->
waitingRequest
,
1
);
/*atomic_add_fetch_32(&tmq->waitingRequest, 1);*/
tscDebug
(
"consumer %ld send poll to %s : vg %d, epoch %d, req offset %ld, reqId %lu"
,
tmq
->
consumerId
,
tscDebug
(
"consumer %ld send poll to %s : vg %d, epoch %d, req offset %ld, reqId %lu"
,
tmq
->
consumerId
,
pTopic
->
topicName
,
pVg
->
vgId
,
tmq
->
epoch
,
pVg
->
currentOffset
,
pReq
->
reqId
);
pTopic
->
topicName
,
pVg
->
vgId
,
tmq
->
epoch
,
pVg
->
currentOffset
,
pReq
->
reqId
);
/*printf("send vg %d %ld\n", pVg->vgId, pVg->currentOffset);*/
/*printf("send vg %d %ld\n", pVg->vgId, pVg->currentOffset);*/
...
@@ -1385,7 +1313,7 @@ SMqRspObj* tmqHandleAllRsp(tmq_t* tmq, int64_t blockingTime, bool pollIfReset) {
...
@@ -1385,7 +1313,7 @@ SMqRspObj* tmqHandleAllRsp(tmq_t* tmq, int64_t blockingTime, bool pollIfReset) {
if
(
rspWrapper
->
tmqRspType
==
TMQ_MSG_TYPE__POLL_RSP
)
{
if
(
rspWrapper
->
tmqRspType
==
TMQ_MSG_TYPE__POLL_RSP
)
{
SMqPollRspWrapper
*
pollRspWrapper
=
(
SMqPollRspWrapper
*
)
rspWrapper
;
SMqPollRspWrapper
*
pollRspWrapper
=
(
SMqPollRspWrapper
*
)
rspWrapper
;
atomic_sub_fetch_32
(
&
tmq
->
readyRequest
,
1
);
/*atomic_sub_fetch_32(&tmq->readyRequest, 1);*/
/*printf("handle poll rsp %d\n", rspMsg->head.mqMsgType);*/
/*printf("handle poll rsp %d\n", rspMsg->head.mqMsgType);*/
if
(
pollRspWrapper
->
msg
.
head
.
epoch
==
atomic_load_32
(
&
tmq
->
epoch
))
{
if
(
pollRspWrapper
->
msg
.
head
.
epoch
==
atomic_load_32
(
&
tmq
->
epoch
))
{
/*printf("epoch match\n");*/
/*printf("epoch match\n");*/
...
@@ -1393,7 +1321,7 @@ SMqRspObj* tmqHandleAllRsp(tmq_t* tmq, int64_t blockingTime, bool pollIfReset) {
...
@@ -1393,7 +1321,7 @@ SMqRspObj* tmqHandleAllRsp(tmq_t* tmq, int64_t blockingTime, bool pollIfReset) {
/*printf("vg %d offset %ld up to %ld\n", pVg->vgId, pVg->currentOffset, rspMsg->msg.rspOffset);*/
/*printf("vg %d offset %ld up to %ld\n", pVg->vgId, pVg->currentOffset, rspMsg->msg.rspOffset);*/
pVg
->
currentOffset
=
pollRspWrapper
->
msg
.
rspOffset
;
pVg
->
currentOffset
=
pollRspWrapper
->
msg
.
rspOffset
;
atomic_store_32
(
&
pVg
->
vgStatus
,
TMQ_VG_STATUS__IDLE
);
atomic_store_32
(
&
pVg
->
vgStatus
,
TMQ_VG_STATUS__IDLE
);
if
(
pollRspWrapper
->
msg
.
dataLen
==
0
)
{
if
(
pollRspWrapper
->
msg
.
blockNum
==
0
)
{
taosFreeQitem
(
pollRspWrapper
);
taosFreeQitem
(
pollRspWrapper
);
rspWrapper
=
NULL
;
rspWrapper
=
NULL
;
continue
;
continue
;
...
@@ -1449,7 +1377,10 @@ TAOS_RES* tmq_consumer_poll(tmq_t* tmq, int64_t blocking_time) {
...
@@ -1449,7 +1377,10 @@ TAOS_RES* tmq_consumer_poll(tmq_t* tmq, int64_t blocking_time) {
// TODO: put into another thread or delayed queue
// TODO: put into another thread or delayed queue
int64_t
status
=
atomic_load_64
(
&
tmq
->
status
);
int64_t
status
=
atomic_load_64
(
&
tmq
->
status
);
tmqAskEp
(
tmq
,
status
==
TMQ_CONSUMER_STATUS__INIT
);
while
(
0
!=
tmqAskEp
(
tmq
,
status
==
TMQ_CONSUMER_STATUS__INIT
))
{
tscDebug
(
"not ready, retry
\n
"
);
taosSsleep
(
1
);
}
rspObj
=
tmqHandleAllRsp
(
tmq
,
blocking_time
,
false
);
rspObj
=
tmqHandleAllRsp
(
tmq
,
blocking_time
,
false
);
if
(
rspObj
)
{
if
(
rspObj
)
{
...
...
source/common/src/tdatablock.c
浏览文件 @
395d9e8b
...
@@ -113,14 +113,27 @@ int32_t colDataAppend(SColumnInfoData* pColumnInfoData, uint32_t currentRow, con
...
@@ -113,14 +113,27 @@ int32_t colDataAppend(SColumnInfoData* pColumnInfoData, uint32_t currentRow, con
int32_t
type
=
pColumnInfoData
->
info
.
type
;
int32_t
type
=
pColumnInfoData
->
info
.
type
;
if
(
IS_VAR_DATA_TYPE
(
type
))
{
if
(
IS_VAR_DATA_TYPE
(
type
))
{
int32_t
dataLen
=
varDataTLen
(
pData
);
if
(
type
==
TSDB_DATA_TYPE_JSON
)
{
if
(
*
pData
==
TSDB_DATA_TYPE_NULL
)
{
dataLen
=
0
;
}
else
if
(
*
pData
==
TSDB_DATA_TYPE_NCHAR
)
{
dataLen
=
varDataTLen
(
pData
+
CHAR_BYTES
);
}
else
if
(
*
pData
==
TSDB_DATA_TYPE_BIGINT
||
*
pData
==
TSDB_DATA_TYPE_DOUBLE
)
{
dataLen
=
LONG_BYTES
;
}
else
if
(
*
pData
==
TSDB_DATA_TYPE_BOOL
)
{
dataLen
=
CHAR_BYTES
;
}
dataLen
+=
CHAR_BYTES
;
}
SVarColAttr
*
pAttr
=
&
pColumnInfoData
->
varmeta
;
SVarColAttr
*
pAttr
=
&
pColumnInfoData
->
varmeta
;
if
(
pAttr
->
allocLen
<
pAttr
->
length
+
varDataTLen
(
pData
)
)
{
if
(
pAttr
->
allocLen
<
pAttr
->
length
+
dataLen
)
{
uint32_t
newSize
=
pAttr
->
allocLen
;
uint32_t
newSize
=
pAttr
->
allocLen
;
if
(
newSize
==
0
)
{
if
(
newSize
==
0
)
{
newSize
=
8
;
newSize
=
8
;
}
}
while
(
newSize
<
pAttr
->
length
+
varDataTLen
(
pData
)
)
{
while
(
newSize
<
pAttr
->
length
+
dataLen
)
{
newSize
=
newSize
*
1
.
5
;
newSize
=
newSize
*
1
.
5
;
}
}
...
@@ -136,8 +149,8 @@ int32_t colDataAppend(SColumnInfoData* pColumnInfoData, uint32_t currentRow, con
...
@@ -136,8 +149,8 @@ int32_t colDataAppend(SColumnInfoData* pColumnInfoData, uint32_t currentRow, con
uint32_t
len
=
pColumnInfoData
->
varmeta
.
length
;
uint32_t
len
=
pColumnInfoData
->
varmeta
.
length
;
pColumnInfoData
->
varmeta
.
offset
[
currentRow
]
=
len
;
pColumnInfoData
->
varmeta
.
offset
[
currentRow
]
=
len
;
memcpy
(
pColumnInfoData
->
pData
+
len
,
pData
,
varDataTLen
(
pData
)
);
memcpy
(
pColumnInfoData
->
pData
+
len
,
pData
,
dataLen
);
pColumnInfoData
->
varmeta
.
length
+=
varDataTLen
(
pData
)
;
pColumnInfoData
->
varmeta
.
length
+=
dataLen
;
}
else
{
}
else
{
memcpy
(
pColumnInfoData
->
pData
+
pColumnInfoData
->
info
.
bytes
*
currentRow
,
pData
,
pColumnInfoData
->
info
.
bytes
);
memcpy
(
pColumnInfoData
->
pData
+
pColumnInfoData
->
info
.
bytes
*
currentRow
,
pData
,
pColumnInfoData
->
info
.
bytes
);
}
}
...
...
source/common/src/tglobal.c
浏览文件 @
395d9e8b
...
@@ -289,6 +289,7 @@ static int32_t taosAddServerLogCfg(SConfig *pCfg) {
...
@@ -289,6 +289,7 @@ static int32_t taosAddServerLogCfg(SConfig *pCfg) {
if
(
cfgAddInt32
(
pCfg
,
"tsdbDebugFlag"
,
tsdbDebugFlag
,
0
,
255
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"tsdbDebugFlag"
,
tsdbDebugFlag
,
0
,
255
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"tqDebugFlag"
,
tqDebugFlag
,
0
,
255
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"tqDebugFlag"
,
tqDebugFlag
,
0
,
255
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"fsDebugFlag"
,
fsDebugFlag
,
0
,
255
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"fsDebugFlag"
,
fsDebugFlag
,
0
,
255
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"fnDebugFlag"
,
fnDebugFlag
,
0
,
255
,
0
)
!=
0
)
return
-
1
;
return
0
;
return
0
;
}
}
...
@@ -473,6 +474,7 @@ static void taosSetServerLogCfg(SConfig *pCfg) {
...
@@ -473,6 +474,7 @@ static void taosSetServerLogCfg(SConfig *pCfg) {
tsdbDebugFlag
=
cfgGetItem
(
pCfg
,
"tsdbDebugFlag"
)
->
i32
;
tsdbDebugFlag
=
cfgGetItem
(
pCfg
,
"tsdbDebugFlag"
)
->
i32
;
tqDebugFlag
=
cfgGetItem
(
pCfg
,
"tqDebugFlag"
)
->
i32
;
tqDebugFlag
=
cfgGetItem
(
pCfg
,
"tqDebugFlag"
)
->
i32
;
fsDebugFlag
=
cfgGetItem
(
pCfg
,
"fsDebugFlag"
)
->
i32
;
fsDebugFlag
=
cfgGetItem
(
pCfg
,
"fsDebugFlag"
)
->
i32
;
fnDebugFlag
=
cfgGetItem
(
pCfg
,
"fnDebugFlag"
)
->
i32
;
}
}
static
int32_t
taosSetClientCfg
(
SConfig
*
pCfg
)
{
static
int32_t
taosSetClientCfg
(
SConfig
*
pCfg
)
{
...
...
source/common/src/tmsg.c
浏览文件 @
395d9e8b
...
@@ -125,14 +125,14 @@ int32_t taosEncodeSEpSet(void **buf, const SEpSet *pEp) {
...
@@ -125,14 +125,14 @@ int32_t taosEncodeSEpSet(void **buf, const SEpSet *pEp) {
return
tlen
;
return
tlen
;
}
}
void
*
taosDecodeSEpSet
(
void
*
buf
,
SEpSet
*
pEp
)
{
void
*
taosDecodeSEpSet
(
const
void
*
buf
,
SEpSet
*
pEp
)
{
buf
=
taosDecodeFixedI8
(
buf
,
&
pEp
->
inUse
);
buf
=
taosDecodeFixedI8
(
buf
,
&
pEp
->
inUse
);
buf
=
taosDecodeFixedI8
(
buf
,
&
pEp
->
numOfEps
);
buf
=
taosDecodeFixedI8
(
buf
,
&
pEp
->
numOfEps
);
for
(
int32_t
i
=
0
;
i
<
TSDB_MAX_REPLICA
;
i
++
)
{
for
(
int32_t
i
=
0
;
i
<
TSDB_MAX_REPLICA
;
i
++
)
{
buf
=
taosDecodeFixedU16
(
buf
,
&
pEp
->
eps
[
i
].
port
);
buf
=
taosDecodeFixedU16
(
buf
,
&
pEp
->
eps
[
i
].
port
);
buf
=
taosDecodeStringTo
(
buf
,
pEp
->
eps
[
i
].
fqdn
);
buf
=
taosDecodeStringTo
(
buf
,
pEp
->
eps
[
i
].
fqdn
);
}
}
return
buf
;
return
(
void
*
)
buf
;
}
}
static
int32_t
tSerializeSClientHbReq
(
SCoder
*
pEncoder
,
const
SClientHbReq
*
pReq
)
{
static
int32_t
tSerializeSClientHbReq
(
SCoder
*
pEncoder
,
const
SClientHbReq
*
pReq
)
{
...
@@ -3599,8 +3599,6 @@ int32_t tSerializeSCMCreateStreamReq(void *buf, int32_t bufLen, const SCMCreateS
...
@@ -3599,8 +3599,6 @@ int32_t tSerializeSCMCreateStreamReq(void *buf, int32_t bufLen, const SCMCreateS
if
(
tEncodeI8
(
&
encoder
,
pReq
->
igExists
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
igExists
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
sqlLen
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
sqlLen
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
astLen
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
astLen
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
triggerType
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
pReq
->
watermark
)
<
0
)
return
-
1
;
if
(
sqlLen
>
0
&&
tEncodeCStr
(
&
encoder
,
pReq
->
sql
)
<
0
)
return
-
1
;
if
(
sqlLen
>
0
&&
tEncodeCStr
(
&
encoder
,
pReq
->
sql
)
<
0
)
return
-
1
;
if
(
astLen
>
0
&&
tEncodeCStr
(
&
encoder
,
pReq
->
ast
)
<
0
)
return
-
1
;
if
(
astLen
>
0
&&
tEncodeCStr
(
&
encoder
,
pReq
->
ast
)
<
0
)
return
-
1
;
...
...
source/common/src/trow.c
浏览文件 @
395d9e8b
...
@@ -519,8 +519,9 @@ static int32_t tdAppendKvRowToDataCol(STSRow *pRow, STSchema *pSchema, SDataCols
...
@@ -519,8 +519,9 @@ static int32_t tdAppendKvRowToDataCol(STSRow *pRow, STSchema *pSchema, SDataCols
SKvRowIdx
*
pIdx
=
tdKvRowColIdxAt
(
pRow
,
rcol
);
SKvRowIdx
*
pIdx
=
tdKvRowColIdxAt
(
pRow
,
rcol
);
int16_t
colIdx
=
-
1
;
int16_t
colIdx
=
-
1
;
if
(
pIdx
)
{
if
(
pIdx
)
{
colIdx
=
POINTER_DISTANCE
(
p
Row
->
data
,
pIdx
)
/
sizeof
(
SKvRowIdx
);
colIdx
=
POINTER_DISTANCE
(
p
Idx
,
TD_ROW_COL_IDX
(
pRow
)
)
/
sizeof
(
SKvRowIdx
);
}
}
TASSERT
(
colIdx
>=
0
);
SCellVal
sVal
=
{
0
};
SCellVal
sVal
=
{
0
};
if
(
pIdx
->
colId
==
pDataCol
->
colId
)
{
if
(
pIdx
->
colId
==
pDataCol
->
colId
)
{
if
(
tdGetKvRowValOfCol
(
&
sVal
,
pRow
,
pBitmap
,
pIdx
->
offset
,
colIdx
)
<
0
)
{
if
(
tdGetKvRowValOfCol
(
&
sVal
,
pRow
,
pBitmap
,
pIdx
->
offset
,
colIdx
)
<
0
)
{
...
...
source/common/src/ttypes.c
浏览文件 @
395d9e8b
...
@@ -379,7 +379,7 @@ static void getStatics_nchr(int8_t bitmapMode, const void *pBitmap, const void *
...
@@ -379,7 +379,7 @@ static void getStatics_nchr(int8_t bitmapMode, const void *pBitmap, const void *
*
maxIndex
=
0
;
*
maxIndex
=
0
;
}
}
tDataTypeDescriptor
tDataTypes
[
15
]
=
{
tDataTypeDescriptor
tDataTypes
[
TSDB_DATA_TYPE_MAX
]
=
{
{
TSDB_DATA_TYPE_NULL
,
6
,
1
,
"NOTYPE"
,
0
,
0
,
NULL
,
NULL
,
NULL
},
{
TSDB_DATA_TYPE_NULL
,
6
,
1
,
"NOTYPE"
,
0
,
0
,
NULL
,
NULL
,
NULL
},
{
TSDB_DATA_TYPE_BOOL
,
4
,
CHAR_BYTES
,
"BOOL"
,
false
,
true
,
tsCompressBool
,
tsDecompressBool
,
getStatics_bool
},
{
TSDB_DATA_TYPE_BOOL
,
4
,
CHAR_BYTES
,
"BOOL"
,
false
,
true
,
tsCompressBool
,
tsDecompressBool
,
getStatics_bool
},
{
TSDB_DATA_TYPE_TINYINT
,
7
,
CHAR_BYTES
,
"TINYINT"
,
INT8_MIN
,
INT8_MAX
,
tsCompressTinyint
,
tsDecompressTinyint
,
{
TSDB_DATA_TYPE_TINYINT
,
7
,
CHAR_BYTES
,
"TINYINT"
,
INT8_MIN
,
INT8_MAX
,
tsCompressTinyint
,
tsDecompressTinyint
,
...
@@ -402,6 +402,7 @@ tDataTypeDescriptor tDataTypes[15] = {
...
@@ -402,6 +402,7 @@ tDataTypeDescriptor tDataTypes[15] = {
{
TSDB_DATA_TYPE_UINT
,
12
,
INT_BYTES
,
"INT UNSIGNED"
,
0
,
UINT32_MAX
,
tsCompressInt
,
tsDecompressInt
,
getStatics_u32
},
{
TSDB_DATA_TYPE_UINT
,
12
,
INT_BYTES
,
"INT UNSIGNED"
,
0
,
UINT32_MAX
,
tsCompressInt
,
tsDecompressInt
,
getStatics_u32
},
{
TSDB_DATA_TYPE_UBIGINT
,
15
,
LONG_BYTES
,
"BIGINT UNSIGNED"
,
0
,
UINT64_MAX
,
tsCompressBigint
,
tsDecompressBigint
,
{
TSDB_DATA_TYPE_UBIGINT
,
15
,
LONG_BYTES
,
"BIGINT UNSIGNED"
,
0
,
UINT64_MAX
,
tsCompressBigint
,
tsDecompressBigint
,
getStatics_u64
},
getStatics_u64
},
{
TSDB_DATA_TYPE_JSON
,
4
,
TSDB_MAX_JSON_TAG_LEN
,
"JSON"
,
0
,
0
,
tsCompressString
,
tsDecompressString
,
getStatics_nchr
},
};
};
char
tTokenTypeSwitcher
[
13
]
=
{
char
tTokenTypeSwitcher
[
13
]
=
{
...
...
source/common/src/tvariant.c
浏览文件 @
395d9e8b
...
@@ -118,7 +118,7 @@ void taosVariantCreate(SVariant *pVar, const char *z, int32_t n, int32_t type) {
...
@@ -118,7 +118,7 @@ void taosVariantCreate(SVariant *pVar, const char *z, int32_t n, int32_t type) {
}
}
case
TSDB_DATA_TYPE_BINARY
:
{
case
TSDB_DATA_TYPE_BINARY
:
{
pVar
->
pz
=
strndup
(
z
,
n
);
pVar
->
pz
=
strndup
(
z
,
n
);
pVar
->
nLen
=
strRmquote
(
pVar
->
pz
,
n
);
//
pVar->nLen = strRmquote(pVar->pz, n);
break
;
break
;
}
}
case
TSDB_DATA_TYPE_TIMESTAMP
:
{
case
TSDB_DATA_TYPE_TIMESTAMP
:
{
...
...
source/dnode/mgmt/mgmt_mnode/src/mmHandle.c
浏览文件 @
395d9e8b
...
@@ -211,6 +211,7 @@ void mmInitMsgHandle(SMgmtWrapper *pWrapper) {
...
@@ -211,6 +211,7 @@ void mmInitMsgHandle(SMgmtWrapper *pWrapper) {
dmSetMsgHandle
(
pWrapper
,
TDMT_MND_SUBSCRIBE
,
mmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_MND_SUBSCRIBE
,
mmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_MND_MQ_COMMIT_OFFSET
,
mmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_MND_MQ_COMMIT_OFFSET
,
mmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_MND_GET_SUB_EP
,
mmProcessReadMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_MND_GET_SUB_EP
,
mmProcessReadMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_MQ_VG_CHANGE_RSP
,
mmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_MND_CREATE_STREAM
,
mmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_MND_CREATE_STREAM
,
mmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_TASK_DEPLOY_RSP
,
mmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_TASK_DEPLOY_RSP
,
mmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_MND_GET_DB_CFG
,
mmProcessReadMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_MND_GET_DB_CFG
,
mmProcessReadMsg
,
DEFAULT_HANDLE
);
...
...
source/dnode/mgmt/mgmt_vnode/src/vmHandle.c
浏览文件 @
395d9e8b
...
@@ -252,7 +252,7 @@ void vmInitMsgHandle(SMgmtWrapper *pWrapper) {
...
@@ -252,7 +252,7 @@ void vmInitMsgHandle(SMgmtWrapper *pWrapper) {
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_MQ_QUERY
,
vmProcessQueryMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_MQ_QUERY
,
vmProcessQueryMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_MQ_CONNECT
,
vmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_MQ_CONNECT
,
vmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_MQ_DISCONNECT
,
vmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_MQ_DISCONNECT
,
vmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_MQ_SET_CUR
,
vmProcessWriteMsg
,
DEFAULT_HANDLE
);
//
dmSetMsgHandle(pWrapper, TDMT_VND_MQ_SET_CUR, vmProcessWriteMsg, DEFAULT_HANDLE);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_RES_READY
,
vmProcessFetchMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_RES_READY
,
vmProcessFetchMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_TASKS_STATUS
,
vmProcessFetchMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_TASKS_STATUS
,
vmProcessFetchMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_CANCEL_TASK
,
vmProcessFetchMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_CANCEL_TASK
,
vmProcessFetchMsg
,
DEFAULT_HANDLE
);
...
@@ -265,10 +265,11 @@ void vmInitMsgHandle(SMgmtWrapper *pWrapper) {
...
@@ -265,10 +265,11 @@ void vmInitMsgHandle(SMgmtWrapper *pWrapper) {
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_CREATE_SMA
,
vmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_CREATE_SMA
,
vmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_CANCEL_SMA
,
vmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_CANCEL_SMA
,
vmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_DROP_SMA
,
vmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_DROP_SMA
,
vmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_MQ_SET_CONN
,
vmProcessWriteMsg
,
DEFAULT_HANDLE
);
//dmSetMsgHandle(pWrapper, TDMT_VND_MQ_SET_CONN, vmProcessWriteMsg, DEFAULT_HANDLE);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_MQ_REB
,
vmProcessWriteMsg
,
DEFAULT_HANDLE
);
//dmSetMsgHandle(pWrapper, TDMT_VND_MQ_REB, vmProcessWriteMsg, DEFAULT_HANDLE);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_MQ_CANCEL_CONN
,
vmProcessWriteMsg
,
DEFAULT_HANDLE
);
//dmSetMsgHandle(pWrapper, TDMT_VND_MQ_CANCEL_CONN, vmProcessWriteMsg, DEFAULT_HANDLE);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_MQ_SET_CUR
,
vmProcessFetchMsg
,
DEFAULT_HANDLE
);
//dmSetMsgHandle(pWrapper, TDMT_VND_MQ_SET_CUR, vmProcessFetchMsg, DEFAULT_HANDLE);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_MQ_VG_CHANGE
,
(
NodeMsgFp
)
vmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_CONSUME
,
vmProcessFetchMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_CONSUME
,
vmProcessFetchMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_TASK_DEPLOY
,
vmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_TASK_DEPLOY
,
vmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_QUERY_HEARTBEAT
,
vmProcessFetchMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_QUERY_HEARTBEAT
,
vmProcessFetchMsg
,
DEFAULT_HANDLE
);
...
...
source/dnode/mnode/impl/inc/mndConsumer.h
浏览文件 @
395d9e8b
...
@@ -22,27 +22,30 @@
...
@@ -22,27 +22,30 @@
extern
"C"
{
extern
"C"
{
#endif
#endif
enum
{
enum
{
MQ_CONSUMER_STATUS__INIT
=
1
,
// MQ_CONSUMER_STATUS__INIT = 1,
MQ_CONSUMER_STATUS__IDLE
,
MQ_CONSUMER_STATUS__MODIFY
=
1
,
MQ_CONSUMER_STATUS__ACTIVE
,
MQ_CONSUMER_STATUS__MODIFY_IN_REB
,
// MQ_CONSUMER_STATUS__IDLE,
MQ_CONSUMER_STATUS__READY
,
MQ_CONSUMER_STATUS__LOST
,
MQ_CONSUMER_STATUS__LOST
,
MQ_CONSUMER_STATUS__MODIFY
MQ_CONSUMER_STATUS__LOST_IN_REB
,
MQ_CONSUMER_STATUS__LOST_REBD
,
};
};
int32_t
mndInitConsumer
(
SMnode
*
pMnode
);
int32_t
mndInitConsumer
(
SMnode
*
pMnode
);
void
mndCleanupConsumer
(
SMnode
*
pMnode
);
void
mndCleanupConsumer
(
SMnode
*
pMnode
);
SMqConsumerObj
*
mndAcquireConsumer
(
SMnode
*
pMnode
,
int64_t
consumerId
);
SMqConsumerObj
*
mndAcquireConsumer
(
SMnode
*
pMnode
,
int64_t
consumerId
);
void
mndReleaseConsumer
(
SMnode
*
pMnode
,
SMqConsumerObj
*
pConsumer
);
void
mndReleaseConsumer
(
SMnode
*
pMnode
,
SMqConsumerObj
*
pConsumer
);
SMqConsumerObj
*
mndCreateConsumer
(
int64_t
consumerId
,
const
char
*
cgroup
);
SMqConsumerObj
*
mndCreateConsumer
(
int64_t
consumerId
,
const
char
*
cgroup
);
SSdbRaw
*
mndConsumerActionEncode
(
SMqConsumerObj
*
pConsumer
);
SSdbRaw
*
mndConsumerActionEncode
(
SMqConsumerObj
*
pConsumer
);
SSdbRow
*
mndConsumerActionDecode
(
SSdbRaw
*
pRaw
);
SSdbRow
*
mndConsumerActionDecode
(
SSdbRaw
*
pRaw
);
int32_t
mndSetConsumerCommitLogs
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SMqConsumerObj
*
pConsumer
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
#endif
#endif
...
...
source/dnode/mnode/impl/inc/mndDef.h
浏览文件 @
395d9e8b
...
@@ -88,6 +88,7 @@ typedef enum {
...
@@ -88,6 +88,7 @@ typedef enum {
TRN_TYPE_CREATE_STREAM
=
1019
,
TRN_TYPE_CREATE_STREAM
=
1019
,
TRN_TYPE_DROP_STREAM
=
1020
,
TRN_TYPE_DROP_STREAM
=
1020
,
TRN_TYPE_ALTER_STREAM
=
1021
,
TRN_TYPE_ALTER_STREAM
=
1021
,
TRN_TYPE_CONSUMER_LOST
=
1022
,
TRN_TYPE_BASIC_SCOPE_END
,
TRN_TYPE_BASIC_SCOPE_END
,
TRN_TYPE_GLOBAL_SCOPE
=
2000
,
TRN_TYPE_GLOBAL_SCOPE
=
2000
,
TRN_TYPE_CREATE_DNODE
=
2001
,
TRN_TYPE_CREATE_DNODE
=
2001
,
...
@@ -511,6 +512,7 @@ static FORCE_INLINE void* tDecodeSMqOffsetObj(void* buf, SMqOffsetObj* pOffset)
...
@@ -511,6 +512,7 @@ static FORCE_INLINE void* tDecodeSMqOffsetObj(void* buf, SMqOffsetObj* pOffset)
return
buf
;
return
buf
;
}
}
#if 0
typedef struct {
typedef struct {
char key[TSDB_SUBSCRIBE_KEY_LEN];
char key[TSDB_SUBSCRIBE_KEY_LEN];
int32_t status;
int32_t status;
...
@@ -641,6 +643,7 @@ static FORCE_INLINE void tDeleteSMqSubscribeObj(SMqSubscribeObj* pSub) {
...
@@ -641,6 +643,7 @@ static FORCE_INLINE void tDeleteSMqSubscribeObj(SMqSubscribeObj* pSub) {
pSub->unassignedVg = NULL;
pSub->unassignedVg = NULL;
}
}
}
}
#endif
typedef
struct
{
typedef
struct
{
char
name
[
TSDB_TOPIC_FNAME_LEN
];
char
name
[
TSDB_TOPIC_FNAME_LEN
];
...
@@ -659,6 +662,7 @@ typedef struct {
...
@@ -659,6 +662,7 @@ typedef struct {
SSchemaWrapper
schema
;
SSchemaWrapper
schema
;
}
SMqTopicObj
;
}
SMqTopicObj
;
#if 0
typedef struct {
typedef struct {
int64_t consumerId;
int64_t consumerId;
int64_t connId;
int64_t connId;
...
@@ -713,7 +717,7 @@ static FORCE_INLINE void* tDecodeSMqConsumerObj(void* buf, SMqConsumerObj* pCons
...
@@ -713,7 +717,7 @@ static FORCE_INLINE void* tDecodeSMqConsumerObj(void* buf, SMqConsumerObj* pCons
buf = taosDecodeStringTo(buf, pConsumer->cgroup);
buf = taosDecodeStringTo(buf, pConsumer->cgroup);
buf = taosDecodeFixedI32(buf, &sz);
buf = taosDecodeFixedI32(buf, &sz);
pConsumer
->
currentTopics
=
taosArrayInit
(
sz
,
sizeof
(
SMqConsumerObj
));
pConsumer->currentTopics = taosArrayInit(sz, sizeof(
void*
));
for (int32_t i = 0; i < sz; i++) {
for (int32_t i = 0; i < sz; i++) {
char* topic;
char* topic;
buf = taosDecodeString(buf, &topic);
buf = taosDecodeString(buf, &topic);
...
@@ -721,7 +725,7 @@ static FORCE_INLINE void* tDecodeSMqConsumerObj(void* buf, SMqConsumerObj* pCons
...
@@ -721,7 +725,7 @@ static FORCE_INLINE void* tDecodeSMqConsumerObj(void* buf, SMqConsumerObj* pCons
}
}
buf = taosDecodeFixedI32(buf, &sz);
buf = taosDecodeFixedI32(buf, &sz);
pConsumer
->
recentRemovedTopics
=
taosArrayInit
(
sz
,
sizeof
(
SMqConsumerObj
));
pConsumer->recentRemovedTopics = taosArrayInit(sz, sizeof(
void*
));
for (int32_t i = 0; i < sz; i++) {
for (int32_t i = 0; i < sz; i++) {
char* topic;
char* topic;
buf = taosDecodeString(buf, &topic);
buf = taosDecodeString(buf, &topic);
...
@@ -729,6 +733,132 @@ static FORCE_INLINE void* tDecodeSMqConsumerObj(void* buf, SMqConsumerObj* pCons
...
@@ -729,6 +733,132 @@ static FORCE_INLINE void* tDecodeSMqConsumerObj(void* buf, SMqConsumerObj* pCons
}
}
return buf;
return buf;
}
}
#endif
enum
{
CONSUMER_UPDATE__TOUCH
=
1
,
CONSUMER_UPDATE__ADD
,
CONSUMER_UPDATE__REMOVE
,
CONSUMER_UPDATE__LOST
,
CONSUMER_UPDATE__MODIFY
,
};
typedef
struct
{
int64_t
consumerId
;
char
cgroup
[
TSDB_CGROUP_LEN
];
int8_t
updateType
;
// used only for update
int32_t
epoch
;
int32_t
status
;
// hbStatus is not applicable to serialization
int32_t
hbStatus
;
// lock is used for topics update
SRWLatch
lock
;
SArray
*
currentTopics
;
// SArray<char*>
#if 0
SArray* waitingRebTopics; // SArray<char*>
#endif
SArray
*
rebNewTopics
;
// SArray<char*>
SArray
*
rebRemovedTopics
;
// SArray<char*>
}
SMqConsumerObj
;
SMqConsumerObj
*
tNewSMqConsumerObj
(
int64_t
consumerId
,
char
cgroup
[
TSDB_CGROUP_LEN
]);
void
tDeleteSMqConsumerObj
(
SMqConsumerObj
*
pConsumer
);
int32_t
tEncodeSMqConsumerObj
(
void
**
buf
,
const
SMqConsumerObj
*
pConsumer
);
void
*
tDecodeSMqConsumerObj
(
const
void
*
buf
,
SMqConsumerObj
*
pConsumer
);
typedef
struct
{
int32_t
vgId
;
char
*
qmsg
;
// char topic[TSDB_TOPIC_FNAME_LEN];
SEpSet
epSet
;
}
SMqVgEp
;
SMqVgEp
*
tCloneSMqVgEp
(
const
SMqVgEp
*
pVgEp
);
void
tDeleteSMqVgEp
(
SMqVgEp
*
pVgEp
);
int32_t
tEncodeSMqVgEp
(
void
**
buf
,
const
SMqVgEp
*
pVgEp
);
void
*
tDecodeSMqVgEp
(
const
void
*
buf
,
SMqVgEp
*
pVgEp
);
typedef
struct
{
int64_t
consumerId
;
// -1 for unassigned
SArray
*
vgs
;
// SArray<SMqVgEp*>
}
SMqConsumerEpInSub
;
SMqConsumerEpInSub
*
tCloneSMqConsumerEpInSub
(
const
SMqConsumerEpInSub
*
pEpInSub
);
void
tDeleteSMqConsumerEpInSub
(
SMqConsumerEpInSub
*
pEpInSub
);
int32_t
tEncodeSMqConsumerEpInSub
(
void
**
buf
,
const
SMqConsumerEpInSub
*
pEpInSub
);
void
*
tDecodeSMqConsumerEpInSub
(
const
void
*
buf
,
SMqConsumerEpInSub
*
pEpInSub
);
typedef
struct
{
char
key
[
TSDB_SUBSCRIBE_KEY_LEN
];
SRWLatch
lock
;
int32_t
vgNum
;
SHashObj
*
consumerHash
;
// consumerId -> SMqConsumerEpInSub
}
SMqSubscribeObj
;
SMqSubscribeObj
*
tNewSubscribeObj
(
const
char
key
[
TSDB_SUBSCRIBE_KEY_LEN
]);
SMqSubscribeObj
*
tCloneSubscribeObj
(
const
SMqSubscribeObj
*
pSub
);
void
tDeleteSubscribeObj
(
SMqSubscribeObj
*
pSub
);
int32_t
tEncodeSubscribeObj
(
void
**
buf
,
const
SMqSubscribeObj
*
pSub
);
void
*
tDecodeSubscribeObj
(
const
void
*
buf
,
SMqSubscribeObj
*
pSub
);
typedef
struct
{
int32_t
epoch
;
SArray
*
consumers
;
// SArray<SMqConsumerEpInSub*>
}
SMqSubActionLogEntry
;
SMqSubActionLogEntry
*
tCloneSMqSubActionLogEntry
(
SMqSubActionLogEntry
*
pEntry
);
void
tDeleteSMqSubActionLogEntry
(
SMqSubActionLogEntry
*
pEntry
);
int32_t
tEncodeSMqSubActionLogEntry
(
void
**
buf
,
const
SMqSubActionLogEntry
*
pEntry
);
void
*
tDecodeSMqSubActionLogEntry
(
const
void
*
buf
,
SMqSubActionLogEntry
*
pEntry
);
typedef
struct
{
char
key
[
TSDB_SUBSCRIBE_KEY_LEN
];
SArray
*
logs
;
// SArray<SMqSubActionLogEntry*>
}
SMqSubActionLogObj
;
SMqSubActionLogObj
*
tCloneSMqSubActionLogObj
(
SMqSubActionLogObj
*
pLog
);
void
tDeleteSMqSubActionLogObj
(
SMqSubActionLogObj
*
pLog
);
int32_t
tEncodeSMqSubActionLogObj
(
void
**
buf
,
const
SMqSubActionLogObj
*
pLog
);
void
*
tDecodeSMqSubActionLogObj
(
const
void
*
buf
,
SMqSubActionLogObj
*
pLog
);
typedef
struct
{
int64_t
consumerId
;
char
cgroup
[
TSDB_CGROUP_LEN
];
SRWLatch
lock
;
SArray
*
vgs
;
// SArray<SMqVgEp*>
}
SMqConsumerEpObj
;
SMqConsumerEpObj
*
tCloneSMqConsumerEpObj
(
const
SMqConsumerEpObj
*
pConsumerEp
);
void
tDeleteSMqConsumerEpObj
(
SMqConsumerEpObj
*
pConsumerEp
);
int32_t
tEncodeSMqConsumerEpObj
(
void
**
buf
,
const
SMqConsumerEpObj
*
pConsumerEp
);
void
*
tDecodeSMqConsumerEpObj
(
const
void
*
buf
,
SMqConsumerEpObj
*
pConsumerEp
);
typedef
struct
{
const
SMqSubscribeObj
*
pOldSub
;
const
SMqTopicObj
*
pTopic
;
const
SMqRebSubscribe
*
pRebInfo
;
}
SMqRebInputObj
;
typedef
struct
{
int64_t
oldConsumerId
;
int64_t
newConsumerId
;
SMqVgEp
*
pVgEp
;
}
SMqRebOutputVg
;
#if 0
typedef struct {
int64_t consumerId;
} SMqRebOutputConsumer;
#endif
typedef
struct
{
SArray
*
rebVgs
;
// SArray<SMqRebOutputVg>
SArray
*
newConsumers
;
// SArray<int64_t>
SArray
*
removedConsumers
;
// SArray<int64_t>
SArray
*
touchedConsumers
;
// SArray<int64_t>
SMqSubscribeObj
*
pSub
;
SMqSubActionLogEntry
*
pLogEntry
;
}
SMqRebOutputObj
;
typedef
struct
{
typedef
struct
{
char
name
[
TSDB_TOPIC_FNAME_LEN
];
char
name
[
TSDB_TOPIC_FNAME_LEN
];
...
...
source/dnode/mnode/impl/inc/mndOffset.h
浏览文件 @
395d9e8b
...
@@ -31,7 +31,7 @@ void mndReleaseOffset(SMnode *pMnode, SMqOffsetObj *pOffset);
...
@@ -31,7 +31,7 @@ void mndReleaseOffset(SMnode *pMnode, SMqOffsetObj *pOffset);
SSdbRaw
*
mndOffsetActionEncode
(
SMqOffsetObj
*
pOffset
);
SSdbRaw
*
mndOffsetActionEncode
(
SMqOffsetObj
*
pOffset
);
SSdbRow
*
mndOffsetActionDecode
(
SSdbRaw
*
pRaw
);
SSdbRow
*
mndOffsetActionDecode
(
SSdbRaw
*
pRaw
);
int32_t
mndCreateOffset
(
STrans
*
pTrans
,
const
char
*
cgroup
,
const
char
*
topicName
,
const
SArray
*
vgs
);
int32_t
mndCreateOffset
s
(
STrans
*
pTrans
,
const
char
*
cgroup
,
const
char
*
topicName
,
const
SArray
*
vgs
);
static
FORCE_INLINE
int32_t
mndMakePartitionKey
(
char
*
key
,
const
char
*
cgroup
,
const
char
*
topicName
,
int32_t
vgId
)
{
static
FORCE_INLINE
int32_t
mndMakePartitionKey
(
char
*
key
,
const
char
*
cgroup
,
const
char
*
topicName
,
int32_t
vgId
)
{
return
snprintf
(
key
,
TSDB_PARTITION_KEY_LEN
,
"%d:%s:%s"
,
vgId
,
cgroup
,
topicName
);
return
snprintf
(
key
,
TSDB_PARTITION_KEY_LEN
,
"%d:%s:%s"
,
vgId
,
cgroup
,
topicName
);
...
...
source/dnode/mnode/impl/inc/mndSubscribe.h
浏览文件 @
395d9e8b
...
@@ -26,9 +26,11 @@ int32_t mndInitSubscribe(SMnode *pMnode);
...
@@ -26,9 +26,11 @@ int32_t mndInitSubscribe(SMnode *pMnode);
void
mndCleanupSubscribe
(
SMnode
*
pMnode
);
void
mndCleanupSubscribe
(
SMnode
*
pMnode
);
SMqSubscribeObj
*
mndAcquireSubscribe
(
SMnode
*
pMnode
,
const
char
*
CGroup
,
const
char
*
topicName
);
SMqSubscribeObj
*
mndAcquireSubscribe
(
SMnode
*
pMnode
,
const
char
*
CGroup
,
const
char
*
topicName
);
SMqSubscribeObj
*
mndAcquireSubscribeByKey
(
SMnode
*
pMnode
,
const
char
*
key
);
SMqSubscribeObj
*
mndAcquireSubscribeByKey
(
SMnode
*
pMnode
,
const
char
*
key
);
void
mndReleaseSubscribe
(
SMnode
*
pMnode
,
SMqSubscribeObj
*
pSub
);
void
mndReleaseSubscribe
(
SMnode
*
pMnode
,
SMqSubscribeObj
*
pSub
);
int32_t
mndMakeSubscribeKey
(
char
*
key
,
const
char
*
cgroup
,
const
char
*
topicName
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
#endif
#endif
...
...
source/dnode/mnode/impl/src/mndConsumer.c
浏览文件 @
395d9e8b
此差异已折叠。
点击以展开。
source/dnode/mnode/impl/src/mndDef.c
浏览文件 @
395d9e8b
...
@@ -14,6 +14,403 @@
...
@@ -14,6 +14,403 @@
*/
*/
#include "mndDef.h"
#include "mndDef.h"
#include "mndConsumer.h"
SMqConsumerObj
*
tNewSMqConsumerObj
(
int64_t
consumerId
,
char
cgroup
[
TSDB_CGROUP_LEN
])
{
SMqConsumerObj
*
pConsumer
=
taosMemoryCalloc
(
1
,
sizeof
(
SMqConsumerObj
));
if
(
pConsumer
==
NULL
)
{
return
NULL
;
}
pConsumer
->
consumerId
=
consumerId
;
memcpy
(
pConsumer
->
cgroup
,
cgroup
,
TSDB_CGROUP_LEN
);
pConsumer
->
epoch
=
0
;
pConsumer
->
status
=
MQ_CONSUMER_STATUS__MODIFY
;
pConsumer
->
hbStatus
=
0
;
taosInitRWLatch
(
&
pConsumer
->
lock
);
pConsumer
->
currentTopics
=
taosArrayInit
(
0
,
sizeof
(
void
*
));
#if 0
pConsumer->waitingRebTopics = NULL;
#endif
pConsumer
->
rebNewTopics
=
taosArrayInit
(
0
,
sizeof
(
void
*
));
pConsumer
->
rebRemovedTopics
=
taosArrayInit
(
0
,
sizeof
(
void
*
));
if
(
pConsumer
->
currentTopics
==
NULL
||
pConsumer
->
rebNewTopics
==
NULL
||
pConsumer
->
rebRemovedTopics
==
NULL
)
{
taosArrayDestroy
(
pConsumer
->
currentTopics
);
taosArrayDestroy
(
pConsumer
->
rebNewTopics
);
taosArrayDestroy
(
pConsumer
->
rebRemovedTopics
);
taosMemoryFree
(
pConsumer
);
return
NULL
;
}
return
pConsumer
;
}
void
tDeleteSMqConsumerObj
(
SMqConsumerObj
*
pConsumer
)
{
if
(
pConsumer
->
currentTopics
)
{
taosArrayDestroyP
(
pConsumer
->
currentTopics
,
(
FDelete
)
taosMemoryFree
);
}
#if 0
if (pConsumer->waitingRebTopics) {
taosArrayDestroyP(pConsumer->waitingRebTopics, taosMemoryFree);
}
#endif
if
(
pConsumer
->
rebNewTopics
)
{
taosArrayDestroyP
(
pConsumer
->
rebNewTopics
,
(
FDelete
)
taosMemoryFree
);
}
if
(
pConsumer
->
rebRemovedTopics
)
{
taosArrayDestroyP
(
pConsumer
->
rebRemovedTopics
,
(
FDelete
)
taosMemoryFree
);
}
}
int32_t
tEncodeSMqConsumerObj
(
void
**
buf
,
const
SMqConsumerObj
*
pConsumer
)
{
int32_t
tlen
=
0
;
int32_t
sz
;
tlen
+=
taosEncodeFixedI64
(
buf
,
pConsumer
->
consumerId
);
tlen
+=
taosEncodeString
(
buf
,
pConsumer
->
cgroup
);
tlen
+=
taosEncodeFixedI8
(
buf
,
pConsumer
->
updateType
);
tlen
+=
taosEncodeFixedI32
(
buf
,
pConsumer
->
epoch
);
tlen
+=
taosEncodeFixedI32
(
buf
,
pConsumer
->
status
);
// current topics
if
(
pConsumer
->
currentTopics
)
{
sz
=
taosArrayGetSize
(
pConsumer
->
currentTopics
);
tlen
+=
taosEncodeFixedI32
(
buf
,
sz
);
for
(
int32_t
i
=
0
;
i
<
sz
;
i
++
)
{
char
*
topic
=
taosArrayGetP
(
pConsumer
->
currentTopics
,
i
);
tlen
+=
taosEncodeString
(
buf
,
topic
);
}
}
else
{
tlen
+=
taosEncodeFixedI32
(
buf
,
0
);
}
#if 0
// waiting reb topics
if (pConsumer->waitingRebTopics) {
sz = taosArrayGetSize(pConsumer->waitingRebTopics);
tlen += taosEncodeFixedI32(buf, sz);
for (int32_t i = 0; i < sz; i++) {
char *topic = taosArrayGetP(pConsumer->waitingRebTopics, i);
tlen += taosEncodeString(buf, topic);
}
} else {
tlen += taosEncodeFixedI32(buf, 0);
}
#endif
// reb new topics
if
(
pConsumer
->
rebNewTopics
)
{
sz
=
taosArrayGetSize
(
pConsumer
->
rebNewTopics
);
tlen
+=
taosEncodeFixedI32
(
buf
,
sz
);
for
(
int32_t
i
=
0
;
i
<
sz
;
i
++
)
{
char
*
topic
=
taosArrayGetP
(
pConsumer
->
rebNewTopics
,
i
);
tlen
+=
taosEncodeString
(
buf
,
topic
);
}
}
else
{
tlen
+=
taosEncodeFixedI32
(
buf
,
0
);
}
// reb removed topics
if
(
pConsumer
->
rebRemovedTopics
)
{
sz
=
taosArrayGetSize
(
pConsumer
->
rebRemovedTopics
);
tlen
+=
taosEncodeFixedI32
(
buf
,
sz
);
for
(
int32_t
i
=
0
;
i
<
sz
;
i
++
)
{
char
*
topic
=
taosArrayGetP
(
pConsumer
->
rebRemovedTopics
,
i
);
tlen
+=
taosEncodeString
(
buf
,
topic
);
}
}
else
{
tlen
+=
taosEncodeFixedI32
(
buf
,
0
);
}
return
tlen
;
}
void
*
tDecodeSMqConsumerObj
(
const
void
*
buf
,
SMqConsumerObj
*
pConsumer
)
{
int32_t
sz
;
buf
=
taosDecodeFixedI64
(
buf
,
&
pConsumer
->
consumerId
);
buf
=
taosDecodeStringTo
(
buf
,
pConsumer
->
cgroup
);
buf
=
taosDecodeFixedI8
(
buf
,
&
pConsumer
->
updateType
);
buf
=
taosDecodeFixedI32
(
buf
,
&
pConsumer
->
epoch
);
buf
=
taosDecodeFixedI32
(
buf
,
&
pConsumer
->
status
);
// current topics
buf
=
taosDecodeFixedI32
(
buf
,
&
sz
);
pConsumer
->
currentTopics
=
taosArrayInit
(
sz
,
sizeof
(
void
*
));
for
(
int32_t
i
=
0
;
i
<
sz
;
i
++
)
{
char
*
topic
;
buf
=
taosDecodeString
(
buf
,
&
topic
);
taosArrayPush
(
pConsumer
->
currentTopics
,
&
topic
);
}
#if 0
// waiting reb topics
buf = taosDecodeFixedI32(buf, &sz);
pConsumer->waitingRebTopics = taosArrayInit(sz, sizeof(void *));
for (int32_t i = 0; i < sz; i++) {
char *topic;
buf = taosDecodeString(buf, &topic);
taosArrayPush(pConsumer->waitingRebTopics, &topic);
}
#endif
// reb new topics
buf
=
taosDecodeFixedI32
(
buf
,
&
sz
);
pConsumer
->
rebNewTopics
=
taosArrayInit
(
sz
,
sizeof
(
void
*
));
for
(
int32_t
i
=
0
;
i
<
sz
;
i
++
)
{
char
*
topic
;
buf
=
taosDecodeString
(
buf
,
&
topic
);
taosArrayPush
(
pConsumer
->
rebNewTopics
,
&
topic
);
}
// reb removed topics
buf
=
taosDecodeFixedI32
(
buf
,
&
sz
);
pConsumer
->
rebRemovedTopics
=
taosArrayInit
(
sz
,
sizeof
(
void
*
));
for
(
int32_t
i
=
0
;
i
<
sz
;
i
++
)
{
char
*
topic
;
buf
=
taosDecodeString
(
buf
,
&
topic
);
taosArrayPush
(
pConsumer
->
rebRemovedTopics
,
&
topic
);
}
return
(
void
*
)
buf
;
}
SMqVgEp
*
tCloneSMqVgEp
(
const
SMqVgEp
*
pVgEp
)
{
SMqVgEp
*
pVgEpNew
=
taosMemoryMalloc
(
sizeof
(
SMqVgEp
));
if
(
pVgEpNew
==
NULL
)
return
NULL
;
pVgEpNew
->
vgId
=
pVgEp
->
vgId
;
pVgEpNew
->
qmsg
=
strdup
(
pVgEp
->
qmsg
);
/*memcpy(pVgEpNew->topic, pVgEp->topic, TSDB_TOPIC_FNAME_LEN);*/
pVgEpNew
->
epSet
=
pVgEp
->
epSet
;
return
pVgEpNew
;
}
void
tDeleteSMqVgEp
(
SMqVgEp
*
pVgEp
)
{
taosMemoryFree
(
pVgEp
->
qmsg
);
}
int32_t
tEncodeSMqVgEp
(
void
**
buf
,
const
SMqVgEp
*
pVgEp
)
{
int32_t
tlen
=
0
;
tlen
+=
taosEncodeFixedI32
(
buf
,
pVgEp
->
vgId
);
tlen
+=
taosEncodeString
(
buf
,
pVgEp
->
qmsg
);
/*tlen += taosEncodeString(buf, pVgEp->topic);*/
tlen
+=
taosEncodeSEpSet
(
buf
,
&
pVgEp
->
epSet
);
return
tlen
;
}
void
*
tDecodeSMqVgEp
(
const
void
*
buf
,
SMqVgEp
*
pVgEp
)
{
buf
=
taosDecodeFixedI32
(
buf
,
&
pVgEp
->
vgId
);
buf
=
taosDecodeString
(
buf
,
&
pVgEp
->
qmsg
);
/*buf = taosDecodeStringTo(buf, pVgEp->topic);*/
buf
=
taosDecodeSEpSet
(
buf
,
&
pVgEp
->
epSet
);
return
(
void
*
)
buf
;
}
SMqConsumerEpObj
*
tCloneSMqConsumerEpObj
(
const
SMqConsumerEpObj
*
pConsumerEp
)
{
SMqConsumerEpObj
*
pConsumerEpNew
=
taosMemoryMalloc
(
sizeof
(
SMqConsumerEpObj
));
if
(
pConsumerEpNew
==
NULL
)
return
NULL
;
pConsumerEpNew
->
consumerId
=
pConsumerEp
->
consumerId
;
memcpy
(
pConsumerEpNew
->
cgroup
,
pConsumerEp
->
cgroup
,
TSDB_CGROUP_LEN
);
taosInitRWLatch
(
&
pConsumerEpNew
->
lock
);
pConsumerEpNew
->
vgs
=
taosArrayDeepCopy
(
pConsumerEpNew
->
vgs
,
(
FCopy
)
tCloneSMqVgEp
);
return
pConsumerEpNew
;
}
void
tDeleteSMqConsumerEpObj
(
SMqConsumerEpObj
*
pConsumerEp
)
{
taosArrayDestroyEx
(
pConsumerEp
->
vgs
,
(
FDelete
)
tDeleteSMqVgEp
);
}
int32_t
tEncodeSMqConsumerEpObj
(
void
**
buf
,
const
SMqConsumerEpObj
*
pConsumerEp
)
{
int32_t
tlen
=
0
;
tlen
+=
taosEncodeFixedI64
(
buf
,
pConsumerEp
->
consumerId
);
tlen
+=
taosEncodeString
(
buf
,
pConsumerEp
->
cgroup
);
tlen
+=
taosEncodeArray
(
buf
,
pConsumerEp
->
vgs
,
(
FEncode
)
tEncodeSMqVgEp
);
return
tlen
;
}
void
*
tDecodeSMqConsumerEpObj
(
const
void
*
buf
,
SMqConsumerEpObj
*
pConsumerEp
)
{
buf
=
taosDecodeFixedI64
(
buf
,
&
pConsumerEp
->
consumerId
);
buf
=
taosDecodeStringTo
(
buf
,
pConsumerEp
->
cgroup
);
buf
=
taosDecodeArray
(
buf
,
&
pConsumerEp
->
vgs
,
(
FDecode
)
tDecodeSMqVgEp
,
sizeof
(
SMqSubVgEp
));
return
(
void
*
)
buf
;
}
SMqConsumerEpInSub
*
tCloneSMqConsumerEpInSub
(
const
SMqConsumerEpInSub
*
pEpInSub
)
{
SMqConsumerEpInSub
*
pEpInSubNew
=
taosMemoryMalloc
(
sizeof
(
SMqConsumerEpInSub
));
if
(
pEpInSubNew
==
NULL
)
return
NULL
;
pEpInSubNew
->
consumerId
=
pEpInSub
->
consumerId
;
pEpInSubNew
->
vgs
=
taosArrayDeepCopy
(
pEpInSub
->
vgs
,
(
FCopy
)
tCloneSMqVgEp
);
return
pEpInSubNew
;
}
void
tDeleteSMqConsumerEpInSub
(
SMqConsumerEpInSub
*
pEpInSub
)
{
taosArrayDestroyEx
(
pEpInSub
->
vgs
,
(
FDelete
)
tDeleteSMqVgEp
);
}
int32_t
tEncodeSMqConsumerEpInSub
(
void
**
buf
,
const
SMqConsumerEpInSub
*
pEpInSub
)
{
int32_t
tlen
=
0
;
tlen
+=
taosEncodeFixedI64
(
buf
,
pEpInSub
->
consumerId
);
int32_t
sz
=
taosArrayGetSize
(
pEpInSub
->
vgs
);
tlen
+=
taosEncodeFixedI32
(
buf
,
sz
);
for
(
int32_t
i
=
0
;
i
<
sz
;
i
++
)
{
SMqVgEp
*
pVgEp
=
taosArrayGetP
(
pEpInSub
->
vgs
,
i
);
tlen
+=
tEncodeSMqVgEp
(
buf
,
pVgEp
);
}
/*tlen += taosEncodeArray(buf, pEpInSub->vgs, (FEncode)tEncodeSMqVgEp);*/
return
tlen
;
}
void
*
tDecodeSMqConsumerEpInSub
(
const
void
*
buf
,
SMqConsumerEpInSub
*
pEpInSub
)
{
buf
=
taosDecodeFixedI64
(
buf
,
&
pEpInSub
->
consumerId
);
/*buf = taosDecodeArray(buf, &pEpInSub->vgs, (FDecode)tDecodeSMqVgEp, sizeof(SMqSubVgEp));*/
int32_t
sz
;
buf
=
taosDecodeFixedI32
(
buf
,
&
sz
);
pEpInSub
->
vgs
=
taosArrayInit
(
sz
,
sizeof
(
void
*
));
for
(
int32_t
i
=
0
;
i
<
sz
;
i
++
)
{
SMqVgEp
*
pVgEp
=
taosMemoryMalloc
(
sizeof
(
SMqVgEp
));
buf
=
tDecodeSMqVgEp
(
buf
,
pVgEp
);
taosArrayPush
(
pEpInSub
->
vgs
,
&
pVgEp
);
}
return
(
void
*
)
buf
;
}
SMqSubscribeObj
*
tNewSubscribeObj
(
const
char
key
[
TSDB_SUBSCRIBE_KEY_LEN
])
{
SMqSubscribeObj
*
pSubNew
=
taosMemoryMalloc
(
sizeof
(
SMqSubscribeObj
));
if
(
pSubNew
==
NULL
)
return
NULL
;
memcpy
(
pSubNew
->
key
,
key
,
TSDB_SUBSCRIBE_KEY_LEN
);
taosInitRWLatch
(
&
pSubNew
->
lock
);
pSubNew
->
vgNum
=
-
1
;
pSubNew
->
consumerHash
=
taosHashInit
(
64
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BIGINT
),
false
,
HASH_NO_LOCK
);
// TODO set free fp
SMqConsumerEpInSub
epInSub
=
{
.
consumerId
=
-
1
,
.
vgs
=
taosArrayInit
(
0
,
sizeof
(
void
*
)),
};
int64_t
unexistKey
=
-
1
;
taosHashPut
(
pSubNew
->
consumerHash
,
&
unexistKey
,
sizeof
(
int64_t
),
&
epInSub
,
sizeof
(
SMqConsumerEpInSub
));
return
pSubNew
;
}
SMqSubscribeObj
*
tCloneSubscribeObj
(
const
SMqSubscribeObj
*
pSub
)
{
SMqSubscribeObj
*
pSubNew
=
taosMemoryMalloc
(
sizeof
(
SMqSubscribeObj
));
if
(
pSubNew
==
NULL
)
return
NULL
;
memcpy
(
pSubNew
->
key
,
pSub
->
key
,
TSDB_SUBSCRIBE_KEY_LEN
);
taosInitRWLatch
(
&
pSubNew
->
lock
);
pSubNew
->
vgNum
=
pSub
->
vgNum
;
/*pSubNew->consumerEps = taosArrayDeepCopy(pSub->consumerEps, (FCopy)tCloneSMqConsumerEpInSub);*/
pSubNew
->
consumerHash
=
taosHashInit
(
64
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BIGINT
),
false
,
HASH_NO_LOCK
);
/*taosHashSetFreeFp(pSubNew->consumerHash, taosArrayDestroy);*/
void
*
pIter
=
NULL
;
SMqConsumerEpInSub
*
pEpInSub
=
NULL
;
while
(
1
)
{
pIter
=
taosHashIterate
(
pSub
->
consumerHash
,
pIter
);
if
(
pIter
==
NULL
)
break
;
pEpInSub
=
(
SMqConsumerEpInSub
*
)
pIter
;
SMqConsumerEpInSub
newEp
=
{
.
consumerId
=
pEpInSub
->
consumerId
,
.
vgs
=
taosArrayDeepCopy
(
pEpInSub
->
vgs
,
(
FCopy
)
tCloneSMqVgEp
),
};
taosHashPut
(
pSubNew
->
consumerHash
,
&
newEp
.
consumerId
,
sizeof
(
int64_t
),
&
newEp
,
sizeof
(
SMqConsumerEpInSub
));
}
return
pSubNew
;
}
void
tDeleteSubscribeObj
(
SMqSubscribeObj
*
pSub
)
{
/*taosArrayDestroyEx(pSub->consumerEps, (FDelete)tDeleteSMqConsumerEpInSub);*/
taosHashCleanup
(
pSub
->
consumerHash
);
}
int32_t
tEncodeSubscribeObj
(
void
**
buf
,
const
SMqSubscribeObj
*
pSub
)
{
int32_t
tlen
=
0
;
tlen
+=
taosEncodeString
(
buf
,
pSub
->
key
);
tlen
+=
taosEncodeFixedI32
(
buf
,
pSub
->
vgNum
);
void
*
pIter
=
NULL
;
int32_t
sz
=
taosHashGetSize
(
pSub
->
consumerHash
);
tlen
+=
taosEncodeFixedI32
(
buf
,
sz
);
int32_t
cnt
=
0
;
while
(
1
)
{
pIter
=
taosHashIterate
(
pSub
->
consumerHash
,
pIter
);
if
(
pIter
==
NULL
)
break
;
SMqConsumerEpInSub
*
pEpInSub
=
(
SMqConsumerEpInSub
*
)
pIter
;
tlen
+=
tEncodeSMqConsumerEpInSub
(
buf
,
pEpInSub
);
cnt
++
;
}
ASSERT
(
cnt
==
sz
);
/*tlen += taosEncodeArray(buf, pSub->consumerEps, (FEncode)tEncodeSMqConsumerEpInSub);*/
return
tlen
;
}
void
*
tDecodeSubscribeObj
(
const
void
*
buf
,
SMqSubscribeObj
*
pSub
)
{
//
buf
=
taosDecodeStringTo
(
buf
,
pSub
->
key
);
buf
=
taosDecodeFixedI32
(
buf
,
&
pSub
->
vgNum
);
int32_t
sz
;
buf
=
taosDecodeFixedI32
(
buf
,
&
sz
);
pSub
->
consumerHash
=
taosHashInit
(
64
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BIGINT
),
true
,
HASH_NO_LOCK
);
for
(
int32_t
i
=
0
;
i
<
sz
;
i
++
)
{
/*SMqConsumerEpInSub* pEpInSub = taosMemoryMalloc(sizeof(SMqConsumerEpInSub));*/
SMqConsumerEpInSub
epInSub
=
{
0
};
buf
=
tDecodeSMqConsumerEpInSub
(
buf
,
&
epInSub
);
taosHashPut
(
pSub
->
consumerHash
,
&
epInSub
.
consumerId
,
sizeof
(
int64_t
),
&
epInSub
,
sizeof
(
SMqConsumerEpInSub
));
}
/*buf = taosDecodeArray(buf, &pSub->consumerEps, (FDecode)tDecodeSMqConsumerEpInSub, sizeof(SMqConsumerEpInSub));*/
return
(
void
*
)
buf
;
}
SMqSubActionLogEntry
*
tCloneSMqSubActionLogEntry
(
SMqSubActionLogEntry
*
pEntry
)
{
SMqSubActionLogEntry
*
pEntryNew
=
taosMemoryMalloc
(
sizeof
(
SMqSubActionLogEntry
));
if
(
pEntryNew
==
NULL
)
return
NULL
;
pEntryNew
->
epoch
=
pEntry
->
epoch
;
pEntryNew
->
consumers
=
taosArrayDeepCopy
(
pEntry
->
consumers
,
(
FCopy
)
tCloneSMqConsumerEpInSub
);
return
pEntryNew
;
}
void
tDeleteSMqSubActionLogEntry
(
SMqSubActionLogEntry
*
pEntry
)
{
taosArrayDestroyEx
(
pEntry
->
consumers
,
(
FDelete
)
tDeleteSMqConsumerEpInSub
);
}
int32_t
tEncodeSMqSubActionLogEntry
(
void
**
buf
,
const
SMqSubActionLogEntry
*
pEntry
)
{
int32_t
tlen
=
0
;
tlen
+=
taosEncodeFixedI32
(
buf
,
pEntry
->
epoch
);
tlen
+=
taosEncodeArray
(
buf
,
pEntry
->
consumers
,
(
FEncode
)
tEncodeSMqSubActionLogEntry
);
return
tlen
;
}
void
*
tDecodeSMqSubActionLogEntry
(
const
void
*
buf
,
SMqSubActionLogEntry
*
pEntry
)
{
buf
=
taosDecodeFixedI32
(
buf
,
&
pEntry
->
epoch
);
buf
=
taosDecodeArray
(
buf
,
&
pEntry
->
consumers
,
(
FDecode
)
tDecodeSMqSubActionLogEntry
,
sizeof
(
SMqSubActionLogEntry
));
return
(
void
*
)
buf
;
}
SMqSubActionLogObj
*
tCloneSMqSubActionLogObj
(
SMqSubActionLogObj
*
pLog
)
{
SMqSubActionLogObj
*
pLogNew
=
taosMemoryMalloc
(
sizeof
(
SMqSubActionLogObj
));
if
(
pLogNew
==
NULL
)
return
pLogNew
;
memcpy
(
pLogNew
->
key
,
pLog
->
key
,
TSDB_SUBSCRIBE_KEY_LEN
);
pLogNew
->
logs
=
taosArrayDeepCopy
(
pLog
->
logs
,
(
FCopy
)
tCloneSMqConsumerEpInSub
);
return
pLogNew
;
}
void
tDeleteSMqSubActionLogObj
(
SMqSubActionLogObj
*
pLog
)
{
taosArrayDestroyEx
(
pLog
->
logs
,
(
FDelete
)
tDeleteSMqConsumerEpInSub
);
}
int32_t
tEncodeSMqSubActionLogObj
(
void
**
buf
,
const
SMqSubActionLogObj
*
pLog
)
{
int32_t
tlen
=
0
;
tlen
+=
taosEncodeString
(
buf
,
pLog
->
key
);
tlen
+=
taosEncodeArray
(
buf
,
pLog
->
logs
,
(
FEncode
)
tEncodeSMqSubActionLogEntry
);
return
tlen
;
}
void
*
tDecodeSMqSubActionLogObj
(
const
void
*
buf
,
SMqSubActionLogObj
*
pLog
)
{
buf
=
taosDecodeStringTo
(
buf
,
pLog
->
key
);
buf
=
taosDecodeArray
(
buf
,
&
pLog
->
logs
,
(
FDecode
)
tDecodeSMqSubActionLogEntry
,
sizeof
(
SMqSubActionLogEntry
));
return
(
void
*
)
buf
;
}
int32_t
tEncodeSStreamObj
(
SCoder
*
pEncoder
,
const
SStreamObj
*
pObj
)
{
int32_t
tEncodeSStreamObj
(
SCoder
*
pEncoder
,
const
SStreamObj
*
pObj
)
{
int32_t
sz
=
0
;
int32_t
sz
=
0
;
...
...
source/dnode/mnode/impl/src/mndOffset.c
浏览文件 @
395d9e8b
...
@@ -130,8 +130,7 @@ OFFSET_DECODE_OVER:
...
@@ -130,8 +130,7 @@ OFFSET_DECODE_OVER:
return
pRow
;
return
pRow
;
}
}
int32_t
mndCreateOffset
(
STrans
*
pTrans
,
const
char
*
cgroup
,
const
char
*
topicName
,
const
SArray
*
vgs
)
{
int32_t
mndCreateOffsets
(
STrans
*
pTrans
,
const
char
*
cgroup
,
const
char
*
topicName
,
const
SArray
*
vgs
)
{
int32_t
code
=
0
;
int32_t
sz
=
taosArrayGetSize
(
vgs
);
int32_t
sz
=
taosArrayGetSize
(
vgs
);
for
(
int32_t
i
=
0
;
i
<
sz
;
i
++
)
{
for
(
int32_t
i
=
0
;
i
<
sz
;
i
++
)
{
SMqConsumerEp
*
pConsumerEp
=
taosArrayGet
(
vgs
,
i
);
SMqConsumerEp
*
pConsumerEp
=
taosArrayGet
(
vgs
,
i
);
...
@@ -170,13 +169,22 @@ static int32_t mndProcessCommitOffsetReq(SNodeMsg *pMsg) {
...
@@ -170,13 +169,22 @@ static int32_t mndProcessCommitOffsetReq(SNodeMsg *pMsg) {
if
(
mndMakePartitionKey
(
key
,
pOffset
->
cgroup
,
pOffset
->
topicName
,
pOffset
->
vgId
)
<
0
)
{
if
(
mndMakePartitionKey
(
key
,
pOffset
->
cgroup
,
pOffset
->
topicName
,
pOffset
->
vgId
)
<
0
)
{
return
-
1
;
return
-
1
;
}
}
bool
create
=
false
;
SMqOffsetObj
*
pOffsetObj
=
mndAcquireOffset
(
pMnode
,
key
);
SMqOffsetObj
*
pOffsetObj
=
mndAcquireOffset
(
pMnode
,
key
);
ASSERT
(
pOffsetObj
);
if
(
pOffsetObj
==
NULL
)
{
pOffsetObj
=
taosMemoryMalloc
(
sizeof
(
SMqOffset
));
memcpy
(
pOffsetObj
->
key
,
key
,
TSDB_PARTITION_KEY_LEN
);
create
=
true
;
}
pOffsetObj
->
offset
=
pOffset
->
offset
;
pOffsetObj
->
offset
=
pOffset
->
offset
;
SSdbRaw
*
pOffsetRaw
=
mndOffsetActionEncode
(
pOffsetObj
);
SSdbRaw
*
pOffsetRaw
=
mndOffsetActionEncode
(
pOffsetObj
);
sdbSetRawStatus
(
pOffsetRaw
,
SDB_STATUS_READY
);
sdbSetRawStatus
(
pOffsetRaw
,
SDB_STATUS_READY
);
mndTransAppendRedolog
(
pTrans
,
pOffsetRaw
);
mndTransAppendRedolog
(
pTrans
,
pOffsetRaw
);
mndReleaseOffset
(
pMnode
,
pOffsetObj
);
if
(
create
)
{
taosMemoryFree
(
pOffsetObj
);
}
else
{
mndReleaseOffset
(
pMnode
,
pOffsetObj
);
}
}
}
if
(
mndTransPrepare
(
pMnode
,
pTrans
)
!=
0
)
{
if
(
mndTransPrepare
(
pMnode
,
pTrans
)
!=
0
)
{
...
@@ -201,7 +209,7 @@ static int32_t mndOffsetActionDelete(SSdb *pSdb, SMqOffsetObj *pOffset) {
...
@@ -201,7 +209,7 @@ static int32_t mndOffsetActionDelete(SSdb *pSdb, SMqOffsetObj *pOffset) {
static
int32_t
mndOffsetActionUpdate
(
SSdb
*
pSdb
,
SMqOffsetObj
*
pOldOffset
,
SMqOffsetObj
*
pNewOffset
)
{
static
int32_t
mndOffsetActionUpdate
(
SSdb
*
pSdb
,
SMqOffsetObj
*
pOldOffset
,
SMqOffsetObj
*
pNewOffset
)
{
mTrace
(
"offset:%s, perform update action"
,
pOldOffset
->
key
);
mTrace
(
"offset:%s, perform update action"
,
pOldOffset
->
key
);
pOldOffset
->
offset
=
pNewOffset
->
offset
;
atomic_store_64
(
&
pOldOffset
->
offset
,
pNewOffset
->
offset
)
;
return
0
;
return
0
;
}
}
...
...
source/dnode/mnode/impl/src/mndScheduler.c
浏览文件 @
395d9e8b
...
@@ -434,7 +434,9 @@ int32_t mndSchedInitSubEp(SMnode* pMnode, const SMqTopicObj* pTopic, SMqSubscrib
...
@@ -434,7 +434,9 @@ int32_t mndSchedInitSubEp(SMnode* pMnode, const SMqTopicObj* pTopic, SMqSubscrib
return
-
1
;
return
-
1
;
}
}
ASSERT
(
pSub
->
vgNum
==
0
);
ASSERT
(
pSub
->
vgNum
==
-
1
);
pSub
->
vgNum
=
0
;
int32_t
levelNum
=
LIST_LENGTH
(
pPlan
->
pSubplans
);
int32_t
levelNum
=
LIST_LENGTH
(
pPlan
->
pSubplans
);
if
(
levelNum
!=
1
)
{
if
(
levelNum
!=
1
)
{
...
@@ -453,6 +455,12 @@ int32_t mndSchedInitSubEp(SMnode* pMnode, const SMqTopicObj* pTopic, SMqSubscrib
...
@@ -453,6 +455,12 @@ int32_t mndSchedInitSubEp(SMnode* pMnode, const SMqTopicObj* pTopic, SMqSubscrib
}
}
SSubplan
*
plan
=
nodesListGetNode
(
inner
->
pNodeList
,
0
);
SSubplan
*
plan
=
nodesListGetNode
(
inner
->
pNodeList
,
0
);
int64_t
unexistKey
=
-
1
;
SMqConsumerEpInSub
*
pEpInSub
=
taosHashGet
(
pSub
->
consumerHash
,
&
unexistKey
,
sizeof
(
int64_t
));
ASSERT
(
pEpInSub
);
ASSERT
(
taosHashGetSize
(
pSub
->
consumerHash
)
==
1
);
void
*
pIter
=
NULL
;
void
*
pIter
=
NULL
;
while
(
1
)
{
while
(
1
)
{
pIter
=
sdbFetch
(
pSdb
,
SDB_VGROUP
,
pIter
,
(
void
**
)
&
pVgroup
);
pIter
=
sdbFetch
(
pSdb
,
SDB_VGROUP
,
pIter
,
(
void
**
)
&
pVgroup
);
...
@@ -466,24 +474,41 @@ int32_t mndSchedInitSubEp(SMnode* pMnode, const SMqTopicObj* pTopic, SMqSubscrib
...
@@ -466,24 +474,41 @@ int32_t mndSchedInitSubEp(SMnode* pMnode, const SMqTopicObj* pTopic, SMqSubscrib
plan
->
execNode
.
nodeId
=
pVgroup
->
vgId
;
plan
->
execNode
.
nodeId
=
pVgroup
->
vgId
;
plan
->
execNode
.
epSet
=
mndGetVgroupEpset
(
pMnode
,
pVgroup
);
plan
->
execNode
.
epSet
=
mndGetVgroupEpset
(
pMnode
,
pVgroup
);
SMqVgEp
*
pVgEp
=
taosMemoryMalloc
(
sizeof
(
SMqVgEp
));
pVgEp
->
epSet
=
plan
->
execNode
.
epSet
;
pVgEp
->
vgId
=
plan
->
execNode
.
nodeId
;
#if 0
SMqConsumerEp consumerEp = {0};
SMqConsumerEp consumerEp = {0};
consumerEp.status = 0;
consumerEp.status = 0;
consumerEp.consumerId = -1;
consumerEp.consumerId = -1;
consumerEp.epSet = plan->execNode.epSet;
consumerEp.epSet = plan->execNode.epSet;
consumerEp.vgId = plan->execNode.nodeId;
consumerEp.vgId = plan->execNode.nodeId;
#endif
mDebug
(
"init subscribption %s, assign vg: %d"
,
pSub
->
key
,
consumerEp
.
vgId
);
mDebug
(
"init subscribption %s, assign vg: %d"
,
pSub
->
key
,
pVgEp
->
vgId
);
int32_t
msgLen
;
int32_t
msgLen
;
if
(
qSubPlanToString
(
plan
,
&
consumerEp
.
qmsg
,
&
msgLen
)
<
0
)
{
if
(
qSubPlanToString
(
plan
,
&
pVgEp
->
qmsg
,
&
msgLen
)
<
0
)
{
sdbRelease
(
pSdb
,
pVgroup
);
sdbRelease
(
pSdb
,
pVgroup
);
qDestroyQueryPlan
(
pPlan
);
qDestroyQueryPlan
(
pPlan
);
terrno
=
TSDB_CODE_QRY_INVALID_INPUT
;
terrno
=
TSDB_CODE_QRY_INVALID_INPUT
;
return
-
1
;
return
-
1
;
}
}
taosArrayPush
(
pSub
->
unassignedVg
,
&
consumerEp
);
taosArrayPush
(
pEpInSub
->
vgs
,
&
pVgEp
);
ASSERT
(
taosHashGetSize
(
pSub
->
consumerHash
)
==
1
);
/*taosArrayPush(pSub->unassignedVg, &consumerEp);*/
}
}
ASSERT
(
pEpInSub
->
vgs
->
size
>
0
);
pEpInSub
=
taosHashGet
(
pSub
->
consumerHash
,
&
unexistKey
,
sizeof
(
int64_t
));
ASSERT
(
pEpInSub
->
vgs
->
size
>
0
);
ASSERT
(
taosHashGetSize
(
pSub
->
consumerHash
)
==
1
);
qDestroyQueryPlan
(
pPlan
);
qDestroyQueryPlan
(
pPlan
);
return
0
;
return
0
;
...
...
source/dnode/mnode/impl/src/mndStb.c
浏览文件 @
395d9e8b
...
@@ -348,7 +348,7 @@ static int32_t mndStbActionUpdate(SSdb *pSdb, SStbObj *pOld, SStbObj *pNew) {
...
@@ -348,7 +348,7 @@ static int32_t mndStbActionUpdate(SSdb *pSdb, SStbObj *pOld, SStbObj *pNew) {
memcpy
(
pOld
->
pColumns
,
pNew
->
pColumns
,
pOld
->
numOfColumns
*
sizeof
(
SSchema
));
memcpy
(
pOld
->
pColumns
,
pNew
->
pColumns
,
pOld
->
numOfColumns
*
sizeof
(
SSchema
));
memcpy
(
pOld
->
pTags
,
pNew
->
pTags
,
pOld
->
numOfTags
*
sizeof
(
SSchema
));
memcpy
(
pOld
->
pTags
,
pNew
->
pTags
,
pOld
->
numOfTags
*
sizeof
(
SSchema
));
if
(
pNew
->
commentLen
!=
0
)
{
if
(
pNew
->
commentLen
!=
0
)
{
memcpy
(
pOld
->
comment
,
pNew
->
comment
,
TSDB_STB_COMMENT_LEN
);
memcpy
(
pOld
->
comment
,
pNew
->
comment
,
pNew
->
commentLen
);
}
}
if
(
pNew
->
ast1Len
!=
0
)
{
if
(
pNew
->
ast1Len
!=
0
)
{
memcpy
(
pOld
->
pAst1
,
pNew
->
pAst1
,
pNew
->
ast1Len
);
memcpy
(
pOld
->
pAst1
,
pNew
->
pAst1
,
pNew
->
ast1Len
);
...
...
source/dnode/mnode/impl/src/mndSubscribe.c
浏览文件 @
395d9e8b
此差异已折叠。
点击以展开。
source/dnode/mnode/impl/src/mnode.c
浏览文件 @
395d9e8b
...
@@ -22,12 +22,14 @@
...
@@ -22,12 +22,14 @@
#include "mndDb.h"
#include "mndDb.h"
#include "mndDnode.h"
#include "mndDnode.h"
#include "mndFunc.h"
#include "mndFunc.h"
#include "mndGrant.h"
#include "mndInfoSchema.h"
#include "mndInfoSchema.h"
#include "mndPerfSchema.h"
#include "mndMnode.h"
#include "mndMnode.h"
#include "mndOffset.h"
#include "mndOffset.h"
#include "mndPerfSchema.h"
#include "mndProfile.h"
#include "mndProfile.h"
#include "mndQnode.h"
#include "mndQnode.h"
#include "mndQuery.h"
#include "mndShow.h"
#include "mndShow.h"
#include "mndSma.h"
#include "mndSma.h"
#include "mndSnode.h"
#include "mndSnode.h"
...
@@ -40,8 +42,6 @@
...
@@ -40,8 +42,6 @@
#include "mndTrans.h"
#include "mndTrans.h"
#include "mndUser.h"
#include "mndUser.h"
#include "mndVgroup.h"
#include "mndVgroup.h"
#include "mndQuery.h"
#include "mndGrant.h"
#define MQ_TIMER_MS 3000
#define MQ_TIMER_MS 3000
#define TRNAS_TIMER_MS 6000
#define TRNAS_TIMER_MS 6000
...
...
source/dnode/vnode/src/inc/tq.h
浏览文件 @
395d9e8b
...
@@ -16,6 +16,13 @@
...
@@ -16,6 +16,13 @@
#ifndef _TD_VNODE_TQ_H_
#ifndef _TD_VNODE_TQ_H_
#define _TD_VNODE_TQ_H_
#define _TD_VNODE_TQ_H_
#include "executor.h"
#include "os.h"
#include "thash.h"
#include "tmsg.h"
#include "ttimer.h"
#include "wal.h"
#ifdef __cplusplus
#ifdef __cplusplus
extern
"C"
{
extern
"C"
{
#endif
#endif
...
@@ -30,12 +37,6 @@ extern "C" {
...
@@ -30,12 +37,6 @@ extern "C" {
#define tqTrace(...) do { if (tqDebugFlag & DEBUG_TRACE) { taosPrintLog("TQ ", DEBUG_TRACE, tqDebugFlag, __VA_ARGS__); }} while(0)
#define tqTrace(...) do { if (tqDebugFlag & DEBUG_TRACE) { taosPrintLog("TQ ", DEBUG_TRACE, tqDebugFlag, __VA_ARGS__); }} while(0)
// clang-format on
// clang-format on
enum
{
TQ_STREAM_TOKEN__DATA
=
1
,
TQ_STREAM_TOKEN__WATERMARK
,
TQ_STREAM_TOKEN__CHECKPOINT
,
};
#define TQ_BUFFER_SIZE 4
#define TQ_BUFFER_SIZE 4
#define TQ_BUCKET_MASK 0xFF
#define TQ_BUCKET_MASK 0xFF
...
@@ -151,22 +152,27 @@ typedef struct {
...
@@ -151,22 +152,27 @@ typedef struct {
}
STqMetaStore
;
}
STqMetaStore
;
typedef
struct
{
typedef
struct
{
SMemAllocatorFactory
*
pAllocatorFactory
;
char
subKey
[
TSDB_SUBSCRIBE_KEY_LEN
];
SMemAllocator
*
pAllocator
;
int64_t
consumerId
;
}
STqMemRef
;
int32_t
epoch
;
char
*
qmsg
;
// SRWLatch lock;
SWalReadHandle
*
pReadHandle
;
// number should be identical to fetch thread num
qTaskInfo_t
task
[
4
];
}
STqExec
;
struct
STQ
{
struct
STQ
{
// the collection of groups
// the collection of groups
// the handle of meta kvstore
// the handle of meta kvstore
bool
writeTrigger
;
bool
writeTrigger
;
char
*
path
;
char
*
path
;
STqMemRef
tqMemRef
;
STqMetaStore
*
tqMeta
;
STqMetaStore
*
tqMeta
;
// STqPushMgr* tqPushMgr;
SHashObj
*
tqMetaNew
;
// subKey -> tqExec
SHashObj
*
pStreamTasks
;
SHashObj
*
pStreamTasks
;
SVnode
*
pVnode
;
SVnode
*
pVnode
;
SWal
*
pWal
;
SWal
*
pWal
;
SMeta
*
pVnodeMeta
;
SMeta
*
pVnodeMeta
;
};
};
typedef
struct
{
typedef
struct
{
...
@@ -230,10 +236,6 @@ typedef struct {
...
@@ -230,10 +236,6 @@ typedef struct {
// TODO sync function
// TODO sync function
}
STqStreamPusher
;
}
STqStreamPusher
;
typedef
struct
{
int8_t
type
;
// mq or stream
}
STqPusher
;
typedef
struct
{
typedef
struct
{
SHashObj
*
pHash
;
// <id, STqPush*>
SHashObj
*
pHash
;
// <id, STqPush*>
}
STqPushMgr
;
}
STqPushMgr
;
...
@@ -257,9 +259,10 @@ int tqPushMsg(STQ*, void* msg, int32_t msgLen, tmsg_t msgType, int64_t version);
...
@@ -257,9 +259,10 @@ int tqPushMsg(STQ*, void* msg, int32_t msgLen, tmsg_t msgType, int64_t version);
int
tqCommit
(
STQ
*
);
int
tqCommit
(
STQ
*
);
int32_t
tqProcessPollReq
(
STQ
*
pTq
,
SRpcMsg
*
pMsg
,
int32_t
workerId
);
int32_t
tqProcessPollReq
(
STQ
*
pTq
,
SRpcMsg
*
pMsg
,
int32_t
workerId
);
int32_t
tqProcessSetConnReq
(
STQ
*
pTq
,
char
*
msg
);
int32_t
tqProcessVgChangeReq
(
STQ
*
pTq
,
char
*
msg
,
int32_t
msgLen
);
int32_t
tqProcessRebReq
(
STQ
*
pTq
,
char
*
msg
);
// int32_t tqProcessSetConnReq(STQ* pTq, char* msg);
int32_t
tqProcessCancelConnReq
(
STQ
*
pTq
,
char
*
msg
);
// int32_t tqProcessRebReq(STQ* pTq, char* msg);
// int32_t tqProcessCancelConnReq(STQ* pTq, char* msg);
int32_t
tqProcessTaskExec
(
STQ
*
pTq
,
char
*
msg
,
int32_t
msgLen
,
int32_t
workerId
);
int32_t
tqProcessTaskExec
(
STQ
*
pTq
,
char
*
msg
,
int32_t
msgLen
,
int32_t
workerId
);
int32_t
tqProcessTaskDeploy
(
STQ
*
pTq
,
char
*
msg
,
int32_t
msgLen
);
int32_t
tqProcessTaskDeploy
(
STQ
*
pTq
,
char
*
msg
,
int32_t
msgLen
);
int32_t
tqProcessStreamTrigger
(
STQ
*
pTq
,
void
*
data
,
int32_t
dataLen
,
int32_t
workerId
);
int32_t
tqProcessStreamTrigger
(
STQ
*
pTq
,
void
*
data
,
int32_t
dataLen
,
int32_t
workerId
);
...
@@ -314,4 +317,4 @@ STqStreamPusher* tqAddStreamPusher(STqPushMgr* pushMgr, int64_t streamId, SEpSet
...
@@ -314,4 +317,4 @@ STqStreamPusher* tqAddStreamPusher(STqPushMgr* pushMgr, int64_t streamId, SEpSet
}
}
#endif
#endif
#endif
/*_TD_VNODE_TQ_H_*/
#endif
/*_TD_VNODE_TQ_H_*/
\ No newline at end of file
source/dnode/vnode/src/tq/tq.c
浏览文件 @
395d9e8b
...
@@ -29,31 +29,14 @@ STQ* tqOpen(const char* path, SVnode* pVnode, SWal* pWal, SMeta* pVnodeMeta, SMe
...
@@ -29,31 +29,14 @@ STQ* tqOpen(const char* path, SVnode* pVnode, SWal* pWal, SMeta* pVnodeMeta, SMe
pTq
->
pVnode
=
pVnode
;
pTq
->
pVnode
=
pVnode
;
pTq
->
pWal
=
pWal
;
pTq
->
pWal
=
pWal
;
pTq
->
pVnodeMeta
=
pVnodeMeta
;
pTq
->
pVnodeMeta
=
pVnodeMeta
;
#if 0
pTq->tqMemRef.pAllocatorFactory = allocFac;
pTq->tqMemRef.pAllocator = allocFac->create(allocFac);
if (pTq->tqMemRef.pAllocator == NULL) {
// TODO: error code of buffer pool
}
#endif
pTq
->
tqMeta
=
tqStoreOpen
(
pTq
,
path
,
(
FTqSerialize
)
tqSerializeConsumer
,
(
FTqDeserialize
)
tqDeserializeConsumer
,
pTq
->
tqMeta
=
tqStoreOpen
(
pTq
,
path
,
(
FTqSerialize
)
tqSerializeConsumer
,
(
FTqDeserialize
)
tqDeserializeConsumer
,
(
FTqDelete
)
taosMemoryFree
,
0
);
(
FTqDelete
)
taosMemoryFree
,
0
);
if
(
pTq
->
tqMeta
==
NULL
)
{
if
(
pTq
->
tqMeta
==
NULL
)
{
taosMemoryFree
(
pTq
);
taosMemoryFree
(
pTq
);
#if 0
allocFac->destroy(allocFac, pTq->tqMemRef.pAllocator);
#endif
return
NULL
;
return
NULL
;
}
}
#if 0
pTq
->
tqMetaNew
=
taosHashInit
(
64
,
MurmurHash3_32
,
true
,
HASH_ENTRY_LOCK
);
pTq->tqPushMgr = tqPushMgrOpen();
if (pTq->tqPushMgr == NULL) {
// free store
taosMemoryFree(pTq);
return NULL;
}
#endif
pTq
->
pStreamTasks
=
taosHashInit
(
64
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_INT
),
true
,
HASH_NO_LOCK
);
pTq
->
pStreamTasks
=
taosHashInit
(
64
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_INT
),
true
,
HASH_NO_LOCK
);
...
@@ -248,16 +231,15 @@ int32_t tqDeserializeConsumer(STQ* pTq, const STqSerializedHead* pHead, STqConsu
...
@@ -248,16 +231,15 @@ int32_t tqDeserializeConsumer(STQ* pTq, const STqSerializedHead* pHead, STqConsu
return
0
;
return
0
;
}
}
#if 0
int32_t
tqProcessPollReq
(
STQ
*
pTq
,
SRpcMsg
*
pMsg
,
int32_t
workerId
)
{
int32_t
tqProcessPollReq
(
STQ
*
pTq
,
SRpcMsg
*
pMsg
,
int32_t
workerId
)
{
SMqPollReq* pReq = pMsg->pCont;
SMqPollReqV2
*
pReq
=
pMsg
->
pCont
;
int64_t consumerId = pReq->consumerId;
int64_t
consumerId
=
pReq
->
consumerId
;
int64_t fetchOffset;
int32_t
reqEpoch
=
pReq
->
epoch
;
int64_t blockingTime = pReq->blockingTime;
int64_t
fetchOffset
;
int32_t reqEpoch = pReq->epoch;
if
(
pReq
->
currentOffset
==
TMQ_CONF__RESET_OFFSET__EARLIEAST
)
{
if
(
pReq
->
currentOffset
==
TMQ_CONF__RESET_OFFSET__EARLIEAST
)
{
fetchOffset =
0
;
fetchOffset
=
walGetFirstVer
(
pTq
->
pWal
)
;
}
else
if
(
pReq
->
currentOffset
==
TMQ_CONF__RESET_OFFSET__LATEST
)
{
}
else
if
(
pReq
->
currentOffset
==
TMQ_CONF__RESET_OFFSET__LATEST
)
{
fetchOffset
=
walGetLastVer
(
pTq
->
pWal
);
fetchOffset
=
walGetLastVer
(
pTq
->
pWal
);
}
else
{
}
else
{
...
@@ -267,65 +249,29 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg, int32_t workerId) {
...
@@ -267,65 +249,29 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg, int32_t workerId) {
vDebug
(
"tmq poll: consumer %ld (epoch %d) recv poll req in vg %d, req %ld %ld"
,
consumerId
,
pReq
->
epoch
,
vDebug
(
"tmq poll: consumer %ld (epoch %d) recv poll req in vg %d, req %ld %ld"
,
consumerId
,
pReq
->
epoch
,
TD_VID
(
pTq
->
pVnode
),
pReq
->
currentOffset
,
fetchOffset
);
TD_VID
(
pTq
->
pVnode
),
pReq
->
currentOffset
,
fetchOffset
);
SMqPollRsp rsp = {
STqExec
*
pExec
=
taosHashGet
(
pTq
->
tqMetaNew
,
pReq
->
subKey
,
strlen
(
pReq
->
subKey
));
/*.consumerId = consumerId,*/
ASSERT
(
pExec
);
.numOfTopics = 0,
.pBlockData = NULL,
};
STqConsumer* pConsumer = tqHandleGet(pTq->tqMeta, consumerId);
if (pConsumer == NULL) {
vWarn("tmq poll: consumer %ld (epoch %d) not found in vg %d", consumerId, pReq->epoch, TD_VID(pTq->pVnode));
pMsg->pCont = NULL;
pMsg->contLen = 0;
pMsg->code = -1;
tmsgSendRsp(pMsg);
return 0;
}
int32_t consumerEpoch = atomic_load_32(&p
Consumer
->epoch);
int32_t
consumerEpoch
=
atomic_load_32
(
&
p
Exec
->
epoch
);
while
(
consumerEpoch
<
reqEpoch
)
{
while
(
consumerEpoch
<
reqEpoch
)
{
consumerEpoch = atomic_val_compare_exchange_32(&p
Consumer
->epoch, consumerEpoch, reqEpoch);
consumerEpoch
=
atomic_val_compare_exchange_32
(
&
p
Exec
->
epoch
,
consumerEpoch
,
reqEpoch
);
}
}
STqTopic* pTopic = NULL;
SMqDataBlkRsp
rsp
=
{
0
};
int32_t sz = taosArrayGetSize(pConsumer->topics);
for (int32_t i = 0; i < sz; i++) {
STqTopic* topic = taosArrayGet(pConsumer->topics, i);
// TODO race condition
ASSERT(pConsumer->consumerId == consumerId);
if (strcmp(topic->topicName, pReq->topic) == 0) {
pTopic = topic;
break;
}
}
if (pTopic == NULL) {
vWarn("tmq poll: consumer %ld (epoch %d) topic %s not found in vg %d", consumerId, pReq->epoch, pReq->topic,
TD_VID(pTq->pVnode));
pMsg->pCont = NULL;
pMsg->contLen = 0;
pMsg->code = -1;
tmsgSendRsp(pMsg);
return 0;
}
vDebug("poll topic %s from consumer %ld (epoch %d) vg %d", pTopic->topicName, consumerId, pReq->epoch,
TD_VID(pTq->pVnode));
rsp
.
reqOffset
=
pReq
->
currentOffset
;
rsp
.
reqOffset
=
pReq
->
currentOffset
;
rsp.skipLogNum = 0;
rsp
.
blockDataLen
=
taosArrayInit
(
0
,
sizeof
(
int32_t
));
rsp
.
blockData
=
taosArrayInit
(
0
,
sizeof
(
void
*
));
while
(
1
)
{
while
(
1
)
{
/*if (fetchOffset > walGetLastVer(pTq->pWal) || walReadWithHandle(pTopic->pReadhandle, fetchOffset) < 0) {*/
consumerEpoch
=
atomic_load_32
(
&
pExec
->
epoch
);
// TODO
consumerEpoch = atomic_load_32(&pConsumer->epoch);
if
(
consumerEpoch
>
reqEpoch
)
{
if
(
consumerEpoch
>
reqEpoch
)
{
vDebug
(
"tmq poll: consumer %ld (epoch %d) vg %d offset %ld, found new consumer epoch %d discard req epoch %d"
,
vDebug
(
"tmq poll: consumer %ld (epoch %d) vg %d offset %ld, found new consumer epoch %d discard req epoch %d"
,
consumerId
,
pReq
->
epoch
,
TD_VID
(
pTq
->
pVnode
),
fetchOffset
,
consumerEpoch
,
reqEpoch
);
consumerId
,
pReq
->
epoch
,
TD_VID
(
pTq
->
pVnode
),
fetchOffset
,
consumerEpoch
,
reqEpoch
);
break
;
break
;
}
}
SWalReadHead
*
pHead
;
SWalReadHead
*
pHead
;
if (walReadWithHandle_s(p
Topic->pReadh
andle, fetchOffset, &pHead) < 0) {
if
(
walReadWithHandle_s
(
p
Exec
->
pReadH
andle
,
fetchOffset
,
&
pHead
)
<
0
)
{
// TODO: no more log, set timer to wait blocking time
// TODO: no more log, set timer to wait blocking time
// if data inserted during waiting, launch query and
// if data inserted during waiting, launch query and
// response to user
// response to user
...
@@ -333,101 +279,88 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg, int32_t workerId) {
...
@@ -333,101 +279,88 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg, int32_t workerId) {
TD_VID
(
pTq
->
pVnode
),
fetchOffset
);
TD_VID
(
pTq
->
pVnode
),
fetchOffset
);
break
;
break
;
}
}
vDebug
(
"tmq poll: consumer %ld (epoch %d) iter log, vg %d offset %ld msgType %d"
,
consumerId
,
pReq
->
epoch
,
vDebug
(
"tmq poll: consumer %ld (epoch %d) iter log, vg %d offset %ld msgType %d"
,
consumerId
,
pReq
->
epoch
,
TD_VID
(
pTq
->
pVnode
),
fetchOffset
,
pHead
->
msgType
);
TD_VID
(
pTq
->
pVnode
),
fetchOffset
,
pHead
->
msgType
);
/*int8_t pos = fetchOffset % TQ_BUFFER_SIZE;*/
/*pHead = pTopic->pReadhandle->pHead;*/
if
(
pHead
->
msgType
==
TDMT_VND_SUBMIT
)
{
if
(
pHead
->
msgType
==
TDMT_VND_SUBMIT
)
{
SSubmitReq
*
pCont
=
(
SSubmitReq
*
)
&
pHead
->
body
;
SSubmitReq
*
pCont
=
(
SSubmitReq
*
)
&
pHead
->
body
;
qTaskInfo_t task = p
Topic->buffer.output[workerId].task
;
qTaskInfo_t
task
=
p
Exec
->
task
[
workerId
]
;
ASSERT
(
task
);
ASSERT
(
task
);
qSetStreamInput
(
task
,
pCont
,
STREAM_DATA_TYPE_SUBMIT_BLOCK
);
qSetStreamInput
(
task
,
pCont
,
STREAM_DATA_TYPE_SUBMIT_BLOCK
);
SArray* pRes = taosArrayInit(0, sizeof(SSDataBlock));
while
(
1
)
{
while
(
1
)
{
SSDataBlock
*
pDataBlock
=
NULL
;
SSDataBlock
*
pDataBlock
=
NULL
;
uint64_t ts;
uint64_t
ts
=
0
;
if
(
qExecTask
(
task
,
&
pDataBlock
,
&
ts
)
<
0
)
{
if
(
qExecTask
(
task
,
&
pDataBlock
,
&
ts
)
<
0
)
{
ASSERT(false);
ASSERT
(
0
);
}
if (pDataBlock == NULL) {
/*pos = fetchOffset % TQ_BUFFER_SIZE;*/
break;
}
}
if
(
pDataBlock
==
NULL
)
break
;
taosArrayPush(pRes, pDataBlock
);
ASSERT
(
pDataBlock
->
info
.
rows
!=
0
);
}
ASSERT
(
pDataBlock
->
info
.
numOfCols
!=
0
);
if (taosArrayGetSize(pRes) == 0) {
int32_t
dataStrLen
=
sizeof
(
SRetrieveTableRsp
)
+
blockGetEncodeSize
(
pDataBlock
);
vDebug("tmq poll: consumer %ld (epoch %d) iter log, vg %d skip log %ld since not wanted", consumerId,
void
*
buf
=
taosMemoryCalloc
(
1
,
dataStrLen
);
pReq->epoch, TD_VID(pTq->pVnode), fetchOffset);
SRetrieveTableRsp
*
pRetrieve
=
(
SRetrieveTableRsp
*
)
buf
;
fetchOffset++;
pRetrieve
->
useconds
=
ts
;
rsp.skipLogNum++;
pRetrieve
->
precision
=
TSDB_DEFAULT_PRECISION
;
taosArrayDestroy(pRes);
pRetrieve
->
compressed
=
0
;
continue;
pRetrieve
->
completed
=
1
;
pRetrieve
->
numOfRows
=
htonl
(
pDataBlock
->
info
.
rows
);
// TODO enable compress
int32_t
actualLen
=
0
;
blockCompressEncode
(
pDataBlock
,
pRetrieve
->
data
,
&
actualLen
,
pDataBlock
->
info
.
numOfCols
,
false
);
actualLen
+=
sizeof
(
SRetrieveTableRsp
);
ASSERT
(
actualLen
<=
dataStrLen
);
taosArrayPush
(
rsp
.
blockDataLen
,
&
actualLen
);
taosArrayPush
(
rsp
.
blockData
,
&
buf
);
rsp
.
blockNum
++
;
}
}
rsp.schema = pTopic->buffer.output[workerId].pReadHandle->pSchemaWrapper;
}
rsp.rspOffset = fetchOffset;
rsp.numOfTopics = 1;
// TODO batch optimization
rsp.pBlockData = pRes;
if
(
rsp
.
blockNum
!=
0
)
break
;
rsp
.
skipLogNum
++
;
fetchOffset
++
;
}
int32_t tlen = sizeof(SMqRspHead) + tEncodeSMqPollRsp(NULL, &rsp);
ASSERT
(
taosArrayGetSize
(
rsp
.
blockData
)
==
rsp
.
blockNum
);
void* buf = rpcMallocCont(tlen);
ASSERT
(
taosArrayGetSize
(
rsp
.
blockDataLen
)
==
rsp
.
blockNum
);
if (buf == NULL) {
pMsg->code = -1;
taosMemoryFree(pHead);
return -1;
}
((SMqRspHead*)buf)->mqMsgType = TMQ_MSG_TYPE__POLL_RSP;
((SMqRspHead*)buf)->epoch = pReq->epoch;
((SMqRspHead*)buf)->consumerId = consumerId;
void* abuf = POINTER_SHIFT(buf, sizeof(SMqRspHead));
if
(
rsp
.
blockNum
!=
0
)
tEncodeSMqPollRsp(&abuf, &rsp);
rsp
.
rspOffset
=
fetchOffset
;
/*taosArrayDestroyEx(rsp.pBlockData, (void (*)(void*))tDeleteSSDataBlock);*/
else
pMsg->pCont = buf;
rsp
.
rspOffset
=
fetchOffset
-
1
;
pMsg->contLen = tlen;
pMsg->code = 0;
vDebug("vg %d offset %ld msgType %d from consumer %ld (epoch %d) actual rsp", TD_VID(pTq->pVnode), fetchOffset,
pHead->msgType, consumerId, pReq->epoch);
tmsgSendRsp(pMsg);
taosMemoryFree(pHead);
return 0;
} else {
taosMemoryFree(pHead);
fetchOffset++;
rsp.skipLogNum++;
}
}
/*if (blockingTime != 0) {*/
int32_t
tlen
=
sizeof
(
SMqRspHead
)
+
tEncodeSMqDataBlkRsp
(
NULL
,
&
rsp
);
/*tqAddClientPusher(pTq->tqPushMgr, pMsg, consumerId, blockingTime);*/
/*} else {*/
int32_t tlen = sizeof(SMqRspHead) + tEncodeSMqPollRsp(NULL, &rsp);
void
*
buf
=
rpcMallocCont
(
tlen
);
void
*
buf
=
rpcMallocCont
(
tlen
);
if
(
buf
==
NULL
)
{
if
(
buf
==
NULL
)
{
pMsg
->
code
=
-
1
;
pMsg
->
code
=
-
1
;
return
-
1
;
return
-
1
;
}
}
((
SMqRspHead
*
)
buf
)
->
mqMsgType
=
TMQ_MSG_TYPE__POLL_RSP
;
((
SMqRspHead
*
)
buf
)
->
mqMsgType
=
TMQ_MSG_TYPE__POLL_RSP
;
((
SMqRspHead
*
)
buf
)
->
epoch
=
pReq
->
epoch
;
((
SMqRspHead
*
)
buf
)
->
epoch
=
pReq
->
epoch
;
rsp.rspOffset = fetchOffset - 1
;
((
SMqRspHead
*
)
buf
)
->
consumerId
=
consumerId
;
void
*
abuf
=
POINTER_SHIFT
(
buf
,
sizeof
(
SMqRspHead
));
void
*
abuf
=
POINTER_SHIFT
(
buf
,
sizeof
(
SMqRspHead
));
tEncodeSMqPollRsp(&abuf, &rsp);
tEncodeSMqDataBlkRsp
(
&
abuf
,
&
rsp
);
rsp.pBlockData = NULL;
pMsg
->
pCont
=
buf
;
pMsg
->
pCont
=
buf
;
pMsg
->
contLen
=
tlen
;
pMsg
->
contLen
=
tlen
;
pMsg
->
code
=
0
;
pMsg
->
code
=
0
;
tmsgSendRsp
(
pMsg
);
tmsgSendRsp
(
pMsg
);
vDebug("vg %d offset %ld from consumer %ld (epoch %d) not rsp", TD_VID(pTq->pVnode), fetchOffset, consumerId,
pReq->epoch);
/*}*/
vDebug
(
"vg %d offset %ld from consumer %ld (epoch %d) send rsp, block num: %d, reqOffset: %ld, rspOffset: %ld"
,
TD_VID
(
pTq
->
pVnode
),
fetchOffset
,
consumerId
,
pReq
->
epoch
,
rsp
.
blockNum
,
rsp
.
reqOffset
,
rsp
.
rspOffset
);
// TODO destroy
taosArrayDestroy
(
rsp
.
blockData
);
taosArrayDestroy
(
rsp
.
blockDataLen
);
return
0
;
return
0
;
}
}
#endif
#if 0
int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg, int32_t workerId) {
int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg, int32_t workerId) {
SMqPollReq* pReq = pMsg->pCont;
SMqPollReq* pReq = pMsg->pCont;
int64_t consumerId = pReq->consumerId;
int64_t consumerId = pReq->consumerId;
...
@@ -436,7 +369,7 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg, int32_t workerId) {
...
@@ -436,7 +369,7 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg, int32_t workerId) {
int32_t reqEpoch = pReq->epoch;
int32_t reqEpoch = pReq->epoch;
if (pReq->currentOffset == TMQ_CONF__RESET_OFFSET__EARLIEAST) {
if (pReq->currentOffset == TMQ_CONF__RESET_OFFSET__EARLIEAST) {
fetchOffset
=
0
;
fetchOffset =
walGetFirstVer(pTq->pWal)
;
} else if (pReq->currentOffset == TMQ_CONF__RESET_OFFSET__LATEST) {
} else if (pReq->currentOffset == TMQ_CONF__RESET_OFFSET__LATEST) {
fetchOffset = walGetLastVer(pTq->pWal);
fetchOffset = walGetLastVer(pTq->pWal);
} else {
} else {
...
@@ -635,7 +568,57 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg, int32_t workerId) {
...
@@ -635,7 +568,57 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg, int32_t workerId) {
return 0;
return 0;
}
}
#endif
// TODO: persist meta into tdb
int32_t
tqProcessVgChangeReq
(
STQ
*
pTq
,
char
*
msg
,
int32_t
msgLen
)
{
SMqRebVgReq
req
;
tDecodeSMqRebVgReq
(
msg
,
&
req
);
// todo lock
STqExec
*
pExec
=
taosHashGet
(
pTq
->
tqMetaNew
,
req
.
subKey
,
strlen
(
req
.
subKey
));
if
(
pExec
==
NULL
)
{
ASSERT
(
req
.
oldConsumerId
==
-
1
);
ASSERT
(
req
.
newConsumerId
!=
-
1
);
STqExec
exec
=
{
0
};
pExec
=
&
exec
;
/*taosInitRWLatch(&pExec->lock);*/
memcpy
(
pExec
->
subKey
,
req
.
subKey
,
TSDB_SUBSCRIBE_KEY_LEN
);
pExec
->
consumerId
=
req
.
newConsumerId
;
pExec
->
epoch
=
-
1
;
pExec
->
qmsg
=
req
.
qmsg
;
req
.
qmsg
=
NULL
;
pExec
->
pReadHandle
=
walOpenReadHandle
(
pTq
->
pVnode
->
pWal
);
for
(
int32_t
i
=
0
;
i
<
4
;
i
++
)
{
STqReadHandle
*
pReadHandle
=
tqInitSubmitMsgScanner
(
pTq
->
pVnodeMeta
);
SReadHandle
handle
=
{
.
reader
=
pReadHandle
,
.
meta
=
pTq
->
pVnodeMeta
,
};
pExec
->
task
[
i
]
=
qCreateStreamExecTaskInfo
(
pExec
->
qmsg
,
&
handle
);
ASSERT
(
pExec
->
task
[
i
]);
}
taosHashPut
(
pTq
->
tqMetaNew
,
req
.
subKey
,
strlen
(
req
.
subKey
),
pExec
,
sizeof
(
STqExec
));
return
0
;
}
else
{
/*if (req.newConsumerId != -1) {*/
/*taosWLockLatch(&pExec->lock);*/
ASSERT
(
pExec
->
consumerId
==
req
.
oldConsumerId
);
// TODO handle qmsg and exec modification
atomic_store_32
(
&
pExec
->
epoch
,
-
1
);
atomic_store_64
(
&
pExec
->
consumerId
,
req
.
newConsumerId
);
atomic_add_fetch_32
(
&
pExec
->
epoch
,
1
);
/*taosWUnLockLatch(&pExec->lock);*/
return
0
;
/*} else {*/
// TODO
/*taosHashRemove(pTq->tqMetaNew, req.subKey, strlen(req.subKey));*/
/*return 0;*/
/*}*/
}
}
#if 0
int32_t tqProcessRebReq(STQ* pTq, char* msg) {
int32_t tqProcessRebReq(STQ* pTq, char* msg) {
SMqMVRebReq req = {0};
SMqMVRebReq req = {0};
terrno = TSDB_CODE_SUCCESS;
terrno = TSDB_CODE_SUCCESS;
...
@@ -754,6 +737,7 @@ int32_t tqProcessCancelConnReq(STQ* pTq, char* msg) {
...
@@ -754,6 +737,7 @@ int32_t tqProcessCancelConnReq(STQ* pTq, char* msg) {
terrno = TSDB_CODE_SUCCESS;
terrno = TSDB_CODE_SUCCESS;
return 0;
return 0;
}
}
#endif
int32_t
tqExpandTask
(
STQ
*
pTq
,
SStreamTask
*
pTask
,
int32_t
parallel
)
{
int32_t
tqExpandTask
(
STQ
*
pTq
,
SStreamTask
*
pTask
,
int32_t
parallel
)
{
if
(
pTask
->
execType
==
TASK_EXEC__NONE
)
return
0
;
if
(
pTask
->
execType
==
TASK_EXEC__NONE
)
return
0
;
...
...
source/dnode/vnode/src/tq/tqMetaStore.c
浏览文件 @
395d9e8b
...
@@ -13,7 +13,6 @@
...
@@ -13,7 +13,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
*/
#include "vnodeInt.h"
#include "vnodeInt.h"
// TODO:replace by an abstract file layer
// #include <fcntl.h>
// #include <fcntl.h>
// #include <string.h>
// #include <string.h>
// #include <unistd.h>
// #include <unistd.h>
...
...
source/dnode/vnode/src/vnd/vnodeSvr.c
浏览文件 @
395d9e8b
此差异已折叠。
点击以展开。
source/libs/function/inc/fnLog.h
0 → 100644
浏览文件 @
395d9e8b
此差异已折叠。
点击以展开。
source/libs/function/inc/tudf.h
浏览文件 @
395d9e8b
此差异已折叠。
点击以展开。
source/libs/function/inc/udfc.h
浏览文件 @
395d9e8b
此差异已折叠。
点击以展开。
source/libs/function/src/builtins.c
浏览文件 @
395d9e8b
此差异已折叠。
点击以展开。
source/libs/function/src/tudf.c
浏览文件 @
395d9e8b
此差异已折叠。
点击以展开。
source/libs/function/src/udfd.c
浏览文件 @
395d9e8b
此差异已折叠。
点击以展开。
source/libs/function/test/runUdf.c
浏览文件 @
395d9e8b
此差异已折叠。
点击以展开。
source/libs/nodes/src/nodesUtilFuncs.c
浏览文件 @
395d9e8b
此差异已折叠。
点击以展开。
source/libs/parser/inc/parInsertData.h
浏览文件 @
395d9e8b
此差异已折叠。
点击以展开。
source/libs/parser/inc/parInt.h
浏览文件 @
395d9e8b
此差异已折叠。
点击以展开。
source/libs/parser/inc/parUtil.h
浏览文件 @
395d9e8b
此差异已折叠。
点击以展开。
source/libs/parser/src/parAstCreater.c
浏览文件 @
395d9e8b
此差异已折叠。
点击以展开。
source/libs/parser/src/parInsert.c
浏览文件 @
395d9e8b
此差异已折叠。
点击以展开。
source/libs/parser/src/parInsertData.c
浏览文件 @
395d9e8b
此差异已折叠。
点击以展开。
source/libs/parser/src/parTranslater.c
浏览文件 @
395d9e8b
此差异已折叠。
点击以展开。
source/libs/parser/src/parUtil.c
浏览文件 @
395d9e8b
此差异已折叠。
点击以展开。
source/libs/parser/src/parser.c
浏览文件 @
395d9e8b
此差异已折叠。
点击以展开。
source/libs/scalar/inc/filterInt.h
浏览文件 @
395d9e8b
此差异已折叠。
点击以展开。
source/libs/scalar/inc/sclvector.h
浏览文件 @
395d9e8b
此差异已折叠。
点击以展开。
source/libs/scalar/src/filter.c
浏览文件 @
395d9e8b
此差异已折叠。
点击以展开。
source/libs/scalar/src/scalar.c
浏览文件 @
395d9e8b
此差异已折叠。
点击以展开。
source/libs/scalar/src/sclfunc.c
浏览文件 @
395d9e8b
此差异已折叠。
点击以展开。
source/libs/scalar/src/sclvector.c
浏览文件 @
395d9e8b
此差异已折叠。
点击以展开。
source/libs/scalar/test/scalar/CMakeLists.txt
浏览文件 @
395d9e8b
此差异已折叠。
点击以展开。
source/libs/scalar/test/scalar/scalarTests.cpp
浏览文件 @
395d9e8b
此差异已折叠。
点击以展开。
source/os/src/osFile.c
浏览文件 @
395d9e8b
此差异已折叠。
点击以展开。
source/util/src/tarray.c
浏览文件 @
395d9e8b
此差异已折叠。
点击以展开。
source/util/src/tcompare.c
浏览文件 @
395d9e8b
此差异已折叠。
点击以展开。
source/util/src/terror.c
浏览文件 @
395d9e8b
此差异已折叠。
点击以展开。
source/util/src/tjson.c
浏览文件 @
395d9e8b
此差异已折叠。
点击以展开。
source/util/src/tlog.c
浏览文件 @
395d9e8b
此差异已折叠。
点击以展开。
source/util/src/tutil.c
浏览文件 @
395d9e8b
此差异已折叠。
点击以展开。
tests/pytest/insert/binary.py
浏览文件 @
395d9e8b
此差异已折叠。
点击以展开。
tests/script/api/batchprepare.c
浏览文件 @
395d9e8b
此差异已折叠。
点击以展开。
tests/script/api/makefile
浏览文件 @
395d9e8b
此差异已折叠。
点击以展开。
tests/script/jenkins/basic.txt
浏览文件 @
395d9e8b
此差异已折叠。
点击以展开。
tests/script/sh/checkValgrind.sh
0 → 100755
浏览文件 @
395d9e8b
此差异已折叠。
点击以展开。
tests/script/tsim/tmq/basic1.sim
浏览文件 @
395d9e8b
此差异已折叠。
点击以展开。
tests/script/tsim/valgrind/checkError.sim
0 → 100644
浏览文件 @
395d9e8b
此差异已折叠。
点击以展开。
tests/system-test/fulltest.sh
浏览文件 @
395d9e8b
此差异已折叠。
点击以展开。
tests/tsim/src/simExe.c
浏览文件 @
395d9e8b
此差异已折叠。
点击以展开。
tools/shell/src/shellEngine.c
浏览文件 @
395d9e8b
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录