Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
fe7f246c
T
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1192
Star
22018
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
fe7f246c
编写于
4月 29, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'origin/3.0' into feature/dnode
上级
02400c15
45e8eeb9
变更
78
展开全部
隐藏空白更改
内联
并排
Showing
78 changed file
with
2632 addition
and
1603 deletion
+2632
-1603
contrib/CMakeLists.txt
contrib/CMakeLists.txt
+1
-1
example/src/tstream.c
example/src/tstream.c
+7
-4
include/client/taos.h
include/client/taos.h
+38
-40
include/common/systable.h
include/common/systable.h
+78
-0
include/common/tcommon.h
include/common/tcommon.h
+6
-8
include/common/tmsg.h
include/common/tmsg.h
+1
-1
include/common/trow.h
include/common/trow.h
+29
-2
include/libs/executor/dataSinkMgt.h
include/libs/executor/dataSinkMgt.h
+1
-0
include/libs/executor/executor.h
include/libs/executor/executor.h
+1
-0
include/libs/function/function.h
include/libs/function/function.h
+1
-1
include/libs/function/functionMgt.h
include/libs/function/functionMgt.h
+1
-0
include/libs/stream/tstream.h
include/libs/stream/tstream.h
+0
-19
include/util/tdef.h
include/util/tdef.h
+0
-59
source/client/src/tmq.c
source/client/src/tmq.c
+3
-1
source/client/test/clientTests.cpp
source/client/test/clientTests.cpp
+7
-2
source/common/src/systable.c
source/common/src/systable.c
+340
-0
source/dnode/mnode/impl/inc/mndConsumer.h
source/dnode/mnode/impl/inc/mndConsumer.h
+5
-0
source/dnode/mnode/impl/inc/mndDef.h
source/dnode/mnode/impl/inc/mndDef.h
+0
-3
source/dnode/mnode/impl/inc/mndInfoSchema.h
source/dnode/mnode/impl/inc/mndInfoSchema.h
+0
-12
source/dnode/mnode/impl/inc/mndPerfSchema.h
source/dnode/mnode/impl/inc/mndPerfSchema.h
+0
-12
source/dnode/mnode/impl/inc/mndShow.h
source/dnode/mnode/impl/inc/mndShow.h
+1
-0
source/dnode/mnode/impl/inc/mndTrans.h
source/dnode/mnode/impl/inc/mndTrans.h
+2
-2
source/dnode/mnode/impl/src/mndBnode.c
source/dnode/mnode/impl/src/mndBnode.c
+1
-1
source/dnode/mnode/impl/src/mndCluster.c
source/dnode/mnode/impl/src/mndCluster.c
+1
-1
source/dnode/mnode/impl/src/mndConsumer.c
source/dnode/mnode/impl/src/mndConsumer.c
+14
-5
source/dnode/mnode/impl/src/mndDb.c
source/dnode/mnode/impl/src/mndDb.c
+9
-6
source/dnode/mnode/impl/src/mndDef.c
source/dnode/mnode/impl/src/mndDef.c
+6
-0
source/dnode/mnode/impl/src/mndDnode.c
source/dnode/mnode/impl/src/mndDnode.c
+1
-1
source/dnode/mnode/impl/src/mndFunc.c
source/dnode/mnode/impl/src/mndFunc.c
+4
-4
source/dnode/mnode/impl/src/mndInfoSchema.c
source/dnode/mnode/impl/src/mndInfoSchema.c
+10
-251
source/dnode/mnode/impl/src/mndMnode.c
source/dnode/mnode/impl/src/mndMnode.c
+2
-2
source/dnode/mnode/impl/src/mndPerfSchema.c
source/dnode/mnode/impl/src/mndPerfSchema.c
+10
-88
source/dnode/mnode/impl/src/mndProfile.c
source/dnode/mnode/impl/src/mndProfile.c
+33
-32
source/dnode/mnode/impl/src/mndQnode.c
source/dnode/mnode/impl/src/mndQnode.c
+1
-1
source/dnode/mnode/impl/src/mndQuery.c
source/dnode/mnode/impl/src/mndQuery.c
+1
-1
source/dnode/mnode/impl/src/mndScheduler.c
source/dnode/mnode/impl/src/mndScheduler.c
+3
-5
source/dnode/mnode/impl/src/mndShow.c
source/dnode/mnode/impl/src/mndShow.c
+15
-24
source/dnode/mnode/impl/src/mndSnode.c
source/dnode/mnode/impl/src/mndSnode.c
+1
-1
source/dnode/mnode/impl/src/mndStream.c
source/dnode/mnode/impl/src/mndStream.c
+9
-2
source/dnode/mnode/impl/src/mndSubscribe.c
source/dnode/mnode/impl/src/mndSubscribe.c
+5
-2
source/dnode/mnode/impl/src/mndTrans.c
source/dnode/mnode/impl/src/mndTrans.c
+9
-4
source/dnode/mnode/impl/src/mndUser.c
source/dnode/mnode/impl/src/mndUser.c
+1
-1
source/dnode/mnode/impl/src/mndVgroup.c
source/dnode/mnode/impl/src/mndVgroup.c
+1
-1
source/dnode/vnode/inc/vnode.h
source/dnode/vnode/inc/vnode.h
+4
-4
source/dnode/vnode/src/inc/vnodeInt.h
source/dnode/vnode/src/inc/vnodeInt.h
+13
-8
source/dnode/vnode/src/meta/metaQuery.c
source/dnode/vnode/src/meta/metaQuery.c
+2
-2
source/dnode/vnode/src/tq/tq.c
source/dnode/vnode/src/tq/tq.c
+1
-1
source/dnode/vnode/src/tsdb/tsdbRead.c
source/dnode/vnode/src/tsdb/tsdbRead.c
+6
-6
source/dnode/vnode/src/vnd/vnodeQuery.c
source/dnode/vnode/src/vnd/vnodeQuery.c
+20
-0
source/dnode/vnode/src/vnd/vnodeSvr.c
source/dnode/vnode/src/vnd/vnodeSvr.c
+3
-1
source/libs/catalog/src/catalog.c
source/libs/catalog/src/catalog.c
+1
-0
source/libs/executor/inc/executorimpl.h
source/libs/executor/inc/executorimpl.h
+2
-1
source/libs/executor/src/dataDispatcher.c
source/libs/executor/src/dataDispatcher.c
+3
-0
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+163
-141
source/libs/executor/src/scanoperator.c
source/libs/executor/src/scanoperator.c
+240
-110
source/libs/function/inc/builtinsimpl.h
source/libs/function/inc/builtinsimpl.h
+5
-0
source/libs/function/src/builtins.c
source/libs/function/src/builtins.c
+546
-431
source/libs/function/src/builtinsimpl.c
source/libs/function/src/builtinsimpl.c
+345
-231
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+7
-6
source/libs/planner/src/planPhysiCreater.c
source/libs/planner/src/planPhysiCreater.c
+1
-0
source/libs/qcom/src/querymsg.c
source/libs/qcom/src/querymsg.c
+1
-0
source/libs/qworker/src/qworkerMsg.c
source/libs/qworker/src/qworkerMsg.c
+1
-0
source/libs/scalar/src/sclfunc.c
source/libs/scalar/src/sclfunc.c
+61
-11
source/libs/stream/src/tstream.c
source/libs/stream/src/tstream.c
+0
-6
source/libs/stream/src/tstreamUpdate.c
source/libs/stream/src/tstreamUpdate.c
+19
-11
source/libs/stream/test/tstreamUpdateTest.cpp
source/libs/stream/test/tstreamUpdateTest.cpp
+10
-0
source/libs/transport/src/transSrv.c
source/libs/transport/src/transSrv.c
+4
-3
source/os/src/osDir.c
source/os/src/osDir.c
+2
-2
source/os/src/osFile.c
source/os/src/osFile.c
+4
-18
source/os/src/osSysinfo.c
source/os/src/osSysinfo.c
+10
-0
source/util/src/tconfig.c
source/util/src/tconfig.c
+5
-5
tests/script/tsim/query/complex_having.sim
tests/script/tsim/query/complex_having.sim
+1
-0
tests/script/tsim/show/basic.sim
tests/script/tsim/show/basic.sim
+2
-2
tests/system-test/0-others/taosShell.py
tests/system-test/0-others/taosShell.py
+5
-3
tests/system-test/0-others/taosShellError.py
tests/system-test/0-others/taosShellError.py
+282
-0
tests/system-test/0-others/taosShellNetChk.py
tests/system-test/0-others/taosShellNetChk.py
+202
-0
tests/system-test/fulltest.sh
tests/system-test/fulltest.sh
+1
-0
tests/test-all.sh
tests/test-all.sh
+1
-0
未找到文件。
contrib/CMakeLists.txt
浏览文件 @
fe7f246c
...
@@ -228,7 +228,7 @@ endif()
...
@@ -228,7 +228,7 @@ endif()
# iconv
# iconv
if
(
${
BUILD_WITH_ICONV
}
)
if
(
${
BUILD_WITH_ICONV
}
)
add_
subdirectory
(
iconv EXCLUDE_FROM_ALL
)
add_
library
(
iconv STATIC iconv/win_iconv.c
)
endif
(
${
BUILD_WITH_ICONV
}
)
endif
(
${
BUILD_WITH_ICONV
}
)
# wingetopt
# wingetopt
...
...
example/src/tstream.c
浏览文件 @
fe7f246c
...
@@ -25,7 +25,7 @@ int32_t init_env() {
...
@@ -25,7 +25,7 @@ int32_t init_env() {
return
-
1
;
return
-
1
;
}
}
TAOS_RES
*
pRes
=
taos_query
(
pConn
,
"create database if not exists abc1 vgroups
2
"
);
TAOS_RES
*
pRes
=
taos_query
(
pConn
,
"create database if not exists abc1 vgroups
1
"
);
if
(
taos_errno
(
pRes
)
!=
0
)
{
if
(
taos_errno
(
pRes
)
!=
0
)
{
printf
(
"error in create db, reason:%s
\n
"
,
taos_errstr
(
pRes
));
printf
(
"error in create db, reason:%s
\n
"
,
taos_errstr
(
pRes
));
return
-
1
;
return
-
1
;
...
@@ -78,11 +78,14 @@ int32_t create_stream() {
...
@@ -78,11 +78,14 @@ int32_t create_stream() {
taos_free_result
(
pRes
);
taos_free_result
(
pRes
);
/*const char* sql = "select min(k), max(k), sum(k) from tu1";*/
/*const char* sql = "select min(k), max(k), sum(k) from tu1";*/
const
char
*
sql
=
"select min(k), max(k), sum(k) as sum_of_k from st1"
;
/*const char* sql = "select min(k), max(k), sum(k) as sum_of_k from st1";*/
/*const char* sql = "select sum(k) from tu1 interval(10m)";*/
/*const char* sql = "select sum(k) from tu1 interval(10m)";*/
pRes
=
tmq_create_stream
(
pConn
,
"stream1"
,
"out1"
,
sql
);
/*pRes = tmq_create_stream(pConn, "stream1", "out1", sql);*/
pRes
=
taos_query
(
pConn
,
"create stream stream1 trigger window_close as select min(k), max(k), sum(k) as sum_of_k from tu1 interval(10m)"
);
if
(
taos_errno
(
pRes
)
!=
0
)
{
if
(
taos_errno
(
pRes
)
!=
0
)
{
printf
(
"failed to create stream
out
1, reason:%s
\n
"
,
taos_errstr
(
pRes
));
printf
(
"failed to create stream
stream
1, reason:%s
\n
"
,
taos_errstr
(
pRes
));
return
-
1
;
return
-
1
;
}
}
taos_free_result
(
pRes
);
taos_free_result
(
pRes
);
...
...
include/client/taos.h
浏览文件 @
fe7f246c
...
@@ -86,9 +86,9 @@ typedef struct taosField {
...
@@ -86,9 +86,9 @@ typedef struct taosField {
}
TAOS_FIELD
;
}
TAOS_FIELD
;
#ifdef WINDOWS
#ifdef WINDOWS
#define DLL_EXPORT
__declspec(dllexport)
#define DLL_EXPORT
__declspec(dllexport)
#else
#else
#define DLL_EXPORT
#define DLL_EXPORT
#endif
#endif
typedef
void
(
*
__taos_async_fn_t
)(
void
*
param
,
TAOS_RES
*
,
int
code
);
typedef
void
(
*
__taos_async_fn_t
)(
void
*
param
,
TAOS_RES
*
,
int
code
);
...
@@ -123,42 +123,42 @@ DLL_EXPORT int taos_options(TSDB_OPTION option, const void *arg, ...);
...
@@ -123,42 +123,42 @@ DLL_EXPORT int taos_options(TSDB_OPTION option, const void *arg, ...);
DLL_EXPORT
setConfRet
taos_set_config
(
const
char
*
config
);
DLL_EXPORT
setConfRet
taos_set_config
(
const
char
*
config
);
DLL_EXPORT
int
taos_init
(
void
);
DLL_EXPORT
int
taos_init
(
void
);
DLL_EXPORT
TAOS
*
taos_connect
(
const
char
*
ip
,
const
char
*
user
,
const
char
*
pass
,
const
char
*
db
,
uint16_t
port
);
DLL_EXPORT
TAOS
*
taos_connect
(
const
char
*
ip
,
const
char
*
user
,
const
char
*
pass
,
const
char
*
db
,
uint16_t
port
);
DLL_EXPORT
TAOS
*
taos_connect_l
(
const
char
*
ip
,
int
ipLen
,
const
char
*
user
,
int
userLen
,
const
char
*
pass
,
int
passLen
,
DLL_EXPORT
TAOS
*
taos_connect_l
(
const
char
*
ip
,
int
ipLen
,
const
char
*
user
,
int
userLen
,
const
char
*
pass
,
int
passLen
,
const
char
*
db
,
int
dbLen
,
uint16_t
port
);
const
char
*
db
,
int
dbLen
,
uint16_t
port
);
DLL_EXPORT
TAOS
*
taos_connect_auth
(
const
char
*
ip
,
const
char
*
user
,
const
char
*
auth
,
const
char
*
db
,
uint16_t
port
);
DLL_EXPORT
TAOS
*
taos_connect_auth
(
const
char
*
ip
,
const
char
*
user
,
const
char
*
auth
,
const
char
*
db
,
uint16_t
port
);
DLL_EXPORT
void
taos_close
(
TAOS
*
taos
);
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_MULTI_BIND
*
tags
);
DLL_EXPORT
int
taos_stmt_set_tbname_tags
(
TAOS_STMT
*
stmt
,
const
char
*
name
,
TAOS_MULTI_BIND
*
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_MULTI_BIND
*
bind
);
DLL_EXPORT
int
taos_stmt_bind_param
(
TAOS_STMT
*
stmt
,
TAOS_MULTI_BIND
*
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_MULTI_BIND
*
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_MULTI_BIND
*
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
int
taos_stmt_affected_rows_once
(
TAOS_STMT
*
stmt
);
DLL_EXPORT
int
taos_stmt_affected_rows_once
(
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
);
...
@@ -271,10 +271,8 @@ DLL_EXPORT int64_t tmq_get_response_offset(tmq_message_t *message);
...
@@ -271,10 +271,8 @@ DLL_EXPORT int64_t tmq_get_response_offset(tmq_message_t *message);
/* --------------------TMPORARY INTERFACE FOR TESTING--------------------- */
/* --------------------TMPORARY INTERFACE FOR TESTING--------------------- */
#if 0
#if 0
DLL_EXPORT TAOS_RES *tmq_create_topic(TAOS *taos, const char *name, const char *sql, int sqlLen);
DLL_EXPORT TAOS_RES *tmq_create_topic(TAOS *taos, const char *name, const char *sql, int sqlLen);
#endif
DLL_EXPORT TAOS_RES *tmq_create_stream(TAOS *taos, const char *streamName, const char *tbName, const char *sql);
DLL_EXPORT TAOS_RES *tmq_create_stream(TAOS *taos, const char *streamName, const char *tbName, const char *sql);
#endif
/* ------------------------------ TMQ END -------------------------------- */
/* ------------------------------ TMQ END -------------------------------- */
#if 1 // Shuduo: temporary enable for app build
#if 1 // Shuduo: temporary enable for app build
typedef
void
(
*
TAOS_SUBSCRIBE_CALLBACK
)(
TAOS_SUB
*
tsub
,
TAOS_RES
*
res
,
void
*
param
,
int
code
);
typedef
void
(
*
TAOS_SUBSCRIBE_CALLBACK
)(
TAOS_SUB
*
tsub
,
TAOS_RES
*
res
,
void
*
param
,
int
code
);
...
...
include/common/systable.h
0 → 100644
浏览文件 @
fe7f246c
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef __cplusplus
extern
"C"
{
#endif
#include "os.h"
#ifndef TDENGINE_SYSTABLE_H
#define TDENGINE_SYSTABLE_H
#define TSDB_INFORMATION_SCHEMA_DB "information_schema"
#define TSDB_PERFORMANCE_SCHEMA_DB "performance_schema"
#define TSDB_INS_TABLE_DNODES "dnodes"
#define TSDB_INS_TABLE_MNODES "mnodes"
#define TSDB_INS_TABLE_MODULES "modules"
#define TSDB_INS_TABLE_QNODES "qnodes"
#define TSDB_INS_TABLE_BNODES "bnodes"
#define TSDB_INS_TABLE_SNODES "snodes"
#define TSDB_INS_TABLE_CLUSTER "cluster"
#define TSDB_INS_TABLE_USER_DATABASES "user_databases"
#define TSDB_INS_TABLE_USER_FUNCTIONS "user_functions"
#define TSDB_INS_TABLE_USER_INDEXES "user_indexes"
#define TSDB_INS_TABLE_USER_STABLES "user_stables"
#define TSDB_INS_TABLE_USER_STREAMS "user_streams"
#define TSDB_INS_TABLE_USER_TABLES "user_tables"
#define TSDB_INS_TABLE_USER_TABLE_DISTRIBUTED "user_table_distributed"
#define TSDB_INS_TABLE_USER_USERS "user_users"
#define TSDB_INS_TABLE_LICENCES "grants"
#define TSDB_INS_TABLE_VGROUPS "vgroups"
#define TSDB_INS_TABLE_VNODES "vnodes"
#define TSDB_INS_TABLE_CONFIGS "configs"
#define TSDB_PERFORMANCE_SCHEMA_DB "performance_schema"
#define TSDB_PERFS_TABLE_SMAS "smas"
#define TSDB_PERFS_TABLE_SUBSCRIBES "subscribes"
#define TSDB_PERFS_TABLE_CONNECTIONS "connections"
#define TSDB_PERFS_TABLE_QUERIES "queries"
#define TSDB_PERFS_TABLE_TOPICS "topics"
#define TSDB_PERFS_TABLE_CONSUMERS "consumers"
#define TSDB_PERFS_TABLE_SUBSCRIPTIONS "subscriptions"
#define TSDB_PERFS_TABLE_OFFSETS "offsets"
#define TSDB_PERFS_TABLE_TRANS "trans"
#define TSDB_PERFS_TABLE_STREAMS "streams"
typedef
struct
SSysDbTableSchema
{
const
char
*
name
;
const
int32_t
type
;
const
int32_t
bytes
;
}
SSysDbTableSchema
;
typedef
struct
SSysTableMeta
{
const
char
*
name
;
const
SSysDbTableSchema
*
schema
;
const
int32_t
colNum
;
}
SSysTableMeta
;
void
getInfosDbMeta
(
const
SSysTableMeta
**
pInfosTableMeta
,
size_t
*
size
);
void
getPerfDbMeta
(
const
SSysTableMeta
**
pPerfsTableMeta
,
size_t
*
size
);
#ifdef __cplusplus
}
#endif
#endif // TDENGINE_SYSTABLE_H
include/common/tcommon.h
浏览文件 @
fe7f246c
...
@@ -65,14 +65,12 @@ typedef struct SDataBlockInfo {
...
@@ -65,14 +65,12 @@ typedef struct SDataBlockInfo {
STimeWindow
window
;
STimeWindow
window
;
int32_t
rows
;
int32_t
rows
;
int32_t
rowSize
;
int32_t
rowSize
;
union
{
int64_t
uid
;
// the uid of table, from which current data block comes
int64_t
uid
;
// from which table of uid, comes from this data block
int64_t
blockId
;
// block id, generated by physical planner
int64_t
blockId
;
uint64_t
groupId
;
// no need to serialize
};
int16_t
numOfCols
;
uint64_t
groupId
;
// no need to serialize
int16_t
hasVarCol
;
int16_t
numOfCols
;
int16_t
capacity
;
int16_t
hasVarCol
;
int16_t
capacity
;
}
SDataBlockInfo
;
}
SDataBlockInfo
;
typedef
struct
SSDataBlock
{
typedef
struct
SSDataBlock
{
...
...
include/common/tmsg.h
浏览文件 @
fe7f246c
...
@@ -1038,6 +1038,7 @@ typedef struct {
...
@@ -1038,6 +1038,7 @@ typedef struct {
int8_t
compressed
;
int8_t
compressed
;
int32_t
compLen
;
int32_t
compLen
;
int32_t
numOfRows
;
int32_t
numOfRows
;
int32_t
numOfCols
;
char
data
[];
char
data
[];
}
SRetrieveTableRsp
;
}
SRetrieveTableRsp
;
...
@@ -1473,7 +1474,6 @@ _err:
...
@@ -1473,7 +1474,6 @@ _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
;
...
...
include/common/trow.h
浏览文件 @
fe7f246c
...
@@ -595,6 +595,34 @@ static FORCE_INLINE int32_t tdSRowSetInfo(SRowBuilder *pBuilder, int32_t nCols,
...
@@ -595,6 +595,34 @@ static FORCE_INLINE int32_t tdSRowSetInfo(SRowBuilder *pBuilder, int32_t nCols,
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
/**
* @brief
*
* @param pBuilder
* @param nCols
* @param nBoundCols use -1 if not available
* @param flen
* @return FORCE_INLINE
*/
static
FORCE_INLINE
int32_t
tdSRowSetTpInfo
(
SRowBuilder
*
pBuilder
,
int32_t
nCols
,
int32_t
flen
)
{
pBuilder
->
flen
=
flen
;
pBuilder
->
nCols
=
nCols
;
if
(
pBuilder
->
flen
<=
0
||
pBuilder
->
nCols
<=
0
)
{
TASSERT
(
0
);
terrno
=
TSDB_CODE_INVALID_PARA
;
return
terrno
;
}
#ifdef TD_SUPPORT_BITMAP
// the primary TS key is stored separatedly
pBuilder
->
nBitmaps
=
(
int16_t
)
TD_BITMAP_BYTES
(
pBuilder
->
nCols
-
1
);
#else
pBuilder
->
nBitmaps
=
0
;
pBuilder
->
nBoundBitmaps
=
0
;
#endif
return
TSDB_CODE_SUCCESS
;
}
/**
/**
* @brief To judge row type: STpRow/SKvRow
* @brief To judge row type: STpRow/SKvRow
*
*
...
@@ -1376,7 +1404,7 @@ static void tdSRowPrint(STSRow *row, STSchema *pSchema, const char* tag) {
...
@@ -1376,7 +1404,7 @@ static void tdSRowPrint(STSRow *row, STSchema *pSchema, const char* tag) {
printf
(
"%s >>>"
,
tag
);
printf
(
"%s >>>"
,
tag
);
for
(
int
i
=
0
;
i
<
pSchema
->
numOfCols
;
++
i
)
{
for
(
int
i
=
0
;
i
<
pSchema
->
numOfCols
;
++
i
)
{
STColumn
*
stCol
=
pSchema
->
columns
+
i
;
STColumn
*
stCol
=
pSchema
->
columns
+
i
;
SCellVal
sVal
=
{
.
valType
=
255
,
.
val
=
NULL
};
SCellVal
sVal
=
{
255
,
NULL
};
if
(
!
tdSTSRowIterNext
(
&
iter
,
stCol
->
colId
,
stCol
->
type
,
&
sVal
))
{
if
(
!
tdSTSRowIterNext
(
&
iter
,
stCol
->
colId
,
stCol
->
type
,
&
sVal
))
{
break
;
break
;
}
}
...
@@ -1385,7 +1413,6 @@ static void tdSRowPrint(STSRow *row, STSchema *pSchema, const char* tag) {
...
@@ -1385,7 +1413,6 @@ static void tdSRowPrint(STSRow *row, STSchema *pSchema, const char* tag) {
}
}
printf
(
"
\n
"
);
printf
(
"
\n
"
);
}
}
#ifdef TROW_ORIGIN_HZ
#ifdef TROW_ORIGIN_HZ
typedef
struct
{
typedef
struct
{
uint32_t
nRows
;
uint32_t
nRows
;
...
...
include/libs/executor/dataSinkMgt.h
浏览文件 @
fe7f246c
...
@@ -45,6 +45,7 @@ typedef struct SInputData {
...
@@ -45,6 +45,7 @@ typedef struct SInputData {
typedef
struct
SOutputData
{
typedef
struct
SOutputData
{
int32_t
numOfRows
;
int32_t
numOfRows
;
int32_t
numOfCols
;
int8_t
compressed
;
int8_t
compressed
;
char
*
pData
;
char
*
pData
;
bool
queryEnd
;
bool
queryEnd
;
...
...
include/libs/executor/executor.h
浏览文件 @
fe7f246c
...
@@ -33,6 +33,7 @@ typedef struct SReadHandle {
...
@@ -33,6 +33,7 @@ typedef struct SReadHandle {
void
*
meta
;
void
*
meta
;
void
*
config
;
void
*
config
;
void
*
vnode
;
void
*
vnode
;
void
*
mnd
;
}
SReadHandle
;
}
SReadHandle
;
#define STREAM_DATA_TYPE_SUBMIT_BLOCK 0x1
#define STREAM_DATA_TYPE_SUBMIT_BLOCK 0x1
...
...
include/libs/function/function.h
浏览文件 @
fe7f246c
...
@@ -165,7 +165,7 @@ typedef struct SInputColumnInfoData {
...
@@ -165,7 +165,7 @@ typedef struct SInputColumnInfoData {
SColumnInfoData
*
pPTS
;
// primary timestamp column
SColumnInfoData
*
pPTS
;
// primary timestamp column
SColumnInfoData
**
pData
;
SColumnInfoData
**
pData
;
SColumnDataAgg
**
pColumnDataAgg
;
SColumnDataAgg
**
pColumnDataAgg
;
uint64_t
uid
;
// table uid
uint64_t
uid
;
// table uid
, used to set the tag value when building the final query result for selectivity functions.
}
SInputColumnInfoData
;
}
SInputColumnInfoData
;
// sql function runtime context
// sql function runtime context
...
...
include/libs/function/functionMgt.h
浏览文件 @
fe7f246c
...
@@ -40,6 +40,7 @@ typedef enum EFunctionType {
...
@@ -40,6 +40,7 @@ typedef enum EFunctionType {
FUNCTION_TYPE_STDDEV
,
FUNCTION_TYPE_STDDEV
,
FUNCTION_TYPE_SUM
,
FUNCTION_TYPE_SUM
,
FUNCTION_TYPE_TWA
,
FUNCTION_TYPE_TWA
,
FUNCTION_TYPE_HISTOGRAM
,
// nonstandard SQL function
// nonstandard SQL function
FUNCTION_TYPE_BOTTOM
=
500
,
FUNCTION_TYPE_BOTTOM
=
500
,
...
...
include/libs/stream/tstream.h
浏览文件 @
fe7f246c
...
@@ -35,19 +35,6 @@ enum {
...
@@ -35,19 +35,6 @@ enum {
STREAM_CREATED_BY__SMA
,
STREAM_CREATED_BY__SMA
,
};
};
#if 0
// pipe -> fetch/pipe queue
// merge -> merge queue
// write -> write queue
enum {
TASK_DISPATCH_MSG__SND_PIPE = 1,
TASK_DISPATCH_MSG__SND_MERGE,
TASK_DISPATCH_MSG__VND_PIPE,
TASK_DISPATCH_MSG__VND_MERGE,
TASK_DISPATCH_MSG__VND_WRITE,
};
#endif
typedef
struct
{
typedef
struct
{
int32_t
nodeId
;
// 0 for snode
int32_t
nodeId
;
// 0 for snode
SEpSet
epSet
;
SEpSet
epSet
;
...
@@ -100,10 +87,6 @@ typedef struct {
...
@@ -100,10 +87,6 @@ typedef struct {
int8_t
reserved
;
int8_t
reserved
;
}
STaskSinkFetch
;
}
STaskSinkFetch
;
typedef
struct
{
int8_t
reserved
;
}
STaskSinkShow
;
enum
{
enum
{
TASK_SOURCE__SCAN
=
1
,
TASK_SOURCE__SCAN
=
1
,
TASK_SOURCE__PIPE
,
TASK_SOURCE__PIPE
,
...
@@ -128,7 +111,6 @@ enum {
...
@@ -128,7 +111,6 @@ enum {
TASK_SINK__TABLE
,
TASK_SINK__TABLE
,
TASK_SINK__SMA
,
TASK_SINK__SMA
,
TASK_SINK__FETCH
,
TASK_SINK__FETCH
,
TASK_SINK__SHOW
,
};
};
typedef
struct
{
typedef
struct
{
...
@@ -155,7 +137,6 @@ typedef struct {
...
@@ -155,7 +137,6 @@ typedef struct {
STaskSinkTb
tbSink
;
STaskSinkTb
tbSink
;
STaskSinkSma
smaSink
;
STaskSinkSma
smaSink
;
STaskSinkFetch
fetchSink
;
STaskSinkFetch
fetchSink
;
STaskSinkShow
showSink
;
};
};
// dispatch
// dispatch
...
...
include/util/tdef.h
浏览文件 @
fe7f246c
...
@@ -97,43 +97,6 @@ extern const int32_t TYPE_BYTES[15];
...
@@ -97,43 +97,6 @@ extern const int32_t TYPE_BYTES[15];
#define TSDB_TIME_PRECISION_MICRO_DIGITS 16
#define TSDB_TIME_PRECISION_MICRO_DIGITS 16
#define TSDB_TIME_PRECISION_NANO_DIGITS 19
#define TSDB_TIME_PRECISION_NANO_DIGITS 19
#define TSDB_INFORMATION_SCHEMA_DB "information_schema"
#define TSDB_PERFORMANCE_SCHEMA_DB "performance_schema"
#define TSDB_INS_TABLE_DNODES "dnodes"
#define TSDB_INS_TABLE_MNODES "mnodes"
#define TSDB_INS_TABLE_MODULES "modules"
#define TSDB_INS_TABLE_QNODES "qnodes"
#define TSDB_INS_TABLE_BNODES "bnodes"
#define TSDB_INS_TABLE_SNODES "snodes"
#define TSDB_INS_TABLE_CLUSTER "cluster"
#define TSDB_INS_TABLE_USER_DATABASES "user_databases"
#define TSDB_INS_TABLE_USER_FUNCTIONS "user_functions"
#define TSDB_INS_TABLE_USER_INDEXES "user_indexes"
#define TSDB_INS_TABLE_USER_STABLES "user_stables"
#define TSDB_INS_TABLE_USER_STREAMS "user_streams"
#define TSDB_INS_TABLE_USER_TABLES "user_tables"
#define TSDB_INS_TABLE_USER_TABLE_DISTRIBUTED "user_table_distributed"
#define TSDB_INS_TABLE_USER_USERS "user_users"
#define TSDB_INS_TABLE_LICENCES "grants"
#define TSDB_INS_TABLE_VGROUPS "vgroups"
#define TSDB_INS_TABLE_CONSUMERS "consumers"
#define TSDB_INS_TABLE_SUBSCRIBES "subscribes"
#define TSDB_INS_TABLE_TRANS "trans"
#define TSDB_INS_TABLE_SMAS "smas"
#define TSDB_INS_TABLE_CONFIGS "configs"
#define TSDB_INS_TABLE_CONNS "connections"
#define TSDB_INS_TABLE_QUERIES "queries"
#define TSDB_INS_TABLE_VNODES "vnodes"
#define TSDB_PERFORMANCE_SCHEMA_DB "performance_schema"
#define TSDB_PERFS_TABLE_CONNECTIONS "connections"
#define TSDB_PERFS_TABLE_QUERIES "queries"
#define TSDB_PERFS_TABLE_TOPICS "topics"
#define TSDB_PERFS_TABLE_CONSUMERS "consumers"
#define TSDB_PERFS_TABLE_SUBSCRIPTIONS "subscriptions"
#define TSDB_PERFS_TABLE_OFFSETS "offsets"
#define TSDB_PERFS_TABLE_STREAMS "streams"
#define TSDB_INDEX_TYPE_SMA "SMA"
#define TSDB_INDEX_TYPE_SMA "SMA"
#define TSDB_INDEX_TYPE_FULLTEXT "FULLTEXT"
#define TSDB_INDEX_TYPE_FULLTEXT "FULLTEXT"
...
@@ -205,16 +168,6 @@ typedef enum ELogicConditionType {
...
@@ -205,16 +168,6 @@ typedef enum ELogicConditionType {
LOGIC_COND_TYPE_NOT
,
LOGIC_COND_TYPE_NOT
,
}
ELogicConditionType
;
}
ELogicConditionType
;
#define FUNCTION_CEIL 4500
#define FUNCTION_FLOOR 4501
#define FUNCTION_ABS 4502
#define FUNCTION_ROUND 4503
#define FUNCTION_LENGTH 4800
#define FUNCTION_CONCAT 4801
#define FUNCTION_LTRIM 4802
#define FUNCTION_RTRIM 4803
#define TSDB_NAME_DELIMITER_LEN 1
#define TSDB_NAME_DELIMITER_LEN 1
#define TSDB_UNI_LEN 24
#define TSDB_UNI_LEN 24
...
@@ -417,21 +370,9 @@ typedef enum ELogicConditionType {
...
@@ -417,21 +370,9 @@ typedef enum ELogicConditionType {
* 1. ordinary sub query for select * from super_table
* 1. ordinary sub query for select * from super_table
* 2. all sqlobj generated by createSubqueryObj with this flag
* 2. all sqlobj generated by createSubqueryObj with this flag
*/
*/
#define TSDB_QUERY_TYPE_SUBQUERY 0x02u
#define TSDB_QUERY_TYPE_STABLE_SUBQUERY 0x04u // two-stage subquery for super table
#define TSDB_QUERY_TYPE_TABLE_QUERY 0x08u // query ordinary table; below only apply to client side
#define TSDB_QUERY_TYPE_STABLE_QUERY 0x10u // query on super table
#define TSDB_QUERY_TYPE_JOIN_QUERY 0x20u // join query
#define TSDB_QUERY_TYPE_PROJECTION_QUERY 0x40u // select *,columns... query
#define TSDB_QUERY_TYPE_JOIN_SEC_STAGE 0x80u // join sub query at the second stage
#define TSDB_QUERY_TYPE_TAG_FILTER_QUERY 0x400u
#define TSDB_QUERY_TYPE_INSERT 0x100u // insert type
#define TSDB_QUERY_TYPE_INSERT 0x100u // insert type
#define TSDB_QUERY_TYPE_MULTITABLE_QUERY 0x200u
#define TSDB_QUERY_TYPE_FILE_INSERT 0x400u // insert data from file
#define TSDB_QUERY_TYPE_FILE_INSERT 0x400u // insert data from file
#define TSDB_QUERY_TYPE_STMT_INSERT 0x800u // stmt insert type
#define TSDB_QUERY_TYPE_STMT_INSERT 0x800u // stmt insert type
#define TSDB_QUERY_TYPE_NEST_SUBQUERY 0x1000u // nested sub query
#define TSDB_QUERY_HAS_TYPE(x, _type) (((x) & (_type)) != 0)
#define TSDB_QUERY_HAS_TYPE(x, _type) (((x) & (_type)) != 0)
#define TSDB_QUERY_SET_TYPE(x, _type) ((x) |= (_type))
#define TSDB_QUERY_SET_TYPE(x, _type) ((x) |= (_type))
...
...
source/client/src/tmq.c
浏览文件 @
fe7f246c
...
@@ -667,7 +667,7 @@ tmq_resp_err_t tmq_subscribe(tmq_t* tmq, const tmq_list_t* topic_list) {
...
@@ -667,7 +667,7 @@ tmq_resp_err_t tmq_subscribe(tmq_t* tmq, const tmq_list_t* topic_list) {
if
(
code
!=
0
)
goto
FAIL
;
if
(
code
!=
0
)
goto
FAIL
;
while
(
TSDB_CODE_MND_CONSUMER_NOT_READY
==
tmqAskEp
(
tmq
,
false
))
{
while
(
TSDB_CODE_MND_CONSUMER_NOT_READY
==
tmqAskEp
(
tmq
,
false
))
{
tscDebug
(
"not ready, retry"
);
tscDebug
(
"
consumer
not ready, retry"
);
taosMsleep
(
500
);
taosMsleep
(
500
);
}
}
...
@@ -693,6 +693,7 @@ void tmq_conf_set_offset_commit_cb(tmq_conf_t* conf, tmq_commit_cb* cb) {
...
@@ -693,6 +693,7 @@ void tmq_conf_set_offset_commit_cb(tmq_conf_t* conf, tmq_commit_cb* cb) {
conf
->
commitCb
=
cb
;
conf
->
commitCb
=
cb
;
}
}
#if 0
TAOS_RES* tmq_create_stream(TAOS* taos, const char* streamName, const char* tbName, const char* sql) {
TAOS_RES* tmq_create_stream(TAOS* taos, const char* streamName, const char* tbName, const char* sql) {
STscObj* pTscObj = (STscObj*)taos;
STscObj* pTscObj = (STscObj*)taos;
SRequestObj* pRequest = NULL;
SRequestObj* pRequest = NULL;
...
@@ -777,6 +778,7 @@ _return:
...
@@ -777,6 +778,7 @@ _return:
return pRequest;
return pRequest;
}
}
#endif
#if 0
#if 0
int32_t tmqGetSkipLogNum(tmq_message_t* tmq_message) {
int32_t tmqGetSkipLogNum(tmq_message_t* tmq_message) {
...
...
source/client/test/clientTests.cpp
浏览文件 @
fe7f246c
...
@@ -659,10 +659,15 @@ TEST(testCase, agg_query_tables) {
...
@@ -659,10 +659,15 @@ TEST(testCase, agg_query_tables) {
TAOS
*
pConn
=
taos_connect
(
"localhost"
,
"root"
,
"taosdata"
,
NULL
,
0
);
TAOS
*
pConn
=
taos_connect
(
"localhost"
,
"root"
,
"taosdata"
,
NULL
,
0
);
ASSERT_NE
(
pConn
,
nullptr
);
ASSERT_NE
(
pConn
,
nullptr
);
TAOS_RES
*
pRes
=
taos_query
(
pConn
,
"use abc1"
);
TAOS_RES
*
pRes
=
taos_query
(
pConn
,
"use db"
);
if
(
taos_errno
(
pRes
)
!=
0
)
{
printf
(
"failed to use db, reason:%s
\n
"
,
taos_errstr
(
pRes
));
taos_free_result
(
pRes
);
ASSERT_TRUE
(
false
);
}
taos_free_result
(
pRes
);
taos_free_result
(
pRes
);
pRes
=
taos_query
(
pConn
,
"select
now() from m
1"
);
pRes
=
taos_query
(
pConn
,
"select
tbname from st
1"
);
if
(
taos_errno
(
pRes
)
!=
0
)
{
if
(
taos_errno
(
pRes
)
!=
0
)
{
printf
(
"failed to select from table, reason:%s
\n
"
,
taos_errstr
(
pRes
));
printf
(
"failed to select from table, reason:%s
\n
"
,
taos_errstr
(
pRes
));
taos_free_result
(
pRes
);
taos_free_result
(
pRes
);
...
...
source/common/src/systable.c
0 → 100644
浏览文件 @
fe7f246c
此差异已折叠。
点击以展开。
source/dnode/mnode/impl/inc/mndConsumer.h
浏览文件 @
fe7f246c
...
@@ -44,6 +44,11 @@ SSdbRow *mndConsumerActionDecode(SSdbRaw *pRaw);
...
@@ -44,6 +44,11 @@ SSdbRow *mndConsumerActionDecode(SSdbRaw *pRaw);
int32_t
mndSetConsumerCommitLogs
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SMqConsumerObj
*
pConsumer
);
int32_t
mndSetConsumerCommitLogs
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SMqConsumerObj
*
pConsumer
);
bool
mndRebTryStart
();
void
mndRebEnd
();
void
mndRebCntInc
();
void
mndRebCntDec
();
#ifdef __cplusplus
#ifdef __cplusplus
}
}
#endif
#endif
...
...
source/dnode/mnode/impl/inc/mndDef.h
浏览文件 @
fe7f246c
...
@@ -388,15 +388,12 @@ typedef struct {
...
@@ -388,15 +388,12 @@ typedef struct {
int8_t
type
;
int8_t
type
;
int8_t
replica
;
int8_t
replica
;
int16_t
numOfColumns
;
int16_t
numOfColumns
;
int32_t
rowSize
;
int32_t
numOfRows
;
int32_t
numOfRows
;
void
*
pIter
;
void
*
pIter
;
SMnode
*
pMnode
;
SMnode
*
pMnode
;
STableMetaRsp
*
pMeta
;
STableMetaRsp
*
pMeta
;
bool
sysDbRsp
;
bool
sysDbRsp
;
char
db
[
TSDB_DB_FNAME_LEN
];
char
db
[
TSDB_DB_FNAME_LEN
];
int16_t
offset
[
TSDB_MAX_COLUMNS
];
int32_t
bytes
[
TSDB_MAX_COLUMNS
];
}
SShowObj
;
}
SShowObj
;
typedef
struct
{
typedef
struct
{
...
...
source/dnode/mnode/impl/inc/mndInfoSchema.h
浏览文件 @
fe7f246c
...
@@ -22,18 +22,6 @@
...
@@ -22,18 +22,6 @@
extern
"C"
{
extern
"C"
{
#endif
#endif
typedef
struct
SInfosTableSchema
{
const
char
*
name
;
const
int32_t
type
;
const
int32_t
bytes
;
}
SInfosTableSchema
;
typedef
struct
SInfosTableMeta
{
const
char
*
name
;
const
SInfosTableSchema
*
schema
;
const
int32_t
colNum
;
}
SInfosTableMeta
;
int32_t
mndInitInfos
(
SMnode
*
pMnode
);
int32_t
mndInitInfos
(
SMnode
*
pMnode
);
void
mndCleanupInfos
(
SMnode
*
pMnode
);
void
mndCleanupInfos
(
SMnode
*
pMnode
);
int32_t
mndBuildInsTableSchema
(
SMnode
*
pMnode
,
const
char
*
dbFName
,
const
char
*
tbName
,
STableMetaRsp
*
pRsp
);
int32_t
mndBuildInsTableSchema
(
SMnode
*
pMnode
,
const
char
*
dbFName
,
const
char
*
tbName
,
STableMetaRsp
*
pRsp
);
...
...
source/dnode/mnode/impl/inc/mndPerfSchema.h
浏览文件 @
fe7f246c
...
@@ -22,18 +22,6 @@
...
@@ -22,18 +22,6 @@
extern
"C"
{
extern
"C"
{
#endif
#endif
typedef
struct
SPerfsTableSchema
{
char
*
name
;
int32_t
type
;
int32_t
bytes
;
}
SPerfsTableSchema
;
typedef
struct
SPerfsTableMeta
{
char
*
name
;
const
SPerfsTableSchema
*
schema
;
int32_t
colNum
;
}
SPerfsTableMeta
;
int32_t
mndBuildPerfsTableSchema
(
SMnode
*
pMnode
,
const
char
*
dbFName
,
const
char
*
tbName
,
STableMetaRsp
*
pRsp
);
int32_t
mndBuildPerfsTableSchema
(
SMnode
*
pMnode
,
const
char
*
dbFName
,
const
char
*
tbName
,
STableMetaRsp
*
pRsp
);
int32_t
mndInitPerfs
(
SMnode
*
pMnode
);
int32_t
mndInitPerfs
(
SMnode
*
pMnode
);
void
mndCleanupPerfs
(
SMnode
*
pMnode
);
void
mndCleanupPerfs
(
SMnode
*
pMnode
);
...
...
source/dnode/mnode/impl/inc/mndShow.h
浏览文件 @
fe7f246c
...
@@ -17,6 +17,7 @@
...
@@ -17,6 +17,7 @@
#define _TD_MND_SHOW_H_
#define _TD_MND_SHOW_H_
#include "mndInt.h"
#include "mndInt.h"
#include "systable.h"
#ifdef __cplusplus
#ifdef __cplusplus
extern
"C"
{
extern
"C"
{
...
...
source/dnode/mnode/impl/inc/mndTrans.h
浏览文件 @
fe7f246c
...
@@ -36,8 +36,8 @@ typedef struct {
...
@@ -36,8 +36,8 @@ typedef struct {
typedef
enum
{
typedef
enum
{
TEST_TRANS_START_FUNC
=
1
,
TEST_TRANS_START_FUNC
=
1
,
TEST_TRANS_STOP_FUNC
=
2
,
TEST_TRANS_STOP_FUNC
=
2
,
CONSUME
_TRANS_START_FUNC
=
3
,
MQ_REB
_TRANS_START_FUNC
=
3
,
CONSUME
_TRANS_STOP_FUNC
=
4
,
MQ_REB
_TRANS_STOP_FUNC
=
4
,
}
ETrnFuncType
;
}
ETrnFuncType
;
typedef
void
(
*
TransCbFp
)(
SMnode
*
pMnode
,
void
*
param
,
int32_t
paramLen
);
typedef
void
(
*
TransCbFp
)(
SMnode
*
pMnode
,
void
*
param
,
int32_t
paramLen
);
...
...
source/dnode/mnode/impl/src/mndBnode.c
浏览文件 @
fe7f246c
...
@@ -453,7 +453,7 @@ static int32_t mndRetrieveBnodes(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock *p
...
@@ -453,7 +453,7 @@ static int32_t mndRetrieveBnodes(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock *p
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
&
pObj
->
id
,
false
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
&
pObj
->
id
,
false
);
char
buf
[
TSDB_EP_LEN
+
VARSTR_HEADER_SIZE
]
=
{
0
};
char
buf
[
TSDB_EP_LEN
+
VARSTR_HEADER_SIZE
]
=
{
0
};
STR_WITH_MAXSIZE_TO_VARSTR
(
buf
,
pObj
->
pDnode
->
ep
,
pShow
->
bytes
[
cols
]
);
STR_WITH_MAXSIZE_TO_VARSTR
(
buf
,
pObj
->
pDnode
->
ep
,
pShow
->
pMeta
->
pSchemas
[
cols
].
bytes
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
numOfRows
,
buf
,
false
);
colDataAppend
(
pColInfo
,
numOfRows
,
buf
,
false
);
...
...
source/dnode/mnode/impl/src/mndCluster.c
浏览文件 @
fe7f246c
...
@@ -194,7 +194,7 @@ static int32_t mndRetrieveClusters(SNodeMsg *pMsg, SShowObj *pShow, SSDataBlock
...
@@ -194,7 +194,7 @@ static int32_t mndRetrieveClusters(SNodeMsg *pMsg, SShowObj *pShow, SSDataBlock
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
&
pCluster
->
id
,
false
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
&
pCluster
->
id
,
false
);
char
buf
[
tListLen
(
pCluster
->
name
)
+
VARSTR_HEADER_SIZE
]
=
{
0
};
char
buf
[
tListLen
(
pCluster
->
name
)
+
VARSTR_HEADER_SIZE
]
=
{
0
};
STR_WITH_MAXSIZE_TO_VARSTR
(
buf
,
pCluster
->
name
,
pShow
->
bytes
[
cols
]
);
STR_WITH_MAXSIZE_TO_VARSTR
(
buf
,
pCluster
->
name
,
pShow
->
pMeta
->
pSchemas
[
cols
].
bytes
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
numOfRows
,
buf
,
false
);
colDataAppend
(
pColInfo
,
numOfRows
,
buf
,
false
);
...
...
source/dnode/mnode/impl/src/mndConsumer.c
浏览文件 @
fe7f246c
...
@@ -35,7 +35,7 @@
...
@@ -35,7 +35,7 @@
#define MND_CONSUMER_LOST_HB_CNT 3
#define MND_CONSUMER_LOST_HB_CNT 3
static
int8_t
mq
InRebFlag
=
0
;
static
int8_t
mq
RebLock
=
0
;
static
const
char
*
mndConsumerStatusName
(
int
status
);
static
const
char
*
mndConsumerStatusName
(
int
status
);
...
@@ -75,6 +75,17 @@ int32_t mndInitConsumer(SMnode *pMnode) {
...
@@ -75,6 +75,17 @@ int32_t mndInitConsumer(SMnode *pMnode) {
void
mndCleanupConsumer
(
SMnode
*
pMnode
)
{}
void
mndCleanupConsumer
(
SMnode
*
pMnode
)
{}
bool
mndRebTryStart
()
{
int8_t
old
=
atomic_val_compare_exchange_8
(
&
mqRebLock
,
0
,
1
);
return
old
==
0
;
}
void
mndRebEnd
()
{
atomic_sub_fetch_8
(
&
mqRebLock
,
1
);
}
void
mndRebCntInc
()
{
atomic_add_fetch_8
(
&
mqRebLock
,
1
);
}
void
mndRebCntDec
()
{
atomic_sub_fetch_8
(
&
mqRebLock
,
1
);
}
static
int32_t
mndProcessConsumerLostMsg
(
SNodeMsg
*
pMsg
)
{
static
int32_t
mndProcessConsumerLostMsg
(
SNodeMsg
*
pMsg
)
{
SMnode
*
pMnode
=
pMsg
->
pNode
;
SMnode
*
pMnode
=
pMsg
->
pNode
;
SMqConsumerLostMsg
*
pLostMsg
=
pMsg
->
rpcMsg
.
pCont
;
SMqConsumerLostMsg
*
pLostMsg
=
pMsg
->
rpcMsg
.
pCont
;
...
@@ -143,8 +154,7 @@ static int32_t mndProcessMqTimerMsg(SNodeMsg *pMsg) {
...
@@ -143,8 +154,7 @@ static int32_t mndProcessMqTimerMsg(SNodeMsg *pMsg) {
void
*
pIter
=
NULL
;
void
*
pIter
=
NULL
;
// rebalance cannot be parallel
// rebalance cannot be parallel
int8_t
old
=
atomic_val_compare_exchange_8
(
&
mqInRebFlag
,
0
,
1
);
if
(
!
mndRebTryStart
())
{
if
(
old
!=
0
)
{
mInfo
(
"mq rebalance already in progress, do nothing"
);
mInfo
(
"mq rebalance already in progress, do nothing"
);
return
0
;
return
0
;
}
}
...
@@ -152,7 +162,6 @@ static int32_t mndProcessMqTimerMsg(SNodeMsg *pMsg) {
...
@@ -152,7 +162,6 @@ static int32_t mndProcessMqTimerMsg(SNodeMsg *pMsg) {
SMqDoRebalanceMsg
*
pRebMsg
=
rpcMallocCont
(
sizeof
(
SMqDoRebalanceMsg
));
SMqDoRebalanceMsg
*
pRebMsg
=
rpcMallocCont
(
sizeof
(
SMqDoRebalanceMsg
));
pRebMsg
->
rebSubHash
=
taosHashInit
(
64
,
MurmurHash3_32
,
true
,
HASH_NO_LOCK
);
pRebMsg
->
rebSubHash
=
taosHashInit
(
64
,
MurmurHash3_32
,
true
,
HASH_NO_LOCK
);
// TODO set cleanfp
// TODO set cleanfp
pRebMsg
->
mqInReb
=
&
mqInRebFlag
;
// iterate all consumers, find all modification
// iterate all consumers, find all modification
while
(
1
)
{
while
(
1
)
{
...
@@ -223,7 +232,7 @@ static int32_t mndProcessMqTimerMsg(SNodeMsg *pMsg) {
...
@@ -223,7 +232,7 @@ static int32_t mndProcessMqTimerMsg(SNodeMsg *pMsg) {
taosHashCleanup
(
pRebMsg
->
rebSubHash
);
taosHashCleanup
(
pRebMsg
->
rebSubHash
);
rpcFreeCont
(
pRebMsg
);
rpcFreeCont
(
pRebMsg
);
mTrace
(
"mq rebalance finished, no modification"
);
mTrace
(
"mq rebalance finished, no modification"
);
atomic_store_8
(
&
mqInRebFlag
,
0
);
mndRebEnd
(
);
}
}
return
0
;
return
0
;
}
}
...
...
source/dnode/mnode/impl/src/mndDb.c
浏览文件 @
fe7f246c
...
@@ -23,6 +23,7 @@
...
@@ -23,6 +23,7 @@
#include "mndTrans.h"
#include "mndTrans.h"
#include "mndUser.h"
#include "mndUser.h"
#include "mndVgroup.h"
#include "mndVgroup.h"
#include "systable.h"
#define DB_VER_NUMBER 1
#define DB_VER_NUMBER 1
#define DB_RESERVE_SIZE 64
#define DB_RESERVE_SIZE 64
...
@@ -1192,7 +1193,7 @@ static int32_t mndProcessUseDbReq(SNodeMsg *pReq) {
...
@@ -1192,7 +1193,7 @@ static int32_t mndProcessUseDbReq(SNodeMsg *pReq) {
}
}
char
*
p
=
strchr
(
usedbReq
.
db
,
'.'
);
char
*
p
=
strchr
(
usedbReq
.
db
,
'.'
);
if
(
p
&&
0
==
strcmp
(
p
+
1
,
TSDB_INFORMATION_SCHEMA_DB
))
{
if
(
p
&&
((
0
==
strcmp
(
p
+
1
,
TSDB_INFORMATION_SCHEMA_DB
)
||
(
0
==
strcmp
(
p
+
1
,
TSDB_PERFORMANCE_SCHEMA_DB
)))
))
{
memcpy
(
usedbRsp
.
db
,
usedbReq
.
db
,
TSDB_DB_FNAME_LEN
);
memcpy
(
usedbRsp
.
db
,
usedbReq
.
db
,
TSDB_DB_FNAME_LEN
);
int32_t
vgVersion
=
mndGetGlobalVgroupVersion
(
pMnode
);
int32_t
vgVersion
=
mndGetGlobalVgroupVersion
(
pMnode
);
if
(
usedbReq
.
vgVersion
<
vgVersion
)
{
if
(
usedbReq
.
vgVersion
<
vgVersion
)
{
...
@@ -1386,12 +1387,13 @@ static void dumpDbInfoData(SSDataBlock *pBlock, SDbObj *pDb, SShowObj *pShow, in
...
@@ -1386,12 +1387,13 @@ static void dumpDbInfoData(SSDataBlock *pBlock, SDbObj *pDb, SShowObj *pShow, in
bool
sysDb
)
{
bool
sysDb
)
{
int32_t
cols
=
0
;
int32_t
cols
=
0
;
char
*
buf
=
taosMemoryMalloc
(
pShow
->
bytes
[
cols
]);
int32_t
bytes
=
pShow
->
pMeta
->
pSchemas
[
cols
].
bytes
;
char
*
buf
=
taosMemoryMalloc
(
bytes
);
const
char
*
name
=
mndGetDbStr
(
pDb
->
name
);
const
char
*
name
=
mndGetDbStr
(
pDb
->
name
);
if
(
name
!=
NULL
)
{
if
(
name
!=
NULL
)
{
STR_WITH_MAXSIZE_TO_VARSTR
(
buf
,
name
,
pShow
->
bytes
[
cols
]
);
STR_WITH_MAXSIZE_TO_VARSTR
(
buf
,
name
,
bytes
);
}
else
{
}
else
{
STR_WITH_MAXSIZE_TO_VARSTR
(
buf
,
"NULL"
,
pShow
->
bytes
[
cols
]
);
STR_WITH_MAXSIZE_TO_VARSTR
(
buf
,
"NULL"
,
bytes
);
}
}
char
*
status
=
"ready"
;
char
*
status
=
"ready"
;
...
@@ -1429,7 +1431,6 @@ static void dumpDbInfoData(SSDataBlock *pBlock, SDbObj *pDb, SShowObj *pShow, in
...
@@ -1429,7 +1431,6 @@ static void dumpDbInfoData(SSDataBlock *pBlock, SDbObj *pDb, SShowObj *pShow, in
colDataAppend
(
pColInfo
,
rows
,
(
const
char
*
)
&
pDb
->
cfg
.
replications
,
false
);
colDataAppend
(
pColInfo
,
rows
,
(
const
char
*
)
&
pDb
->
cfg
.
replications
,
false
);
const
char
*
src
=
pDb
->
cfg
.
strict
?
"strict"
:
"nostrict"
;
const
char
*
src
=
pDb
->
cfg
.
strict
?
"strict"
:
"nostrict"
;
char
b
[
9
+
VARSTR_HEADER_SIZE
]
=
{
0
};
STR_WITH_SIZE_TO_VARSTR
(
b
,
src
,
strlen
(
src
));
STR_WITH_SIZE_TO_VARSTR
(
b
,
src
,
strlen
(
src
));
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
rows
,
(
const
char
*
)
b
,
false
);
colDataAppend
(
pColInfo
,
rows
,
(
const
char
*
)
b
,
false
);
...
@@ -1499,8 +1500,10 @@ static void dumpDbInfoData(SSDataBlock *pBlock, SDbObj *pDb, SShowObj *pShow, in
...
@@ -1499,8 +1500,10 @@ static void dumpDbInfoData(SSDataBlock *pBlock, SDbObj *pDb, SShowObj *pShow, in
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
rows
,
(
const
char
*
)
t
,
false
);
colDataAppend
(
pColInfo
,
rows
,
(
const
char
*
)
t
,
false
);
// single stable model
int8_t
m
=
0
;
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
rows
,
(
const
char
*
)
&
pDb
->
cfg
.
numOfStables
,
false
);
colDataAppend
(
pColInfo
,
rows
,
(
const
char
*
)
&
m
,
false
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
);
colDataAppend
(
pColInfo
,
rows
,
(
const
char
*
)
b
,
false
);
colDataAppend
(
pColInfo
,
rows
,
(
const
char
*
)
b
,
false
);
...
...
source/dnode/mnode/impl/src/mndDef.c
浏览文件 @
fe7f246c
...
@@ -418,6 +418,9 @@ int32_t tEncodeSStreamObj(SCoder *pEncoder, const SStreamObj *pObj) {
...
@@ -418,6 +418,9 @@ int32_t tEncodeSStreamObj(SCoder *pEncoder, const SStreamObj *pObj) {
if
(
tEncodeI32
(
pEncoder
,
pObj
->
version
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
pEncoder
,
pObj
->
version
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
pEncoder
,
pObj
->
status
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
pEncoder
,
pObj
->
status
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
pEncoder
,
pObj
->
createdBy
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
pEncoder
,
pObj
->
createdBy
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
pEncoder
,
pObj
->
trigger
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
pEncoder
,
pObj
->
triggerParam
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
pEncoder
,
pObj
->
waterMark
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
pEncoder
,
pObj
->
fixedSinkVgId
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
pEncoder
,
pObj
->
fixedSinkVgId
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
pEncoder
,
pObj
->
smaId
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
pEncoder
,
pObj
->
smaId
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
pEncoder
,
pObj
->
sql
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
pEncoder
,
pObj
->
sql
)
<
0
)
return
-
1
;
...
@@ -464,6 +467,9 @@ int32_t tDecodeSStreamObj(SCoder *pDecoder, SStreamObj *pObj) {
...
@@ -464,6 +467,9 @@ int32_t tDecodeSStreamObj(SCoder *pDecoder, SStreamObj *pObj) {
if
(
tDecodeI32
(
pDecoder
,
&
pObj
->
version
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
pDecoder
,
&
pObj
->
version
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
pDecoder
,
&
pObj
->
status
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
pDecoder
,
&
pObj
->
status
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
pDecoder
,
&
pObj
->
createdBy
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
pDecoder
,
&
pObj
->
createdBy
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
pDecoder
,
&
pObj
->
trigger
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
pDecoder
,
&
pObj
->
triggerParam
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
pDecoder
,
&
pObj
->
waterMark
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
pDecoder
,
&
pObj
->
fixedSinkVgId
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
pDecoder
,
&
pObj
->
fixedSinkVgId
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
pDecoder
,
&
pObj
->
smaId
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
pDecoder
,
&
pObj
->
smaId
)
<
0
)
return
-
1
;
if
(
tDecodeCStrAlloc
(
pDecoder
,
&
pObj
->
sql
)
<
0
)
return
-
1
;
if
(
tDecodeCStrAlloc
(
pDecoder
,
&
pObj
->
sql
)
<
0
)
return
-
1
;
...
...
source/dnode/mnode/impl/src/mndDnode.c
浏览文件 @
fe7f246c
...
@@ -705,7 +705,7 @@ static int32_t mndRetrieveDnodes(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock *p
...
@@ -705,7 +705,7 @@ static int32_t mndRetrieveDnodes(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock *p
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
&
pDnode
->
id
,
false
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
&
pDnode
->
id
,
false
);
char
buf
[
tListLen
(
pDnode
->
ep
)
+
VARSTR_HEADER_SIZE
]
=
{
0
};
char
buf
[
tListLen
(
pDnode
->
ep
)
+
VARSTR_HEADER_SIZE
]
=
{
0
};
STR_WITH_MAXSIZE_TO_VARSTR
(
buf
,
pDnode
->
ep
,
pShow
->
bytes
[
cols
]
);
STR_WITH_MAXSIZE_TO_VARSTR
(
buf
,
pDnode
->
ep
,
pShow
->
pMeta
->
pSchemas
[
cols
].
bytes
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
numOfRows
,
buf
,
false
);
colDataAppend
(
pColInfo
,
numOfRows
,
buf
,
false
);
...
...
source/dnode/mnode/impl/src/mndFunc.c
浏览文件 @
fe7f246c
...
@@ -517,14 +517,14 @@ static int32_t mndRetrieveFuncs(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock *pB
...
@@ -517,14 +517,14 @@ static int32_t mndRetrieveFuncs(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock *pB
cols
=
0
;
cols
=
0
;
char
b1
[
tListLen
(
pFunc
->
name
)
+
VARSTR_HEADER_SIZE
]
=
{
0
};
char
b1
[
tListLen
(
pFunc
->
name
)
+
VARSTR_HEADER_SIZE
]
=
{
0
};
STR_WITH_MAXSIZE_TO_VARSTR
(
b1
,
pFunc
->
name
,
pShow
->
bytes
[
cols
]
);
STR_WITH_MAXSIZE_TO_VARSTR
(
b1
,
pFunc
->
name
,
pShow
->
pMeta
->
pSchemas
[
cols
].
bytes
);
SColumnInfoData
*
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
SColumnInfoData
*
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
b1
,
false
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
b1
,
false
);
if
(
pFunc
->
pComment
)
{
if
(
pFunc
->
pComment
)
{
char
*
b2
=
taosMemoryCalloc
(
1
,
pShow
->
bytes
[
cols
]
);
char
*
b2
=
taosMemoryCalloc
(
1
,
pShow
->
pMeta
->
pSchemas
[
cols
].
bytes
);
STR_WITH_MAXSIZE_TO_VARSTR
(
b2
,
pFunc
->
pComment
,
pShow
->
bytes
[
cols
]
);
STR_WITH_MAXSIZE_TO_VARSTR
(
b2
,
pFunc
->
pComment
,
pShow
->
pMeta
->
pSchemas
[
cols
].
bytes
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
b2
,
false
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
b2
,
false
);
...
@@ -540,7 +540,7 @@ static int32_t mndRetrieveFuncs(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock *pB
...
@@ -540,7 +540,7 @@ static int32_t mndRetrieveFuncs(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock *pB
char
b3
[
TSDB_TYPE_STR_MAX_LEN
]
=
{
0
};
char
b3
[
TSDB_TYPE_STR_MAX_LEN
]
=
{
0
};
STR_WITH_MAXSIZE_TO_VARSTR
(
b3
,
mnodeGenTypeStr
(
buf
,
TSDB_TYPE_STR_MAX_LEN
,
pFunc
->
outputType
,
pFunc
->
outputLen
),
STR_WITH_MAXSIZE_TO_VARSTR
(
b3
,
mnodeGenTypeStr
(
buf
,
TSDB_TYPE_STR_MAX_LEN
,
pFunc
->
outputType
,
pFunc
->
outputLen
),
pShow
->
bytes
[
cols
]
);
pShow
->
pMeta
->
pSchemas
[
cols
].
bytes
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
b3
,
false
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
b3
,
false
);
...
...
source/dnode/mnode/impl/src/mndInfoSchema.c
浏览文件 @
fe7f246c
...
@@ -14,255 +14,10 @@
...
@@ -14,255 +14,10 @@
*/
*/
#define _DEFAULT_SOURCE
#define _DEFAULT_SOURCE
#include "
mndInfoSchema
.h"
#include "
systable
.h"
#include "mndInt.h"
#include "mndInt.h"
#define SYSTABLE_SCH_TABLE_NAME_LEN ((TSDB_TABLE_NAME_LEN - 1) + VARSTR_HEADER_SIZE)
static
int32_t
mndInitInfosTableSchema
(
const
SSysDbTableSchema
*
pSrc
,
int32_t
colNum
,
SSchema
**
pDst
)
{
#define SYSTABLE_SCH_DB_NAME_LEN ((TSDB_DB_NAME_LEN - 1) + VARSTR_HEADER_SIZE)
#define SYSTABLE_SCH_COL_NAME_LEN ((TSDB_COL_NAME_LEN - 1) + VARSTR_HEADER_SIZE)
static
const
SInfosTableSchema
dnodesSchema
[]
=
{
{.
name
=
"id"
,
.
bytes
=
2
,
.
type
=
TSDB_DATA_TYPE_SMALLINT
},
{.
name
=
"endpoint"
,
.
bytes
=
TSDB_EP_LEN
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"vnodes"
,
.
bytes
=
2
,
.
type
=
TSDB_DATA_TYPE_SMALLINT
},
{.
name
=
"max_vnodes"
,
.
bytes
=
2
,
.
type
=
TSDB_DATA_TYPE_SMALLINT
},
{.
name
=
"status"
,
.
bytes
=
10
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"create_time"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_TIMESTAMP
},
{.
name
=
"note"
,
.
bytes
=
256
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
};
static
const
SInfosTableSchema
mnodesSchema
[]
=
{
{.
name
=
"id"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
},
{.
name
=
"endpoint"
,
.
bytes
=
TSDB_EP_LEN
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"role"
,
.
bytes
=
12
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"role_time"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_TIMESTAMP
},
{.
name
=
"create_time"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_TIMESTAMP
},
};
static
const
SInfosTableSchema
modulesSchema
[]
=
{
{.
name
=
"id"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
},
{.
name
=
"endpoint"
,
.
bytes
=
134
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"module"
,
.
bytes
=
10
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
};
static
const
SInfosTableSchema
qnodesSchema
[]
=
{
{.
name
=
"id"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
},
{.
name
=
"endpoint"
,
.
bytes
=
TSDB_EP_LEN
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"create_time"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_TIMESTAMP
},
};
static
const
SInfosTableSchema
snodesSchema
[]
=
{
{.
name
=
"id"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
},
{.
name
=
"endpoint"
,
.
bytes
=
TSDB_EP_LEN
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"create_time"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_TIMESTAMP
},
};
static
const
SInfosTableSchema
bnodesSchema
[]
=
{
{.
name
=
"id"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
},
{.
name
=
"endpoint"
,
.
bytes
=
TSDB_EP_LEN
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"create_time"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_TIMESTAMP
},
};
static
const
SInfosTableSchema
clusterSchema
[]
=
{
{.
name
=
"id"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_BIGINT
},
{.
name
=
"name"
,
.
bytes
=
TSDB_CLUSTER_ID_LEN
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"create_time"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_TIMESTAMP
},
};
static
const
SInfosTableSchema
userDBSchema
[]
=
{
{.
name
=
"name"
,
.
bytes
=
SYSTABLE_SCH_DB_NAME_LEN
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"create_time"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_TIMESTAMP
},
{.
name
=
"vgroups"
,
.
bytes
=
2
,
.
type
=
TSDB_DATA_TYPE_SMALLINT
},
{.
name
=
"ntables"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_BIGINT
},
{.
name
=
"replica"
,
.
bytes
=
2
,
.
type
=
TSDB_DATA_TYPE_TINYINT
},
{.
name
=
"strict"
,
.
bytes
=
9
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"duration"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
},
{.
name
=
"keep"
,
.
bytes
=
24
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"buffer"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
},
{.
name
=
"pagesize"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
},
{.
name
=
"pages"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
},
{.
name
=
"minrows"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
},
{.
name
=
"maxrows"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
},
{.
name
=
"wal"
,
.
bytes
=
1
,
.
type
=
TSDB_DATA_TYPE_TINYINT
},
{.
name
=
"fsync"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
},
{.
name
=
"comp"
,
.
bytes
=
1
,
.
type
=
TSDB_DATA_TYPE_TINYINT
},
{.
name
=
"cachelast"
,
.
bytes
=
1
,
.
type
=
TSDB_DATA_TYPE_TINYINT
},
{.
name
=
"precision"
,
.
bytes
=
2
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"single_stable"
,
.
bytes
=
1
,
.
type
=
TSDB_DATA_TYPE_TINYINT
},
{.
name
=
"status"
,
.
bytes
=
10
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
// {.name = "update", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT}, // disable update
};
static
const
SInfosTableSchema
userFuncSchema
[]
=
{
{.
name
=
"name"
,
.
bytes
=
TSDB_FUNC_NAME_LEN
-
1
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"comment"
,
.
bytes
=
PATH_MAX
-
1
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"aggregate"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
},
{.
name
=
"output_type"
,
.
bytes
=
TSDB_TYPE_STR_MAX_LEN
-
1
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"create_time"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_TIMESTAMP
},
{.
name
=
"code_len"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
},
{.
name
=
"bufsize"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
},
};
static
const
SInfosTableSchema
userIdxSchema
[]
=
{
{.
name
=
"db_name"
,
.
bytes
=
SYSTABLE_SCH_DB_NAME_LEN
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"table_name"
,
.
bytes
=
SYSTABLE_SCH_TABLE_NAME_LEN
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"index_database"
,
.
bytes
=
SYSTABLE_SCH_DB_NAME_LEN
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"index_name"
,
.
bytes
=
SYSTABLE_SCH_TABLE_NAME_LEN
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"column_name"
,
.
bytes
=
SYSTABLE_SCH_COL_NAME_LEN
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"index_type"
,
.
bytes
=
10
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"index_extensions"
,
.
bytes
=
256
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
};
static
const
SInfosTableSchema
userStbsSchema
[]
=
{
{.
name
=
"stable_name"
,
.
bytes
=
SYSTABLE_SCH_TABLE_NAME_LEN
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"db_name"
,
.
bytes
=
SYSTABLE_SCH_DB_NAME_LEN
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"create_time"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_TIMESTAMP
},
{.
name
=
"columns"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
},
{.
name
=
"tags"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
},
{.
name
=
"last_update"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_TIMESTAMP
},
{.
name
=
"table_comment"
,
.
bytes
=
1024
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
};
static
const
SInfosTableSchema
userTblsSchema
[]
=
{
{.
name
=
"table_name"
,
.
bytes
=
SYSTABLE_SCH_TABLE_NAME_LEN
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"db_name"
,
.
bytes
=
SYSTABLE_SCH_DB_NAME_LEN
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"create_time"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_TIMESTAMP
},
{.
name
=
"columns"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
},
{.
name
=
"stable_name"
,
.
bytes
=
SYSTABLE_SCH_TABLE_NAME_LEN
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"uid"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_BIGINT
},
{.
name
=
"vgroup_id"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
},
{.
name
=
"ttl"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
},
{.
name
=
"table_comment"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
},
{.
name
=
"type"
,
.
bytes
=
20
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
};
static
const
SInfosTableSchema
userTblDistSchema
[]
=
{
{.
name
=
"db_name"
,
.
bytes
=
32
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"table_name"
,
.
bytes
=
SYSTABLE_SCH_DB_NAME_LEN
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"distributed_histogram"
,
.
bytes
=
500
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"min_of_rows"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
},
{.
name
=
"max_of_rows"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
},
{.
name
=
"avg_of_rows"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
},
{.
name
=
"stddev_of_rows"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
},
{.
name
=
"rows"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_BIGINT
},
{.
name
=
"blocks"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
},
{.
name
=
"storage_size"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_BIGINT
},
{.
name
=
"compression_ratio"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_DOUBLE
},
{.
name
=
"rows_in_mem"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
},
{.
name
=
"seek_header_time"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
},
};
static
const
SInfosTableSchema
userUsersSchema
[]
=
{
{.
name
=
"name"
,
.
bytes
=
TSDB_USER_LEN
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"privilege"
,
.
bytes
=
10
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"create_time"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_TIMESTAMP
},
};
static
const
SInfosTableSchema
grantsSchema
[]
=
{
{.
name
=
"version"
,
.
bytes
=
8
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"expire time"
,
.
bytes
=
19
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"expired"
,
.
bytes
=
5
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"storage(GB)"
,
.
bytes
=
21
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"timeseries"
,
.
bytes
=
21
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"databases"
,
.
bytes
=
10
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"users"
,
.
bytes
=
10
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"accounts"
,
.
bytes
=
10
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"dnodes"
,
.
bytes
=
10
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"connections"
,
.
bytes
=
11
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"streams"
,
.
bytes
=
9
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"cpu cores"
,
.
bytes
=
9
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"speed(PPS)"
,
.
bytes
=
9
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"querytime"
,
.
bytes
=
9
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
};
static
const
SInfosTableSchema
vgroupsSchema
[]
=
{
{.
name
=
"vgroup_id"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
},
{.
name
=
"db_name"
,
.
bytes
=
SYSTABLE_SCH_DB_NAME_LEN
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"tables"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
},
{.
name
=
"v1_dnode"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
},
{.
name
=
"v1_status"
,
.
bytes
=
10
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"v2_dnode"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
},
{.
name
=
"v2_status"
,
.
bytes
=
10
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"v3_dnode"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
},
{.
name
=
"v3_status"
,
.
bytes
=
10
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"status"
,
.
bytes
=
12
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"nfiles"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
},
{.
name
=
"file_size"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
},
};
static
const
SInfosTableSchema
smaSchema
[]
=
{
{.
name
=
"sma_name"
,
.
bytes
=
SYSTABLE_SCH_TABLE_NAME_LEN
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"create_time"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_TIMESTAMP
},
{.
name
=
"stable_name"
,
.
bytes
=
SYSTABLE_SCH_TABLE_NAME_LEN
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
};
static
const
SInfosTableSchema
transSchema
[]
=
{
{.
name
=
"id"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
},
{.
name
=
"created_time"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_TIMESTAMP
},
{.
name
=
"stage"
,
.
bytes
=
TSDB_TRANS_STAGE_LEN
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"db"
,
.
bytes
=
SYSTABLE_SCH_DB_NAME_LEN
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"type"
,
.
bytes
=
TSDB_TRANS_TYPE_LEN
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"last_exec_time"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_TIMESTAMP
},
{.
name
=
"last_error"
,
.
bytes
=
(
TSDB_TRANS_ERROR_LEN
-
1
)
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
};
static
const
SInfosTableSchema
configSchema
[]
=
{
{.
name
=
"name"
,
.
bytes
=
TSDB_CONFIG_OPTION_LEN
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"value"
,
.
bytes
=
TSDB_CONIIG_VALUE_LEN
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
};
static
const
SInfosTableSchema
connSchema
[]
=
{
{.
name
=
"connId"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
},
{.
name
=
"user"
,
.
bytes
=
TSDB_USER_LEN
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"program"
,
.
bytes
=
TSDB_APP_NAME_LEN
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"pid"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
},
{.
name
=
"ip:port"
,
.
bytes
=
TSDB_IPv4ADDR_LEN
+
6
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"login_time"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_TIMESTAMP
},
{.
name
=
"last_access"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_TIMESTAMP
},
};
static
const
SInfosTableSchema
querySchema
[]
=
{
{.
name
=
"queryId"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
},
{.
name
=
"connId"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
},
{.
name
=
"user"
,
.
bytes
=
TSDB_USER_LEN
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"ip:port"
,
.
bytes
=
TSDB_IPv4ADDR_LEN
+
6
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"qid"
,
.
bytes
=
22
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"created_time"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_TIMESTAMP
},
{.
name
=
"time"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_BIGINT
},
{.
name
=
"sql_obj_id"
,
.
bytes
=
QUERY_OBJ_ID_SIZE
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"pid"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
},
{.
name
=
"ep"
,
.
bytes
=
TSDB_EP_LEN
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"stable_query"
,
.
bytes
=
1
,
.
type
=
TSDB_DATA_TYPE_BOOL
},
{.
name
=
"sub_queries"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
},
{.
name
=
"sub_query_info"
,
.
bytes
=
TSDB_SHOW_SUBQUERY_LEN
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"sql"
,
.
bytes
=
TSDB_SHOW_SQL_LEN
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
};
static
const
SInfosTableMeta
infosMeta
[]
=
{
{
TSDB_INS_TABLE_DNODES
,
dnodesSchema
,
tListLen
(
dnodesSchema
)},
{
TSDB_INS_TABLE_MNODES
,
mnodesSchema
,
tListLen
(
mnodesSchema
)},
{
TSDB_INS_TABLE_MODULES
,
modulesSchema
,
tListLen
(
modulesSchema
)},
{
TSDB_INS_TABLE_QNODES
,
qnodesSchema
,
tListLen
(
qnodesSchema
)},
{
TSDB_INS_TABLE_SNODES
,
snodesSchema
,
tListLen
(
snodesSchema
)},
{
TSDB_INS_TABLE_BNODES
,
bnodesSchema
,
tListLen
(
bnodesSchema
)},
{
TSDB_INS_TABLE_CLUSTER
,
clusterSchema
,
tListLen
(
clusterSchema
)},
{
TSDB_INS_TABLE_USER_DATABASES
,
userDBSchema
,
tListLen
(
userDBSchema
)},
{
TSDB_INS_TABLE_USER_FUNCTIONS
,
userFuncSchema
,
tListLen
(
userFuncSchema
)},
{
TSDB_INS_TABLE_USER_INDEXES
,
userIdxSchema
,
tListLen
(
userIdxSchema
)},
{
TSDB_INS_TABLE_USER_STABLES
,
userStbsSchema
,
tListLen
(
userStbsSchema
)},
{
TSDB_INS_TABLE_USER_TABLES
,
userTblsSchema
,
tListLen
(
userTblsSchema
)},
{
TSDB_INS_TABLE_USER_TABLE_DISTRIBUTED
,
userTblDistSchema
,
tListLen
(
userTblDistSchema
)},
{
TSDB_INS_TABLE_USER_USERS
,
userUsersSchema
,
tListLen
(
userUsersSchema
)},
{
TSDB_INS_TABLE_LICENCES
,
grantsSchema
,
tListLen
(
grantsSchema
)},
{
TSDB_INS_TABLE_VGROUPS
,
vgroupsSchema
,
tListLen
(
vgroupsSchema
)},
{
TSDB_INS_TABLE_TRANS
,
transSchema
,
tListLen
(
transSchema
)},
{
TSDB_INS_TABLE_SMAS
,
smaSchema
,
tListLen
(
smaSchema
)},
{
TSDB_INS_TABLE_CONFIGS
,
configSchema
,
tListLen
(
configSchema
)},
{
TSDB_INS_TABLE_CONNS
,
connSchema
,
tListLen
(
connSchema
)},
{
TSDB_INS_TABLE_QUERIES
,
querySchema
,
tListLen
(
querySchema
)},
};
static
int32_t
mndInitInfosTableSchema
(
const
SInfosTableSchema
*
pSrc
,
int32_t
colNum
,
SSchema
**
pDst
)
{
SSchema
*
schema
=
taosMemoryCalloc
(
colNum
,
sizeof
(
SSchema
));
SSchema
*
schema
=
taosMemoryCalloc
(
colNum
,
sizeof
(
SSchema
));
if
(
NULL
==
schema
)
{
if
(
NULL
==
schema
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
...
@@ -288,11 +43,15 @@ static int32_t mndInsInitMeta(SHashObj *hash) {
...
@@ -288,11 +43,15 @@ static int32_t mndInsInitMeta(SHashObj *hash) {
meta
.
sversion
=
1
;
meta
.
sversion
=
1
;
meta
.
tversion
=
1
;
meta
.
tversion
=
1
;
for
(
int32_t
i
=
0
;
i
<
tListLen
(
infosMeta
);
++
i
)
{
size_t
size
=
0
;
tstrncpy
(
meta
.
tbName
,
infosMeta
[
i
].
name
,
sizeof
(
meta
.
tbName
));
const
SSysTableMeta
*
pInfosTableMeta
=
NULL
;
meta
.
numOfColumns
=
infosMeta
[
i
].
colNum
;
getInfosDbMeta
(
&
pInfosTableMeta
,
&
size
);
for
(
int32_t
i
=
0
;
i
<
size
;
++
i
)
{
tstrncpy
(
meta
.
tbName
,
pInfosTableMeta
[
i
].
name
,
sizeof
(
meta
.
tbName
));
meta
.
numOfColumns
=
pInfosTableMeta
[
i
].
colNum
;
if
(
mndInitInfosTableSchema
(
infosMeta
[
i
].
schema
,
infos
Meta
[
i
].
colNum
,
&
meta
.
pSchemas
))
{
if
(
mndInitInfosTableSchema
(
pInfosTableMeta
[
i
].
schema
,
pInfosTable
Meta
[
i
].
colNum
,
&
meta
.
pSchemas
))
{
return
-
1
;
return
-
1
;
}
}
...
...
source/dnode/mnode/impl/src/mndMnode.c
浏览文件 @
fe7f246c
...
@@ -619,14 +619,14 @@ static int32_t mndRetrieveMnodes(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock *p
...
@@ -619,14 +619,14 @@ static int32_t mndRetrieveMnodes(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock *p
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
&
pObj
->
id
,
false
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
&
pObj
->
id
,
false
);
char
b1
[
TSDB_EP_LEN
+
VARSTR_HEADER_SIZE
]
=
{
0
};
char
b1
[
TSDB_EP_LEN
+
VARSTR_HEADER_SIZE
]
=
{
0
};
STR_WITH_MAXSIZE_TO_VARSTR
(
b1
,
pObj
->
pDnode
->
ep
,
pShow
->
bytes
[
cols
]
);
STR_WITH_MAXSIZE_TO_VARSTR
(
b1
,
pObj
->
pDnode
->
ep
,
pShow
->
pMeta
->
pSchemas
[
cols
].
bytes
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
numOfRows
,
b1
,
false
);
colDataAppend
(
pColInfo
,
numOfRows
,
b1
,
false
);
const
char
*
roles
=
syncStr
(
pObj
->
role
);
const
char
*
roles
=
syncStr
(
pObj
->
role
);
char
*
b2
=
taosMemoryCalloc
(
1
,
strlen
(
roles
)
+
VARSTR_HEADER_SIZE
);
char
*
b2
=
taosMemoryCalloc
(
1
,
strlen
(
roles
)
+
VARSTR_HEADER_SIZE
);
STR_WITH_MAXSIZE_TO_VARSTR
(
b2
,
roles
,
pShow
->
bytes
[
cols
]
);
STR_WITH_MAXSIZE_TO_VARSTR
(
b2
,
roles
,
pShow
->
pMeta
->
pSchemas
[
cols
].
bytes
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
b2
,
false
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
b2
,
false
);
...
...
source/dnode/mnode/impl/src/mndPerfSchema.c
浏览文件 @
fe7f246c
...
@@ -14,92 +14,11 @@
...
@@ -14,92 +14,11 @@
*/
*/
#define _DEFAULT_SOURCE
#define _DEFAULT_SOURCE
#include "mndPerfSchema.h"
#include "mndInt.h"
#include "mndInt.h"
#include "systable.h"
//!!!! Note: only APPEND columns in below tables, NO insert !!!!
static
const
SPerfsTableSchema
connectionsSchema
[]
=
{
{.
name
=
"conn_id"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_UINT
},
{.
name
=
"user"
,
.
bytes
=
TSDB_USER_LEN
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_BINARY
},
{.
name
=
"program"
,
.
bytes
=
TSDB_APP_NAME_LEN
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_BINARY
},
{.
name
=
"pid"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
},
{.
name
=
"end_point"
,
.
bytes
=
TSDB_EP_LEN
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_BINARY
},
{.
name
=
"login_time"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_TIMESTAMP
},
{.
name
=
"last_access"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_TIMESTAMP
},
};
static
const
SPerfsTableSchema
queriesSchema
[]
=
{
{.
name
=
"query_id"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_UBIGINT
},
{.
name
=
"sql"
,
.
bytes
=
TSDB_SHOW_SQL_LEN
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_BINARY
},
{.
name
=
"user"
,
.
bytes
=
TSDB_USER_LEN
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_BINARY
},
{.
name
=
"pid"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
},
{.
name
=
"fqdn"
,
.
bytes
=
TSDB_FQDN_LEN
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_BINARY
},
{.
name
=
"exec_time"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_BIGINT
},
{.
name
=
"create_time"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_TIMESTAMP
},
{.
name
=
"sub_queries"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
},
{.
name
=
"sub_query_info"
,
.
bytes
=
TSDB_SHOW_SUBQUERY_LEN
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_BINARY
},
};
static
const
SPerfsTableSchema
topicSchema
[]
=
{
{.
name
=
"topic_name"
,
.
bytes
=
SYSTABLE_SCH_TABLE_NAME_LEN
,
.
type
=
TSDB_DATA_TYPE_BINARY
},
{.
name
=
"db_name"
,
.
bytes
=
SYSTABLE_SCH_DB_NAME_LEN
,
.
type
=
TSDB_DATA_TYPE_BINARY
},
{.
name
=
"create_time"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_TIMESTAMP
},
{.
name
=
"sql"
,
.
bytes
=
TSDB_SHOW_SQL_LEN
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_BINARY
},
// TODO config
};
static
const
SPerfsTableSchema
consumerSchema
[]
=
{
{.
name
=
"consumer_id"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_BIGINT
},
{.
name
=
"group_id"
,
.
bytes
=
SYSTABLE_SCH_TABLE_NAME_LEN
,
.
type
=
TSDB_DATA_TYPE_BINARY
},
{.
name
=
"app_id"
,
.
bytes
=
SYSTABLE_SCH_TABLE_NAME_LEN
,
.
type
=
TSDB_DATA_TYPE_BINARY
},
{.
name
=
"status"
,
.
bytes
=
20
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_BINARY
},
{.
name
=
"topics"
,
.
bytes
=
TSDB_SHOW_LIST_LEN
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_BINARY
},
{.
name
=
"pid"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
},
{.
name
=
"end_point"
,
.
bytes
=
TSDB_EP_LEN
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_BINARY
},
{.
name
=
"up_time"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_TIMESTAMP
},
{.
name
=
"subscribe_time"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_TIMESTAMP
},
{.
name
=
"rebalance_time"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_TIMESTAMP
},
};
static
const
SPerfsTableSchema
subscriptionSchema
[]
=
{
{.
name
=
"topic_name"
,
.
bytes
=
SYSTABLE_SCH_TABLE_NAME_LEN
,
.
type
=
TSDB_DATA_TYPE_BINARY
},
{.
name
=
"group_id"
,
.
bytes
=
SYSTABLE_SCH_TABLE_NAME_LEN
,
.
type
=
TSDB_DATA_TYPE_BINARY
},
{.
name
=
"vgroup_id"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
},
{.
name
=
"consumer_id"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_BIGINT
},
};
static
const
SPerfsTableSchema
offsetSchema
[]
=
{
{.
name
=
"topic_name"
,
.
bytes
=
SYSTABLE_SCH_TABLE_NAME_LEN
,
.
type
=
TSDB_DATA_TYPE_BINARY
},
{.
name
=
"group_id"
,
.
bytes
=
SYSTABLE_SCH_TABLE_NAME_LEN
,
.
type
=
TSDB_DATA_TYPE_BINARY
},
{.
name
=
"vgroup_id"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
},
{.
name
=
"committed_offset"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_BIGINT
},
{.
name
=
"current_offset"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_BIGINT
},
{.
name
=
"skip_log_cnt"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_BIGINT
},
};
static
const
SPerfsTableSchema
streamSchema
[]
=
{
{.
name
=
"stream_name"
,
.
bytes
=
SYSTABLE_SCH_DB_NAME_LEN
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"create_time"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_TIMESTAMP
},
{.
name
=
"sql"
,
.
bytes
=
TSDB_SHOW_SQL_LEN
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"status"
,
.
bytes
=
20
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_BINARY
},
{.
name
=
"source_db"
,
.
bytes
=
SYSTABLE_SCH_DB_NAME_LEN
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"target_db"
,
.
bytes
=
SYSTABLE_SCH_DB_NAME_LEN
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"target_table"
,
.
bytes
=
SYSTABLE_SCH_TABLE_NAME_LEN
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"watermark"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_BIGINT
},
{.
name
=
"trigger"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
},
};
static
const
SPerfsTableMeta
perfsMeta
[]
=
{
{
TSDB_PERFS_TABLE_CONNECTIONS
,
connectionsSchema
,
tListLen
(
connectionsSchema
)},
{
TSDB_PERFS_TABLE_QUERIES
,
queriesSchema
,
tListLen
(
queriesSchema
)},
{
TSDB_PERFS_TABLE_TOPICS
,
topicSchema
,
tListLen
(
topicSchema
)},
{
TSDB_PERFS_TABLE_CONSUMERS
,
consumerSchema
,
tListLen
(
consumerSchema
)},
{
TSDB_PERFS_TABLE_SUBSCRIPTIONS
,
subscriptionSchema
,
tListLen
(
subscriptionSchema
)},
{
TSDB_PERFS_TABLE_OFFSETS
,
offsetSchema
,
tListLen
(
offsetSchema
)},
{
TSDB_PERFS_TABLE_STREAMS
,
streamSchema
,
tListLen
(
streamSchema
)},
};
// connection/application/
// connection/application/
int32_t
mndInitPerfsTableSchema
(
const
S
Perfs
TableSchema
*
pSrc
,
int32_t
colNum
,
SSchema
**
pDst
)
{
int32_t
mndInitPerfsTableSchema
(
const
S
SysDb
TableSchema
*
pSrc
,
int32_t
colNum
,
SSchema
**
pDst
)
{
SSchema
*
schema
=
taosMemoryCalloc
(
colNum
,
sizeof
(
SSchema
));
SSchema
*
schema
=
taosMemoryCalloc
(
colNum
,
sizeof
(
SSchema
));
if
(
NULL
==
schema
)
{
if
(
NULL
==
schema
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
...
@@ -126,11 +45,15 @@ int32_t mndPerfsInitMeta(SHashObj *hash) {
...
@@ -126,11 +45,15 @@ int32_t mndPerfsInitMeta(SHashObj *hash) {
meta
.
sversion
=
1
;
meta
.
sversion
=
1
;
meta
.
tversion
=
1
;
meta
.
tversion
=
1
;
for
(
int32_t
i
=
0
;
i
<
tListLen
(
perfsMeta
);
++
i
)
{
size_t
size
=
0
;
strcpy
(
meta
.
tbName
,
perfsMeta
[
i
].
name
);
const
SSysTableMeta
*
pSysDbTableMeta
=
NULL
;
meta
.
numOfColumns
=
perfsMeta
[
i
].
colNum
;
getPerfDbMeta
(
&
pSysDbTableMeta
,
&
size
);
for
(
int32_t
i
=
0
;
i
<
size
;
++
i
)
{
strcpy
(
meta
.
tbName
,
pSysDbTableMeta
[
i
].
name
);
meta
.
numOfColumns
=
pSysDbTableMeta
[
i
].
colNum
;
if
(
mndInitPerfsTableSchema
(
p
erfsMeta
[
i
].
schema
,
perfs
Meta
[
i
].
colNum
,
&
meta
.
pSchemas
))
{
if
(
mndInitPerfsTableSchema
(
p
SysDbTableMeta
[
i
].
schema
,
pSysDbTable
Meta
[
i
].
colNum
,
&
meta
.
pSchemas
))
{
return
-
1
;
return
-
1
;
}
}
...
@@ -166,7 +89,6 @@ int32_t mndBuildPerfsTableSchema(SMnode *pMnode, const char *dbFName, const char
...
@@ -166,7 +89,6 @@ int32_t mndBuildPerfsTableSchema(SMnode *pMnode, const char *dbFName, const char
}
}
memcpy
(
pRsp
->
pSchemas
,
meta
->
pSchemas
,
meta
->
numOfColumns
*
sizeof
(
SSchema
));
memcpy
(
pRsp
->
pSchemas
,
meta
->
pSchemas
,
meta
->
numOfColumns
*
sizeof
(
SSchema
));
return
0
;
return
0
;
}
}
...
...
source/dnode/mnode/impl/src/mndProfile.c
浏览文件 @
fe7f246c
...
@@ -570,38 +570,39 @@ static int32_t mndRetrieveConns(SNodeMsg *pReq, SShowObj *pShow, char *data, int
...
@@ -570,38 +570,39 @@ static int32_t mndRetrieveConns(SNodeMsg *pReq, SShowObj *pShow, char *data, int
if
(
pConn
==
NULL
)
break
;
if
(
pConn
==
NULL
)
break
;
cols
=
0
;
cols
=
0
;
#if 0
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
pWrite = data + pShow->offset[cols] * rows + pShow->
pMeta->pSchemas[cols].bytes
* numOfRows;
*(uint32_t *)pWrite = pConn->id;
*(uint32_t *)pWrite = pConn->id;
cols++;
cols++;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
pWrite = data + pShow->offset[cols] * rows + pShow->
pMeta->pSchemas[cols].bytes
* numOfRows;
STR_WITH_MAXSIZE_TO_VARSTR
(
pWrite
,
pConn
->
user
,
pShow
->
bytes
[
cols
]
);
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pConn->user, pShow->
pMeta->pSchemas[cols].bytes
);
cols++;
cols++;
// app name
// app name
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
pWrite = data + pShow->offset[cols] * rows + pShow->
pMeta->pSchemas[cols].bytes
* numOfRows;
STR_WITH_MAXSIZE_TO_VARSTR
(
pWrite
,
pConn
->
app
,
pShow
->
bytes
[
cols
]
);
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pConn->app, pShow->
pMeta->pSchemas[cols].bytes
);
cols++;
cols++;
// app pid
// app pid
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
pWrite = data + pShow->offset[cols] * rows + pShow->
pMeta->pSchemas[cols].bytes
* numOfRows;
*(int32_t *)pWrite = pConn->pid;
*(int32_t *)pWrite = pConn->pid;
cols++;
cols++;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
pWrite = data + pShow->offset[cols] * rows + pShow->
pMeta->pSchemas[cols].bytes
* numOfRows;
taosIpPort2String(pConn->ip, pConn->port, ipStr);
taosIpPort2String(pConn->ip, pConn->port, ipStr);
STR_WITH_MAXSIZE_TO_VARSTR
(
pWrite
,
ipStr
,
pShow
->
bytes
[
cols
]
);
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, ipStr, pShow->
pMeta->pSchemas[cols].bytes
);
cols++;
cols++;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
pWrite = data + pShow->offset[cols] * rows + pShow->
pMeta->pSchemas[cols].bytes
* numOfRows;
*(int64_t *)pWrite = pConn->loginTimeMs;
*(int64_t *)pWrite = pConn->loginTimeMs;
cols++;
cols++;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
pWrite = data + pShow->offset[cols] * rows + pShow->
pMeta->pSchemas[cols].bytes
* numOfRows;
if (pConn->lastAccessTimeMs < pConn->loginTimeMs) pConn->lastAccessTimeMs = pConn->loginTimeMs;
if (pConn->lastAccessTimeMs < pConn->loginTimeMs) pConn->lastAccessTimeMs = pConn->loginTimeMs;
*(int64_t *)pWrite = pConn->lastAccessTimeMs;
*(int64_t *)pWrite = pConn->lastAccessTimeMs;
cols++;
cols++;
#endif
numOfRows
++
;
numOfRows
++
;
}
}
...
@@ -643,67 +644,67 @@ static int32_t mndRetrieveQueries(SNodeMsg *pReq, SShowObj *pShow, char *data, i
...
@@ -643,67 +644,67 @@ static int32_t mndRetrieveQueries(SNodeMsg *pReq, SShowObj *pShow, char *data, i
SQueryDesc *pDesc = pConn->pQueries + i;
SQueryDesc *pDesc = pConn->pQueries + i;
cols = 0;
cols = 0;
pWrite = data + pShow->offset[cols] * rows + pShow->
bytes[cols]
* numOfRows;
pWrite = data + pShow->offset[cols] * rows + pShow->
pMeta->pSchemas[cols].bytes
* numOfRows;
*(int64_t *)pWrite = htobe64(pDesc->queryId);
*(int64_t *)pWrite = htobe64(pDesc->queryId);
cols++;
cols++;
pWrite = data + pShow->offset[cols] * rows + pShow->
bytes[cols]
* numOfRows;
pWrite = data + pShow->offset[cols] * rows + pShow->
pMeta->pSchemas[cols].bytes
* numOfRows;
*(int64_t *)pWrite = htobe64(pConn->id);
*(int64_t *)pWrite = htobe64(pConn->id);
cols++;
cols++;
pWrite = data + pShow->offset[cols] * rows + pShow->
bytes[cols]
* numOfRows;
pWrite = data + pShow->offset[cols] * rows + pShow->
pMeta->pSchemas[cols].bytes
* numOfRows;
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pConn->user, pShow->
bytes[cols]
);
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pConn->user, pShow->
pMeta->pSchemas[cols].bytes
);
cols++;
cols++;
pWrite = data + pShow->offset[cols] * rows + pShow->
bytes[cols]
* numOfRows;
pWrite = data + pShow->offset[cols] * rows + pShow->
pMeta->pSchemas[cols].bytes
* numOfRows;
snprintf(str, tListLen(str), "%s:%u", taosIpStr(pConn->ip), pConn->port);
snprintf(str, tListLen(str), "%s:%u", taosIpStr(pConn->ip), pConn->port);
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, str, pShow->
bytes[cols]
);
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, str, pShow->
pMeta->pSchemas[cols].bytes
);
cols++;
cols++;
char handleBuf[24] = {0};
char handleBuf[24] = {0};
snprintf(handleBuf, tListLen(handleBuf), "%" PRIu64, htobe64(pDesc->qId));
snprintf(handleBuf, tListLen(handleBuf), "%" PRIu64, htobe64(pDesc->qId));
pWrite = data + pShow->offset[cols] * rows + pShow->
bytes[cols]
* numOfRows;
pWrite = data + pShow->offset[cols] * rows + pShow->
pMeta->pSchemas[cols].bytes
* numOfRows;
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, handleBuf, pShow->
bytes[cols]
);
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, handleBuf, pShow->
pMeta->pSchemas[cols].bytes
);
cols++;
cols++;
pWrite = data + pShow->offset[cols] * rows + pShow->
bytes[cols]
* numOfRows;
pWrite = data + pShow->offset[cols] * rows + pShow->
pMeta->pSchemas[cols].bytes
* numOfRows;
*(int64_t *)pWrite = htobe64(pDesc->stime);
*(int64_t *)pWrite = htobe64(pDesc->stime);
cols++;
cols++;
pWrite = data + pShow->offset[cols] * rows + pShow->
bytes[cols]
* numOfRows;
pWrite = data + pShow->offset[cols] * rows + pShow->
pMeta->pSchemas[cols].bytes
* numOfRows;
*(int64_t *)pWrite = htobe64(pDesc->useconds);
*(int64_t *)pWrite = htobe64(pDesc->useconds);
cols++;
cols++;
snprintf(str, tListLen(str), "0x%" PRIx64, htobe64(pDesc->sqlObjId));
snprintf(str, tListLen(str), "0x%" PRIx64, htobe64(pDesc->sqlObjId));
pWrite = data + pShow->offset[cols] * rows + pShow->
bytes[cols]
* numOfRows;
pWrite = data + pShow->offset[cols] * rows + pShow->
pMeta->pSchemas[cols].bytes
* numOfRows;
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, str, pShow->
bytes[cols]
);
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, str, pShow->
pMeta->pSchemas[cols].bytes
);
cols++;
cols++;
pWrite = data + pShow->offset[cols] * rows + pShow->
bytes[cols]
* numOfRows;
pWrite = data + pShow->offset[cols] * rows + pShow->
pMeta->pSchemas[cols].bytes
* numOfRows;
*(int32_t *)pWrite = htonl(pDesc->pid);
*(int32_t *)pWrite = htonl(pDesc->pid);
cols++;
cols++;
char epBuf[TSDB_EP_LEN + 1] = {0};
char epBuf[TSDB_EP_LEN + 1] = {0};
snprintf(epBuf, tListLen(epBuf), "%s:%u", pDesc->fqdn, pConn->port);
snprintf(epBuf, tListLen(epBuf), "%s:%u", pDesc->fqdn, pConn->port);
pWrite = data + pShow->offset[cols] * rows + pShow->
bytes[cols]
* numOfRows;
pWrite = data + pShow->offset[cols] * rows + pShow->
pMeta->pSchemas[cols].bytes
* numOfRows;
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, epBuf, pShow->
bytes[cols]
);
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, epBuf, pShow->
pMeta->pSchemas[cols].bytes
);
cols++;
cols++;
pWrite = data + pShow->offset[cols] * rows + pShow->
bytes[cols]
* numOfRows;
pWrite = data + pShow->offset[cols] * rows + pShow->
pMeta->pSchemas[cols].bytes
* numOfRows;
*(bool *)pWrite = pDesc->stableQuery;
*(bool *)pWrite = pDesc->stableQuery;
cols++;
cols++;
pWrite = data + pShow->offset[cols] * rows + pShow->
bytes[cols]
* numOfRows;
pWrite = data + pShow->offset[cols] * rows + pShow->
pMeta->pSchemas[cols].bytes
* numOfRows;
*(int32_t *)pWrite = htonl(pDesc->numOfSub);
*(int32_t *)pWrite = htonl(pDesc->numOfSub);
cols++;
cols++;
pWrite = data + pShow->offset[cols] * rows + pShow->
bytes[cols]
* numOfRows;
pWrite = data + pShow->offset[cols] * rows + pShow->
pMeta->pSchemas[cols].bytes
* numOfRows;
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pDesc->subSqlInfo, pShow->
bytes[cols]
);
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pDesc->subSqlInfo, pShow->
pMeta->pSchemas[cols].bytes
);
cols++;
cols++;
pWrite = data + pShow->offset[cols] * rows + pShow->
bytes[cols]
* numOfRows;
pWrite = data + pShow->offset[cols] * rows + pShow->
pMeta->pSchemas[cols].bytes
* numOfRows;
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pDesc->sql, pShow->
bytes[cols]
);
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pDesc->sql, pShow->
pMeta->pSchemas[cols].bytes
);
cols++;
cols++;
numOfRows++;
numOfRows++;
...
...
source/dnode/mnode/impl/src/mndQnode.c
浏览文件 @
fe7f246c
...
@@ -517,7 +517,7 @@ static int32_t mndRetrieveQnodes(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock *p
...
@@ -517,7 +517,7 @@ static int32_t mndRetrieveQnodes(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock *p
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
&
pObj
->
id
,
false
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
&
pObj
->
id
,
false
);
char
ep
[
TSDB_EP_LEN
+
VARSTR_HEADER_SIZE
]
=
{
0
};
char
ep
[
TSDB_EP_LEN
+
VARSTR_HEADER_SIZE
]
=
{
0
};
STR_WITH_MAXSIZE_TO_VARSTR
(
ep
,
pObj
->
pDnode
->
ep
,
pShow
->
bytes
[
cols
]
);
STR_WITH_MAXSIZE_TO_VARSTR
(
ep
,
pObj
->
pDnode
->
ep
,
pShow
->
pMeta
->
pSchemas
[
cols
].
bytes
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
ep
,
false
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
ep
,
false
);
...
...
source/dnode/mnode/impl/src/mndQuery.c
浏览文件 @
fe7f246c
...
@@ -20,7 +20,7 @@
...
@@ -20,7 +20,7 @@
int32_t
mndProcessQueryMsg
(
SNodeMsg
*
pReq
)
{
int32_t
mndProcessQueryMsg
(
SNodeMsg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pNode
;
SMnode
*
pMnode
=
pReq
->
pNode
;
SReadHandle
handle
=
{
0
};
SReadHandle
handle
=
{
.
mnd
=
pMnode
};
mTrace
(
"msg:%p, in query queue is processing"
,
pReq
);
mTrace
(
"msg:%p, in query queue is processing"
,
pReq
);
switch
(
pReq
->
rpcMsg
.
msgType
)
{
switch
(
pReq
->
rpcMsg
.
msgType
)
{
...
...
source/dnode/mnode/impl/src/mndScheduler.c
浏览文件 @
fe7f246c
...
@@ -308,8 +308,7 @@ int32_t mndScheduleStream(SMnode* pMnode, STrans* pTrans, SStreamObj* pStream) {
...
@@ -308,8 +308,7 @@ int32_t mndScheduleStream(SMnode* pMnode, STrans* pTrans, SStreamObj* pStream) {
// sink part
// sink part
if
(
level
==
0
)
{
if
(
level
==
0
)
{
// only for inplace
// only for inplace
pTask
->
sinkType
=
TASK_SINK__SHOW
;
pTask
->
sinkType
=
TASK_SINK__NONE
;
pTask
->
showSink
.
reserved
=
0
;
if
(
!
hasExtraSink
)
{
if
(
!
hasExtraSink
)
{
#if 1
#if 1
if
(
pStream
->
createdBy
==
STREAM_CREATED_BY__SMA
)
{
if
(
pStream
->
createdBy
==
STREAM_CREATED_BY__SMA
)
{
...
@@ -368,8 +367,7 @@ int32_t mndScheduleStream(SMnode* pMnode, STrans* pTrans, SStreamObj* pStream) {
...
@@ -368,8 +367,7 @@ int32_t mndScheduleStream(SMnode* pMnode, STrans* pTrans, SStreamObj* pStream) {
pTask
->
sourceType
=
TASK_SOURCE__PIPE
;
pTask
->
sourceType
=
TASK_SOURCE__PIPE
;
// sink part
// sink part
pTask
->
sinkType
=
TASK_SINK__SHOW
;
pTask
->
sinkType
=
TASK_SINK__NONE
;
/*pTask->sinkType = TASK_SINK__NONE;*/
// dispatch part
// dispatch part
ASSERT
(
hasExtraSink
);
ASSERT
(
hasExtraSink
);
...
@@ -456,7 +454,7 @@ int32_t mndScheduleStream(SMnode* pMnode, STrans* pTrans, SStreamObj* pStream) {
...
@@ -456,7 +454,7 @@ int32_t mndScheduleStream(SMnode* pMnode, STrans* pTrans, SStreamObj* pStream) {
pTask
->
sourceType
=
TASK_SOURCE__MERGE
;
pTask
->
sourceType
=
TASK_SOURCE__MERGE
;
// sink part
// sink part
pTask
->
sinkType
=
TASK_SINK__
SHOW
;
pTask
->
sinkType
=
TASK_SINK__
NONE
;
// dispatch part
// dispatch part
pTask
->
dispatchType
=
TASK_DISPATCH__NONE
;
pTask
->
dispatchType
=
TASK_DISPATCH__NONE
;
...
...
source/dnode/mnode/impl/src/mndShow.c
浏览文件 @
fe7f246c
...
@@ -15,6 +15,7 @@
...
@@ -15,6 +15,7 @@
#define _DEFAULT_SOURCE
#define _DEFAULT_SOURCE
#include "mndShow.h"
#include "mndShow.h"
#include "systable.h"
#define SHOW_STEP_SIZE 100
#define SHOW_STEP_SIZE 100
...
@@ -47,7 +48,7 @@ void mndCleanupShow(SMnode *pMnode) {
...
@@ -47,7 +48,7 @@ void mndCleanupShow(SMnode *pMnode) {
}
}
}
}
static
int32_t
convertToRetrieveType
(
char
*
name
,
int32_t
len
)
{
static
int32_t
convertToRetrieveType
(
char
*
name
,
int32_t
len
)
{
int32_t
type
=
-
1
;
int32_t
type
=
-
1
;
if
(
strncasecmp
(
name
,
TSDB_INS_TABLE_DNODES
,
len
)
==
0
)
{
if
(
strncasecmp
(
name
,
TSDB_INS_TABLE_DNODES
,
len
)
==
0
)
{
...
@@ -72,8 +73,6 @@ static int32_t convertToRetrieveType(char* name, int32_t len) {
...
@@ -72,8 +73,6 @@ static int32_t convertToRetrieveType(char* name, int32_t len) {
// type = TSDB_MGMT_TABLE_INDEX;
// type = TSDB_MGMT_TABLE_INDEX;
}
else
if
(
strncasecmp
(
name
,
TSDB_INS_TABLE_USER_STABLES
,
len
)
==
0
)
{
}
else
if
(
strncasecmp
(
name
,
TSDB_INS_TABLE_USER_STABLES
,
len
)
==
0
)
{
type
=
TSDB_MGMT_TABLE_STB
;
type
=
TSDB_MGMT_TABLE_STB
;
}
else
if
(
strncasecmp
(
name
,
TSDB_INS_TABLE_USER_STREAMS
,
len
)
==
0
)
{
type
=
TSDB_MGMT_TABLE_STREAMS
;
}
else
if
(
strncasecmp
(
name
,
TSDB_INS_TABLE_USER_TABLES
,
len
)
==
0
)
{
}
else
if
(
strncasecmp
(
name
,
TSDB_INS_TABLE_USER_TABLES
,
len
)
==
0
)
{
type
=
TSDB_MGMT_TABLE_TABLE
;
type
=
TSDB_MGMT_TABLE_TABLE
;
}
else
if
(
strncasecmp
(
name
,
TSDB_INS_TABLE_USER_TABLE_DISTRIBUTED
,
len
)
==
0
)
{
}
else
if
(
strncasecmp
(
name
,
TSDB_INS_TABLE_USER_TABLE_DISTRIBUTED
,
len
)
==
0
)
{
...
@@ -84,26 +83,28 @@ static int32_t convertToRetrieveType(char* name, int32_t len) {
...
@@ -84,26 +83,28 @@ static int32_t convertToRetrieveType(char* name, int32_t len) {
type
=
TSDB_MGMT_TABLE_GRANTS
;
type
=
TSDB_MGMT_TABLE_GRANTS
;
}
else
if
(
strncasecmp
(
name
,
TSDB_INS_TABLE_VGROUPS
,
len
)
==
0
)
{
}
else
if
(
strncasecmp
(
name
,
TSDB_INS_TABLE_VGROUPS
,
len
)
==
0
)
{
type
=
TSDB_MGMT_TABLE_VGROUP
;
type
=
TSDB_MGMT_TABLE_VGROUP
;
}
else
if
(
strncasecmp
(
name
,
TSDB_
IN
S_TABLE_CONSUMERS
,
len
)
==
0
)
{
}
else
if
(
strncasecmp
(
name
,
TSDB_
PERF
S_TABLE_CONSUMERS
,
len
)
==
0
)
{
type
=
TSDB_MGMT_TABLE_CONSUMERS
;
type
=
TSDB_MGMT_TABLE_CONSUMERS
;
}
else
if
(
strncasecmp
(
name
,
TSDB_
IN
S_TABLE_SUBSCRIBES
,
len
)
==
0
)
{
}
else
if
(
strncasecmp
(
name
,
TSDB_
PERF
S_TABLE_SUBSCRIBES
,
len
)
==
0
)
{
type
=
TSDB_MGMT_TABLE_SUBSCRIBES
;
type
=
TSDB_MGMT_TABLE_SUBSCRIBES
;
}
else
if
(
strncasecmp
(
name
,
TSDB_
IN
S_TABLE_TRANS
,
len
)
==
0
)
{
}
else
if
(
strncasecmp
(
name
,
TSDB_
PERF
S_TABLE_TRANS
,
len
)
==
0
)
{
type
=
TSDB_MGMT_TABLE_TRANS
;
type
=
TSDB_MGMT_TABLE_TRANS
;
}
else
if
(
strncasecmp
(
name
,
TSDB_
IN
S_TABLE_SMAS
,
len
)
==
0
)
{
}
else
if
(
strncasecmp
(
name
,
TSDB_
PERF
S_TABLE_SMAS
,
len
)
==
0
)
{
type
=
TSDB_MGMT_TABLE_SMAS
;
type
=
TSDB_MGMT_TABLE_SMAS
;
}
else
if
(
strncasecmp
(
name
,
TSDB_INS_TABLE_CONFIGS
,
len
)
==
0
)
{
}
else
if
(
strncasecmp
(
name
,
TSDB_INS_TABLE_CONFIGS
,
len
)
==
0
)
{
type
=
TSDB_MGMT_TABLE_CONFIGS
;
type
=
TSDB_MGMT_TABLE_CONFIGS
;
}
else
if
(
strncasecmp
(
name
,
TSDB_
INS_TABLE_CON
NS
,
len
)
==
0
)
{
}
else
if
(
strncasecmp
(
name
,
TSDB_
PERFS_TABLE_CONNECTIO
NS
,
len
)
==
0
)
{
type
=
TSDB_MGMT_TABLE_CONNS
;
type
=
TSDB_MGMT_TABLE_CONNS
;
}
else
if
(
strncasecmp
(
name
,
TSDB_
IN
S_TABLE_QUERIES
,
len
)
==
0
)
{
}
else
if
(
strncasecmp
(
name
,
TSDB_
PERF
S_TABLE_QUERIES
,
len
)
==
0
)
{
type
=
TSDB_MGMT_TABLE_QUERIES
;
type
=
TSDB_MGMT_TABLE_QUERIES
;
}
else
if
(
strncasecmp
(
name
,
TSDB_INS_TABLE_VNODES
,
len
)
==
0
)
{
}
else
if
(
strncasecmp
(
name
,
TSDB_INS_TABLE_VNODES
,
len
)
==
0
)
{
type
=
TSDB_MGMT_TABLE_VNODES
;
type
=
TSDB_MGMT_TABLE_VNODES
;
}
else
if
(
strncasecmp
(
name
,
TSDB_PERFS_TABLE_TOPICS
,
len
)
==
0
)
{
}
else
if
(
strncasecmp
(
name
,
TSDB_PERFS_TABLE_TOPICS
,
len
)
==
0
)
{
type
=
TSDB_MGMT_TABLE_TOPICS
;
type
=
TSDB_MGMT_TABLE_TOPICS
;
}
else
if
(
strncasecmp
(
name
,
TSDB_PERFS_TABLE_STREAMS
,
len
)
==
0
)
{
type
=
TSDB_MGMT_TABLE_STREAMS
;
}
else
{
}
else
{
// ASSERT(0);
// ASSERT(0);
}
}
return
type
;
return
type
;
...
@@ -115,12 +116,12 @@ static SShowObj *mndCreateShowObj(SMnode *pMnode, SRetrieveTableReq *pReq) {
...
@@ -115,12 +116,12 @@ static SShowObj *mndCreateShowObj(SMnode *pMnode, SRetrieveTableReq *pReq) {
int64_t
showId
=
atomic_add_fetch_64
(
&
pMgmt
->
showId
,
1
);
int64_t
showId
=
atomic_add_fetch_64
(
&
pMgmt
->
showId
,
1
);
if
(
showId
==
0
)
atomic_add_fetch_64
(
&
pMgmt
->
showId
,
1
);
if
(
showId
==
0
)
atomic_add_fetch_64
(
&
pMgmt
->
showId
,
1
);
int32_t
size
=
sizeof
(
SShowObj
);
int32_t
size
=
sizeof
(
SShowObj
);
SShowObj
showObj
=
{
0
};
SShowObj
showObj
=
{
0
};
showObj
.
id
=
showId
;
showObj
.
id
=
showId
;
showObj
.
pMnode
=
pMnode
;
showObj
.
pMnode
=
pMnode
;
showObj
.
type
=
convertToRetrieveType
(
pReq
->
tb
,
tListLen
(
pReq
->
tb
));
showObj
.
type
=
convertToRetrieveType
(
pReq
->
tb
,
tListLen
(
pReq
->
tb
));
memcpy
(
showObj
.
db
,
pReq
->
db
,
TSDB_DB_FNAME_LEN
);
memcpy
(
showObj
.
db
,
pReq
->
db
,
TSDB_DB_FNAME_LEN
);
int32_t
keepTime
=
tsShellActivityTimer
*
6
*
1000
;
int32_t
keepTime
=
tsShellActivityTimer
*
6
*
1000
;
...
@@ -208,16 +209,6 @@ static int32_t mndProcessRetrieveSysTableReq(SNodeMsg *pReq) {
...
@@ -208,16 +209,6 @@ static int32_t mndProcessRetrieveSysTableReq(SNodeMsg *pReq) {
pShow
->
pMeta
=
pMeta
;
pShow
->
pMeta
=
pMeta
;
pShow
->
numOfColumns
=
pShow
->
pMeta
->
numOfColumns
;
pShow
->
numOfColumns
=
pShow
->
pMeta
->
numOfColumns
;
int32_t
offset
=
0
;
for
(
int32_t
i
=
0
;
i
<
pShow
->
pMeta
->
numOfColumns
;
++
i
)
{
pShow
->
offset
[
i
]
=
offset
;
int32_t
bytes
=
pShow
->
pMeta
->
pSchemas
[
i
].
bytes
;
pShow
->
rowSize
+=
bytes
;
pShow
->
bytes
[
i
]
=
bytes
;
offset
+=
bytes
;
}
}
else
{
}
else
{
pShow
=
mndAcquireShowObj
(
pMnode
,
retrieveReq
.
showId
);
pShow
=
mndAcquireShowObj
(
pMnode
,
retrieveReq
.
showId
);
if
(
pShow
==
NULL
)
{
if
(
pShow
==
NULL
)
{
...
...
source/dnode/mnode/impl/src/mndSnode.c
浏览文件 @
fe7f246c
...
@@ -463,7 +463,7 @@ static int32_t mndRetrieveSnodes(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock *p
...
@@ -463,7 +463,7 @@ static int32_t mndRetrieveSnodes(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock *p
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
&
pObj
->
id
,
false
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
&
pObj
->
id
,
false
);
char
ep
[
TSDB_EP_LEN
+
VARSTR_HEADER_SIZE
]
=
{
0
};
char
ep
[
TSDB_EP_LEN
+
VARSTR_HEADER_SIZE
]
=
{
0
};
STR_WITH_MAXSIZE_TO_VARSTR
(
ep
,
pObj
->
pDnode
->
ep
,
pShow
->
bytes
[
cols
]
);
STR_WITH_MAXSIZE_TO_VARSTR
(
ep
,
pObj
->
pDnode
->
ep
,
pShow
->
pMeta
->
pSchemas
[
cols
].
bytes
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
ep
,
false
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
ep
,
false
);
...
...
source/dnode/mnode/impl/src/mndStream.c
浏览文件 @
fe7f246c
...
@@ -308,6 +308,8 @@ static int32_t mndCreateStream(SMnode *pMnode, SNodeMsg *pReq, SCMCreateStreamRe
...
@@ -308,6 +308,8 @@ static int32_t mndCreateStream(SMnode *pMnode, SNodeMsg *pReq, SCMCreateStreamRe
streamObj
.
smaId
=
0
;
streamObj
.
smaId
=
0
;
/*streamObj.physicalPlan = "";*/
/*streamObj.physicalPlan = "";*/
streamObj
.
logicalPlan
=
"not implemented"
;
streamObj
.
logicalPlan
=
"not implemented"
;
streamObj
.
trigger
=
pCreate
->
triggerType
;
streamObj
.
waterMark
=
pCreate
->
watermark
;
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_TYPE_CREATE_STREAM
,
&
pReq
->
rpcMsg
);
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_TYPE_CREATE_STREAM
,
&
pReq
->
rpcMsg
);
if
(
pTrans
==
NULL
)
{
if
(
pTrans
==
NULL
)
{
...
@@ -431,7 +433,7 @@ static int32_t mndRetrieveStream(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock *p
...
@@ -431,7 +433,7 @@ static int32_t mndRetrieveStream(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock *p
SStreamObj
*
pStream
=
NULL
;
SStreamObj
*
pStream
=
NULL
;
while
(
numOfRows
<
rows
)
{
while
(
numOfRows
<
rows
)
{
pShow
->
pIter
=
sdbFetch
(
pSdb
,
SDB_
TOPIC
,
pShow
->
pIter
,
(
void
**
)
&
pStream
);
pShow
->
pIter
=
sdbFetch
(
pSdb
,
SDB_
STREAM
,
pShow
->
pIter
,
(
void
**
)
&
pStream
);
if
(
pShow
->
pIter
==
NULL
)
break
;
if
(
pShow
->
pIter
==
NULL
)
break
;
SColumnInfoData
*
pColInfo
;
SColumnInfoData
*
pColInfo
;
...
@@ -471,8 +473,13 @@ static int32_t mndRetrieveStream(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock *p
...
@@ -471,8 +473,13 @@ static int32_t mndRetrieveStream(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock *p
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
&
pStream
->
trigger
,
false
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
&
pStream
->
trigger
,
false
);
numOfRows
++
;
sdbRelease
(
pSdb
,
pStream
);
}
}
return
0
;
pShow
->
numOfRows
+=
numOfRows
;
return
numOfRows
;
}
}
static
void
mndCancelGetNextStream
(
SMnode
*
pMnode
,
void
*
pIter
)
{
static
void
mndCancelGetNextStream
(
SMnode
*
pMnode
,
void
*
pIter
)
{
...
...
source/dnode/mnode/impl/src/mndSubscribe.c
浏览文件 @
fe7f246c
...
@@ -452,7 +452,10 @@ static int32_t mndPersistRebResult(SMnode *pMnode, SNodeMsg *pMsg, const SMqRebO
...
@@ -452,7 +452,10 @@ static int32_t mndPersistRebResult(SMnode *pMnode, SNodeMsg *pMsg, const SMqRebO
}
}
// 4. TODO commit log: modification log
// 4. TODO commit log: modification log
// 5. execution
// 5. set cb
mndTransSetCb
(
pTrans
,
MQ_REB_TRANS_START_FUNC
,
MQ_REB_TRANS_STOP_FUNC
,
NULL
,
0
);
// 6. execution
if
(
mndTransPrepare
(
pMnode
,
pTrans
)
!=
0
)
goto
REB_FAIL
;
if
(
mndTransPrepare
(
pMnode
,
pTrans
)
!=
0
)
goto
REB_FAIL
;
mndTransDrop
(
pTrans
);
mndTransDrop
(
pTrans
);
...
@@ -518,9 +521,9 @@ static int32_t mndProcessRebalanceReq(SNodeMsg *pMsg) {
...
@@ -518,9 +521,9 @@ static int32_t mndProcessRebalanceReq(SNodeMsg *pMsg) {
}
}
// reset flag
// reset flag
atomic_store_8
(
pReq
->
mqInReb
,
0
);
mInfo
(
"mq rebalance completed successfully"
);
mInfo
(
"mq rebalance completed successfully"
);
taosHashCleanup
(
pReq
->
rebSubHash
);
taosHashCleanup
(
pReq
->
rebSubHash
);
mndRebEnd
();
return
0
;
return
0
;
}
}
...
...
source/dnode/mnode/impl/src/mndTrans.c
浏览文件 @
fe7f246c
...
@@ -16,6 +16,7 @@
...
@@ -16,6 +16,7 @@
#define _DEFAULT_SOURCE
#define _DEFAULT_SOURCE
#include "mndTrans.h"
#include "mndTrans.h"
#include "mndAuth.h"
#include "mndAuth.h"
#include "mndConsumer.h"
#include "mndDb.h"
#include "mndDb.h"
#include "mndShow.h"
#include "mndShow.h"
#include "mndSync.h"
#include "mndSync.h"
...
@@ -442,6 +443,10 @@ static TransCbFp mndTransGetCbFp(ETrnFuncType ftype) {
...
@@ -442,6 +443,10 @@ static TransCbFp mndTransGetCbFp(ETrnFuncType ftype) {
return
mndTransTestStartFunc
;
return
mndTransTestStartFunc
;
case
TEST_TRANS_STOP_FUNC
:
case
TEST_TRANS_STOP_FUNC
:
return
mndTransTestStopFunc
;
return
mndTransTestStopFunc
;
case
MQ_REB_TRANS_START_FUNC
:
return
mndRebCntInc
;
case
MQ_REB_TRANS_STOP_FUNC
:
return
mndRebCntDec
;
default:
default:
return
NULL
;
return
NULL
;
}
}
...
@@ -1346,17 +1351,17 @@ static int32_t mndRetrieveTrans(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock *pB
...
@@ -1346,17 +1351,17 @@ static int32_t mndRetrieveTrans(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock *pB
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
&
pTrans
->
createdTime
,
false
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
&
pTrans
->
createdTime
,
false
);
char
stage
[
TSDB_TRANS_STAGE_LEN
+
VARSTR_HEADER_SIZE
]
=
{
0
};
char
stage
[
TSDB_TRANS_STAGE_LEN
+
VARSTR_HEADER_SIZE
]
=
{
0
};
STR_WITH_MAXSIZE_TO_VARSTR
(
stage
,
mndTransStr
(
pTrans
->
stage
),
pShow
->
bytes
[
cols
]
);
STR_WITH_MAXSIZE_TO_VARSTR
(
stage
,
mndTransStr
(
pTrans
->
stage
),
pShow
->
pMeta
->
pSchemas
[
cols
].
bytes
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
stage
,
false
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
stage
,
false
);
char
dbname
[
TSDB_DB_NAME_LEN
+
VARSTR_HEADER_SIZE
]
=
{
0
};
char
dbname
[
TSDB_DB_NAME_LEN
+
VARSTR_HEADER_SIZE
]
=
{
0
};
STR_WITH_MAXSIZE_TO_VARSTR
(
dbname
,
mndGetDbStr
(
pTrans
->
dbname
),
pShow
->
bytes
[
cols
]
);
STR_WITH_MAXSIZE_TO_VARSTR
(
dbname
,
mndGetDbStr
(
pTrans
->
dbname
),
pShow
->
pMeta
->
pSchemas
[
cols
].
bytes
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
dbname
,
false
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
dbname
,
false
);
char
transType
[
TSDB_TRANS_TYPE_LEN
+
VARSTR_HEADER_SIZE
]
=
{
0
};
char
transType
[
TSDB_TRANS_TYPE_LEN
+
VARSTR_HEADER_SIZE
]
=
{
0
};
STR_WITH_MAXSIZE_TO_VARSTR
(
dbname
,
mndTransType
(
pTrans
->
transType
),
pShow
->
bytes
[
cols
]
);
STR_WITH_MAXSIZE_TO_VARSTR
(
dbname
,
mndTransType
(
pTrans
->
transType
),
pShow
->
pMeta
->
pSchemas
[
cols
].
bytes
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
transType
,
false
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
transType
,
false
);
...
@@ -1364,7 +1369,7 @@ static int32_t mndRetrieveTrans(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock *pB
...
@@ -1364,7 +1369,7 @@ static int32_t mndRetrieveTrans(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock *pB
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
&
pTrans
->
lastExecTime
,
false
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
&
pTrans
->
lastExecTime
,
false
);
char
lastError
[
TSDB_TRANS_ERROR_LEN
+
VARSTR_HEADER_SIZE
]
=
{
0
};
char
lastError
[
TSDB_TRANS_ERROR_LEN
+
VARSTR_HEADER_SIZE
]
=
{
0
};
STR_WITH_MAXSIZE_TO_VARSTR
(
dbname
,
pTrans
->
lastError
,
pShow
->
bytes
[
cols
]
);
STR_WITH_MAXSIZE_TO_VARSTR
(
dbname
,
pTrans
->
lastError
,
pShow
->
pMeta
->
pSchemas
[
cols
].
bytes
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
lastError
,
false
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
lastError
,
false
);
...
...
source/dnode/mnode/impl/src/mndUser.c
浏览文件 @
fe7f246c
...
@@ -657,7 +657,7 @@ static int32_t mndRetrieveUsers(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock *pB
...
@@ -657,7 +657,7 @@ static int32_t mndRetrieveUsers(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock *pB
SColumnInfoData
*
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
);
SColumnInfoData
*
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
);
char
name
[
TSDB_USER_LEN
+
VARSTR_HEADER_SIZE
]
=
{
0
};
char
name
[
TSDB_USER_LEN
+
VARSTR_HEADER_SIZE
]
=
{
0
};
STR_WITH_MAXSIZE_TO_VARSTR
(
name
,
pUser
->
user
,
pShow
->
bytes
[
cols
]
);
STR_WITH_MAXSIZE_TO_VARSTR
(
name
,
pUser
->
user
,
pShow
->
pMeta
->
pSchemas
[
cols
].
bytes
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
name
,
false
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
name
,
false
);
...
...
source/dnode/mnode/impl/src/mndVgroup.c
浏览文件 @
fe7f246c
...
@@ -540,7 +540,7 @@ static int32_t mndRetrieveVgroups(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock*
...
@@ -540,7 +540,7 @@ static int32_t mndRetrieveVgroups(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock*
char
buf1
[
20
]
=
{
0
};
char
buf1
[
20
]
=
{
0
};
const
char
*
role
=
syncStr
(
pVgroup
->
vnodeGid
[
i
].
role
);
const
char
*
role
=
syncStr
(
pVgroup
->
vnodeGid
[
i
].
role
);
STR_WITH_MAXSIZE_TO_VARSTR
(
buf1
,
role
,
pShow
->
bytes
[
cols
]
);
STR_WITH_MAXSIZE_TO_VARSTR
(
buf1
,
role
,
pShow
->
pMeta
->
pSchemas
[
cols
].
bytes
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
buf1
,
false
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
buf1
,
false
);
...
...
source/dnode/vnode/inc/vnode.h
浏览文件 @
fe7f246c
...
@@ -92,16 +92,16 @@ int metaTbCursorNext(SMTbCursor *pTbCur);
...
@@ -92,16 +92,16 @@ int metaTbCursorNext(SMTbCursor *pTbCur);
#endif
#endif
// tsdb
// tsdb
typedef
struct
STsdb
STsdb
;
//
typedef struct STsdb STsdb;
typedef
void
*
tsdbReaderT
;
typedef
void
*
tsdbReaderT
;
#define BLOCK_LOAD_OFFSET_SEQ_ORDER 1
#define BLOCK_LOAD_OFFSET_SEQ_ORDER 1
#define BLOCK_LOAD_TABLE_SEQ_ORDER 2
#define BLOCK_LOAD_TABLE_SEQ_ORDER 2
#define BLOCK_LOAD_TABLE_RR_ORDER 3
#define BLOCK_LOAD_TABLE_RR_ORDER 3
tsdbReaderT
*
tsdbQueryTables
(
S
Tsdb
*
tsdb
,
SQueryTableDataCond
*
pCond
,
STableGroupInfo
*
tableInfoGroup
,
uint64_t
qId
,
tsdbReaderT
*
tsdbQueryTables
(
S
Vnode
*
pVnode
,
SQueryTableDataCond
*
pCond
,
STableGroupInfo
*
tableInfoGroup
,
uint64_t
qId
,
uint64_t
taskId
);
uint64_t
taskId
);
tsdbReaderT
tsdbQueryCacheLast
(
S
Tsdb
*
tsdb
,
SQueryTableDataCond
*
pCond
,
STableGroupInfo
*
groupList
,
uint64_t
qId
,
tsdbReaderT
tsdbQueryCacheLast
(
S
Vnode
*
pVnode
,
SQueryTableDataCond
*
pCond
,
STableGroupInfo
*
groupList
,
uint64_t
qId
,
void
*
pMemRef
);
void
*
pMemRef
);
int32_t
tsdbGetFileBlocksDistInfo
(
tsdbReaderT
*
pReader
,
STableBlockDistInfo
*
pTableBlockInfo
);
int32_t
tsdbGetFileBlocksDistInfo
(
tsdbReaderT
*
pReader
,
STableBlockDistInfo
*
pTableBlockInfo
);
bool
isTsdbCacheLastRow
(
tsdbReaderT
*
pReader
);
bool
isTsdbCacheLastRow
(
tsdbReaderT
*
pReader
);
...
@@ -116,7 +116,7 @@ SArray *tsdbRetrieveDataBlock(tsdbReaderT *pTsdbReadHandle, SArray *pColumn
...
@@ -116,7 +116,7 @@ SArray *tsdbRetrieveDataBlock(tsdbReaderT *pTsdbReadHandle, SArray *pColumn
void
tsdbResetReadHandle
(
tsdbReaderT
queryHandle
,
SQueryTableDataCond
*
pCond
);
void
tsdbResetReadHandle
(
tsdbReaderT
queryHandle
,
SQueryTableDataCond
*
pCond
);
void
tsdbDestroyTableGroup
(
STableGroupInfo
*
pGroupList
);
void
tsdbDestroyTableGroup
(
STableGroupInfo
*
pGroupList
);
int32_t
tsdbGetOneTableGroup
(
void
*
pMeta
,
uint64_t
uid
,
TSKEY
startKey
,
STableGroupInfo
*
pGroupInfo
);
int32_t
tsdbGetOneTableGroup
(
void
*
pMeta
,
uint64_t
uid
,
TSKEY
startKey
,
STableGroupInfo
*
pGroupInfo
);
int32_t
tsdbGetTableGroupFromIdList
(
S
Tsdb
*
tsdb
,
SArray
*
pTableIdList
,
STableGroupInfo
*
pGroupInfo
);
int32_t
tsdbGetTableGroupFromIdList
(
S
Vnode
*
pVnode
,
SArray
*
pTableIdList
,
STableGroupInfo
*
pGroupInfo
);
// tq
// tq
...
...
source/dnode/vnode/src/inc/vnodeInt.h
浏览文件 @
fe7f246c
...
@@ -87,14 +87,19 @@ int32_t metaCreateTSma(SMeta* pMeta, SSmaCfg* pCfg);
...
@@ -87,14 +87,19 @@ int32_t metaCreateTSma(SMeta* pMeta, SSmaCfg* pCfg);
int32_t
metaDropTSma
(
SMeta
*
pMeta
,
int64_t
indexUid
);
int32_t
metaDropTSma
(
SMeta
*
pMeta
,
int64_t
indexUid
);
// tsdb
// tsdb
int
tsdbOpen
(
SVnode
*
pVnode
,
STsdb
**
ppTsdb
);
int
tsdbOpen
(
SVnode
*
pVnode
,
STsdb
**
ppTsdb
);
int
tsdbClose
(
STsdb
*
pTsdb
);
int
tsdbClose
(
STsdb
*
pTsdb
);
int
tsdbBegin
(
STsdb
*
pTsdb
);
int
tsdbBegin
(
STsdb
*
pTsdb
);
int
tsdbCommit
(
STsdb
*
pTsdb
);
int
tsdbCommit
(
STsdb
*
pTsdb
);
int32_t
tsdbUpdateSmaWindow
(
STsdb
*
pTsdb
,
SSubmitReq
*
pMsg
,
int64_t
version
);
int32_t
tsdbUpdateSmaWindow
(
STsdb
*
pTsdb
,
SSubmitReq
*
pMsg
,
int64_t
version
);
int32_t
tsdbCreateTSma
(
STsdb
*
pTsdb
,
char
*
pMsg
);
int32_t
tsdbCreateTSma
(
STsdb
*
pTsdb
,
char
*
pMsg
);
int32_t
tsdbInsertTSmaData
(
STsdb
*
pTsdb
,
int64_t
indexUid
,
const
char
*
msg
);
int32_t
tsdbInsertTSmaData
(
STsdb
*
pTsdb
,
int64_t
indexUid
,
const
char
*
msg
);
int
tsdbInsertData
(
STsdb
*
pTsdb
,
int64_t
version
,
SSubmitReq
*
pMsg
,
SSubmitRsp
*
pRsp
);
int
tsdbInsertData
(
STsdb
*
pTsdb
,
int64_t
version
,
SSubmitReq
*
pMsg
,
SSubmitRsp
*
pRsp
);
tsdbReaderT
*
tsdbQueryTablesT
(
STsdb
*
tsdb
,
SQueryTableDataCond
*
pCond
,
STableGroupInfo
*
groupList
,
uint64_t
qId
,
uint64_t
taskId
);
tsdbReaderT
tsdbQueryCacheLastT
(
STsdb
*
tsdb
,
SQueryTableDataCond
*
pCond
,
STableGroupInfo
*
groupList
,
uint64_t
qId
,
void
*
pMemRef
);
int32_t
tsdbGetTableGroupFromIdListT
(
STsdb
*
tsdb
,
SArray
*
pTableIdList
,
STableGroupInfo
*
pGroupInfo
);
// tq
// tq
STQ
*
tqOpen
(
const
char
*
path
,
SVnode
*
pVnode
,
SWal
*
pWal
);
STQ
*
tqOpen
(
const
char
*
path
,
SVnode
*
pVnode
,
SWal
*
pWal
);
...
...
source/dnode/vnode/src/meta/metaQuery.c
浏览文件 @
fe7f246c
...
@@ -159,7 +159,7 @@ SSchemaWrapper *metaGetTableSchema(SMeta *pMeta, tb_uid_t uid, int32_t sver, boo
...
@@ -159,7 +159,7 @@ SSchemaWrapper *metaGetTableSchema(SMeta *pMeta, tb_uid_t uid, int32_t sver, boo
// decode
// decode
pBuf
=
pVal
;
pBuf
=
pVal
;
pSW
=
taosMemoryMalloc
(
sizeof
(
pSW
));
pSW
=
taosMemoryMalloc
(
sizeof
(
SSchemaWrapper
));
tCoderInit
(
&
coder
,
TD_LITTLE_ENDIAN
,
pVal
,
vLen
,
TD_DECODER
);
tCoderInit
(
&
coder
,
TD_LITTLE_ENDIAN
,
pVal
,
vLen
,
TD_DECODER
);
tDecodeSSchemaWrapper
(
&
coder
,
pSW
);
tDecodeSSchemaWrapper
(
&
coder
,
pSW
);
...
@@ -436,4 +436,4 @@ void *metaGetSmaInfoByIndex(SMeta *pMeta, int64_t indexUid, bool isDecode) {
...
@@ -436,4 +436,4 @@ void *metaGetSmaInfoByIndex(SMeta *pMeta, int64_t indexUid, bool isDecode) {
return
NULL
;
return
NULL
;
}
}
#endif
#endif
\ No newline at end of file
source/dnode/vnode/src/tq/tq.c
浏览文件 @
fe7f246c
...
@@ -864,7 +864,7 @@ int32_t tqExpandTask(STQ* pTq, SStreamTask* pTask, int32_t parallel) {
...
@@ -864,7 +864,7 @@ int32_t tqExpandTask(STQ* pTq, SStreamTask* pTask, int32_t parallel) {
}
}
int32_t
tqProcessTaskDeploy
(
STQ
*
pTq
,
char
*
msg
,
int32_t
msgLen
)
{
int32_t
tqProcessTaskDeploy
(
STQ
*
pTq
,
char
*
msg
,
int32_t
msgLen
)
{
SStreamTask
*
pTask
=
taosMemory
Malloc
(
sizeof
(
SStreamTask
));
SStreamTask
*
pTask
=
taosMemory
Calloc
(
1
,
sizeof
(
SStreamTask
));
if
(
pTask
==
NULL
)
{
if
(
pTask
==
NULL
)
{
return
-
1
;
return
-
1
;
}
}
...
...
source/dnode/vnode/src/tsdb/tsdbRead.c
浏览文件 @
fe7f246c
...
@@ -422,7 +422,7 @@ _end:
...
@@ -422,7 +422,7 @@ _end:
return
NULL
;
return
NULL
;
}
}
tsdbReaderT
*
tsdbQueryTables
(
STsdb
*
tsdb
,
SQueryTableDataCond
*
pCond
,
STableGroupInfo
*
groupList
,
uint64_t
qId
,
tsdbReaderT
*
tsdbQueryTables
T
(
STsdb
*
tsdb
,
SQueryTableDataCond
*
pCond
,
STableGroupInfo
*
groupList
,
uint64_t
qId
,
uint64_t
taskId
)
{
uint64_t
taskId
)
{
STsdbReadHandle
*
pTsdbReadHandle
=
tsdbQueryTablesImpl
(
tsdb
,
pCond
,
qId
,
taskId
);
STsdbReadHandle
*
pTsdbReadHandle
=
tsdbQueryTablesImpl
(
tsdb
,
pCond
,
qId
,
taskId
);
if
(
pTsdbReadHandle
==
NULL
)
{
if
(
pTsdbReadHandle
==
NULL
)
{
...
@@ -535,7 +535,7 @@ tsdbReaderT tsdbQueryLastRow(STsdb* tsdb, SQueryTableDataCond* pCond, STableGrou
...
@@ -535,7 +535,7 @@ tsdbReaderT tsdbQueryLastRow(STsdb* tsdb, SQueryTableDataCond* pCond, STableGrou
return
NULL
;
return
NULL
;
}
}
STsdbReadHandle
*
pTsdbReadHandle
=
(
STsdbReadHandle
*
)
tsdbQueryTables
(
tsdb
,
pCond
,
groupList
,
qId
,
taskId
);
STsdbReadHandle
*
pTsdbReadHandle
=
(
STsdbReadHandle
*
)
tsdbQueryTables
T
(
tsdb
,
pCond
,
groupList
,
qId
,
taskId
);
if
(
pTsdbReadHandle
==
NULL
)
{
if
(
pTsdbReadHandle
==
NULL
)
{
return
NULL
;
return
NULL
;
}
}
...
@@ -555,8 +555,8 @@ tsdbReaderT tsdbQueryLastRow(STsdb* tsdb, SQueryTableDataCond* pCond, STableGrou
...
@@ -555,8 +555,8 @@ tsdbReaderT tsdbQueryLastRow(STsdb* tsdb, SQueryTableDataCond* pCond, STableGrou
}
}
#if 0
#if 0
tsdbReaderT tsdbQueryCacheLast(STsdb *tsdb, SQueryTableDataCond *pCond, STableGroupInfo *groupList, uint64_t qId, STsdbMemTable* pMemRef) {
tsdbReaderT tsdbQueryCacheLast
T
(STsdb *tsdb, SQueryTableDataCond *pCond, STableGroupInfo *groupList, uint64_t qId, STsdbMemTable* pMemRef) {
STsdbReadHandle *pTsdbReadHandle = (STsdbReadHandle*) tsdbQueryTables(tsdb, pCond, groupList, qId, pMemRef);
STsdbReadHandle *pTsdbReadHandle = (STsdbReadHandle*) tsdbQueryTables
T
(tsdb, pCond, groupList, qId, pMemRef);
if (pTsdbReadHandle == NULL) {
if (pTsdbReadHandle == NULL) {
return NULL;
return NULL;
}
}
...
@@ -634,7 +634,7 @@ tsdbReaderT tsdbQueryRowsInExternalWindow(STsdb* tsdb, SQueryTableDataCond* pCon
...
@@ -634,7 +634,7 @@ tsdbReaderT tsdbQueryRowsInExternalWindow(STsdb* tsdb, SQueryTableDataCond* pCon
}
}
}
}
STsdbReadHandle
*
pTsdbReadHandle
=
(
STsdbReadHandle
*
)
tsdbQueryTables
(
tsdb
,
pCond
,
pNew
,
qId
,
taskId
);
STsdbReadHandle
*
pTsdbReadHandle
=
(
STsdbReadHandle
*
)
tsdbQueryTables
T
(
tsdb
,
pCond
,
pNew
,
qId
,
taskId
);
pTsdbReadHandle
->
loadExternalRow
=
true
;
pTsdbReadHandle
->
loadExternalRow
=
true
;
pTsdbReadHandle
->
currentLoadExternalRows
=
true
;
pTsdbReadHandle
->
currentLoadExternalRows
=
true
;
...
@@ -3717,7 +3717,7 @@ _error:
...
@@ -3717,7 +3717,7 @@ _error:
}
}
#if 0
#if 0
int32_t tsdbGetTableGroupFromIdList(STsdb* tsdb, SArray* pTableIdList, STableGroupInfo* pGroupInfo) {
int32_t tsdbGetTableGroupFromIdList
T
(STsdb* tsdb, SArray* pTableIdList, STableGroupInfo* pGroupInfo) {
if (tsdbRLockRepoMeta(tsdb) < 0) {
if (tsdbRLockRepoMeta(tsdb) < 0) {
return terrno;
return terrno;
}
}
...
...
source/dnode/vnode/src/vnd/vnodeQuery.c
浏览文件 @
fe7f246c
...
@@ -147,4 +147,24 @@ void vnodeGetInfo(SVnode *pVnode, const char **dbname, int32_t *vgId) {
...
@@ -147,4 +147,24 @@ void vnodeGetInfo(SVnode *pVnode, const char **dbname, int32_t *vgId) {
if
(
vgId
)
{
if
(
vgId
)
{
*
vgId
=
TD_VID
(
pVnode
);
*
vgId
=
TD_VID
(
pVnode
);
}
}
}
// wrapper of tsdb read interface
// TODO: use FORCE_INLINE if possible later
tsdbReaderT
*
tsdbQueryTables
(
SVnode
*
pVnode
,
SQueryTableDataCond
*
pCond
,
STableGroupInfo
*
tableInfoGroup
,
uint64_t
qId
,
uint64_t
taskId
)
{
return
tsdbQueryTablesT
(
pVnode
->
pTsdb
,
pCond
,
tableInfoGroup
,
qId
,
taskId
);
}
tsdbReaderT
tsdbQueryCacheLast
(
SVnode
*
pVnode
,
SQueryTableDataCond
*
pCond
,
STableGroupInfo
*
groupList
,
uint64_t
qId
,
void
*
pMemRef
)
{
#if 0
return tsdbQueryCacheLastT(pVnode->pTsdb, pCond, groupList, qId, pMemRef);
#endif
return
0
;
}
int32_t
tsdbGetTableGroupFromIdList
(
SVnode
*
pVnode
,
SArray
*
pTableIdList
,
STableGroupInfo
*
pGroupInfo
)
{
#if 0
return tsdbGetTableGroupFromIdListT(pVnode->pTsdb, pTableIdList, pGroupInfo);
#endif
return
0
;
}
}
\ No newline at end of file
source/dnode/vnode/src/vnd/vnodeSvr.c
浏览文件 @
fe7f246c
...
@@ -141,8 +141,10 @@ _err:
...
@@ -141,8 +141,10 @@ _err:
int
vnodeProcessQueryMsg
(
SVnode
*
pVnode
,
SRpcMsg
*
pMsg
)
{
int
vnodeProcessQueryMsg
(
SVnode
*
pVnode
,
SRpcMsg
*
pMsg
)
{
vTrace
(
"message in vnode query queue is processing"
);
vTrace
(
"message in vnode query queue is processing"
);
#if 0
SReadHandle handle = {.reader = pVnode->pTsdb, .meta = pVnode->pMeta, .config = &pVnode->config, .vnode = pVnode};
SReadHandle handle = {.reader = pVnode->pTsdb, .meta = pVnode->pMeta, .config = &pVnode->config, .vnode = pVnode};
#endif
SReadHandle
handle
=
{.
meta
=
pVnode
->
pMeta
,
.
config
=
&
pVnode
->
config
,
.
vnode
=
pVnode
};
switch
(
pMsg
->
msgType
)
{
switch
(
pMsg
->
msgType
)
{
case
TDMT_VND_QUERY
:
case
TDMT_VND_QUERY
:
return
qWorkerProcessQueryMsg
(
&
handle
,
pVnode
->
pQuery
,
pMsg
);
return
qWorkerProcessQueryMsg
(
&
handle
,
pVnode
->
pQuery
,
pMsg
);
...
...
source/libs/catalog/src/catalog.c
浏览文件 @
fe7f246c
...
@@ -17,6 +17,7 @@
...
@@ -17,6 +17,7 @@
#include "query.h"
#include "query.h"
#include "tname.h"
#include "tname.h"
#include "catalogInt.h"
#include "catalogInt.h"
#include "systable.h"
int32_t
ctgActUpdateVg
(
SCtgMetaAction
*
action
);
int32_t
ctgActUpdateVg
(
SCtgMetaAction
*
action
);
int32_t
ctgActUpdateTbl
(
SCtgMetaAction
*
action
);
int32_t
ctgActUpdateTbl
(
SCtgMetaAction
*
action
);
...
...
source/libs/executor/inc/executorimpl.h
浏览文件 @
fe7f246c
...
@@ -640,6 +640,7 @@ int32_t getTableScanOrder(SOperatorInfo* pOperator);
...
@@ -640,6 +640,7 @@ int32_t getTableScanOrder(SOperatorInfo* pOperator);
void
doSetOperatorCompleted
(
SOperatorInfo
*
pOperator
);
void
doSetOperatorCompleted
(
SOperatorInfo
*
pOperator
);
void
doFilter
(
const
SNode
*
pFilterNode
,
SSDataBlock
*
pBlock
);
void
doFilter
(
const
SNode
*
pFilterNode
,
SSDataBlock
*
pBlock
);
SqlFunctionCtx
*
createSqlFunctionCtx
(
SExprInfo
*
pExprInfo
,
int32_t
numOfOutput
,
int32_t
**
rowCellInfoOffset
);
SqlFunctionCtx
*
createSqlFunctionCtx
(
SExprInfo
*
pExprInfo
,
int32_t
numOfOutput
,
int32_t
**
rowCellInfoOffset
);
void
relocateColumnData
(
SSDataBlock
*
pBlock
,
const
SArray
*
pColMatchInfo
,
SArray
*
pCols
);
SOperatorInfo
*
createExchangeOperatorInfo
(
const
SNodeList
*
pSources
,
SSDataBlock
*
pBlock
,
SExecTaskInfo
*
pTaskInfo
);
SOperatorInfo
*
createExchangeOperatorInfo
(
const
SNodeList
*
pSources
,
SSDataBlock
*
pBlock
,
SExecTaskInfo
*
pTaskInfo
);
...
@@ -694,7 +695,7 @@ SOperatorInfo* createMultiTableTimeIntervalOperatorInfo(STaskRuntimeEnv* pRuntim
...
@@ -694,7 +695,7 @@ SOperatorInfo* createMultiTableTimeIntervalOperatorInfo(STaskRuntimeEnv* pRuntim
SExprInfo* pExpr, int32_t numOfOutput);
SExprInfo* pExpr, int32_t numOfOutput);
#endif
#endif
void
projectApplyFunctions
(
SExprInfo
*
pExpr
,
SSDataBlock
*
pResult
,
SSDataBlock
*
pSrcBlock
,
SqlFunctionCtx
*
pCtx
,
int32_t
projectApplyFunctions
(
SExprInfo
*
pExpr
,
SSDataBlock
*
pResult
,
SSDataBlock
*
pSrcBlock
,
SqlFunctionCtx
*
pCtx
,
int32_t
numOfOutput
,
SArray
*
pPseudoList
);
int32_t
numOfOutput
,
SArray
*
pPseudoList
);
void
setInputDataBlock
(
SOperatorInfo
*
pOperator
,
SqlFunctionCtx
*
pCtx
,
SSDataBlock
*
pBlock
,
int32_t
order
,
bool
createDummyCol
);
void
setInputDataBlock
(
SOperatorInfo
*
pOperator
,
SqlFunctionCtx
*
pCtx
,
SSDataBlock
*
pBlock
,
int32_t
order
,
bool
createDummyCol
);
...
...
source/libs/executor/src/dataDispatcher.c
浏览文件 @
fe7f246c
...
@@ -31,6 +31,7 @@ typedef struct SDataDispatchBuf {
...
@@ -31,6 +31,7 @@ typedef struct SDataDispatchBuf {
typedef
struct
SDataCacheEntry
{
typedef
struct
SDataCacheEntry
{
int32_t
dataLen
;
int32_t
dataLen
;
int32_t
numOfRows
;
int32_t
numOfRows
;
int32_t
numOfCols
;
int8_t
compressed
;
int8_t
compressed
;
char
data
[];
char
data
[];
}
SDataCacheEntry
;
}
SDataCacheEntry
;
...
@@ -76,6 +77,7 @@ static void toDataCacheEntry(const SDataDispatchHandle* pHandle, const SInputDat
...
@@ -76,6 +77,7 @@ static void toDataCacheEntry(const SDataDispatchHandle* pHandle, const SInputDat
SDataCacheEntry
*
pEntry
=
(
SDataCacheEntry
*
)
pBuf
->
pData
;
SDataCacheEntry
*
pEntry
=
(
SDataCacheEntry
*
)
pBuf
->
pData
;
pEntry
->
compressed
=
(
int8_t
)
needCompress
(
pInput
->
pData
,
numOfCols
);
pEntry
->
compressed
=
(
int8_t
)
needCompress
(
pInput
->
pData
,
numOfCols
);
pEntry
->
numOfRows
=
pInput
->
pData
->
info
.
rows
;
pEntry
->
numOfRows
=
pInput
->
pData
->
info
.
rows
;
pEntry
->
numOfCols
=
pInput
->
pData
->
info
.
numOfCols
;
pEntry
->
dataLen
=
0
;
pEntry
->
dataLen
=
0
;
pBuf
->
useSize
=
sizeof
(
SRetrieveTableRsp
);
pBuf
->
useSize
=
sizeof
(
SRetrieveTableRsp
);
...
@@ -169,6 +171,7 @@ static int32_t getDataBlock(SDataSinkHandle* pHandle, SOutputData* pOutput) {
...
@@ -169,6 +171,7 @@ static int32_t getDataBlock(SDataSinkHandle* pHandle, SOutputData* pOutput) {
SDataCacheEntry
*
pEntry
=
(
SDataCacheEntry
*
)(
pDispatcher
->
nextOutput
.
pData
);
SDataCacheEntry
*
pEntry
=
(
SDataCacheEntry
*
)(
pDispatcher
->
nextOutput
.
pData
);
memcpy
(
pOutput
->
pData
,
pEntry
->
data
,
pEntry
->
dataLen
);
memcpy
(
pOutput
->
pData
,
pEntry
->
data
,
pEntry
->
dataLen
);
pOutput
->
numOfRows
=
pEntry
->
numOfRows
;
pOutput
->
numOfRows
=
pEntry
->
numOfRows
;
pOutput
->
numOfCols
=
pEntry
->
numOfCols
;
pOutput
->
compressed
=
pEntry
->
compressed
;
pOutput
->
compressed
=
pEntry
->
compressed
;
taosMemoryFreeClear
(
pDispatcher
->
nextOutput
.
pData
);
// todo persistent
taosMemoryFreeClear
(
pDispatcher
->
nextOutput
.
pData
);
// todo persistent
pOutput
->
bufStatus
=
updateStatus
(
pDispatcher
);
pOutput
->
bufStatus
=
updateStatus
(
pDispatcher
);
...
...
source/libs/executor/src/executorimpl.c
浏览文件 @
fe7f246c
此差异已折叠。
点击以展开。
source/libs/executor/src/scanoperator.c
浏览文件 @
fe7f246c
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
* 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
<common/ttime.h>
#include
"common/ttime.h"
#include "filter.h"
#include "filter.h"
#include "function.h"
#include "function.h"
#include "functionMgt.h"
#include "functionMgt.h"
...
@@ -21,7 +21,7 @@
...
@@ -21,7 +21,7 @@
#include "querynodes.h"
#include "querynodes.h"
#include "tglobal.h"
#include "tglobal.h"
#include "tname.h"
#include "tname.h"
#include "
vnod
e.h"
#include "
systabl
e.h"
#include "tdatablock.h"
#include "tdatablock.h"
#include "tmsg.h"
#include "tmsg.h"
...
@@ -36,6 +36,9 @@
...
@@ -36,6 +36,9 @@
#define SET_REVERSE_SCAN_FLAG(_info) ((_info)->scanFlag = REVERSE_SCAN)
#define SET_REVERSE_SCAN_FLAG(_info) ((_info)->scanFlag = REVERSE_SCAN)
#define SWITCH_ORDER(n) (((n) = ((n) == TSDB_ORDER_ASC) ? TSDB_ORDER_DESC : TSDB_ORDER_ASC))
#define SWITCH_ORDER(n) (((n) = ((n) == TSDB_ORDER_ASC) ? TSDB_ORDER_DESC : TSDB_ORDER_ASC))
int32_t
buildSysDbTableInfo
(
const
SSysTableScanInfo
*
pInfo
);
int32_t
buildDbTableInfoBlock
(
const
SSDataBlock
*
p
,
const
SSysTableMeta
*
pSysDbTableMeta
,
size_t
size
,
const
char
*
dbName
);
void
switchCtxOrder
(
SqlFunctionCtx
*
pCtx
,
int32_t
numOfOutput
)
{
void
switchCtxOrder
(
SqlFunctionCtx
*
pCtx
,
int32_t
numOfOutput
)
{
for
(
int32_t
i
=
0
;
i
<
numOfOutput
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfOutput
;
++
i
)
{
SWITCH_ORDER
(
pCtx
[
i
].
order
);
SWITCH_ORDER
(
pCtx
[
i
].
order
);
...
@@ -65,21 +68,6 @@ static void setupQueryRangeForReverseScan(STableScanInfo* pTableScanInfo) {
...
@@ -65,21 +68,6 @@ static void setupQueryRangeForReverseScan(STableScanInfo* pTableScanInfo) {
#endif
#endif
}
}
// relocated the column data according to the slotId
static
void
relocateColumnData
(
SSDataBlock
*
pBlock
,
const
SArray
*
pColMatchInfo
,
SArray
*
pCols
)
{
int32_t
numOfCols
=
pBlock
->
info
.
numOfCols
;
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
SColumnInfoData
*
p
=
taosArrayGet
(
pCols
,
i
);
SColMatchInfo
*
pmInfo
=
taosArrayGet
(
pColMatchInfo
,
i
);
if
(
!
pmInfo
->
output
)
{
continue
;
}
ASSERT
(
pmInfo
->
colId
==
p
->
info
.
colId
);
taosArraySet
(
pBlock
->
pDataBlock
,
pmInfo
->
targetSlotId
,
p
);
}
}
static
void
getNextTimeWindow
(
SInterval
*
pInterval
,
STimeWindow
*
tw
,
int32_t
order
)
{
static
void
getNextTimeWindow
(
SInterval
*
pInterval
,
STimeWindow
*
tw
,
int32_t
order
)
{
int32_t
factor
=
GET_FORWARD_DIRECTION_FACTOR
(
order
);
int32_t
factor
=
GET_FORWARD_DIRECTION_FACTOR
(
order
);
if
(
pInterval
->
intervalUnit
!=
'n'
&&
pInterval
->
intervalUnit
!=
'y'
)
{
if
(
pInterval
->
intervalUnit
!=
'n'
&&
pInterval
->
intervalUnit
!=
'y'
)
{
...
@@ -244,11 +232,6 @@ int32_t loadDataBlock(SOperatorInfo* pOperator, STableScanInfo* pTableScanInfo,
...
@@ -244,11 +232,6 @@ int32_t loadDataBlock(SOperatorInfo* pOperator, STableScanInfo* pTableScanInfo,
}
}
relocateColumnData
(
pBlock
,
pTableScanInfo
->
pColMatchInfo
,
pCols
);
relocateColumnData
(
pBlock
,
pTableScanInfo
->
pColMatchInfo
,
pCols
);
// reset the block to be 0 by default, this blockId is assigned by physical plan and is used by direct upstream
// operator.
pBlock
->
info
.
blockId
=
0
;
doFilter
(
pTableScanInfo
->
pFilterNode
,
pBlock
);
doFilter
(
pTableScanInfo
->
pFilterNode
,
pBlock
);
if
(
pBlock
->
info
.
rows
==
0
)
{
if
(
pBlock
->
info
.
rows
==
0
)
{
pCost
->
filterOutBlocks
+=
1
;
pCost
->
filterOutBlocks
+=
1
;
...
@@ -788,7 +771,12 @@ static SSDataBlock* doFilterResult(SSysTableScanInfo* pInfo) {
...
@@ -788,7 +771,12 @@ static SSDataBlock* doFilterResult(SSysTableScanInfo* pInfo) {
continue
;
continue
;
}
}
colDataAppend
(
pDest
,
numOfRow
,
colDataGetData
(
pSrc
,
j
),
false
);
if
(
colDataIsNull_s
(
pSrc
,
j
))
{
colDataAppendNULL
(
pDest
,
numOfRow
);
}
else
{
colDataAppend
(
pDest
,
numOfRow
,
colDataGetData
(
pSrc
,
j
),
false
);
}
numOfRow
+=
1
;
numOfRow
+=
1
;
}
}
}
else
{
}
else
{
...
@@ -802,6 +790,67 @@ static SSDataBlock* doFilterResult(SSysTableScanInfo* pInfo) {
...
@@ -802,6 +790,67 @@ static SSDataBlock* doFilterResult(SSysTableScanInfo* pInfo) {
return
pInfo
->
pRes
->
info
.
rows
==
0
?
NULL
:
pInfo
->
pRes
;
return
pInfo
->
pRes
->
info
.
rows
==
0
?
NULL
:
pInfo
->
pRes
;
}
}
static
SSDataBlock
*
buildSysTableMetaBlock
()
{
SSDataBlock
*
pBlock
=
taosMemoryCalloc
(
1
,
sizeof
(
SSDataBlock
));
pBlock
->
info
.
numOfCols
=
10
;
pBlock
->
info
.
hasVarCol
=
true
;
pBlock
->
pDataBlock
=
taosArrayInit
(
pBlock
->
info
.
numOfCols
,
sizeof
(
SColumnInfoData
));
SColumnInfoData
colInfoData
=
{
0
};
colInfoData
.
info
.
colId
=
1
;
colInfoData
.
info
.
type
=
TSDB_DATA_TYPE_VARCHAR
;
colInfoData
.
info
.
bytes
=
(
TSDB_TABLE_NAME_LEN
-
1
)
+
VARSTR_HEADER_SIZE
;
taosArrayPush
(
pBlock
->
pDataBlock
,
&
colInfoData
);
colInfoData
.
info
.
colId
=
2
;
colInfoData
.
info
.
type
=
TSDB_DATA_TYPE_VARCHAR
;
colInfoData
.
info
.
bytes
=
(
TSDB_DB_NAME_LEN
-
1
)
+
VARSTR_HEADER_SIZE
;
taosArrayPush
(
pBlock
->
pDataBlock
,
&
colInfoData
);
colInfoData
.
info
.
colId
=
3
;
colInfoData
.
info
.
type
=
TSDB_DATA_TYPE_TIMESTAMP
;
colInfoData
.
info
.
bytes
=
8
;
taosArrayPush
(
pBlock
->
pDataBlock
,
&
colInfoData
);
colInfoData
.
info
.
colId
=
4
;
colInfoData
.
info
.
type
=
TSDB_DATA_TYPE_INT
;
colInfoData
.
info
.
bytes
=
4
;
taosArrayPush
(
pBlock
->
pDataBlock
,
&
colInfoData
);
colInfoData
.
info
.
colId
=
5
;
colInfoData
.
info
.
type
=
TSDB_DATA_TYPE_VARCHAR
;
colInfoData
.
info
.
bytes
=
(
TSDB_TABLE_NAME_LEN
-
1
)
+
VARSTR_HEADER_SIZE
;
taosArrayPush
(
pBlock
->
pDataBlock
,
&
colInfoData
);
colInfoData
.
info
.
colId
=
6
;
colInfoData
.
info
.
type
=
TSDB_DATA_TYPE_BIGINT
;
colInfoData
.
info
.
bytes
=
8
;
taosArrayPush
(
pBlock
->
pDataBlock
,
&
colInfoData
);
colInfoData
.
info
.
colId
=
7
;
colInfoData
.
info
.
type
=
TSDB_DATA_TYPE_INT
;
colInfoData
.
info
.
bytes
=
4
;
taosArrayPush
(
pBlock
->
pDataBlock
,
&
colInfoData
);
colInfoData
.
info
.
colId
=
8
;
colInfoData
.
info
.
type
=
TSDB_DATA_TYPE_INT
;
colInfoData
.
info
.
bytes
=
4
;
taosArrayPush
(
pBlock
->
pDataBlock
,
&
colInfoData
);
colInfoData
.
info
.
colId
=
9
;
colInfoData
.
info
.
type
=
TSDB_DATA_TYPE_VARCHAR
;
colInfoData
.
info
.
bytes
=
512
+
VARSTR_HEADER_SIZE
;
taosArrayPush
(
pBlock
->
pDataBlock
,
&
colInfoData
);
colInfoData
.
info
.
colId
=
10
;
colInfoData
.
info
.
type
=
TSDB_DATA_TYPE_VARCHAR
;
colInfoData
.
info
.
bytes
=
20
+
VARSTR_HEADER_SIZE
;
taosArrayPush
(
pBlock
->
pDataBlock
,
&
colInfoData
);
return
pBlock
;
}
static
SSDataBlock
*
doSysTableScan
(
SOperatorInfo
*
pOperator
,
bool
*
newgroup
)
{
static
SSDataBlock
*
doSysTableScan
(
SOperatorInfo
*
pOperator
,
bool
*
newgroup
)
{
// build message and send to mnode to fetch the content of system tables.
// build message and send to mnode to fetch the content of system tables.
SExecTaskInfo
*
pTaskInfo
=
pOperator
->
pTaskInfo
;
SExecTaskInfo
*
pTaskInfo
=
pOperator
->
pTaskInfo
;
...
@@ -810,115 +859,135 @@ static SSDataBlock* doSysTableScan(SOperatorInfo* pOperator, bool* newgroup) {
...
@@ -810,115 +859,135 @@ static SSDataBlock* doSysTableScan(SOperatorInfo* pOperator, bool* newgroup) {
// retrieve local table list info from vnode
// retrieve local table list info from vnode
const
char
*
name
=
tNameGetTableName
(
&
pInfo
->
name
);
const
char
*
name
=
tNameGetTableName
(
&
pInfo
->
name
);
if
(
strncasecmp
(
name
,
TSDB_INS_TABLE_USER_TABLES
,
TSDB_TABLE_FNAME_LEN
)
==
0
)
{
if
(
strncasecmp
(
name
,
TSDB_INS_TABLE_USER_TABLES
,
TSDB_TABLE_FNAME_LEN
)
==
0
)
{
if
(
pInfo
->
pCur
==
NULL
)
{
// the retrieve is executed on the mnode, so return tables that belongs to the information schema database.
pInfo
->
pCur
=
metaOpenTbCursor
(
pInfo
->
readHandle
.
meta
);
if
(
pInfo
->
readHandle
.
mnd
!=
NULL
)
{
}
if
(
pOperator
->
status
==
OP_EXEC_DONE
)
{
return
NULL
;
blockDataCleanup
(
pInfo
->
pRes
);
}
int32_t
tableNameSlotId
=
1
;
SColumnInfoData
*
pTableNameCol
=
taosArrayGet
(
pInfo
->
pRes
->
pDataBlock
,
tableNameSlotId
);
int32_t
numOfRows
=
0
;
const
char
*
db
=
NULL
;
int32_t
vgId
=
0
;
vnodeGetInfo
(
pInfo
->
readHandle
.
vnode
,
&
db
,
&
vgId
);
SName
sn
=
{
0
};
char
dbname
[
TSDB_DB_FNAME_LEN
+
VARSTR_HEADER_SIZE
]
=
{
0
};
tNameFromString
(
&
sn
,
db
,
T_NAME_ACCT
|
T_NAME_DB
);
tNameGetDbName
(
&
sn
,
varDataVal
(
dbname
));
varDataSetLen
(
dbname
,
strlen
(
varDataVal
(
dbname
)));
char
n
[
TSDB_TABLE_NAME_LEN
]
=
{
0
};
buildSysDbTableInfo
(
pInfo
);
while
(
metaTbCursorNext
(
pInfo
->
pCur
)
==
0
)
{
STR_TO_VARSTR
(
n
,
pInfo
->
pCur
->
mr
.
me
.
name
);
colDataAppend
(
pTableNameCol
,
numOfRows
,
n
,
false
);
int32_t
tableType
=
pInfo
->
pCur
->
mr
.
me
.
type
;
doFilterResult
(
pInfo
);
pInfo
->
loadInfo
.
totalRows
+=
pInfo
->
pRes
->
info
.
rows
;
// database name
pOperator
->
status
=
OP_EXEC_DONE
;
SColumnInfoData
*
pColInfoData
=
taosArrayGet
(
pInfo
->
pRes
->
pDataBlock
,
0
);
return
(
pInfo
->
pRes
->
info
.
rows
==
0
)
?
NULL
:
pInfo
->
pRes
;
colDataAppend
(
pColInfoData
,
numOfRows
,
dbname
,
false
);
}
else
{
if
(
pInfo
->
pCur
==
NULL
)
{
pInfo
->
pCur
=
metaOpenTbCursor
(
pInfo
->
readHandle
.
meta
);
}
// vgId
blockDataCleanup
(
pInfo
->
pRes
);
pColInfoData
=
taosArrayGet
(
pInfo
->
pRes
->
pDataBlock
,
6
);
colDataAppend
(
pColInfoData
,
numOfRows
,
(
char
*
)
&
vgId
,
false
);
// table comment
int32_t
numOfRows
=
0
;
// todo: set the correct comment
pColInfoData
=
taosArrayGet
(
pInfo
->
pRes
->
pDataBlock
,
8
);
colDataAppendNULL
(
pColInfoData
,
numOfRows
);
char
str
[
256
]
=
{
0
};
const
char
*
db
=
NULL
;
if
(
tableType
==
TSDB_CHILD_TABLE
)
{
int32_t
vgId
=
0
;
SMetaReader
mr
=
{
0
};
vnodeGetInfo
(
pInfo
->
readHandle
.
vnode
,
&
db
,
&
vgId
);
metaReaderInit
(
&
mr
,
pInfo
->
readHandle
.
meta
,
0
);
metaGetTableEntryByUid
(
&
mr
,
pInfo
->
pCur
->
mr
.
me
.
ctbEntry
.
suid
);
pColInfoData
=
taosArrayGet
(
pInfo
->
pRes
->
pDataBlock
,
3
);
SName
sn
=
{
0
};
colDataAppend
(
pColInfoData
,
numOfRows
,
(
char
*
)
&
mr
.
me
.
stbEntry
.
schema
.
nCols
,
false
);
char
dbname
[
TSDB_DB_FNAME_LEN
+
VARSTR_HEADER_SIZE
]
=
{
0
};
tNameFromString
(
&
sn
,
db
,
T_NAME_ACCT
|
T_NAME_DB
);
// create time
tNameGetDbName
(
&
sn
,
varDataVal
(
dbname
));
int64_t
ts
=
pInfo
->
pCur
->
mr
.
me
.
ctbEntry
.
ctime
;
varDataSetLen
(
dbname
,
strlen
(
varDataVal
(
dbname
)));
pColInfoData
=
taosArrayGet
(
pInfo
->
pRes
->
pDataBlock
,
2
);
colDataAppend
(
pColInfoData
,
numOfRows
,
(
char
*
)
&
ts
,
false
);
// super table name
SSDataBlock
*
p
=
buildSysTableMetaBlock
();
STR_TO_VARSTR
(
str
,
mr
.
me
.
name
);
blockDataEnsureCapacity
(
p
,
pInfo
->
capacity
);
pColInfoData
=
taosArrayGet
(
pInfo
->
pRes
->
pDataBlock
,
4
);
colDataAppend
(
pColInfoData
,
numOfRows
,
str
,
false
);
metaReaderClear
(
&
mr
);
// uid
char
n
[
TSDB_TABLE_NAME_LEN
+
VARSTR_HEADER_SIZE
]
=
{
0
};
pColInfoData
=
taosArrayGet
(
pInfo
->
pRes
->
pDataBlock
,
5
);
while
(
metaTbCursorNext
(
pInfo
->
pCur
)
==
0
)
{
colDataAppend
(
pColInfoData
,
numOfRows
,
(
char
*
)
&
pInfo
->
pCur
->
mr
.
me
.
uid
,
fals
e
);
STR_TO_VARSTR
(
n
,
pInfo
->
pCur
->
mr
.
me
.
nam
e
);
// t
tl
// t
able name
pColInfoData
=
taosArrayGet
(
pInfo
->
pRes
->
pDataBlock
,
7
);
SColumnInfoData
*
pColInfoData
=
taosArrayGet
(
p
->
pDataBlock
,
0
);
colDataAppend
(
pColInfoData
,
numOfRows
,
(
char
*
)
&
pInfo
->
pCur
->
mr
.
me
.
ctbEntry
.
ttlDays
,
false
);
colDataAppend
(
pColInfoData
,
numOfRows
,
n
,
false
);
STR_TO_VARSTR
(
str
,
"CHILD_TABLE"
);
// database name
}
else
if
(
tableType
==
TSDB_NORMAL_TABLE
)
{
pColInfoData
=
taosArrayGet
(
p
->
pDataBlock
,
1
);
// create time
colDataAppend
(
pColInfoData
,
numOfRows
,
dbname
,
false
);
pColInfoData
=
taosArrayGet
(
pInfo
->
pRes
->
pDataBlock
,
2
);
colDataAppend
(
pColInfoData
,
numOfRows
,
(
char
*
)
&
pInfo
->
pCur
->
mr
.
me
.
ntbEntry
.
ctime
,
false
);
//
number of columns
//
vgId
pColInfoData
=
taosArrayGet
(
p
Info
->
pRes
->
pDataBlock
,
3
);
pColInfoData
=
taosArrayGet
(
p
->
pDataBlock
,
6
);
colDataAppend
(
pColInfoData
,
numOfRows
,
(
char
*
)
&
pInfo
->
pCur
->
mr
.
me
.
ntbEntry
.
schema
.
nCols
,
false
);
colDataAppend
(
pColInfoData
,
numOfRows
,
(
char
*
)
&
vgId
,
false
);
// super table name
// table comment
pColInfoData
=
taosArrayGet
(
pInfo
->
pRes
->
pDataBlock
,
4
);
// todo: set the correct comment
pColInfoData
=
taosArrayGet
(
p
->
pDataBlock
,
8
);
colDataAppendNULL
(
pColInfoData
,
numOfRows
);
colDataAppendNULL
(
pColInfoData
,
numOfRows
);
// uid
char
str
[
256
]
=
{
0
};
pColInfoData
=
taosArrayGet
(
pInfo
->
pRes
->
pDataBlock
,
5
);
int32_t
tableType
=
pInfo
->
pCur
->
mr
.
me
.
type
;
colDataAppend
(
pColInfoData
,
numOfRows
,
(
char
*
)
&
pInfo
->
pCur
->
mr
.
me
.
uid
,
false
);
if
(
tableType
==
TSDB_CHILD_TABLE
)
{
// create time
int64_t
ts
=
pInfo
->
pCur
->
mr
.
me
.
ctbEntry
.
ctime
;
pColInfoData
=
taosArrayGet
(
p
->
pDataBlock
,
2
);
colDataAppend
(
pColInfoData
,
numOfRows
,
(
char
*
)
&
ts
,
false
);
SMetaReader
mr
=
{
0
};
metaReaderInit
(
&
mr
,
pInfo
->
readHandle
.
meta
,
0
);
metaGetTableEntryByUid
(
&
mr
,
pInfo
->
pCur
->
mr
.
me
.
ctbEntry
.
suid
);
// number of columns
pColInfoData
=
taosArrayGet
(
p
->
pDataBlock
,
3
);
colDataAppend
(
pColInfoData
,
numOfRows
,
(
char
*
)
&
mr
.
me
.
stbEntry
.
schema
.
nCols
,
false
);
// super table name
STR_TO_VARSTR
(
str
,
mr
.
me
.
name
);
pColInfoData
=
taosArrayGet
(
p
->
pDataBlock
,
4
);
colDataAppend
(
pColInfoData
,
numOfRows
,
str
,
false
);
metaReaderClear
(
&
mr
);
// uid
pColInfoData
=
taosArrayGet
(
p
->
pDataBlock
,
5
);
colDataAppend
(
pColInfoData
,
numOfRows
,
(
char
*
)
&
pInfo
->
pCur
->
mr
.
me
.
uid
,
false
);
// ttl
pColInfoData
=
taosArrayGet
(
p
->
pDataBlock
,
7
);
colDataAppend
(
pColInfoData
,
numOfRows
,
(
char
*
)
&
pInfo
->
pCur
->
mr
.
me
.
ctbEntry
.
ttlDays
,
false
);
STR_TO_VARSTR
(
str
,
"CHILD_TABLE"
);
}
else
if
(
tableType
==
TSDB_NORMAL_TABLE
)
{
// create time
pColInfoData
=
taosArrayGet
(
p
->
pDataBlock
,
2
);
colDataAppend
(
pColInfoData
,
numOfRows
,
(
char
*
)
&
pInfo
->
pCur
->
mr
.
me
.
ntbEntry
.
ctime
,
false
);
// number of columns
pColInfoData
=
taosArrayGet
(
p
->
pDataBlock
,
3
);
colDataAppend
(
pColInfoData
,
numOfRows
,
(
char
*
)
&
pInfo
->
pCur
->
mr
.
me
.
ntbEntry
.
schema
.
nCols
,
false
);
// super table name
pColInfoData
=
taosArrayGet
(
p
->
pDataBlock
,
4
);
colDataAppendNULL
(
pColInfoData
,
numOfRows
);
// uid
pColInfoData
=
taosArrayGet
(
p
->
pDataBlock
,
5
);
colDataAppend
(
pColInfoData
,
numOfRows
,
(
char
*
)
&
pInfo
->
pCur
->
mr
.
me
.
uid
,
false
);
// ttl
pColInfoData
=
taosArrayGet
(
p
->
pDataBlock
,
7
);
colDataAppend
(
pColInfoData
,
numOfRows
,
(
char
*
)
&
pInfo
->
pCur
->
mr
.
me
.
ntbEntry
.
ttlDays
,
false
);
STR_TO_VARSTR
(
str
,
"NORMAL_TABLE"
);
}
// ttl
pColInfoData
=
taosArrayGet
(
p
->
pDataBlock
,
9
);
pColInfoData
=
taosArrayGet
(
pInfo
->
pRes
->
pDataBlock
,
7
);
colDataAppend
(
pColInfoData
,
numOfRows
,
str
,
false
);
colDataAppend
(
pColInfoData
,
numOfRows
,
(
char
*
)
&
pInfo
->
pCur
->
mr
.
me
.
ntbEntry
.
ttlDays
,
false
);
STR_TO_VARSTR
(
str
,
"NORMAL_TABLE"
);
if
(
++
numOfRows
>=
pInfo
->
capacity
)
{
break
;
}
}
}
pColInfoData
=
taosArrayGet
(
pInfo
->
pRes
->
pDataBlock
,
9
);
p
->
info
.
rows
=
numOfRows
;
colDataAppend
(
pColInfoData
,
numOfRows
,
str
,
false
);
pInfo
->
pRes
->
info
.
rows
=
numOfRows
;
if
(
++
numOfRows
>=
pInfo
->
capacity
)
{
break
;
}
}
pInfo
->
loadInfo
.
totalRows
+=
numOfRows
;
relocateColumnData
(
pInfo
->
pRes
,
pInfo
->
scanCols
,
p
->
pDataBlock
)
;
pInfo
->
pRes
->
info
.
rows
=
numOfRows
;
doFilterResult
(
pInfo
)
;
// pInfo->elapsedTime
;
pInfo
->
loadInfo
.
totalRows
+=
pInfo
->
pRes
->
info
.
rows
;
// pInfo->totalByt
es;
return
(
pInfo
->
pRes
->
info
.
rows
==
0
)
?
NULL
:
pInfo
->
pR
es
;
return
(
pInfo
->
pRes
->
info
.
rows
==
0
)
?
NULL
:
pInfo
->
pRes
;
}
}
else
{
// load the meta from mnode of the given epset
}
else
{
// load the meta from mnode of the given epset
if
(
pOperator
->
status
==
OP_EXEC_DONE
)
{
if
(
pOperator
->
status
==
OP_EXEC_DONE
)
{
return
NULL
;
return
NULL
;
...
@@ -988,6 +1057,67 @@ static SSDataBlock* doSysTableScan(SOperatorInfo* pOperator, bool* newgroup) {
...
@@ -988,6 +1057,67 @@ static SSDataBlock* doSysTableScan(SOperatorInfo* pOperator, bool* newgroup) {
}
}
}
}
int32_t
buildSysDbTableInfo
(
const
SSysTableScanInfo
*
pInfo
)
{
SSDataBlock
*
p
=
buildSysTableMetaBlock
();
blockDataEnsureCapacity
(
p
,
pInfo
->
capacity
);
size_t
size
=
0
;
const
SSysTableMeta
*
pSysDbTableMeta
=
NULL
;
getInfosDbMeta
(
&
pSysDbTableMeta
,
&
size
);
p
->
info
.
rows
=
buildDbTableInfoBlock
(
p
,
pSysDbTableMeta
,
size
,
TSDB_INFORMATION_SCHEMA_DB
);
getPerfDbMeta
(
&
pSysDbTableMeta
,
&
size
);
p
->
info
.
rows
=
buildDbTableInfoBlock
(
p
,
pSysDbTableMeta
,
size
,
TSDB_PERFORMANCE_SCHEMA_DB
);
relocateColumnData
(
pInfo
->
pRes
,
pInfo
->
scanCols
,
p
->
pDataBlock
);
// blockDataDestroy(p); todo handle memory leak
pInfo
->
pRes
->
info
.
rows
=
p
->
info
.
rows
;
return
p
->
info
.
rows
;
}
int32_t
buildDbTableInfoBlock
(
const
SSDataBlock
*
p
,
const
SSysTableMeta
*
pSysDbTableMeta
,
size_t
size
,
const
char
*
dbName
)
{
char
n
[
TSDB_TABLE_FNAME_LEN
+
VARSTR_HEADER_SIZE
]
=
{
0
};
int32_t
numOfRows
=
p
->
info
.
rows
;
for
(
int32_t
i
=
0
;
i
<
size
;
++
i
)
{
const
SSysTableMeta
*
pm
=
&
pSysDbTableMeta
[
i
];
SColumnInfoData
*
pColInfoData
=
taosArrayGet
(
p
->
pDataBlock
,
0
);
STR_TO_VARSTR
(
n
,
pm
->
name
);
colDataAppend
(
pColInfoData
,
numOfRows
,
n
,
false
);
// database name
STR_TO_VARSTR
(
n
,
dbName
);
pColInfoData
=
taosArrayGet
(
p
->
pDataBlock
,
1
);
colDataAppend
(
pColInfoData
,
numOfRows
,
n
,
false
);
// create time
pColInfoData
=
taosArrayGet
(
p
->
pDataBlock
,
2
);
colDataAppendNULL
(
pColInfoData
,
numOfRows
);
// number of columns
pColInfoData
=
taosArrayGet
(
p
->
pDataBlock
,
3
);
colDataAppend
(
pColInfoData
,
numOfRows
,
(
char
*
)
&
pm
->
colNum
,
false
);
for
(
int32_t
j
=
4
;
j
<=
8
;
++
j
)
{
pColInfoData
=
taosArrayGet
(
p
->
pDataBlock
,
j
);
colDataAppendNULL
(
pColInfoData
,
numOfRows
);
}
STR_TO_VARSTR
(
n
,
"SYSTEM_TABLE"
);
pColInfoData
=
taosArrayGet
(
p
->
pDataBlock
,
9
);
colDataAppend
(
pColInfoData
,
numOfRows
,
n
,
false
);
numOfRows
+=
1
;
}
return
numOfRows
;
}
SOperatorInfo
*
createSysTableScanOperatorInfo
(
void
*
readHandle
,
SSDataBlock
*
pResBlock
,
const
SName
*
pName
,
SOperatorInfo
*
createSysTableScanOperatorInfo
(
void
*
readHandle
,
SSDataBlock
*
pResBlock
,
const
SName
*
pName
,
SNode
*
pCondition
,
SEpSet
epset
,
SArray
*
colList
,
SNode
*
pCondition
,
SEpSet
epset
,
SArray
*
colList
,
SExecTaskInfo
*
pTaskInfo
,
bool
showRewrite
,
int32_t
accountId
)
{
SExecTaskInfo
*
pTaskInfo
,
bool
showRewrite
,
int32_t
accountId
)
{
...
...
source/libs/function/inc/builtinsimpl.h
浏览文件 @
fe7f246c
...
@@ -68,6 +68,11 @@ bool getTopBotFuncEnv(SFunctionNode* UNUSED_PARAM(pFunc), SFuncExecEnv* pEnv);
...
@@ -68,6 +68,11 @@ bool getTopBotFuncEnv(SFunctionNode* UNUSED_PARAM(pFunc), SFuncExecEnv* pEnv);
int32_t
topFunction
(
SqlFunctionCtx
*
pCtx
);
int32_t
topFunction
(
SqlFunctionCtx
*
pCtx
);
int32_t
topBotFinalize
(
SqlFunctionCtx
*
pCtx
,
SSDataBlock
*
pBlock
);
int32_t
topBotFinalize
(
SqlFunctionCtx
*
pCtx
,
SSDataBlock
*
pBlock
);
bool
getSpreadFuncEnv
(
struct
SFunctionNode
*
pFunc
,
SFuncExecEnv
*
pEnv
);
bool
spreadFunctionSetup
(
SqlFunctionCtx
*
pCtx
,
SResultRowEntryInfo
*
pResultInfo
);
int32_t
spreadFunction
(
SqlFunctionCtx
*
pCtx
);
int32_t
spreadFinalize
(
SqlFunctionCtx
*
pCtx
,
SSDataBlock
*
pBlock
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
#endif
#endif
...
...
source/libs/function/src/builtins.c
浏览文件 @
fe7f246c
此差异已折叠。
点击以展开。
source/libs/function/src/builtinsimpl.c
浏览文件 @
fe7f246c
此差异已折叠。
点击以展开。
source/libs/parser/src/parTranslater.c
浏览文件 @
fe7f246c
...
@@ -22,6 +22,7 @@
...
@@ -22,6 +22,7 @@
#include "scalar.h"
#include "scalar.h"
#include "tglobal.h"
#include "tglobal.h"
#include "ttime.h"
#include "ttime.h"
#include "systable.h"
#define generateDealNodeErrMsg(pCxt, code, ...) \
#define generateDealNodeErrMsg(pCxt, code, ...) \
(pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, code, ##__VA_ARGS__) ? DEAL_RES_ERROR : DEAL_RES_ERROR)
(pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, code, ##__VA_ARGS__) ? DEAL_RES_ERROR : DEAL_RES_ERROR)
...
@@ -780,17 +781,17 @@ static int32_t setSysTableVgroupList(STranslateContext* pCxt, SName* pName, SRea
...
@@ -780,17 +781,17 @@ static int32_t setSysTableVgroupList(STranslateContext* pCxt, SName* pName, SRea
SArray
*
vgroupList
=
NULL
;
SArray
*
vgroupList
=
NULL
;
if
(
'\0'
!=
pRealTable
->
qualDbName
[
0
])
{
if
(
'\0'
!=
pRealTable
->
qualDbName
[
0
])
{
// todo release after mnode can be processed
// todo release after mnode can be processed
//
if (0 != strcmp(pRealTable->qualDbName, TSDB_INFORMATION_SCHEMA_DB)) {
if
(
0
!=
strcmp
(
pRealTable
->
qualDbName
,
TSDB_INFORMATION_SCHEMA_DB
))
{
code
=
getDBVgInfo
(
pCxt
,
pRealTable
->
qualDbName
,
&
vgroupList
);
code
=
getDBVgInfo
(
pCxt
,
pRealTable
->
qualDbName
,
&
vgroupList
);
//
}
}
}
else
{
}
else
{
code
=
getDBVgInfoImpl
(
pCxt
,
pName
,
&
vgroupList
);
code
=
getDBVgInfoImpl
(
pCxt
,
pName
,
&
vgroupList
);
}
}
// todo release after mnode can be processed
// todo release after mnode can be processed
//
if (TSDB_CODE_SUCCESS == code) {
if
(
TSDB_CODE_SUCCESS
==
code
)
{
//
code = addMnodeToVgroupList(&pCxt->pParseCxt->mgmtEpSet, &vgroupList);
code
=
addMnodeToVgroupList
(
&
pCxt
->
pParseCxt
->
mgmtEpSet
,
&
vgroupList
);
//
}
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
toVgroupsInfo
(
vgroupList
,
&
pRealTable
->
pVgroupList
);
code
=
toVgroupsInfo
(
vgroupList
,
&
pRealTable
->
pVgroupList
);
...
...
source/libs/planner/src/planPhysiCreater.c
浏览文件 @
fe7f246c
...
@@ -18,6 +18,7 @@
...
@@ -18,6 +18,7 @@
#include "catalog.h"
#include "catalog.h"
#include "functionMgt.h"
#include "functionMgt.h"
#include "tglobal.h"
#include "tglobal.h"
#include "systable.h"
typedef
struct
SSlotIdInfo
{
typedef
struct
SSlotIdInfo
{
int16_t
slotId
;
int16_t
slotId
;
...
...
source/libs/qcom/src/querymsg.c
浏览文件 @
fe7f246c
...
@@ -17,6 +17,7 @@
...
@@ -17,6 +17,7 @@
#include "queryInt.h"
#include "queryInt.h"
#include "query.h"
#include "query.h"
#include "trpc.h"
#include "trpc.h"
#include "systable.h"
#pragma GCC diagnostic push
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-truncation"
#pragma GCC diagnostic ignored "-Wformat-truncation"
...
...
source/libs/qworker/src/qworkerMsg.c
浏览文件 @
fe7f246c
...
@@ -34,6 +34,7 @@ void qwBuildFetchRsp(void *msg, SOutputData *input, int32_t len, bool qComplete)
...
@@ -34,6 +34,7 @@ void qwBuildFetchRsp(void *msg, SOutputData *input, int32_t len, bool qComplete)
rsp
->
compressed
=
input
->
compressed
;
rsp
->
compressed
=
input
->
compressed
;
rsp
->
compLen
=
htonl
(
len
);
rsp
->
compLen
=
htonl
(
len
);
rsp
->
numOfRows
=
htonl
(
input
->
numOfRows
);
rsp
->
numOfRows
=
htonl
(
input
->
numOfRows
);
rsp
->
numOfCols
=
htonl
(
input
->
numOfCols
);
}
}
void
qwFreeFetchRsp
(
void
*
msg
)
{
void
qwFreeFetchRsp
(
void
*
msg
)
{
...
...
source/libs/scalar/src/sclfunc.c
浏览文件 @
fe7f246c
...
@@ -15,7 +15,15 @@ typedef int16_t (*_len_fn)(char *, int32_t);
...
@@ -15,7 +15,15 @@ typedef int16_t (*_len_fn)(char *, int32_t);
/** Math functions **/
/** Math functions **/
static
double
tlog
(
double
v
,
double
base
)
{
static
double
tlog
(
double
v
,
double
base
)
{
return
log
(
v
)
/
log
(
base
);
double
a
=
log
(
v
);
double
b
=
log
(
base
);
if
(
isnan
(
a
)
||
isinf
(
a
))
{
return
a
;
}
else
if
(
isnan
(
b
)
||
isinf
(
b
))
{
return
b
;
}
else
{
return
a
/
b
;
}
}
}
int32_t
absFunction
(
SScalarParam
*
pInput
,
int32_t
inputNum
,
SScalarParam
*
pOutput
)
{
int32_t
absFunction
(
SScalarParam
*
pInput
,
int32_t
inputNum
,
SScalarParam
*
pOutput
)
{
...
@@ -160,22 +168,64 @@ static int32_t doScalarFunctionUnique2(SScalarParam *pInput, int32_t inputNum, S
...
@@ -160,22 +168,64 @@ static int32_t doScalarFunctionUnique2(SScalarParam *pInput, int32_t inputNum, S
}
}
double
*
out
=
(
double
*
)
pOutputData
->
pData
;
double
*
out
=
(
double
*
)
pOutputData
->
pData
;
double
result
;
int32_t
numOfRows
=
TMAX
(
pInput
[
0
].
numOfRows
,
pInput
[
1
].
numOfRows
);
if
(
pInput
[
0
].
numOfRows
==
pInput
[
1
].
numOfRows
)
{
for
(
int32_t
i
=
0
;
i
<
numOfRows
;
++
i
)
{
if
(
colDataIsNull_s
(
pInputData
[
0
],
i
)
||
colDataIsNull_s
(
pInputData
[
1
],
i
))
{
colDataAppendNULL
(
pOutputData
,
i
);
continue
;
}
result
=
valFn
(
getValueFn
[
0
](
pInputData
[
0
]
->
pData
,
i
),
getValueFn
[
1
](
pInputData
[
1
]
->
pData
,
i
));
if
(
isinf
(
result
)
||
isnan
(
result
))
{
colDataAppendNULL
(
pOutputData
,
i
);
}
else
{
out
[
i
]
=
result
;
}
}
}
else
if
(
pInput
[
0
].
numOfRows
==
1
)
{
//left operand is constant
if
(
colDataIsNull_s
(
pInputData
[
0
],
0
))
{
colDataAppendNNULL
(
pOutputData
,
0
,
pInput
[
1
].
numOfRows
);
}
else
{
for
(
int32_t
i
=
0
;
i
<
numOfRows
;
++
i
)
{
if
(
colDataIsNull_s
(
pInputData
[
1
],
i
))
{
colDataAppendNULL
(
pOutputData
,
i
);
continue
;
}
for
(
int32_t
i
=
0
;
i
<
pInput
->
numOfRows
;
++
i
)
{
result
=
valFn
(
getValueFn
[
0
](
pInputData
[
0
]
->
pData
,
0
),
getValueFn
[
1
](
pInputData
[
1
]
->
pData
,
i
));
if
(
colDataIsNull_s
(
pInputData
[
0
],
i
)
||
if
(
isinf
(
result
)
||
isnan
(
result
))
{
colDataIsNull_s
(
pInputData
[
1
],
0
))
{
colDataAppendNULL
(
pOutputData
,
i
);
colDataAppendNULL
(
pOutputData
,
i
);
continue
;
continue
;
}
out
[
i
]
=
result
;
}
}
}
double
result
=
valFn
(
getValueFn
[
0
](
pInputData
[
0
]
->
pData
,
i
),
getValueFn
[
1
](
pInputData
[
1
]
->
pData
,
0
));
}
else
if
(
pInput
[
1
].
numOfRows
==
1
)
{
if
(
isinf
(
result
)
||
isnan
(
result
))
{
if
(
colDataIsNull_s
(
pInputData
[
1
],
0
))
{
colDataAppendN
ULL
(
pOutputData
,
i
);
colDataAppendN
NULL
(
pOutputData
,
0
,
pInput
[
0
].
numOfRows
);
}
else
{
}
else
{
out
[
i
]
=
result
;
for
(
int32_t
i
=
0
;
i
<
numOfRows
;
++
i
)
{
if
(
colDataIsNull_s
(
pInputData
[
0
],
i
))
{
colDataAppendNULL
(
pOutputData
,
i
);
continue
;
}
result
=
valFn
(
getValueFn
[
0
](
pInputData
[
0
]
->
pData
,
i
),
getValueFn
[
1
](
pInputData
[
1
]
->
pData
,
0
));
if
(
isinf
(
result
)
||
isnan
(
result
))
{
colDataAppendNULL
(
pOutputData
,
i
);
continue
;
}
out
[
i
]
=
result
;
}
}
}
}
}
pOutput
->
numOfRows
=
pInput
->
numOfRows
;
pOutput
->
numOfRows
=
numOfRows
;
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
...
...
source/libs/stream/src/tstream.c
浏览文件 @
fe7f246c
...
@@ -158,8 +158,6 @@ int32_t streamExecTask(SStreamTask* pTask, SMsgCb* pMsgCb, const void* input, in
...
@@ -158,8 +158,6 @@ int32_t streamExecTask(SStreamTask* pTask, SMsgCb* pMsgCb, const void* input, in
//
//
}
else
if
(
pTask
->
sinkType
==
TASK_SINK__FETCH
)
{
}
else
if
(
pTask
->
sinkType
==
TASK_SINK__FETCH
)
{
//
//
}
else
if
(
pTask
->
sinkType
==
TASK_SINK__SHOW
)
{
blockDebugShowData
(
pRes
);
}
else
{
}
else
{
ASSERT
(
pTask
->
sinkType
==
TASK_SINK__NONE
);
ASSERT
(
pTask
->
sinkType
==
TASK_SINK__NONE
);
}
}
...
@@ -280,8 +278,6 @@ int32_t tEncodeSStreamTask(SCoder* pEncoder, const SStreamTask* pTask) {
...
@@ -280,8 +278,6 @@ int32_t tEncodeSStreamTask(SCoder* pEncoder, const SStreamTask* pTask) {
if
(
tEncodeI64
(
pEncoder
,
pTask
->
smaSink
.
smaId
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
pEncoder
,
pTask
->
smaSink
.
smaId
)
<
0
)
return
-
1
;
}
else
if
(
pTask
->
sinkType
==
TASK_SINK__FETCH
)
{
}
else
if
(
pTask
->
sinkType
==
TASK_SINK__FETCH
)
{
if
(
tEncodeI8
(
pEncoder
,
pTask
->
fetchSink
.
reserved
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
pEncoder
,
pTask
->
fetchSink
.
reserved
)
<
0
)
return
-
1
;
}
else
if
(
pTask
->
sinkType
==
TASK_SINK__SHOW
)
{
if
(
tEncodeI8
(
pEncoder
,
pTask
->
showSink
.
reserved
)
<
0
)
return
-
1
;
}
else
{
}
else
{
ASSERT
(
pTask
->
sinkType
==
TASK_SINK__NONE
);
ASSERT
(
pTask
->
sinkType
==
TASK_SINK__NONE
);
}
}
...
@@ -326,8 +322,6 @@ int32_t tDecodeSStreamTask(SCoder* pDecoder, SStreamTask* pTask) {
...
@@ -326,8 +322,6 @@ int32_t tDecodeSStreamTask(SCoder* pDecoder, SStreamTask* pTask) {
if
(
tDecodeI64
(
pDecoder
,
&
pTask
->
smaSink
.
smaId
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
pDecoder
,
&
pTask
->
smaSink
.
smaId
)
<
0
)
return
-
1
;
}
else
if
(
pTask
->
sinkType
==
TASK_SINK__FETCH
)
{
}
else
if
(
pTask
->
sinkType
==
TASK_SINK__FETCH
)
{
if
(
tDecodeI8
(
pDecoder
,
&
pTask
->
fetchSink
.
reserved
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
pDecoder
,
&
pTask
->
fetchSink
.
reserved
)
<
0
)
return
-
1
;
}
else
if
(
pTask
->
sinkType
==
TASK_SINK__SHOW
)
{
if
(
tDecodeI8
(
pDecoder
,
&
pTask
->
showSink
.
reserved
)
<
0
)
return
-
1
;
}
else
{
}
else
{
ASSERT
(
pTask
->
sinkType
==
TASK_SINK__NONE
);
ASSERT
(
pTask
->
sinkType
==
TASK_SINK__NONE
);
}
}
...
...
source/libs/stream/src/tstreamUpdate.c
浏览文件 @
fe7f246c
...
@@ -54,15 +54,28 @@ static int64_t adjustInterval(int64_t interval, int32_t precision) {
...
@@ -54,15 +54,28 @@ static int64_t adjustInterval(int64_t interval, int32_t precision) {
if
(
precision
!=
TSDB_TIME_PRECISION_MILLI
)
{
if
(
precision
!=
TSDB_TIME_PRECISION_MILLI
)
{
val
=
convertTimePrecision
(
interval
,
precision
,
TSDB_TIME_PRECISION_MILLI
);
val
=
convertTimePrecision
(
interval
,
precision
,
TSDB_TIME_PRECISION_MILLI
);
}
}
if
(
val
<
MIN_INTERVAL
)
{
val
=
MIN_INTERVAL
;
if
(
val
<=
0
||
val
>
MAX_INTERVAL
)
{
}
else
if
(
val
>
MAX_INTERVAL
)
{
val
=
MAX_INTERVAL
;
val
=
MAX_INTERVAL
;
}
else
if
(
val
<
MIN_INTERVAL
)
{
val
=
MIN_INTERVAL
;
}
if
(
precision
!=
TSDB_TIME_PRECISION_MILLI
)
{
val
=
convertTimePrecision
(
val
,
TSDB_TIME_PRECISION_MILLI
,
precision
);
}
}
val
=
convertTimePrecision
(
val
,
TSDB_TIME_PRECISION_MILLI
,
precision
);
return
val
;
return
val
;
}
}
static
int64_t
adjustWatermark
(
int64_t
interval
,
int32_t
watermark
)
{
if
(
watermark
<=
0
||
watermark
>
MAX_NUM_SCALABLE_BF
*
interval
)
{
watermark
=
MAX_NUM_SCALABLE_BF
*
interval
;
}
else
if
(
watermark
<
MIN_NUM_SCALABLE_BF
*
interval
)
{
watermark
=
MIN_NUM_SCALABLE_BF
*
interval
;
}
return
watermark
;
}
SUpdateInfo
*
updateInfoInitP
(
SInterval
*
pInterval
,
int64_t
watermark
)
{
SUpdateInfo
*
updateInfoInitP
(
SInterval
*
pInterval
,
int64_t
watermark
)
{
return
updateInfoInit
(
pInterval
->
interval
,
pInterval
->
precision
,
watermark
);
return
updateInfoInit
(
pInterval
->
interval
,
pInterval
->
precision
,
watermark
);
}
}
...
@@ -76,14 +89,9 @@ SUpdateInfo *updateInfoInit(int64_t interval, int32_t precision, int64_t waterma
...
@@ -76,14 +89,9 @@ SUpdateInfo *updateInfoInit(int64_t interval, int32_t precision, int64_t waterma
pInfo
->
pTsSBFs
=
NULL
;
pInfo
->
pTsSBFs
=
NULL
;
pInfo
->
minTS
=
-
1
;
pInfo
->
minTS
=
-
1
;
pInfo
->
interval
=
adjustInterval
(
interval
,
precision
);
pInfo
->
interval
=
adjustInterval
(
interval
,
precision
);
pInfo
->
watermark
=
watermark
;
pInfo
->
watermark
=
adjustWatermark
(
pInfo
->
interval
,
watermark
)
;
uint64_t
bfSize
=
(
uint64_t
)(
watermark
/
pInfo
->
interval
);
uint64_t
bfSize
=
(
uint64_t
)(
pInfo
->
watermark
/
pInfo
->
interval
);
if
(
bfSize
<
MIN_NUM_SCALABLE_BF
)
{
bfSize
=
MIN_NUM_SCALABLE_BF
;
}
else
if
(
bfSize
>
MAX_NUM_SCALABLE_BF
)
{
bfSize
=
MAX_NUM_SCALABLE_BF
;
}
pInfo
->
pTsSBFs
=
taosArrayInit
(
bfSize
,
sizeof
(
SScalableBf
));
pInfo
->
pTsSBFs
=
taosArrayInit
(
bfSize
,
sizeof
(
SScalableBf
));
if
(
pInfo
->
pTsSBFs
==
NULL
)
{
if
(
pInfo
->
pTsSBFs
==
NULL
)
{
...
...
source/libs/stream/test/tstreamUpdateTest.cpp
浏览文件 @
fe7f246c
...
@@ -90,11 +90,21 @@ TEST(TD_STREAM_UPDATE_TEST, update) {
...
@@ -90,11 +90,21 @@ TEST(TD_STREAM_UPDATE_TEST, update) {
}
}
}
}
SUpdateInfo
*
pSU4
=
updateInfoInit
(
-
1
,
TSDB_TIME_PRECISION_MILLI
,
-
1
);
GTEST_ASSERT_EQ
(
pSU4
->
watermark
,
120
*
pSU4
->
interval
);
GTEST_ASSERT_EQ
(
pSU4
->
interval
,
MILLISECOND_PER_MINUTE
);
SUpdateInfo
*
pSU5
=
updateInfoInit
(
0
,
TSDB_TIME_PRECISION_MILLI
,
0
);
GTEST_ASSERT_EQ
(
pSU5
->
watermark
,
120
*
pSU4
->
interval
);
GTEST_ASSERT_EQ
(
pSU5
->
interval
,
MILLISECOND_PER_MINUTE
);
updateInfoDestroy
(
pSU
);
updateInfoDestroy
(
pSU
);
updateInfoDestroy
(
pSU1
);
updateInfoDestroy
(
pSU1
);
updateInfoDestroy
(
pSU2
);
updateInfoDestroy
(
pSU2
);
updateInfoDestroy
(
pSU3
);
updateInfoDestroy
(
pSU3
);
updateInfoDestroy
(
pSU4
);
updateInfoDestroy
(
pSU5
);
}
}
int
main
(
int
argc
,
char
*
argv
[])
{
int
main
(
int
argc
,
char
*
argv
[])
{
...
...
source/libs/transport/src/transSrv.c
浏览文件 @
fe7f246c
...
@@ -810,16 +810,17 @@ void* transInitServer(uint32_t ip, uint32_t port, char* label, int numOfThreads,
...
@@ -810,16 +810,17 @@ void* transInitServer(uint32_t ip, uint32_t port, char* label, int numOfThreads,
SWorkThrdObj
*
thrd
=
(
SWorkThrdObj
*
)
taosMemoryCalloc
(
1
,
sizeof
(
SWorkThrdObj
));
SWorkThrdObj
*
thrd
=
(
SWorkThrdObj
*
)
taosMemoryCalloc
(
1
,
sizeof
(
SWorkThrdObj
));
thrd
->
quit
=
false
;
thrd
->
quit
=
false
;
srv
->
pThreadObj
[
i
]
=
thrd
;
srv
->
pThreadObj
[
i
]
=
thrd
;
thrd
->
pTransInst
=
shandle
;
srv
->
pipe
[
i
]
=
(
uv_pipe_t
*
)
taosMemoryCalloc
(
2
,
sizeof
(
uv_pipe_t
));
srv
->
pipe
[
i
]
=
(
uv_pipe_t
*
)
taosMemoryCalloc
(
2
,
sizeof
(
uv_pipe_t
));
int
fds
[
2
];
if
(
uv_socketpair
(
AF_UNIX
,
SOCK_STREAM
,
fds
,
UV_NONBLOCK_PIPE
,
UV_NONBLOCK_PIPE
)
!=
0
)
{
uv_os_sock_t
fds
[
2
];
if
(
uv_socketpair
(
SOCK_STREAM
,
0
,
fds
,
UV_NONBLOCK_PIPE
,
UV_NONBLOCK_PIPE
)
!=
0
)
{
goto
End
;
goto
End
;
}
}
uv_pipe_init
(
srv
->
loop
,
&
(
srv
->
pipe
[
i
][
0
]),
1
);
uv_pipe_init
(
srv
->
loop
,
&
(
srv
->
pipe
[
i
][
0
]),
1
);
uv_pipe_open
(
&
(
srv
->
pipe
[
i
][
0
]),
fds
[
1
]);
// init write
uv_pipe_open
(
&
(
srv
->
pipe
[
i
][
0
]),
fds
[
1
]);
// init write
thrd
->
pTransInst
=
shandle
;
thrd
->
fd
=
fds
[
0
];
thrd
->
fd
=
fds
[
0
];
thrd
->
pipe
=
&
(
srv
->
pipe
[
i
][
1
]);
// init read
thrd
->
pipe
=
&
(
srv
->
pipe
[
i
][
1
]);
// init read
...
...
source/os/src/osDir.c
浏览文件 @
fe7f246c
...
@@ -40,11 +40,11 @@ int wordexp(char *words, wordexp_t *pwordexp, int flags) {
...
@@ -40,11 +40,11 @@ int wordexp(char *words, wordexp_t *pwordexp, int flags) {
memset
(
pwordexp
->
wordPos
,
0
,
1025
);
memset
(
pwordexp
->
wordPos
,
0
,
1025
);
if
(
_fullpath
(
pwordexp
->
wordPos
,
words
,
1024
)
==
NULL
)
{
if
(
_fullpath
(
pwordexp
->
wordPos
,
words
,
1024
)
==
NULL
)
{
pwordexp
->
we_wordv
[
0
]
=
words
;
pwordexp
->
we_wordv
[
0
]
=
words
;
printf
(
"failed to parse relative path:%s to abs path"
,
words
);
printf
(
"failed to parse relative path:%s to abs path
\n
"
,
words
);
return
-
1
;
return
-
1
;
}
}
printf
(
"parse relative path:%s to abs path:%s"
,
words
,
pwordexp
->
wordPos
);
printf
(
"parse relative path:%s to abs path:%s
\n
"
,
words
,
pwordexp
->
wordPos
);
return
0
;
return
0
;
}
}
...
...
source/os/src/osFile.c
浏览文件 @
fe7f246c
...
@@ -22,20 +22,6 @@
...
@@ -22,20 +22,6 @@
#define W_OK 2
#define W_OK 2
#define R_OK 4
#define R_OK 4
#if defined(_MSDOS)
#define open _open
#endif
#if defined(_WIN32)
extern
int
openA
(
const
char
*
,
int
,
...);
/* MsvcLibX ANSI version of open */
extern
int
openU
(
const
char
*
,
int
,
...);
/* MsvcLibX UTF-8 version of open */
#if defined(_UTF8_SOURCE) || defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
#define open openU
#else
/* _ANSI_SOURCE */
#define open openA
#endif
/* defined(_UTF8_SOURCE) */
#endif
/* defined(_WIN32) */
#define _SEND_FILE_STEP_ 1000
#define _SEND_FILE_STEP_ 1000
#else
#else
...
@@ -228,9 +214,6 @@ int32_t taosDevInoFile(const char *path, int64_t *stDev, int64_t *stIno) {
...
@@ -228,9 +214,6 @@ int32_t taosDevInoFile(const char *path, int64_t *stDev, int64_t *stIno) {
void
autoDelFileListAdd
(
const
char
*
path
)
{
return
;
}
void
autoDelFileListAdd
(
const
char
*
path
)
{
return
;
}
TdFilePtr
taosOpenFile
(
const
char
*
path
,
int32_t
tdFileOptions
)
{
TdFilePtr
taosOpenFile
(
const
char
*
path
,
int32_t
tdFileOptions
)
{
#ifdef WINDOWS
return
NULL
;
#else
int
fd
=
-
1
;
int
fd
=
-
1
;
FILE
*
fp
=
NULL
;
FILE
*
fp
=
NULL
;
if
(
tdFileOptions
&
TD_FILE_STREAM
)
{
if
(
tdFileOptions
&
TD_FILE_STREAM
)
{
...
@@ -263,7 +246,11 @@ TdFilePtr taosOpenFile(const char *path, int32_t tdFileOptions) {
...
@@ -263,7 +246,11 @@ TdFilePtr taosOpenFile(const char *path, int32_t tdFileOptions) {
access
|=
(
tdFileOptions
&
TD_FILE_APPEND
)
?
O_APPEND
:
0
;
access
|=
(
tdFileOptions
&
TD_FILE_APPEND
)
?
O_APPEND
:
0
;
access
|=
(
tdFileOptions
&
TD_FILE_TEXT
)
?
O_TEXT
:
0
;
access
|=
(
tdFileOptions
&
TD_FILE_TEXT
)
?
O_TEXT
:
0
;
access
|=
(
tdFileOptions
&
TD_FILE_EXCL
)
?
O_EXCL
:
0
;
access
|=
(
tdFileOptions
&
TD_FILE_EXCL
)
?
O_EXCL
:
0
;
#ifdef WINDOWS
fd
=
_open
(
path
,
access
,
_S_IREAD
|
_S_IWRITE
);
#else
fd
=
open
(
path
,
access
,
S_IRWXU
|
S_IRWXG
|
S_IRWXO
);
fd
=
open
(
path
,
access
,
S_IRWXU
|
S_IRWXG
|
S_IRWXO
);
#endif
if
(
fd
==
-
1
)
{
if
(
fd
==
-
1
)
{
return
NULL
;
return
NULL
;
}
}
...
@@ -286,7 +273,6 @@ TdFilePtr taosOpenFile(const char *path, int32_t tdFileOptions) {
...
@@ -286,7 +273,6 @@ TdFilePtr taosOpenFile(const char *path, int32_t tdFileOptions) {
pFile
->
fp
=
fp
;
pFile
->
fp
=
fp
;
pFile
->
refId
=
0
;
pFile
->
refId
=
0
;
return
pFile
;
return
pFile
;
#endif
}
}
int64_t
taosCloseFile
(
TdFilePtr
*
ppFile
)
{
int64_t
taosCloseFile
(
TdFilePtr
*
ppFile
)
{
...
...
source/os/src/osSysinfo.c
浏览文件 @
fe7f246c
...
@@ -866,6 +866,16 @@ void taosSetCoreDump(bool enable) {
...
@@ -866,6 +866,16 @@ void taosSetCoreDump(bool enable) {
SysNameInfo
taosGetSysNameInfo
()
{
SysNameInfo
taosGetSysNameInfo
()
{
#ifdef WINDOWS
#ifdef WINDOWS
SysNameInfo
info
=
{
0
};
DWORD
dwVersion
=
GetVersion
();
tstrncpy
(
info
.
sysname
,
getenv
(
"OS"
),
sizeof
(
info
.
sysname
));
tstrncpy
(
info
.
nodename
,
getenv
(
"COMPUTERNAME"
),
sizeof
(
info
.
nodename
));
sprintf_s
(
info
.
release
,
sizeof
(
info
.
release
),
"%d"
,
dwVersion
&
0x0F
);
sprintf_s
(
info
.
version
,
sizeof
(
info
.
release
),
"%d"
,
(
dwVersion
>>
8
)
&
0x0F
);
tstrncpy
(
info
.
machine
,
getenv
(
"PROCESSOR_ARCHITECTURE"
),
sizeof
(
info
.
machine
));
return
info
;
#elif defined(_TD_DARWIN_64)
#elif defined(_TD_DARWIN_64)
SysNameInfo
info
=
{
0
};
SysNameInfo
info
=
{
0
};
...
...
source/util/src/tconfig.c
浏览文件 @
fe7f246c
...
@@ -687,13 +687,13 @@ int32_t cfgLoadFromEnvFile(SConfig *pConfig, const char *envFile) {
...
@@ -687,13 +687,13 @@ int32_t cfgLoadFromEnvFile(SConfig *pConfig, const char *envFile) {
const
char
*
filepath
=
".env"
;
const
char
*
filepath
=
".env"
;
if
(
envFile
!=
NULL
&&
strlen
(
envFile
)
>
0
)
{
if
(
envFile
!=
NULL
&&
strlen
(
envFile
)
>
0
)
{
if
(
!
taosCheckExistFile
(
envFile
))
{
if
(
!
taosCheckExistFile
(
envFile
))
{
uError
(
"f
ial
to load env file: %s"
,
envFile
);
uError
(
"f
ailed
to load env file: %s"
,
envFile
);
return
-
1
;
return
-
1
;
}
}
filepath
=
envFile
;
filepath
=
envFile
;
}
else
{
}
else
{
if
(
!
taosCheckExistFile
(
filepath
))
{
if
(
!
taosCheckExistFile
(
filepath
))
{
uInfo
(
"f
ial
to load env file: %s"
,
filepath
);
uInfo
(
"f
ailed
to load env file: %s"
,
filepath
);
return
0
;
return
0
;
}
}
}
}
...
@@ -826,7 +826,7 @@ int32_t cfgLoadFromApollUrl(SConfig *pConfig, const char *url) {
...
@@ -826,7 +826,7 @@ int32_t cfgLoadFromApollUrl(SConfig *pConfig, const char *url) {
if
(
strncmp
(
url
,
"jsonFile"
,
8
)
==
0
)
{
if
(
strncmp
(
url
,
"jsonFile"
,
8
)
==
0
)
{
char
*
filepath
=
p
;
char
*
filepath
=
p
;
if
(
!
taosCheckExistFile
(
filepath
))
{
if
(
!
taosCheckExistFile
(
filepath
))
{
uError
(
"f
ial
to load json file: %s"
,
filepath
);
uError
(
"f
ailed
to load json file: %s"
,
filepath
);
return
-
1
;
return
-
1
;
}
}
...
@@ -957,13 +957,13 @@ int32_t cfgGetApollUrl(const char **envCmd, const char *envFile, char* apolloUrl
...
@@ -957,13 +957,13 @@ int32_t cfgGetApollUrl(const char **envCmd, const char *envFile, char* apolloUrl
const
char
*
filepath
=
".env"
;
const
char
*
filepath
=
".env"
;
if
(
envFile
!=
NULL
&&
strlen
(
envFile
)
>
0
)
{
if
(
envFile
!=
NULL
&&
strlen
(
envFile
)
>
0
)
{
if
(
!
taosCheckExistFile
(
envFile
))
{
if
(
!
taosCheckExistFile
(
envFile
))
{
uError
(
"f
ial
to load env file: %s"
,
envFile
);
uError
(
"f
ailed
to load env file: %s"
,
envFile
);
return
-
1
;
return
-
1
;
}
}
filepath
=
envFile
;
filepath
=
envFile
;
}
else
{
}
else
{
if
(
!
taosCheckExistFile
(
filepath
))
{
if
(
!
taosCheckExistFile
(
filepath
))
{
uInfo
(
"f
ial
to load env file: %s"
,
filepath
);
uInfo
(
"f
ailed
to load env file: %s"
,
filepath
);
return
0
;
return
0
;
}
}
}
}
...
...
tests/script/tsim/query/complex_having.sim
浏览文件 @
fe7f246c
...
@@ -215,6 +215,7 @@ sql select count(c1) from stb1
...
@@ -215,6 +215,7 @@ sql select count(c1) from stb1
print ====> sql : select count(c1) from stb1
print ====> sql : select count(c1) from stb1
print ====> rows: $data00
print ====> rows: $data00
if $data00 != 20 then
if $data00 != 20 then
print expect 20, actual: $data00
return -1
return -1
endi
endi
...
...
tests/script/tsim/show/basic.sim
浏览文件 @
fe7f246c
...
@@ -101,7 +101,7 @@ if $rows != 1 then
...
@@ -101,7 +101,7 @@ if $rows != 1 then
endi
endi
#sql select * from information_schema.user_streams
#sql select * from information_schema.user_streams
sql select * from information_schema.user_tables
sql select * from information_schema.user_tables
if $rows !=
1 then
if $rows !=
28 then
return -1
return -1
endi
endi
#sql select * from information_schema.user_table_distributed
#sql select * from information_schema.user_table_distributed
...
@@ -199,7 +199,7 @@ if $rows != 1 then
...
@@ -199,7 +199,7 @@ if $rows != 1 then
endi
endi
#sql select * from information_schema.user_streams
#sql select * from information_schema.user_streams
sql select * from information_schema.user_tables
sql select * from information_schema.user_tables
if $rows !=
1 then
if $rows !=
28 then
return -1
return -1
endi
endi
#sql select * from information_schema.user_table_distributed
#sql select * from information_schema.user_table_distributed
...
...
tests/system-test/0-others/taosShell.py
浏览文件 @
fe7f246c
...
@@ -73,17 +73,19 @@ class TDTestCase:
...
@@ -73,17 +73,19 @@ class TDTestCase:
hostname
=
socket
.
gethostname
()
hostname
=
socket
.
gethostname
()
serverPort
=
'7080'
serverPort
=
'7080'
rpcDebugFlagVal
=
'143'
rpcDebugFlagVal
=
'143'
clientCfgDict
=
{
'serverPort'
:
''
,
'firstEp'
:
''
,
'secondEp'
:
''
,
'rpcDebugFlag'
:
'135'
}
clientCfgDict
=
{
'serverPort'
:
''
,
'firstEp'
:
''
,
'secondEp'
:
''
,
'rpcDebugFlag'
:
'135'
,
'fqdn'
:
''
}
clientCfgDict
[
"serverPort"
]
=
serverPort
clientCfgDict
[
"serverPort"
]
=
serverPort
clientCfgDict
[
"firstEp"
]
=
hostname
+
':'
+
serverPort
clientCfgDict
[
"firstEp"
]
=
hostname
+
':'
+
serverPort
clientCfgDict
[
"secondEp"
]
=
hostname
+
':'
+
serverPort
clientCfgDict
[
"secondEp"
]
=
hostname
+
':'
+
serverPort
clientCfgDict
[
"rpcDebugFlag"
]
=
rpcDebugFlagVal
clientCfgDict
[
"rpcDebugFlag"
]
=
rpcDebugFlagVal
clientCfgDict
[
"fqdn"
]
=
hostname
updatecfgDict
=
{
'clientCfg'
:
{},
'serverPort'
:
''
,
'firstEp'
:
''
,
'secondEp'
:
''
}
updatecfgDict
=
{
'clientCfg'
:
{},
'serverPort'
:
''
,
'firstEp'
:
''
,
'secondEp'
:
''
,
'rpcDebugFlag'
:
'135'
,
'fqdn'
:
''
}
updatecfgDict
[
"clientCfg"
]
=
clientCfgDict
updatecfgDict
[
"clientCfg"
]
=
clientCfgDict
updatecfgDict
[
"serverPort"
]
=
serverPort
updatecfgDict
[
"serverPort"
]
=
serverPort
updatecfgDict
[
"firstEp"
]
=
hostname
+
':'
+
serverPort
updatecfgDict
[
"firstEp"
]
=
hostname
+
':'
+
serverPort
updatecfgDict
[
"secondEp"
]
=
hostname
+
':'
+
serverPort
updatecfgDict
[
"secondEp"
]
=
hostname
+
':'
+
serverPort
updatecfgDict
[
"fqdn"
]
=
hostname
print
(
"===================: "
,
updatecfgDict
)
print
(
"===================: "
,
updatecfgDict
)
...
@@ -288,7 +290,7 @@ class TDTestCase:
...
@@ -288,7 +290,7 @@ class TDTestCase:
retCode
=
taos_command
(
buildPath
,
"f"
,
keyDict
[
'f'
],
'performance_schema'
,
keyDict
[
'c'
],
''
,
''
,
''
)
retCode
=
taos_command
(
buildPath
,
"f"
,
keyDict
[
'f'
],
'performance_schema'
,
keyDict
[
'c'
],
''
,
''
,
''
)
print
(
"============ ret code: "
,
retCode
)
print
(
"============ ret code: "
,
retCode
)
if
retCode
!=
"TAOS_OK"
:
if
retCode
!=
"TAOS_OK"
:
tdLog
.
exit
(
"taos -
s
fail"
)
tdLog
.
exit
(
"taos -
f
fail"
)
print
(
"========== check new db =========="
)
print
(
"========== check new db =========="
)
tdSql
.
query
(
"show databases"
)
tdSql
.
query
(
"show databases"
)
...
...
tests/system-test/0-others/taosShellError.py
0 → 100644
浏览文件 @
fe7f246c
import
taos
import
sys
import
time
import
socket
import
pexpect
import
os
from
util.log
import
*
from
util.sql
import
*
from
util.cases
import
*
from
util.dnodes
import
*
def
taos_command
(
buildPath
,
key
,
value
,
expectString
,
cfgDir
,
sqlString
=
''
,
key1
=
''
,
value1
=
''
):
if
len
(
key
)
==
0
:
tdLog
.
exit
(
"taos test key is null!"
)
taosCmd
=
buildPath
+
'/build/bin/taos '
if
len
(
cfgDir
)
!=
0
:
taosCmd
=
taosCmd
+
'-c '
+
cfgDir
taosCmd
=
taosCmd
+
' -'
+
key
if
len
(
value
)
!=
0
:
if
key
==
'p'
:
taosCmd
=
taosCmd
+
value
else
:
taosCmd
=
taosCmd
+
' '
+
value
if
len
(
key1
)
!=
0
:
taosCmd
=
taosCmd
+
' -'
+
key1
if
key1
==
'p'
:
taosCmd
=
taosCmd
+
value1
else
:
if
len
(
value1
)
!=
0
:
taosCmd
=
taosCmd
+
' '
+
value1
tdLog
.
info
(
"taos cmd: %s"
%
taosCmd
)
child
=
pexpect
.
spawn
(
taosCmd
,
timeout
=
3
)
#output = child.readline()
#print (output.decode())
if
len
(
expectString
)
!=
0
:
i
=
child
.
expect
([
expectString
,
pexpect
.
TIMEOUT
,
pexpect
.
EOF
],
timeout
=
6
)
else
:
i
=
child
.
expect
([
pexpect
.
TIMEOUT
,
pexpect
.
EOF
],
timeout
=
6
)
retResult
=
child
.
before
.
decode
()
print
(
"cmd return result:
\n
%s
\n
"
%
retResult
)
#print(child.after.decode())
if
i
==
0
:
print
(
'taos login success! Here can run sql, taos> '
)
if
len
(
sqlString
)
!=
0
:
child
.
sendline
(
sqlString
)
w
=
child
.
expect
([
"Query OK"
,
pexpect
.
TIMEOUT
,
pexpect
.
EOF
],
timeout
=
1
)
retResult
=
child
.
before
.
decode
()
if
w
==
0
:
return
"TAOS_OK"
,
retResult
else
:
return
"TAOS_FAIL"
,
retResult
else
:
if
key
==
'A'
or
key1
==
'A'
or
key
==
'C'
or
key1
==
'C'
or
key
==
'V'
or
key1
==
'V'
:
return
"TAOS_OK"
,
retResult
else
:
return
"TAOS_OK"
,
retResult
else
:
if
key
==
'A'
or
key1
==
'A'
or
key
==
'C'
or
key1
==
'C'
or
key
==
'V'
or
key1
==
'V'
:
return
"TAOS_OK"
,
retResult
else
:
return
"TAOS_FAIL"
,
retResult
class
TDTestCase
:
#updatecfgDict = {'clientCfg': {'serverPort': 7080, 'firstEp': 'trd02:7080', 'secondEp':'trd02:7080'},\
# 'serverPort': 7080, 'firstEp': 'trd02:7080'}
hostname
=
socket
.
gethostname
()
serverPort
=
'7080'
rpcDebugFlagVal
=
'143'
clientCfgDict
=
{
'serverPort'
:
''
,
'firstEp'
:
''
,
'secondEp'
:
''
,
'rpcDebugFlag'
:
'135'
,
'fqdn'
:
''
}
clientCfgDict
[
"serverPort"
]
=
serverPort
clientCfgDict
[
"firstEp"
]
=
hostname
+
':'
+
serverPort
clientCfgDict
[
"secondEp"
]
=
hostname
+
':'
+
serverPort
clientCfgDict
[
"rpcDebugFlag"
]
=
rpcDebugFlagVal
clientCfgDict
[
"fqdn"
]
=
hostname
updatecfgDict
=
{
'clientCfg'
:
{},
'serverPort'
:
''
,
'firstEp'
:
''
,
'secondEp'
:
''
,
'rpcDebugFlag'
:
'135'
,
'fqdn'
:
''
}
updatecfgDict
[
"clientCfg"
]
=
clientCfgDict
updatecfgDict
[
"serverPort"
]
=
serverPort
updatecfgDict
[
"firstEp"
]
=
hostname
+
':'
+
serverPort
updatecfgDict
[
"secondEp"
]
=
hostname
+
':'
+
serverPort
clientCfgDict
[
"fqdn"
]
=
hostname
print
(
"===================: "
,
updatecfgDict
)
def
init
(
self
,
conn
,
logSql
):
tdLog
.
debug
(
f
"start to excute
{
__file__
}
"
)
tdSql
.
init
(
conn
.
cursor
())
def
getBuildPath
(
self
):
selfPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
if
(
"community"
in
selfPath
):
projPath
=
selfPath
[:
selfPath
.
find
(
"community"
)]
else
:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
if
(
"taosd"
in
files
):
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
):
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
break
return
buildPath
def
run
(
self
):
# sourcery skip: extract-duplicate-method, remove-redundant-fstring
tdSql
.
prepare
()
# time.sleep(2)
tdSql
.
query
(
"create user testpy pass 'testpy'"
)
#hostname = socket.gethostname()
#tdLog.info ("hostname: %s" % hostname)
buildPath
=
self
.
getBuildPath
()
if
(
buildPath
==
""
):
tdLog
.
exit
(
"taosd not found!"
)
else
:
tdLog
.
info
(
"taosd found in %s"
%
buildPath
)
cfgPath
=
buildPath
+
"/../sim/psim/cfg"
tdLog
.
info
(
"cfgPath: %s"
%
cfgPath
)
checkNetworkStatus
=
[
'0: unavailable'
,
'1: network ok'
,
'2: service ok'
,
'3: service degraded'
,
'4: exiting'
]
netrole
=
[
'client'
,
'server'
]
keyDict
=
{
'h'
:
''
,
'P'
:
'6030'
,
'p'
:
'testpy'
,
'u'
:
'testpy'
,
'a'
:
''
,
'A'
:
''
,
'c'
:
''
,
'C'
:
''
,
's'
:
''
,
'r'
:
''
,
'f'
:
''
,
\
'k'
:
''
,
't'
:
''
,
'n'
:
''
,
'l'
:
'1024'
,
'N'
:
'100'
,
'V'
:
''
,
'd'
:
'db'
,
'w'
:
'30'
,
'-help'
:
''
,
'-usage'
:
''
,
'?'
:
''
}
keyDict
[
'h'
]
=
self
.
hostname
keyDict
[
'c'
]
=
cfgPath
keyDict
[
'P'
]
=
self
.
serverPort
tdLog
.
printNoPrefix
(
"================================ parameter: -h wiht error value"
)
#newDbName="dbh"
#sqlString = 'create database ' + newDbName + ';'
keyDict
[
'h'
]
=
'abc'
retCode
,
retVal
=
taos_command
(
buildPath
,
"h"
,
keyDict
[
'h'
],
"taos>"
,
keyDict
[
'c'
],
''
)
if
(
retCode
==
"TAOS_FAIL"
)
and
(
"Unable to establish connection"
in
retVal
):
tdLog
.
info
(
"taos -h %s test suceess"
%
keyDict
[
'h'
])
else
:
tdLog
.
exit
(
"taos -h %s fail"
%
keyDict
[
'h'
])
keyDict
[
'h'
]
=
'
\'
abc
\'
'
retCode
,
retVal
=
taos_command
(
buildPath
,
"h"
,
keyDict
[
'h'
],
"taos>"
,
keyDict
[
'c'
],
''
)
if
(
retCode
==
"TAOS_FAIL"
)
and
(
"Unable to establish connection"
in
retVal
):
tdLog
.
info
(
"taos -h %s test suceess"
%
keyDict
[
'h'
])
else
:
tdLog
.
exit
(
"taos -h %s fail"
%
keyDict
[
'h'
])
keyDict
[
'h'
]
=
'3'
retCode
,
retVal
=
taos_command
(
buildPath
,
"h"
,
keyDict
[
'h'
],
"taos>"
,
keyDict
[
'c'
],
''
)
if
(
retCode
==
"TAOS_FAIL"
)
and
(
"Unable to establish connection"
in
retVal
):
tdLog
.
info
(
"taos -h %s test suceess"
%
keyDict
[
'h'
])
else
:
tdLog
.
exit
(
"taos -h %s fail"
%
keyDict
[
'h'
])
keyDict
[
'h'
]
=
'
\'
3
\'
'
retCode
,
retVal
=
taos_command
(
buildPath
,
"h"
,
keyDict
[
'h'
],
"taos>"
,
keyDict
[
'c'
],
''
)
if
(
retCode
==
"TAOS_FAIL"
)
and
(
"Unable to establish connection"
in
retVal
):
tdLog
.
info
(
"taos -h %s test suceess"
%
keyDict
[
'h'
])
else
:
tdLog
.
exit
(
"taos -h %s fail"
%
keyDict
[
'h'
])
tdLog
.
printNoPrefix
(
"================================ parameter: -P wiht error value"
)
#newDbName="dbh"
#sqlString = 'create database ' + newDbName + ';'
keyDict
[
'P'
]
=
'abc'
retCode
,
retVal
=
taos_command
(
buildPath
,
"P"
,
keyDict
[
'P'
],
"taos>"
,
keyDict
[
'c'
],
''
)
if
(
retCode
==
"TAOS_FAIL"
)
and
(
"Invalid port"
in
retVal
):
tdLog
.
info
(
"taos -P %s test suceess"
%
keyDict
[
'P'
])
else
:
tdLog
.
exit
(
"taos -P %s fail"
%
keyDict
[
'P'
])
keyDict
[
'P'
]
=
'
\'
abc
\'
'
retCode
,
retVal
=
taos_command
(
buildPath
,
"P"
,
keyDict
[
'P'
],
"taos>"
,
keyDict
[
'c'
],
''
)
if
(
retCode
==
"TAOS_FAIL"
)
and
(
"Invalid port"
in
retVal
):
tdLog
.
info
(
"taos -P %s test suceess"
%
keyDict
[
'P'
])
else
:
tdLog
.
exit
(
"taos -P %s fail"
%
keyDict
[
'P'
])
keyDict
[
'P'
]
=
'3'
retCode
,
retVal
=
taos_command
(
buildPath
,
"P"
,
keyDict
[
'P'
],
"taos>"
,
keyDict
[
'c'
],
''
)
if
(
retCode
==
"TAOS_FAIL"
)
and
(
"Unable to establish connection"
in
retVal
):
tdLog
.
info
(
"taos -P %s test suceess"
%
keyDict
[
'P'
])
else
:
tdLog
.
exit
(
"taos -P %s fail"
%
keyDict
[
'P'
])
keyDict
[
'P'
]
=
'
\'
3
\'
'
retCode
,
retVal
=
taos_command
(
buildPath
,
"P"
,
keyDict
[
'P'
],
"taos>"
,
keyDict
[
'c'
],
''
)
if
(
retCode
==
"TAOS_FAIL"
)
and
(
"Unable to establish connection"
in
retVal
):
tdLog
.
info
(
"taos -P %s test suceess"
%
keyDict
[
'P'
])
else
:
tdLog
.
exit
(
"taos -P %s fail"
%
keyDict
[
'P'
])
keyDict
[
'P'
]
=
'12ab'
retCode
,
retVal
=
taos_command
(
buildPath
,
"P"
,
keyDict
[
'P'
],
"taos>"
,
keyDict
[
'c'
],
''
)
if
(
retCode
==
"TAOS_FAIL"
)
and
(
"Unable to establish connection"
in
retVal
):
tdLog
.
info
(
"taos -P %s test suceess"
%
keyDict
[
'P'
])
else
:
tdLog
.
exit
(
"taos -P %s fail"
%
keyDict
[
'P'
])
keyDict
[
'P'
]
=
'
\'
12ab
\'
'
retCode
,
retVal
=
taos_command
(
buildPath
,
"P"
,
keyDict
[
'P'
],
"taos>"
,
keyDict
[
'c'
],
''
)
if
(
retCode
==
"TAOS_FAIL"
)
and
(
"Unable to establish connection"
in
retVal
):
tdLog
.
info
(
"taos -P %s test suceess"
%
keyDict
[
'P'
])
else
:
tdLog
.
exit
(
"taos -P %s fail"
%
keyDict
[
'P'
])
tdLog
.
printNoPrefix
(
"================================ parameter: -f with error sql "
)
pwd
=
os
.
getcwd
()
newDbName
=
"dbf"
sqlFile
=
pwd
+
"/0-others/sql.txt"
sql1
=
"echo 'create database "
+
newDbName
+
"' > "
+
sqlFile
sql2
=
"echo 'use "
+
newDbName
+
"' >> "
+
sqlFile
sql3
=
"echo 'create table ntbf (ts timestamp, c binary(40)) no this item' >> "
+
sqlFile
sql4
=
"echo 'insert into ntbf values (
\"
2021-04-01 08:00:00.000
\"
,
\"
test taos -f1
\"
)(
\"
2021-04-01 08:00:01.000
\"
,
\"
test taos -f2
\"
)' >> "
+
sqlFile
sql5
=
"echo 'show databases' >> "
+
sqlFile
os
.
system
(
sql1
)
os
.
system
(
sql2
)
os
.
system
(
sql3
)
os
.
system
(
sql4
)
os
.
system
(
sql5
)
keyDict
[
'f'
]
=
pwd
+
"/0-others/sql.txt"
retCode
,
retVal
=
taos_command
(
buildPath
,
"f"
,
keyDict
[
'f'
],
'performance_schema'
,
keyDict
[
'c'
],
''
,
''
,
''
)
#print("============ ret code: ", retCode)
if
retCode
!=
"TAOS_OK"
:
tdLog
.
exit
(
"taos -f fail"
)
print
(
"========== check new db =========="
)
tdSql
.
query
(
"show databases"
)
for
i
in
range
(
tdSql
.
queryRows
):
#print ("dbseq: %d, dbname: %s"%(i, tdSql.getData(i, 0)))
if
tdSql
.
getData
(
i
,
0
)
==
newDbName
:
break
else
:
tdLog
.
exit
(
"create db fail after taos -f fail"
)
sqlString
=
"select * from "
+
newDbName
+
".ntbf"
tdSql
.
error
(
sqlString
)
shellCmd
=
"rm -f "
+
sqlFile
os
.
system
(
shellCmd
)
keyDict
[
'f'
]
=
pwd
+
"/0-others/noexistfile.txt"
retCode
,
retVal
=
taos_command
(
buildPath
,
"f"
,
keyDict
[
'f'
],
'failed to open file'
,
keyDict
[
'c'
],
''
,
''
,
''
)
#print("============ ret code: ", retCode)
if
retCode
!=
"TAOS_OK"
:
tdLog
.
exit
(
"taos -f fail"
)
tdSql
.
query
(
'drop database %s'
%
newDbName
)
tdLog
.
printNoPrefix
(
"================================ parameter: -a with error value"
)
#newDbName="dba"
errorPassword
=
'errorPassword'
sqlString
=
'create database '
+
newDbName
+
';'
retCode
,
retVal
=
taos_command
(
buildPath
,
"u"
,
keyDict
[
'u'
],
"taos>"
,
keyDict
[
'c'
],
sqlString
,
'a'
,
errorPassword
)
if
retCode
!=
"TAOS_FAIL"
:
tdLog
.
exit
(
"taos -u %s -a %s"
%
(
keyDict
[
'u'
],
errorPassword
))
tdLog
.
printNoPrefix
(
"================================ parameter: -p with error value"
)
#newDbName="dba"
keyDict
[
'p'
]
=
'errorPassword'
retCode
,
retVal
=
taos_command
(
buildPath
,
"u"
,
keyDict
[
'u'
],
"taos>"
,
keyDict
[
'c'
],
sqlString
,
'p'
,
keyDict
[
'p'
])
if
retCode
==
"TAOS_FAIL"
and
"Authentication failure"
in
retVal
:
tdLog
.
info
(
"taos -p %s test suceess"
%
keyDict
[
'p'
])
else
:
tdLog
.
exit
(
"taos -u %s -p %s"
%
(
keyDict
[
'u'
],
keyDict
[
'p'
]))
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
f
"
{
__file__
}
successfully executed"
)
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tests/system-test/0-others/taosShellNetChk.py
0 → 100644
浏览文件 @
fe7f246c
此差异已折叠。
点击以展开。
tests/system-test/fulltest.sh
浏览文件 @
fe7f246c
#!/bin/bash
#!/bin/bash
set
-e
set
-e
set
-x
python3 ./test.py
-f
0-others/taosShell.py
python3 ./test.py
-f
0-others/taosShell.py
...
...
tests/test-all.sh
浏览文件 @
fe7f246c
...
@@ -93,6 +93,7 @@ function runSimCaseOneByOnefq {
...
@@ -93,6 +93,7 @@ function runSimCaseOneByOnefq {
if
[[
$line
=
~ ^./test.sh
*
]]
||
[[
$line
=
~ ^run
*
]]
;
then
if
[[
$line
=
~ ^./test.sh
*
]]
||
[[
$line
=
~ ^run
*
]]
;
then
#case=`echo $line | grep sim$ |awk '{print $NF}'`
#case=`echo $line | grep sim$ |awk '{print $NF}'`
case
=
`
echo
$line
|
grep
-o
".*
\.
sim"
|awk
'{print $NF}'
`
case
=
`
echo
$line
|
grep
-o
".*
\.
sim"
|awk
'{print $NF}'
`
echo
"
$line
running ..."
start_time
=
`
date
+%s
`
start_time
=
`
date
+%s
`
date
+%F
\
%T
|
tee
-a
out.log
date
+%F
\
%T
|
tee
-a
out.log
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录