Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
141be560
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
141be560
编写于
6月 01, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'origin/3.0' into fix/tsim
上级
7fcfd45a
4e987a50
变更
85
展开全部
隐藏空白更改
内联
并排
Showing
85 changed file
with
5168 addition
and
6982 deletion
+5168
-6982
CMakeLists.txt
CMakeLists.txt
+1
-1
docs-cn/12-taos-sql/07-function.md
docs-cn/12-taos-sql/07-function.md
+640
-1276
docs-cn/12-taos-sql/12-keywords.md
docs-cn/12-taos-sql/12-keywords.md
+3
-0
docs-cn/12-taos-sql/13-operators.md
docs-cn/12-taos-sql/13-operators.md
+2
-2
docs-en/12-taos-sql/07-function.md
docs-en/12-taos-sql/07-function.md
+592
-1271
docs-en/12-taos-sql/12-keywords.md
docs-en/12-taos-sql/12-keywords.md
+1
-0
docs-en/12-taos-sql/13-operators.md
docs-en/12-taos-sql/13-operators.md
+2
-2
example/CMakeLists.txt
example/CMakeLists.txt
+0
-49
examples/c/CMakeLists.txt
examples/c/CMakeLists.txt
+62
-12
examples/c/demoapi.c
examples/c/demoapi.c
+0
-0
examples/c/tmq.c
examples/c/tmq.c
+4
-41
examples/c/tstream.c
examples/c/tstream.c
+0
-0
include/client/taos.h
include/client/taos.h
+12
-1
include/common/tdataformat.h
include/common/tdataformat.h
+69
-123
include/common/tmsg.h
include/common/tmsg.h
+31
-4
include/common/tmsgdef.h
include/common/tmsgdef.h
+2
-0
include/libs/parser/parser.h
include/libs/parser/parser.h
+2
-2
include/os/osDir.h
include/os/osDir.h
+11
-0
include/util/taoserror.h
include/util/taoserror.h
+1
-0
include/util/tdef.h
include/util/tdef.h
+1
-1
include/util/tencode.h
include/util/tencode.h
+65
-8
source/client/inc/clientStmt.h
source/client/inc/clientStmt.h
+3
-0
source/client/src/clientImpl.c
source/client/src/clientImpl.c
+17
-36
source/client/src/clientMain.c
source/client/src/clientMain.c
+41
-0
source/client/src/clientStmt.c
source/client/src/clientStmt.c
+114
-7
source/client/src/tmq.c
source/client/src/tmq.c
+14
-20
source/common/src/tdatablock.c
source/common/src/tdatablock.c
+66
-24
source/common/src/tdataformat.c
source/common/src/tdataformat.c
+799
-367
source/common/src/tmsg.c
source/common/src/tmsg.c
+18
-6
source/dnode/mgmt/mgmt_vnode/src/vmHandle.c
source/dnode/mgmt/mgmt_vnode/src/vmHandle.c
+23
-3
source/dnode/mnode/impl/inc/mndDef.h
source/dnode/mnode/impl/inc/mndDef.h
+1
-0
source/dnode/mnode/impl/src/mndMain.c
source/dnode/mnode/impl/src/mndMain.c
+3
-3
source/dnode/mnode/impl/src/mndSma.c
source/dnode/mnode/impl/src/mndSma.c
+8
-2
source/dnode/mnode/impl/src/mndVgroup.c
source/dnode/mnode/impl/src/mndVgroup.c
+2
-0
source/dnode/mnode/impl/test/user/CMakeLists.txt
source/dnode/mnode/impl/test/user/CMakeLists.txt
+6
-4
source/dnode/vnode/CMakeLists.txt
source/dnode/vnode/CMakeLists.txt
+4
-5
source/dnode/vnode/inc/vnode.h
source/dnode/vnode/inc/vnode.h
+6
-3
source/dnode/vnode/src/inc/meta.h
source/dnode/vnode/src/inc/meta.h
+1
-1
source/dnode/vnode/src/inc/tq.h
source/dnode/vnode/src/inc/tq.h
+13
-6
source/dnode/vnode/src/inc/tsdb.h
source/dnode/vnode/src/inc/tsdb.h
+50
-1
source/dnode/vnode/src/inc/vnodeInt.h
source/dnode/vnode/src/inc/vnodeInt.h
+2
-5
source/dnode/vnode/src/meta/metaEntry.c
source/dnode/vnode/src/meta/metaEntry.c
+2
-3
source/dnode/vnode/src/meta/metaQuery.c
source/dnode/vnode/src/meta/metaQuery.c
+23
-4
source/dnode/vnode/src/meta/metaTable.c
source/dnode/vnode/src/meta/metaTable.c
+73
-48
source/dnode/vnode/src/sma/smaOpen.c
source/dnode/vnode/src/sma/smaOpen.c
+1
-1
source/dnode/vnode/src/sma/smaRollup.c
source/dnode/vnode/src/sma/smaRollup.c
+1
-1
source/dnode/vnode/src/tq/tq.c
source/dnode/vnode/src/tq/tq.c
+27
-182
source/dnode/vnode/src/tq/tqMeta.c
source/dnode/vnode/src/tq/tqMeta.c
+134
-0
source/dnode/vnode/src/tq/tqPush.c
source/dnode/vnode/src/tq/tqPush.c
+2
-0
source/dnode/vnode/src/tsdb/tsdbCommit.c
source/dnode/vnode/src/tsdb/tsdbCommit.c
+1
-1
source/dnode/vnode/src/tsdb/tsdbDelete.c
source/dnode/vnode/src/tsdb/tsdbDelete.c
+14
-0
source/dnode/vnode/src/tsdb/tsdbMemTable.c
source/dnode/vnode/src/tsdb/tsdbMemTable.c
+2
-65
source/dnode/vnode/src/tsdb/tsdbMemTable2.c
source/dnode/vnode/src/tsdb/tsdbMemTable2.c
+291
-95
source/dnode/vnode/src/tsdb/tsdbRead.c
source/dnode/vnode/src/tsdb/tsdbRead.c
+1
-1
source/dnode/vnode/src/tsdb/tsdbSma.c
source/dnode/vnode/src/tsdb/tsdbSma.c
+0
-2203
source/dnode/vnode/src/tsdb/tsdbTDBImpl.c
source/dnode/vnode/src/tsdb/tsdbTDBImpl.c
+0
-128
source/dnode/vnode/src/vnd/vnodeCfg.c
source/dnode/vnode/src/vnd/vnodeCfg.c
+6
-0
source/dnode/vnode/src/vnd/vnodeCommit.c
source/dnode/vnode/src/vnd/vnodeCommit.c
+1
-2
source/dnode/vnode/src/vnd/vnodeOpen.c
source/dnode/vnode/src/vnd/vnodeOpen.c
+1
-1
source/dnode/vnode/src/vnd/vnodeSvr.c
source/dnode/vnode/src/vnd/vnodeSvr.c
+26
-12
source/dnode/vnode/test/tsdbSmaTest.cpp
source/dnode/vnode/test/tsdbSmaTest.cpp
+1
-1
source/libs/catalog/test/catalogTests.cpp
source/libs/catalog/test/catalogTests.cpp
+1
-1
source/libs/executor/src/scanoperator.c
source/libs/executor/src/scanoperator.c
+28
-35
source/libs/function/src/builtinsimpl.c
source/libs/function/src/builtinsimpl.c
+2
-2
source/libs/parser/inc/parUtil.h
source/libs/parser/inc/parUtil.h
+1
-1
source/libs/parser/inc/sql.y
source/libs/parser/inc/sql.y
+4
-0
source/libs/parser/src/parInsert.c
source/libs/parser/src/parInsert.c
+379
-110
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+138
-89
source/libs/parser/src/parUtil.c
source/libs/parser/src/parUtil.c
+35
-58
source/libs/parser/src/parser.c
source/libs/parser/src/parser.c
+7
-42
source/libs/parser/src/sql.c
source/libs/parser/src/sql.c
+965
-486
source/libs/qworker/test/qworkerTests.cpp
source/libs/qworker/test/qworkerTests.cpp
+1
-1
source/libs/scalar/src/sclvector.c
source/libs/scalar/src/sclvector.c
+15
-22
source/libs/scalar/test/filter/filterTests.cpp
source/libs/scalar/test/filter/filterTests.cpp
+1
-1
source/libs/scalar/test/scalar/scalarTests.cpp
source/libs/scalar/test/scalar/scalarTests.cpp
+11
-27
source/libs/scheduler/test/schedulerTests.cpp
source/libs/scheduler/test/schedulerTests.cpp
+1
-1
source/os/CMakeLists.txt
source/os/CMakeLists.txt
+5
-1
source/os/src/osEnv.c
source/os/src/osEnv.c
+2
-2
source/util/src/terror.c
source/util/src/terror.c
+1
-0
tests/pytest/util/dnodes.py
tests/pytest/util/dnodes.py
+1
-0
tests/script/api/batchprepare.c
tests/script/api/batchprepare.c
+251
-67
tests/system-test/0-others/taosShell.py
tests/system-test/0-others/taosShell.py
+6
-0
tests/system-test/0-others/taosShellError.py
tests/system-test/0-others/taosShellError.py
+6
-0
tests/system-test/0-others/taosShellNetChk.py
tests/system-test/0-others/taosShellNetChk.py
+7
-1
tools/taos-tools
tools/taos-tools
+1
-1
未找到文件。
CMakeLists.txt
浏览文件 @
141be560
...
...
@@ -35,7 +35,7 @@ endif(${BUILD_TEST})
add_subdirectory
(
source
)
add_subdirectory
(
tools
)
add_subdirectory
(
tests
)
add_subdirectory
(
example
)
add_subdirectory
(
example
s/c
)
# docs
add_subdirectory
(
docs
)
...
...
docs-cn/12-taos-sql/07-function.md
浏览文件 @
141be560
此差异已折叠。
点击以展开。
docs-cn/12-taos-sql/12-keywords.md
浏览文件 @
141be560
...
...
@@ -93,10 +93,13 @@ title: TDengine 参数限制与保留关键字
`TBNAME` 可以视为超级表中一个特殊的标签,代表子表的表名。
获取一个超级表所有的子表名及相关的标签信息:
```mysql
SELECT TBNAME, location FROM meters;
```
统计超级表下辖子表数量:
```mysql
SELECT COUNT(TBNAME) FROM meters;
```
...
...
docs-cn/12-taos-sql/13-operators.md
浏览文件 @
141be560
...
...
@@ -35,8 +35,8 @@ TDengine 支持 `UNION ALL` 和 `UNION` 操作符。UNION ALL 将查询返回的
| --- | :---------------: | -------------------------------------------------------------------- | -------------------- |
| 1 | = | 除 BLOB、MEDIUMBLOB 和 JSON 外的所有类型 | 相等 |
| 2 | <
\>
, != | 除 BLOB、MEDIUMBLOB 和 JSON 外的所有类型,且不可以为表的时间戳主键列 | 不相等 |
| 3 |
\>
,
\
<
| 除 BLOB、MEDIUMBLOB 和 JSON 外的所有类型 | 大于,小于 |
| 4 |
\>
=,
\
<
= | 除 BLOB、MEDIUMBLOB 和 JSON 外的所有类型 | 大于等于,小于等于 |
| 3 |
\>
, < | 除 BLOB、MEDIUMBLOB 和 JSON 外的所有类型 | 大于,小于 |
| 4 |
\>
=, <= | 除 BLOB、MEDIUMBLOB 和 JSON 外的所有类型 | 大于等于,小于等于 |
| 5 | IS [NOT] NULL | 所有类型 | 是否为空值 |
| 6 | [NOT] BETWEEN AND | 除 BOOL、BLOB、MEDIUMBLOB 和 JSON 外的所有类型 | 闭区间比较 |
| 7 | IN | 除 BLOB、MEDIUMBLOB 和 JSON 外的所有类型,且不可以为表的时间戳主键列 | 与列表内的任意值相等 |
...
...
docs-en/12-taos-sql/07-function.md
浏览文件 @
141be560
此差异已折叠。
点击以展开。
docs-en/12-taos-sql/12-keywords.md
浏览文件 @
141be560
...
...
@@ -56,6 +56,7 @@ There are about 200 keywords reserved by TDengine, they can't be used as the nam
Get the table name and tag values of all subtables in a STable.
```
mysql
SELECT TBNAME, location FROM meters;
```
Count the number of subtables in a STable.
```
mysql
...
...
docs-en/12-taos-sql/13-operators.md
浏览文件 @
141be560
...
...
@@ -35,8 +35,8 @@ TDengine provides 2 set operators: `UNION ALL` and `UNION`. `UNION ALL` combines
| --- | :---------------: | ------------------------------------------------------------------- | ----------------------------------------------- |
| 1 | = | Except for BLOB, MEDIUMBLOB and JSON | Equal |
| 2 | <
\>
, != | Except for BLOB, MEDIUMBLOB, JSON and primary key of timestamp type | Not equal |
| 3 |
\>
,
\
<
| Except for BLOB, MEDIUMBLOB and JSON | Greater than, less than |
| 4 |
\>
=,
\
<
= | Except for BLOB, MEDIUMBLOB and JSON | Greater than or equal to, less than or equal to |
| 3 |
\>
, < | Except for BLOB, MEDIUMBLOB and JSON | Greater than, less than |
| 4 |
\>
=, <= | Except for BLOB, MEDIUMBLOB and JSON | Greater than or equal to, less than or equal to |
| 5 | IS [NOT] NULL | Any types | Is NULL or NOT |
| 6 | [NOT] BETWEEN AND | Except for BLOB, MEDIUMBLOB and JSON | In a value range or not |
| 7 | IN | Except for BLOB, MEDIUMBLOB, JSON and primary key of timestamp type | In a list of values or not |
...
...
example/CMakeLists.txt
已删除
100644 → 0
浏览文件 @
7fcfd45a
add_executable
(
tmq
""
)
add_executable
(
tstream
""
)
add_executable
(
demoapi
""
)
target_sources
(
tmq
PRIVATE
"src/tmq.c"
)
target_sources
(
tstream
PRIVATE
"src/tstream.c"
)
target_sources
(
demoapi
PRIVATE
"src/demoapi.c"
)
target_link_libraries
(
tmq
taos_static
)
target_link_libraries
(
tstream
taos_static
)
target_link_libraries
(
demoapi
taos_static
)
target_include_directories
(
tmq
PUBLIC
"
${
TD_SOURCE_DIR
}
/include/os"
PRIVATE
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/inc"
)
target_include_directories
(
tstream
PRIVATE
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/inc"
)
target_include_directories
(
demoapi
PUBLIC
"
${
TD_SOURCE_DIR
}
/include/client"
PUBLIC
"
${
TD_SOURCE_DIR
}
/include/os"
PRIVATE
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/inc"
)
SET_TARGET_PROPERTIES
(
tmq PROPERTIES OUTPUT_NAME tmq
)
SET_TARGET_PROPERTIES
(
tstream PROPERTIES OUTPUT_NAME tstream
)
SET_TARGET_PROPERTIES
(
demoapi PROPERTIES OUTPUT_NAME demoapi
)
examples/c/CMakeLists.txt
浏览文件 @
141be560
...
...
@@ -3,20 +3,70 @@ PROJECT(TDengine)
IF
(
TD_LINUX
)
INCLUDE_DIRECTORIES
(
.
${
TD_SOURCE_DIR
}
/src/inc
${
TD_SOURCE_DIR
}
/src/client/inc
${
TD_SOURCE_DIR
}
/inc
)
AUX_SOURCE_DIRECTORY
(
. SRC
)
ADD_EXECUTABLE
(
demo apitest.c
)
TARGET_LINK_LIBRARIES
(
demo taos_static trpc tutil pthread
)
ADD_EXECUTABLE
(
sml schemaless.c
)
TARGET_LINK_LIBRARIES
(
sml taos_static trpc tutil pthread
)
ADD_EXECUTABLE
(
subscribe subscribe.c
)
TARGET_LINK_LIBRARIES
(
subscribe taos_static trpc tutil pthread
)
ADD_EXECUTABLE
(
epoll epoll.c
)
TARGET_LINK_LIBRARIES
(
epoll taos_static trpc tutil pthread lua
)
# ADD_EXECUTABLE(demo apitest.c)
#TARGET_LINK_LIBRARIES(demo taos_static trpc tutil pthread )
#ADD_EXECUTABLE(sml schemaless.c)
#TARGET_LINK_LIBRARIES(sml taos_static trpc tutil pthread )
#ADD_EXECUTABLE(subscribe subscribe.c)
#TARGET_LINK_LIBRARIES(subscribe taos_static trpc tutil pthread )
#ADD_EXECUTABLE(epoll epoll.c)
#TARGET_LINK_LIBRARIES(epoll taos_static trpc tutil pthread lua)
add_executable
(
tmq
""
)
add_executable
(
tstream
""
)
add_executable
(
demoapi
""
)
target_sources
(
tmq
PRIVATE
"tmq.c"
)
target_sources
(
tstream
PRIVATE
"tstream.c"
)
target_sources
(
demoapi
PRIVATE
"demoapi.c"
)
target_link_libraries
(
tmq
taos_static
)
target_link_libraries
(
tstream
taos_static
)
target_link_libraries
(
demoapi
taos_static
)
target_include_directories
(
tmq
PUBLIC
"
${
TD_SOURCE_DIR
}
/include/os"
PRIVATE
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/inc"
)
target_include_directories
(
tstream
PRIVATE
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/inc"
)
target_include_directories
(
demoapi
PUBLIC
"
${
TD_SOURCE_DIR
}
/include/client"
PUBLIC
"
${
TD_SOURCE_DIR
}
/include/os"
PRIVATE
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/inc"
)
SET_TARGET_PROPERTIES
(
tmq PROPERTIES OUTPUT_NAME tmq
)
SET_TARGET_PROPERTIES
(
tstream PROPERTIES OUTPUT_NAME tstream
)
SET_TARGET_PROPERTIES
(
demoapi PROPERTIES OUTPUT_NAME demoapi
)
ENDIF
()
IF
(
TD_DARWIN
)
INCLUDE_DIRECTORIES
(
.
${
TD_SOURCE_DIR
}
/src/inc
${
TD_SOURCE_DIR
}
/src/client/inc
${
TD_SOURCE_DIR
}
/inc
)
AUX_SOURCE_DIRECTORY
(
. SRC
)
ADD_EXECUTABLE
(
demo demo.c
)
TARGET_LINK_LIBRARIES
(
demo taos_static trpc tutil pthread lua
)
ADD_EXECUTABLE
(
epoll epoll.c
)
TARGET_LINK_LIBRARIES
(
epoll taos_static trpc tutil pthread lua
)
#
ADD_EXECUTABLE(demo demo.c)
#
TARGET_LINK_LIBRARIES(demo taos_static trpc tutil pthread lua)
#
ADD_EXECUTABLE(epoll epoll.c)
#
TARGET_LINK_LIBRARIES(epoll taos_static trpc tutil pthread lua)
ENDIF
()
example
/sr
c/demoapi.c
→
example
s/
c/demoapi.c
浏览文件 @
141be560
文件已移动
example
/sr
c/tmq.c
→
example
s/
c/tmq.c
浏览文件 @
141be560
...
...
@@ -165,7 +165,6 @@ tmq_t* build_consumer() {
tmq_conf_set
(
conf
,
"group.id"
,
"tg2"
);
tmq_conf_set
(
conf
,
"td.connect.user"
,
"root"
);
tmq_conf_set
(
conf
,
"td.connect.pass"
,
"taosdata"
);
/*tmq_conf_set(conf, "td.connect.db", "abc1");*/
tmq_conf_set
(
conf
,
"msg.with.table.name"
,
"true"
);
tmq_conf_set
(
conf
,
"enable.auto.commit"
,
"false"
);
tmq_conf_set_auto_commit_cb
(
conf
,
tmq_commit_cb_print
,
NULL
);
...
...
@@ -191,20 +190,18 @@ void basic_consume_loop(tmq_t* tmq, tmq_list_t* topics) {
return
;
}
int32_t
cnt
=
0
;
/*clock_t startTime = clock();*/
while
(
running
)
{
TAOS_RES
*
tmqmessage
=
tmq_consumer_poll
(
tmq
,
0
);
if
(
tmqmessage
)
{
cnt
++
;
msg_process
(
tmqmessage
);
if
(
cnt
>=
2
)
break
;
/*printf("get data\n");*/
/*msg_process(tmqmessage);*/
taos_free_result
(
tmqmessage
);
/*} else {*/
/*break;*/
}
}
/*clock_t endTime = clock();*/
/*printf("log cnt: %d %f s\n", cnt, (double)(endTime - startTime) / CLOCKS_PER_SEC);*/
err
=
tmq_consumer_close
(
tmq
);
if
(
err
)
...
...
@@ -253,39 +250,6 @@ void sync_consume_loop(tmq_t* tmq, tmq_list_t* topics) {
fprintf
(
stderr
,
"%% Consumer closed
\n
"
);
}
void
perf_loop
(
tmq_t
*
tmq
,
tmq_list_t
*
topics
)
{
tmq_resp_err_t
err
;
if
((
err
=
tmq_subscribe
(
tmq
,
topics
)))
{
fprintf
(
stderr
,
"%% Failed to start consuming topics: %s
\n
"
,
tmq_err2str
(
err
));
printf
(
"subscribe err
\n
"
);
return
;
}
int32_t
batchCnt
=
0
;
int32_t
skipLogNum
=
0
;
clock_t
startTime
=
clock
();
while
(
running
)
{
TAOS_RES
*
tmqmessage
=
tmq_consumer_poll
(
tmq
,
500
);
if
(
tmqmessage
)
{
batchCnt
++
;
/*skipLogNum += tmqGetSkipLogNum(tmqmessage);*/
/*msg_process(tmqmessage);*/
taos_free_result
(
tmqmessage
);
}
else
{
break
;
}
}
clock_t
endTime
=
clock
();
printf
(
"log batch cnt: %d, skip log cnt: %d, time used:%f s
\n
"
,
batchCnt
,
skipLogNum
,
(
double
)(
endTime
-
startTime
)
/
CLOCKS_PER_SEC
);
err
=
tmq_consumer_close
(
tmq
);
if
(
err
)
fprintf
(
stderr
,
"%% Failed to close consumer: %s
\n
"
,
tmq_err2str
(
err
));
else
fprintf
(
stderr
,
"%% Consumer closed
\n
"
);
}
int
main
(
int
argc
,
char
*
argv
[])
{
if
(
argc
>
1
)
{
printf
(
"env init
\n
"
);
...
...
@@ -296,7 +260,6 @@ int main(int argc, char* argv[]) {
}
tmq_t
*
tmq
=
build_consumer
();
tmq_list_t
*
topic_list
=
build_topic_list
();
/*perf_loop(tmq, topic_list);*/
/*basic_consume_loop(tmq, topic_list);*/
sync_consume_loop
(
tmq
,
topic_list
);
basic_consume_loop
(
tmq
,
topic_list
);
/*sync_consume_loop(tmq, topic_list);*/
}
example
/sr
c/tstream.c
→
example
s/
c/tstream.c
浏览文件 @
141be560
文件已移动
include/client/taos.h
浏览文件 @
141be560
...
...
@@ -85,6 +85,14 @@ typedef struct taosField {
int32_t
bytes
;
}
TAOS_FIELD
;
typedef
struct
TAOS_FIELD_E
{
char
name
[
65
];
int8_t
type
;
uint8_t
precision
;
uint8_t
scale
;
int32_t
bytes
;
}
TAOS_FIELD_E
;
#ifdef WINDOWS
#define DLL_EXPORT __declspec(dllexport)
#else
...
...
@@ -134,7 +142,10 @@ 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_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_tags
(
TAOS_STMT
*
stmt
,
TAOS_MULTI_BIND
*
tags
);
DLL_EXPORT
int
taos_stmt_set_sub_tbname
(
TAOS_STMT
*
stmt
,
const
char
*
name
);
DLL_EXPORT
int
taos_stmt_get_tag_fields
(
TAOS_STMT
*
stmt
,
int
*
fieldNum
,
TAOS_FIELD_E
**
fields
);
DLL_EXPORT
int
taos_stmt_get_col_fields
(
TAOS_STMT
*
stmt
,
int
*
fieldNum
,
TAOS_FIELD_E
**
fields
);
DLL_EXPORT
int
taos_stmt_is_insert
(
TAOS_STMT
*
stmt
,
int
*
insert
);
DLL_EXPORT
int
taos_stmt_num_params
(
TAOS_STMT
*
stmt
,
int
*
nums
);
...
...
@@ -230,7 +241,7 @@ DLL_EXPORT const char *tmq_err2str(tmq_resp_err_t);
DLL_EXPORT
tmq_resp_err_t
tmq_subscribe
(
tmq_t
*
tmq
,
const
tmq_list_t
*
topic_list
);
DLL_EXPORT
tmq_resp_err_t
tmq_unsubscribe
(
tmq_t
*
tmq
);
DLL_EXPORT
tmq_resp_err_t
tmq_subscription
(
tmq_t
*
tmq
,
tmq_list_t
**
topics
);
DLL_EXPORT
TAOS_RES
*
tmq_consumer_poll
(
tmq_t
*
tmq
,
int64_t
wait_time
);
DLL_EXPORT
TAOS_RES
*
tmq_consumer_poll
(
tmq_t
*
tmq
,
int64_t
timeout
);
DLL_EXPORT
tmq_resp_err_t
tmq_consumer_close
(
tmq_t
*
tmq
);
DLL_EXPORT
tmq_resp_err_t
tmq_commit_sync
(
tmq_t
*
tmq
,
const
tmq_topic_vgroup_list_t
*
offsets
);
DLL_EXPORT
void
tmq_commit_async
(
tmq_t
*
tmq
,
const
tmq_topic_vgroup_list_t
*
offsets
,
tmq_commit_cb
*
cb
,
void
*
param
);
...
...
include/common/tdataformat.h
浏览文件 @
141be560
...
...
@@ -18,6 +18,7 @@
#include "os.h"
#include "talgo.h"
#include "tarray.h"
#include "tencode.h"
#include "ttypes.h"
#include "tutil.h"
...
...
@@ -29,6 +30,7 @@ extern "C" {
typedef
struct
SSchema
SSchema
;
typedef
struct
STColumn
STColumn
;
typedef
struct
STSchema
STSchema
;
typedef
struct
SValue
SValue
;
typedef
struct
SColVal
SColVal
;
typedef
struct
STSRow2
STSRow2
;
typedef
struct
STSRowBuilder
STSRowBuilder
;
...
...
@@ -39,32 +41,36 @@ typedef struct STag STag;
int32_t
tTSchemaCreate
(
int32_t
sver
,
SSchema
*
pSchema
,
int32_t
nCols
,
STSchema
**
ppTSchema
);
void
tTSchemaDestroy
(
STSchema
*
pTSchema
);
// SColVal
#define ColValNONE ((SColVal){.type = COL_VAL_NONE, .nData = 0, .pData = NULL})
#define ColValNULL ((SColVal){.type = COL_VAL_NULL, .nData = 0, .pData = NULL})
#define ColValDATA(nData, pData) ((SColVal){.type = COL_VAL_DATA, .nData = (nData), .pData = (pData)})
// STSRow2
#define COL_VAL_NONE(CID) ((SColVal){.cid = (CID), .isNone = 1})
#define COL_VAL_NULL(CID) ((SColVal){.cid = (CID), .isNull = 1})
#define COL_VAL_VALUE(CID, V) ((SColVal){.cid = (CID), .value = (V)})
int32_t
tTSRowClone
(
const
STSRow2
*
pRow
,
STSRow2
**
ppRow
);
void
tTSRowFree
(
STSRow2
*
pRow
);
void
tTSRowGet
(
STSRow2
*
pRow
,
STSchema
*
pTSchema
,
int32_t
iCol
,
SColVal
*
pColVal
);
int32_t
tTSRowToArray
(
STSRow2
*
pRow
,
STSchema
*
pTSchema
,
SArray
**
ppArray
);
int32_t
tPutTSRow
(
uint8_t
*
p
,
STSRow2
*
pRow
);
int32_t
tGetTSRow
(
uint8_t
*
p
,
STSRow2
*
pRow
);
int32_t
tTSRowDup
(
const
STSRow2
*
pRow
,
STSRow2
**
ppRow
);
void
tTSRowFree
(
STSRow2
*
pRow
);
int32_t
tTSRowGet
(
const
STSRow2
*
pRow
,
STSchema
*
pTSchema
,
int32_t
iCol
,
SColVal
*
pColVal
);
// STSRowBuilder
#if 0
int32_t tTSRowBuilderInit(STSRowBuilder *pBuilder, int32_t sver, int32_t nCols, SSchema *pSchema);
void tTSRowBuilderClear(STSRowBuilder *pBuilder);
void tTSRowBuilderReset(STSRowBuilder *pBuilder);
int32_t tTSRowBuilderPut(STSRowBuilder *pBuilder, int32_t cid, uint8_t *pData, uint32_t nData);
int32_t tTSRowBuilderGetRow(STSRowBuilder *pBuilder, const STSRow2 **ppRow);
#endif
// STag
int32_t
tTagNew
(
S
TagVal
*
pTagVals
,
int16_t
nTag
,
STag
**
ppTag
);
int32_t
tTagNew
(
S
Array
*
pArray
,
int32_t
version
,
int8_t
isJson
,
STag
**
ppTag
);
void
tTagFree
(
STag
*
pTag
);
int32_t
tTagSet
(
STag
*
pTag
,
SSchema
*
pSchema
,
int32_t
nCols
,
int
iCol
,
uint8_t
*
pData
,
uint32_t
nData
,
STag
**
ppTag
);
void
tTagGet
(
STag
*
pTag
,
int16_t
cid
,
int8_t
type
,
uint8_t
**
ppData
,
uint32_t
*
nData
);
bool
tTagGet
(
const
STag
*
pTag
,
STagVal
*
pTagVal
);
char
*
tTagValToData
(
const
STagVal
*
pTagVal
,
bool
isJson
);
int32_t
tEncodeTag
(
SEncoder
*
pEncoder
,
const
STag
*
pTag
);
int32_t
tDecodeTag
(
SDecoder
*
pDecoder
,
STag
**
ppTag
);
int32_t
tTagToValArray
(
const
STag
*
pTag
,
SArray
**
ppArray
);
void
debugPrintSTag
(
STag
*
pTag
,
const
char
*
tag
,
int32_t
ln
);
// STRUCT =================
struct
STColumn
{
...
...
@@ -87,7 +93,9 @@ struct STSchema {
#define TSROW_HAS_NONE ((uint8_t)0x1)
#define TSROW_HAS_NULL ((uint8_t)0x2U)
#define TSROW_HAS_VAL ((uint8_t)0x4U)
#define TSROW_KV_ROW ((uint8_t)0x10U)
#define TSROW_KV_SMALL ((uint8_t)0x10U)
#define TSROW_KV_MID ((uint8_t)0x20U)
#define TSROW_KV_BIG ((uint8_t)0x40U)
struct
STSRow2
{
TSKEY
ts
;
uint8_t
flags
;
...
...
@@ -110,20 +118,60 @@ struct STSRowBuilder {
STSRow2
row
;
};
typedef
enum
{
COL_VAL_NONE
=
0
,
COL_VAL_NULL
=
1
,
COL_VAL_DATA
=
2
}
EColValT
;
struct
SValue
{
union
{
int8_t
i8
;
// TSDB_DATA_TYPE_BOOL||TSDB_DATA_TYPE_TINYINT
uint8_t
u8
;
// TSDB_DATA_TYPE_UTINYINT
int16_t
i16
;
// TSDB_DATA_TYPE_SMALLINT
uint16_t
u16
;
// TSDB_DATA_TYPE_USMALLINT
int32_t
i32
;
// TSDB_DATA_TYPE_INT
uint32_t
u32
;
// TSDB_DATA_TYPE_UINT
int64_t
i64
;
// TSDB_DATA_TYPE_BIGINT
uint64_t
u64
;
// TSDB_DATA_TYPE_UBIGINT
TSKEY
ts
;
// TSDB_DATA_TYPE_TIMESTAMP
float
f
;
// TSDB_DATA_TYPE_FLOAT
double
d
;
// TSDB_DATA_TYPE_DOUBLE
struct
{
uint32_t
nData
;
uint8_t
*
pData
;
};
};
};
struct
SColVal
{
EColValT
type
;
uint32_t
nData
;
uint8_t
*
pData
;
int16_t
cid
;
int8_t
isNone
;
int8_t
isNull
;
SValue
value
;
};
#pragma pack(push, 1)
struct
STagVal
{
int16_t
cid
;
int8_t
type
;
uint32_t
nData
;
uint8_t
*
pData
;
union
{
int16_t
cid
;
char
*
pKey
;
};
int8_t
type
;
union
{
int64_t
i64
;
struct
{
uint32_t
nData
;
uint8_t
*
pData
;
};
};
};
#define TD_TAG_JSON ((int8_t)0x40) // distinguish JSON string and JSON value with the highest bit
#define TD_TAG_LARGE ((int8_t)0x20)
struct
STag
{
int8_t
flags
;
int16_t
len
;
int16_t
nTag
;
int32_t
ver
;
int8_t
idx
[];
};
#pragma pack(pop)
#if 1 //================================================================================================================================================
// Imported since 3.0 and use bitmap to demonstrate None/Null/Norm, while use Null/Norm below 3.0 without of bitmap.
#define TD_SUPPORT_BITMAP
...
...
@@ -366,109 +414,6 @@ SDataCols *tdFreeDataCols(SDataCols *pCols);
int32_t
tdMergeDataCols
(
SDataCols
*
target
,
SDataCols
*
source
,
int32_t
rowsToMerge
,
int32_t
*
pOffset
,
bool
update
,
TDRowVerT
maxVer
);
// ----------------- K-V data row structure
/* |<-------------------------------------- len -------------------------------------------->|
* |<----- header ----->|<--------------------------- body -------------------------------->|
* +----------+----------+---------------------------------+---------------------------------+
* | uint16_t | int16_t | | |
* +----------+----------+---------------------------------+---------------------------------+
* | len | ncols | cols index | data part |
* +----------+----------+---------------------------------+---------------------------------+
*/
typedef
void
*
SKVRow
;
typedef
struct
{
int16_t
colId
;
uint16_t
offset
;
}
SColIdx
;
#define TD_KV_ROW_HEAD_SIZE (sizeof(uint16_t) + sizeof(int16_t))
#define kvRowLen(r) (*(uint16_t *)(r))
#define kvRowNCols(r) (*(int16_t *)POINTER_SHIFT(r, sizeof(uint16_t)))
#define kvRowSetLen(r, len) kvRowLen(r) = (len)
#define kvRowSetNCols(r, n) kvRowNCols(r) = (n)
#define kvRowColIdx(r) (SColIdx *)POINTER_SHIFT(r, TD_KV_ROW_HEAD_SIZE)
#define kvRowValues(r) POINTER_SHIFT(r, TD_KV_ROW_HEAD_SIZE + sizeof(SColIdx) * kvRowNCols(r))
#define kvRowCpy(dst, r) memcpy((dst), (r), kvRowLen(r))
#define kvRowColVal(r, colIdx) POINTER_SHIFT(kvRowValues(r), (colIdx)->offset)
#define kvRowColIdxAt(r, i) (kvRowColIdx(r) + (i))
#define kvRowFree(r) taosMemoryFreeClear(r)
#define kvRowEnd(r) POINTER_SHIFT(r, kvRowLen(r))
#define kvRowValLen(r) (kvRowLen(r) - TD_KV_ROW_HEAD_SIZE - sizeof(SColIdx) * kvRowNCols(r))
#define kvRowTKey(r) (*(TKEY *)(kvRowValues(r)))
#define kvRowKey(r) tdGetKey(kvRowTKey(r))
#define kvRowKeys(r) POINTER_SHIFT(r, *(uint16_t *)POINTER_SHIFT(r, TD_KV_ROW_HEAD_SIZE + sizeof(int16_t)))
#define kvRowDeleted(r) TKEY_IS_DELETED(kvRowTKey(r))
SKVRow
tdKVRowDup
(
SKVRow
row
);
int32_t
tdSetKVRowDataOfCol
(
SKVRow
*
orow
,
int16_t
colId
,
int8_t
type
,
void
*
value
);
int32_t
tdEncodeKVRow
(
void
**
buf
,
SKVRow
row
);
void
*
tdDecodeKVRow
(
void
*
buf
,
SKVRow
*
row
);
void
tdSortKVRowByColIdx
(
SKVRow
row
);
static
FORCE_INLINE
int32_t
comparTagId
(
const
void
*
key1
,
const
void
*
key2
)
{
if
(
*
(
int16_t
*
)
key1
>
((
SColIdx
*
)
key2
)
->
colId
)
{
return
1
;
}
else
if
(
*
(
int16_t
*
)
key1
<
((
SColIdx
*
)
key2
)
->
colId
)
{
return
-
1
;
}
else
{
return
0
;
}
}
static
FORCE_INLINE
void
*
tdGetKVRowValOfCol
(
const
SKVRow
row
,
int16_t
colId
)
{
void
*
ret
=
taosbsearch
(
&
colId
,
kvRowColIdx
(
row
),
kvRowNCols
(
row
),
sizeof
(
SColIdx
),
comparTagId
,
TD_EQ
);
if
(
ret
==
NULL
)
return
NULL
;
return
kvRowColVal
(
row
,
(
SColIdx
*
)
ret
);
}
static
FORCE_INLINE
void
*
tdGetKVRowIdxOfCol
(
SKVRow
row
,
int16_t
colId
)
{
return
taosbsearch
(
&
colId
,
kvRowColIdx
(
row
),
kvRowNCols
(
row
),
sizeof
(
SColIdx
),
comparTagId
,
TD_EQ
);
}
// ----------------- K-V data row builder
typedef
struct
{
int16_t
tCols
;
int16_t
nCols
;
SColIdx
*
pColIdx
;
uint16_t
alloc
;
uint16_t
size
;
void
*
buf
;
}
SKVRowBuilder
;
int32_t
tdInitKVRowBuilder
(
SKVRowBuilder
*
pBuilder
);
void
tdDestroyKVRowBuilder
(
SKVRowBuilder
*
pBuilder
);
void
tdResetKVRowBuilder
(
SKVRowBuilder
*
pBuilder
);
SKVRow
tdGetKVRowFromBuilder
(
SKVRowBuilder
*
pBuilder
);
static
FORCE_INLINE
int32_t
tdAddColToKVRow
(
SKVRowBuilder
*
pBuilder
,
col_id_t
colId
,
const
void
*
value
,
int32_t
tlen
)
{
if
(
pBuilder
->
nCols
>=
pBuilder
->
tCols
)
{
pBuilder
->
tCols
*=
2
;
SColIdx
*
pColIdx
=
(
SColIdx
*
)
taosMemoryRealloc
((
void
*
)(
pBuilder
->
pColIdx
),
sizeof
(
SColIdx
)
*
pBuilder
->
tCols
);
if
(
pColIdx
==
NULL
)
return
-
1
;
pBuilder
->
pColIdx
=
pColIdx
;
}
pBuilder
->
pColIdx
[
pBuilder
->
nCols
].
colId
=
colId
;
pBuilder
->
pColIdx
[
pBuilder
->
nCols
].
offset
=
pBuilder
->
size
;
pBuilder
->
nCols
++
;
if
(
tlen
>
pBuilder
->
alloc
-
pBuilder
->
size
)
{
while
(
tlen
>
pBuilder
->
alloc
-
pBuilder
->
size
)
{
pBuilder
->
alloc
*=
2
;
}
void
*
buf
=
taosMemoryRealloc
(
pBuilder
->
buf
,
pBuilder
->
alloc
);
if
(
buf
==
NULL
)
return
-
1
;
pBuilder
->
buf
=
buf
;
}
memcpy
(
POINTER_SHIFT
(
pBuilder
->
buf
,
pBuilder
->
size
),
value
,
tlen
);
pBuilder
->
size
+=
tlen
;
return
0
;
}
#endif
#ifdef __cplusplus
...
...
@@ -476,3 +421,4 @@ static FORCE_INLINE int32_t tdAddColToKVRow(SKVRowBuilder *pBuilder, col_id_t co
#endif
#endif
/*_TD_COMMON_DATA_FORMAT_H_*/
include/common/tmsg.h
浏览文件 @
141be560
...
...
@@ -287,7 +287,7 @@ typedef struct SSchema {
char
name
[
TSDB_COL_NAME_LEN
];
}
SSchema
;
#define COL_IS_SET(FLG) ((
FLG) & (COL_SET_VAL | COL_SET_NULL
) != 0)
#define COL_IS_SET(FLG) ((
(FLG) & (COL_SET_VAL | COL_SET_NULL)
) != 0)
#define COL_CLR_SET(FLG) ((FLG) &= (~(COL_SET_VAL | COL_SET_NULL)))
#define IS_BSMA_ON(s) (((s)->flags & 0x01) == COL_SMA_ON)
...
...
@@ -945,7 +945,6 @@ typedef struct {
int64_t
timeInFetchQueue
;
}
SQnodeLoad
;
typedef
struct
{
int32_t
sver
;
// software version
int64_t
dnodeVer
;
// dnode table version in sdb
...
...
@@ -1031,6 +1030,7 @@ typedef struct {
SReplica
replicas
[
TSDB_MAX_REPLICA
];
int32_t
numOfRetensions
;
SArray
*
pRetensions
;
// SRetention
void
*
pTsma
;
}
SCreateVnodeReq
;
int32_t
tSerializeSCreateVnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SCreateVnodeReq
*
pReq
);
...
...
@@ -1774,6 +1774,15 @@ typedef struct SVCreateTbReq {
int
tEncodeSVCreateTbReq
(
SEncoder
*
pCoder
,
const
SVCreateTbReq
*
pReq
);
int
tDecodeSVCreateTbReq
(
SDecoder
*
pCoder
,
SVCreateTbReq
*
pReq
);
static
FORCE_INLINE
void
tdDestroySVCreateTbReq
(
SVCreateTbReq
*
req
)
{
taosMemoryFreeClear
(
req
->
name
);
if
(
req
->
type
==
TSDB_CHILD_TABLE
)
{
taosMemoryFreeClear
(
req
->
ctb
.
pTag
);
}
else
if
(
req
->
type
==
TSDB_NORMAL_TABLE
)
{
taosMemoryFreeClear
(
req
->
ntb
.
schemaRow
.
pSchema
);
}
}
typedef
struct
{
int32_t
nReqs
;
union
{
...
...
@@ -1964,7 +1973,7 @@ typedef struct {
int8_t
killConnection
;
int8_t
align
[
3
];
SEpSet
epSet
;
SArray
*
pQnodeList
;
SArray
*
pQnodeList
;
}
SQueryHbRspBasic
;
typedef
struct
{
...
...
@@ -2292,6 +2301,7 @@ typedef struct {
int8_t
intervalUnit
;
// MACRO: TIME_UNIT_XXX
int8_t
slidingUnit
;
// MACRO: TIME_UNIT_XXX
int8_t
timezoneInt
;
// sma data expired if timezone changes.
int32_t
dstVgId
;
char
indexName
[
TSDB_INDEX_NAME_LEN
];
int32_t
exprLen
;
int32_t
tagsFilterLen
;
...
...
@@ -2434,7 +2444,7 @@ typedef struct {
int32_t
epoch
;
uint64_t
reqId
;
int64_t
consumerId
;
int64_t
waitTime
;
int64_t
timeout
;
int64_t
currentOffset
;
}
SMqPollReq
;
...
...
@@ -2649,6 +2659,23 @@ typedef struct {
int32_t
tEncodeSVSubmitReq
(
SEncoder
*
pCoder
,
const
SVSubmitReq
*
pReq
);
int32_t
tDecodeSVSubmitReq
(
SDecoder
*
pCoder
,
SVSubmitReq
*
pReq
);
// TDMT_VND_DELETE
typedef
struct
{
TSKEY
sKey
;
TSKEY
eKey
;
// super table
char
*
stbName
;
// child/normal
char
*
tbName
;
}
SVDeleteReq
;
typedef
struct
{
int32_t
code
;
// TODO
}
SVDeleteRsp
;
#pragma pack(pop)
#ifdef __cplusplus
...
...
include/common/tmsgdef.h
浏览文件 @
141be560
...
...
@@ -225,6 +225,8 @@ enum {
TD_DEF_MSG_TYPE
(
TDMT_VND_ALTER_REPLICA
,
"vnode-alter-replica"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_VND_COMPACT
,
"vnode-compact"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_VND_DELETE
,
"vnode-delete-data"
,
SVDeleteReq
,
SVDeleteRsp
)
// Requests handled by QNODE
TD_NEW_MSG_SEG
(
TDMT_QND_MSG
)
...
...
include/libs/parser/parser.h
浏览文件 @
141be560
...
...
@@ -77,8 +77,8 @@ int32_t qStmtParseQuerySql(SParseContext* pCxt, SQuery* pQuery);
int32_t
qBindStmtColsValue
(
void
*
pBlock
,
TAOS_MULTI_BIND
*
bind
,
char
*
msgBuf
,
int32_t
msgBufLen
);
int32_t
qBindStmtSingleColValue
(
void
*
pBlock
,
TAOS_MULTI_BIND
*
bind
,
char
*
msgBuf
,
int32_t
msgBufLen
,
int32_t
colIdx
,
int32_t
rowNum
);
int32_t
qBuildStmtColFields
(
void
*
pDataBlock
,
int32_t
*
fieldNum
,
TAOS_FIELD
**
fields
);
int32_t
qBuildStmtTagFields
(
void
*
pBlock
,
void
*
boundTags
,
int32_t
*
fieldNum
,
TAOS_FIELD
**
fields
);
int32_t
qBuildStmtColFields
(
void
*
pDataBlock
,
int32_t
*
fieldNum
,
TAOS_FIELD
_E
**
fields
);
int32_t
qBuildStmtTagFields
(
void
*
pBlock
,
void
*
boundTags
,
int32_t
*
fieldNum
,
TAOS_FIELD
_E
**
fields
);
int32_t
qBindStmtTagsValue
(
void
*
pBlock
,
void
*
boundTags
,
int64_t
suid
,
char
*
tName
,
TAOS_MULTI_BIND
*
bind
,
char
*
msgBuf
,
int32_t
msgBufLen
);
void
destroyBoundColumnInfo
(
void
*
pBoundInfo
);
...
...
include/os/osDir.h
浏览文件 @
141be560
...
...
@@ -33,8 +33,19 @@ extern "C" {
#ifdef WINDOWS
#define TD_TMP_DIR_PATH "C:\\Windows\\Temp\\"
#define TD_CFG_DIR_PATH "C:\\TDengine\\cfg\\"
#define TD_DATA_DIR_PATH "C:\\TDengine\\data\\"
#define TD_LOG_DIR_PATH "C:\\TDengine\\log\\"
#elif defined(_TD_DARWIN_64)
#define TD_TMP_DIR_PATH "/tmp/taosd/"
#define TD_CFG_DIR_PATH "/usr/local/etc/taos/"
#define TD_DATA_DIR_PATH "/usr/local/var/lib/taos/"
#define TD_LOG_DIR_PATH "/usr/local/var/log/taos/"
#else
#define TD_TMP_DIR_PATH "/tmp/"
#define TD_CFG_DIR_PATH "/etc/taos/"
#define TD_DATA_DIR_PATH "/var/lib/taos/"
#define TD_LOG_DIR_PATH "/var/log/taos/"
#endif
typedef
struct
TdDir
*
TdDirPtr
;
...
...
include/util/taoserror.h
浏览文件 @
141be560
...
...
@@ -70,6 +70,7 @@ int32_t* taosGetErrno();
#define TSDB_CODE_NEED_RETRY TAOS_DEF_ERROR_CODE(0, 0x0028)
#define TSDB_CODE_OUT_OF_RPC_MEMORY_QUEUE TAOS_DEF_ERROR_CODE(0, 0x0029)
#define TSDB_CODE_INVALID_TIMESTAMP TAOS_DEF_ERROR_CODE(0, 0x0030)
#define TSDB_CODE_MSG_DECODE_ERROR TAOS_DEF_ERROR_CODE(0, 0x0031)
#define TSDB_CODE_REF_NO_MEMORY TAOS_DEF_ERROR_CODE(0, 0x0040)
#define TSDB_CODE_REF_FULL TAOS_DEF_ERROR_CODE(0, 0x0041)
...
...
include/util/tdef.h
浏览文件 @
141be560
...
...
@@ -342,7 +342,7 @@ typedef enum ELogicConditionType {
#define TSDB_DEFAULT_DB_SCHEMALESS TSDB_DB_SCHEMALESS_OFF
#define TSDB_MIN_ROLLUP_FILE_FACTOR 0
#define TSDB_MAX_ROLLUP_FILE_FACTOR 1
#define TSDB_MAX_ROLLUP_FILE_FACTOR 1
0
#define TSDB_DEFAULT_ROLLUP_FILE_FACTOR 0.1
#define TSDB_MIN_TABLE_TTL 0
#define TSDB_DEFAULT_TABLE_TTL 0
...
...
include/util/tencode.h
浏览文件 @
141be560
...
...
@@ -378,14 +378,16 @@ static FORCE_INLINE int32_t tDecodeDouble(SDecoder* pCoder, double* val) {
}
static
FORCE_INLINE
int32_t
tDecodeBinary
(
SDecoder
*
pCoder
,
uint8_t
**
val
,
uint32_t
*
len
)
{
if
(
tDecodeU32v
(
pCoder
,
len
)
<
0
)
return
-
1
;
uint32_t
length
=
0
;
if
(
tDecodeU32v
(
pCoder
,
&
length
)
<
0
)
return
-
1
;
if
(
len
)
*
len
=
length
;
if
(
TD_CODER_CHECK_CAPACITY_FAILED
(
pCoder
,
*
len
))
return
-
1
;
if
(
TD_CODER_CHECK_CAPACITY_FAILED
(
pCoder
,
length
))
return
-
1
;
if
(
val
)
{
*
val
=
(
uint8_t
*
)
TD_CODER_CURRENT
(
pCoder
);
}
TD_CODER_MOVE_POS
(
pCoder
,
*
len
);
TD_CODER_MOVE_POS
(
pCoder
,
length
);
return
0
;
}
...
...
@@ -410,14 +412,16 @@ static int32_t tDecodeCStrTo(SDecoder* pCoder, char* val) {
}
static
FORCE_INLINE
int32_t
tDecodeBinaryAlloc
(
SDecoder
*
pCoder
,
void
**
val
,
uint64_t
*
len
)
{
if
(
tDecodeU64v
(
pCoder
,
len
)
<
0
)
return
-
1
;
uint64_t
length
=
0
;
if
(
tDecodeU64v
(
pCoder
,
&
length
)
<
0
)
return
-
1
;
if
(
len
)
*
len
=
length
;
if
(
TD_CODER_CHECK_CAPACITY_FAILED
(
pCoder
,
*
len
))
return
-
1
;
*
val
=
taosMemoryMalloc
(
*
len
);
if
(
TD_CODER_CHECK_CAPACITY_FAILED
(
pCoder
,
length
))
return
-
1
;
*
val
=
taosMemoryMalloc
(
length
);
if
(
*
val
==
NULL
)
return
-
1
;
memcpy
(
*
val
,
TD_CODER_CURRENT
(
pCoder
),
*
len
);
memcpy
(
*
val
,
TD_CODER_CURRENT
(
pCoder
),
length
);
TD_CODER_MOVE_POS
(
pCoder
,
*
len
);
TD_CODER_MOVE_POS
(
pCoder
,
length
);
return
0
;
}
...
...
@@ -530,6 +534,26 @@ static FORCE_INLINE int32_t tPutI64(uint8_t* p, int64_t v) {
return
sizeof
(
int64_t
);
}
static
FORCE_INLINE
int32_t
tPutFloat
(
uint8_t
*
p
,
float
f
)
{
union
{
uint32_t
ui
;
float
f
;
}
v
;
v
.
f
=
f
;
return
tPutU32
(
p
,
v
.
ui
);
}
static
FORCE_INLINE
int32_t
tPutDouble
(
uint8_t
*
p
,
double
d
)
{
union
{
uint64_t
ui
;
double
d
;
}
v
;
v
.
d
=
d
;
return
tPutU64
(
p
,
v
.
ui
);
}
static
FORCE_INLINE
int32_t
tPutU16v
(
uint8_t
*
p
,
uint16_t
v
)
{
tPutV
(
p
,
v
);
}
static
FORCE_INLINE
int32_t
tPutI16v
(
uint8_t
*
p
,
int16_t
v
)
{
return
tPutU16v
(
p
,
ZIGZAGE
(
int16_t
,
v
));
}
...
...
@@ -619,6 +643,34 @@ static FORCE_INLINE int32_t tGetI64v(uint8_t* p, int64_t* v) {
return
n
;
}
static
FORCE_INLINE
int32_t
tGetFloat
(
uint8_t
*
p
,
float
*
f
)
{
int32_t
n
=
0
;
union
{
uint32_t
ui
;
float
f
;
}
v
;
n
=
tGetU32
(
p
,
&
v
.
ui
);
*
f
=
v
.
f
;
return
n
;
}
static
FORCE_INLINE
int32_t
tGetDouble
(
uint8_t
*
p
,
double
*
d
)
{
int32_t
n
=
0
;
union
{
uint64_t
ui
;
double
d
;
}
v
;
n
=
tGetU64
(
p
,
&
v
.
ui
);
*
d
=
v
.
d
;
return
n
;
}
// =====================
static
FORCE_INLINE
int32_t
tPutBinary
(
uint8_t
*
p
,
uint8_t
*
pData
,
uint32_t
nData
)
{
int
n
=
0
;
...
...
@@ -642,6 +694,11 @@ static FORCE_INLINE int32_t tGetBinary(uint8_t* p, uint8_t** ppData, uint32_t* n
return
n
;
}
static
FORCE_INLINE
int32_t
tPutCStr
(
uint8_t
*
p
,
char
*
pData
)
{
return
tPutBinary
(
p
,
(
uint8_t
*
)
pData
,
strlen
(
pData
)
+
1
);
}
static
FORCE_INLINE
int32_t
tGetCStr
(
uint8_t
*
p
,
char
**
ppData
)
{
return
tGetBinary
(
p
,
(
uint8_t
**
)
ppData
,
NULL
);
}
#ifdef __cplusplus
}
#endif
...
...
source/client/inc/clientStmt.h
浏览文件 @
141be560
...
...
@@ -116,8 +116,11 @@ int stmtAffectedRowsOnce(TAOS_STMT *stmt);
int
stmtPrepare
(
TAOS_STMT
*
stmt
,
const
char
*
sql
,
unsigned
long
length
);
int
stmtSetTbName
(
TAOS_STMT
*
stmt
,
const
char
*
tbName
);
int
stmtSetTbTags
(
TAOS_STMT
*
stmt
,
TAOS_MULTI_BIND
*
tags
);
int
stmtGetTagFields
(
TAOS_STMT
*
stmt
,
int
*
nums
,
TAOS_FIELD_E
**
fields
);
int
stmtGetColFields
(
TAOS_STMT
*
stmt
,
int
*
nums
,
TAOS_FIELD_E
**
fields
);
int
stmtIsInsert
(
TAOS_STMT
*
stmt
,
int
*
insert
);
int
stmtGetParamNum
(
TAOS_STMT
*
stmt
,
int
*
nums
);
int
stmtGetParam
(
TAOS_STMT
*
stmt
,
int
idx
,
int
*
type
,
int
*
bytes
);
int
stmtAddBatch
(
TAOS_STMT
*
stmt
);
TAOS_RES
*
stmtUseResult
(
TAOS_STMT
*
stmt
);
int
stmtBindBatch
(
TAOS_STMT
*
stmt
,
TAOS_MULTI_BIND
*
bind
,
int32_t
colIdx
);
...
...
source/client/src/clientImpl.c
浏览文件 @
141be560
...
...
@@ -1033,27 +1033,20 @@ static char* parseTagDatatoJson(void* p) {
goto
end
;
}
int16_t
nCols
=
kvRowNCols
(
p
);
SArray
*
pTagVals
=
NULL
;
if
(
tTagToValArray
((
const
STag
*
)
p
,
&
pTagVals
)
!=
0
)
{
goto
end
;
}
int16_t
nCols
=
taosArrayGetSize
(
pTagVals
);
char
tagJsonKey
[
256
]
=
{
0
};
for
(
int
j
=
0
;
j
<
nCols
;
++
j
)
{
SColIdx
*
pColIdx
=
kvRowColIdxAt
(
p
,
j
);
char
*
val
=
(
char
*
)(
kvRowColVal
(
p
,
pColIdx
));
if
(
j
==
0
)
{
if
(
*
val
==
TSDB_DATA_TYPE_NULL
)
{
string
=
taosMemoryCalloc
(
1
,
8
);
sprintf
(
string
,
"%s"
,
TSDB_DATA_NULL_STR_L
);
goto
end
;
}
continue
;
}
STagVal
*
pTagVal
=
(
STagVal
*
)
taosArrayGet
(
pTagVals
,
j
);
// json key encode by binary
memset
(
tagJsonKey
,
0
,
sizeof
(
tagJsonKey
));
memcpy
(
tagJsonKey
,
varDataVal
(
val
),
varDataLen
(
val
));
memcpy
(
tagJsonKey
,
pTagVal
->
pKey
,
strlen
(
pTagVal
->
pKey
));
// json value
val
+=
varDataTLen
(
val
);
char
*
realData
=
POINTER_SHIFT
(
val
,
CHAR_BYTES
);
char
type
=
*
val
;
char
type
=
pTagVal
->
type
;
if
(
type
==
TSDB_DATA_TYPE_NULL
)
{
cJSON
*
value
=
cJSON_CreateNull
();
if
(
value
==
NULL
)
{
...
...
@@ -1062,11 +1055,11 @@ static char* parseTagDatatoJson(void* p) {
cJSON_AddItemToObject
(
json
,
tagJsonKey
,
value
);
}
else
if
(
type
==
TSDB_DATA_TYPE_NCHAR
)
{
cJSON
*
value
=
NULL
;
if
(
varDataLen
(
realData
)
>
0
)
{
char
*
tagJsonValue
=
taosMemoryCalloc
(
varDataLen
(
realData
)
,
1
);
int32_t
length
=
taosUcs4ToMbs
((
TdUcs4
*
)
varDataVal
(
realData
),
varDataLen
(
realData
)
,
tagJsonValue
);
if
(
pTagVal
->
nData
>
0
)
{
char
*
tagJsonValue
=
taosMemoryCalloc
(
pTagVal
->
nData
,
1
);
int32_t
length
=
taosUcs4ToMbs
((
TdUcs4
*
)
pTagVal
->
pData
,
pTagVal
->
nData
,
tagJsonValue
);
if
(
length
<
0
)
{
tscError
(
"charset:%s to %s. val:%s convert json value failed."
,
DEFAULT_UNICODE_ENCODEC
,
tsCharset
,
val
);
tscError
(
"charset:%s to %s. val:%s convert json value failed."
,
DEFAULT_UNICODE_ENCODEC
,
tsCharset
,
pTagVal
->
pData
);
taosMemoryFree
(
tagJsonValue
);
goto
end
;
}
...
...
@@ -1075,7 +1068,7 @@ static char* parseTagDatatoJson(void* p) {
if
(
value
==
NULL
)
{
goto
end
;
}
}
else
if
(
varDataLen
(
realData
)
==
0
)
{
}
else
if
(
pTagVal
->
nData
==
0
)
{
value
=
cJSON_CreateString
(
""
);
}
else
{
ASSERT
(
0
);
...
...
@@ -1083,22 +1076,14 @@ static char* parseTagDatatoJson(void* p) {
cJSON_AddItemToObject
(
json
,
tagJsonKey
,
value
);
}
else
if
(
type
==
TSDB_DATA_TYPE_DOUBLE
)
{
double
jsonVd
=
*
(
double
*
)(
realData
);
double
jsonVd
=
*
(
double
*
)(
&
pTagVal
->
i64
);
cJSON
*
value
=
cJSON_CreateNumber
(
jsonVd
);
if
(
value
==
NULL
)
{
goto
end
;
}
cJSON_AddItemToObject
(
json
,
tagJsonKey
,
value
);
// }else if(type == TSDB_DATA_TYPE_BIGINT){
// int64_t jsonVd = *(int64_t*)(realData);
// cJSON* value = cJSON_CreateNumber((double)jsonVd);
// if (value == NULL)
// {
// goto end;
// }
// cJSON_AddItemToObject(json, tagJsonKey, value);
}
else
if
(
type
==
TSDB_DATA_TYPE_BOOL
)
{
char
jsonVd
=
*
(
char
*
)(
realData
);
char
jsonVd
=
*
(
char
*
)(
&
pTagVal
->
i64
);
cJSON
*
value
=
cJSON_CreateBool
(
jsonVd
);
if
(
value
==
NULL
)
{
goto
end
;
...
...
@@ -1163,7 +1148,7 @@ static int32_t doConvertUCS4(SReqResultInfo* pResultInfo, int32_t numOfRows, int
if
(
jsonInnerType
==
TSDB_DATA_TYPE_NULL
)
{
sprintf
(
varDataVal
(
dst
),
"%s"
,
TSDB_DATA_NULL_STR_L
);
varDataSetLen
(
dst
,
strlen
(
varDataVal
(
dst
)));
}
else
if
(
jsonInnerType
==
T
SDB_DATA_TYPE
_JSON
)
{
}
else
if
(
jsonInnerType
==
T
D_TAG
_JSON
)
{
char
*
jsonString
=
parseTagDatatoJson
(
jsonInnerData
);
STR_TO_VARSTR
(
dst
,
jsonString
);
taosMemoryFree
(
jsonString
);
...
...
@@ -1182,10 +1167,6 @@ static int32_t doConvertUCS4(SReqResultInfo* pResultInfo, int32_t numOfRows, int
double
jsonVd
=
*
(
double
*
)(
jsonInnerData
);
sprintf
(
varDataVal
(
dst
),
"%.9lf"
,
jsonVd
);
varDataSetLen
(
dst
,
strlen
(
varDataVal
(
dst
)));
}
else
if
(
jsonInnerType
==
TSDB_DATA_TYPE_BIGINT
)
{
int64_t
jsonVd
=
*
(
int64_t
*
)(
jsonInnerData
);
sprintf
(
varDataVal
(
dst
),
"%"
PRId64
,
jsonVd
);
varDataSetLen
(
dst
,
strlen
(
varDataVal
(
dst
)));
}
else
if
(
jsonInnerType
==
TSDB_DATA_TYPE_BOOL
)
{
sprintf
(
varDataVal
(
dst
),
"%s"
,
(
*
((
char
*
)
jsonInnerData
)
==
1
)
?
"true"
:
"false"
);
varDataSetLen
(
dst
,
strlen
(
varDataVal
(
dst
)));
...
...
source/client/src/clientMain.c
浏览文件 @
141be560
...
...
@@ -666,8 +666,39 @@ int taos_stmt_set_tbname(TAOS_STMT *stmt, const char *name) {
return
stmtSetTbName
(
stmt
,
name
);
}
int
taos_stmt_set_tags
(
TAOS_STMT
*
stmt
,
TAOS_MULTI_BIND
*
tags
)
{
if
(
stmt
==
NULL
||
tags
==
NULL
)
{
tscError
(
"NULL parameter for %s"
,
__FUNCTION__
);
terrno
=
TSDB_CODE_INVALID_PARA
;
return
terrno
;
}
return
stmtSetTbTags
(
stmt
,
tags
);
}
int
taos_stmt_set_sub_tbname
(
TAOS_STMT
*
stmt
,
const
char
*
name
)
{
return
taos_stmt_set_tbname
(
stmt
,
name
);
}
int
taos_stmt_get_tag_fields
(
TAOS_STMT
*
stmt
,
int
*
fieldNum
,
TAOS_FIELD_E
**
fields
)
{
if
(
stmt
==
NULL
||
NULL
==
fieldNum
)
{
tscError
(
"NULL parameter for %s"
,
__FUNCTION__
);
terrno
=
TSDB_CODE_INVALID_PARA
;
return
terrno
;
}
return
stmtGetTagFields
(
stmt
,
fieldNum
,
fields
);
}
int
taos_stmt_get_col_fields
(
TAOS_STMT
*
stmt
,
int
*
fieldNum
,
TAOS_FIELD_E
**
fields
)
{
if
(
stmt
==
NULL
||
NULL
==
fieldNum
)
{
tscError
(
"NULL parameter for %s"
,
__FUNCTION__
);
terrno
=
TSDB_CODE_INVALID_PARA
;
return
terrno
;
}
return
stmtGetColFields
(
stmt
,
fieldNum
,
fields
);
}
int
taos_stmt_bind_param
(
TAOS_STMT
*
stmt
,
TAOS_MULTI_BIND
*
bind
)
{
if
(
stmt
==
NULL
||
bind
==
NULL
)
{
tscError
(
"NULL parameter for %s"
,
__FUNCTION__
);
...
...
@@ -772,6 +803,16 @@ int taos_stmt_num_params(TAOS_STMT *stmt, int *nums) {
return
stmtGetParamNum
(
stmt
,
nums
);
}
int
taos_stmt_get_param
(
TAOS_STMT
*
stmt
,
int
idx
,
int
*
type
,
int
*
bytes
)
{
if
(
stmt
==
NULL
||
type
==
NULL
||
NULL
==
bytes
||
idx
<
0
)
{
tscError
(
"invalid parameter for %s"
,
__FUNCTION__
);
terrno
=
TSDB_CODE_INVALID_PARA
;
return
terrno
;
}
return
stmtGetParam
(
stmt
,
idx
,
type
,
bytes
);
}
TAOS_RES
*
taos_stmt_use_result
(
TAOS_STMT
*
stmt
)
{
if
(
stmt
==
NULL
)
{
tscError
(
"NULL parameter for %s"
,
__FUNCTION__
);
...
...
source/client/src/clientStmt.c
浏览文件 @
141be560
...
...
@@ -17,7 +17,7 @@ int32_t stmtSwitchStatus(STscStmt* pStmt, STMT_STATUS newStatus) {
}
break
;
case
STMT_SETTAGS
:
if
(
STMT_STATUS_NE
(
SETTBNAME
))
{
if
(
STMT_STATUS_NE
(
SETTBNAME
)
&&
STMT_STATUS_NE
(
FETCH_FIELDS
)
)
{
code
=
TSDB_CODE_TSC_STMT_API_ERROR
;
}
break
;
...
...
@@ -540,6 +540,8 @@ int stmtSetTbName(TAOS_STMT* stmt, const char* tbName) {
if
(
pStmt
->
bInfo
.
needParse
)
{
strncpy
(
pStmt
->
bInfo
.
tbName
,
tbName
,
sizeof
(
pStmt
->
bInfo
.
tbName
)
-
1
);
pStmt
->
bInfo
.
tbName
[
sizeof
(
pStmt
->
bInfo
.
tbName
)
-
1
]
=
0
;
STMT_ERR_RET
(
stmtParseSql
(
pStmt
));
}
return
TSDB_CODE_SUCCESS
;
...
...
@@ -550,10 +552,6 @@ int stmtSetTbTags(TAOS_STMT* stmt, TAOS_MULTI_BIND* tags) {
STMT_ERR_RET
(
stmtSwitchStatus
(
pStmt
,
STMT_SETTAGS
));
if
(
pStmt
->
bInfo
.
needParse
)
{
STMT_ERR_RET
(
stmtParseSql
(
pStmt
));
}
if
(
pStmt
->
bInfo
.
inExecCache
)
{
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -571,7 +569,7 @@ int stmtSetTbTags(TAOS_STMT* stmt, TAOS_MULTI_BIND* tags) {
return
TSDB_CODE_SUCCESS
;
}
int
32_t
stmtFetchTagFields
(
STscStmt
*
pStmt
,
int32_t
*
fieldNum
,
TAOS_FIELD
**
fields
)
{
int
stmtFetchTagFields
(
STscStmt
*
pStmt
,
int32_t
*
fieldNum
,
TAOS_FIELD_E
**
fields
)
{
if
(
STMT_TYPE_QUERY
==
pStmt
->
sql
.
type
)
{
tscError
(
"invalid operation to get query tag fileds"
);
STMT_ERR_RET
(
TSDB_CODE_TSC_STMT_API_ERROR
);
...
...
@@ -589,7 +587,7 @@ int32_t stmtFetchTagFields(STscStmt* pStmt, int32_t* fieldNum, TAOS_FIELD** fiel
return
TSDB_CODE_SUCCESS
;
}
int
32_t
stmtFetchColFields
(
STscStmt
*
pStmt
,
int32_t
*
fieldNum
,
TAOS_FIELD
**
fields
)
{
int
stmtFetchColFields
(
STscStmt
*
pStmt
,
int32_t
*
fieldNum
,
TAOS_FIELD_E
**
fields
)
{
if
(
STMT_TYPE_QUERY
==
pStmt
->
sql
.
type
)
{
tscError
(
"invalid operation to get query column fileds"
);
STMT_ERR_RET
(
TSDB_CODE_TSC_STMT_API_ERROR
);
...
...
@@ -852,6 +850,71 @@ int stmtIsInsert(TAOS_STMT* stmt, int* insert) {
return
TSDB_CODE_SUCCESS
;
}
int
stmtGetTagFields
(
TAOS_STMT
*
stmt
,
int
*
nums
,
TAOS_FIELD_E
**
fields
)
{
STscStmt
*
pStmt
=
(
STscStmt
*
)
stmt
;
if
(
STMT_TYPE_QUERY
==
pStmt
->
sql
.
type
)
{
STMT_RET
(
TSDB_CODE_TSC_STMT_API_ERROR
);
}
STMT_ERR_RET
(
stmtSwitchStatus
(
pStmt
,
STMT_FETCH_FIELDS
));
if
(
pStmt
->
bInfo
.
needParse
&&
pStmt
->
sql
.
runTimes
&&
pStmt
->
sql
.
type
>
0
&&
STMT_TYPE_MULTI_INSERT
!=
pStmt
->
sql
.
type
)
{
pStmt
->
bInfo
.
needParse
=
false
;
}
if
(
pStmt
->
exec
.
pRequest
&&
STMT_TYPE_QUERY
==
pStmt
->
sql
.
type
&&
pStmt
->
sql
.
runTimes
)
{
taos_free_result
(
pStmt
->
exec
.
pRequest
);
pStmt
->
exec
.
pRequest
=
NULL
;
}
if
(
NULL
==
pStmt
->
exec
.
pRequest
)
{
STMT_ERR_RET
(
buildRequest
(
pStmt
->
taos
,
pStmt
->
sql
.
sqlStr
,
pStmt
->
sql
.
sqlLen
,
&
pStmt
->
exec
.
pRequest
));
}
if
(
pStmt
->
bInfo
.
needParse
)
{
STMT_ERR_RET
(
stmtParseSql
(
pStmt
));
}
STMT_ERR_RET
(
stmtFetchTagFields
(
stmt
,
nums
,
fields
));
return
TSDB_CODE_SUCCESS
;
}
int
stmtGetColFields
(
TAOS_STMT
*
stmt
,
int
*
nums
,
TAOS_FIELD_E
**
fields
)
{
STscStmt
*
pStmt
=
(
STscStmt
*
)
stmt
;
if
(
STMT_TYPE_QUERY
==
pStmt
->
sql
.
type
)
{
STMT_RET
(
TSDB_CODE_TSC_STMT_API_ERROR
);
}
STMT_ERR_RET
(
stmtSwitchStatus
(
pStmt
,
STMT_FETCH_FIELDS
));
if
(
pStmt
->
bInfo
.
needParse
&&
pStmt
->
sql
.
runTimes
&&
pStmt
->
sql
.
type
>
0
&&
STMT_TYPE_MULTI_INSERT
!=
pStmt
->
sql
.
type
)
{
pStmt
->
bInfo
.
needParse
=
false
;
}
if
(
pStmt
->
exec
.
pRequest
&&
STMT_TYPE_QUERY
==
pStmt
->
sql
.
type
&&
pStmt
->
sql
.
runTimes
)
{
taos_free_result
(
pStmt
->
exec
.
pRequest
);
pStmt
->
exec
.
pRequest
=
NULL
;
}
if
(
NULL
==
pStmt
->
exec
.
pRequest
)
{
STMT_ERR_RET
(
buildRequest
(
pStmt
->
taos
,
pStmt
->
sql
.
sqlStr
,
pStmt
->
sql
.
sqlLen
,
&
pStmt
->
exec
.
pRequest
));
}
if
(
pStmt
->
bInfo
.
needParse
)
{
STMT_ERR_RET
(
stmtParseSql
(
pStmt
));
}
STMT_ERR_RET
(
stmtFetchColFields
(
stmt
,
nums
,
fields
));
return
TSDB_CODE_SUCCESS
;
}
int
stmtGetParamNum
(
TAOS_STMT
*
stmt
,
int
*
nums
)
{
STscStmt
*
pStmt
=
(
STscStmt
*
)
stmt
;
...
...
@@ -884,6 +947,50 @@ int stmtGetParamNum(TAOS_STMT* stmt, int* nums) {
return
TSDB_CODE_SUCCESS
;
}
int
stmtGetParam
(
TAOS_STMT
*
stmt
,
int
idx
,
int
*
type
,
int
*
bytes
)
{
STscStmt
*
pStmt
=
(
STscStmt
*
)
stmt
;
if
(
STMT_TYPE_QUERY
==
pStmt
->
sql
.
type
)
{
STMT_RET
(
TSDB_CODE_TSC_STMT_API_ERROR
);
}
STMT_ERR_RET
(
stmtSwitchStatus
(
pStmt
,
STMT_FETCH_FIELDS
));
if
(
pStmt
->
bInfo
.
needParse
&&
pStmt
->
sql
.
runTimes
&&
pStmt
->
sql
.
type
>
0
&&
STMT_TYPE_MULTI_INSERT
!=
pStmt
->
sql
.
type
)
{
pStmt
->
bInfo
.
needParse
=
false
;
}
if
(
pStmt
->
exec
.
pRequest
&&
STMT_TYPE_QUERY
==
pStmt
->
sql
.
type
&&
pStmt
->
sql
.
runTimes
)
{
taos_free_result
(
pStmt
->
exec
.
pRequest
);
pStmt
->
exec
.
pRequest
=
NULL
;
}
if
(
NULL
==
pStmt
->
exec
.
pRequest
)
{
STMT_ERR_RET
(
buildRequest
(
pStmt
->
taos
,
pStmt
->
sql
.
sqlStr
,
pStmt
->
sql
.
sqlLen
,
&
pStmt
->
exec
.
pRequest
));
}
if
(
pStmt
->
bInfo
.
needParse
)
{
STMT_ERR_RET
(
stmtParseSql
(
pStmt
));
}
int32_t
nums
=
0
;
TAOS_FIELD_E
*
pField
=
NULL
;
STMT_ERR_RET
(
stmtFetchColFields
(
stmt
,
&
nums
,
&
pField
));
if
(
idx
>=
nums
)
{
tscError
(
"idx %d is too big"
,
idx
);
taosMemoryFree
(
pField
);
STMT_ERR_RET
(
TSDB_CODE_INVALID_PARA
);
}
*
type
=
pField
[
idx
].
type
;
*
bytes
=
pField
[
idx
].
bytes
;
taosMemoryFree
(
pField
);
return
TSDB_CODE_SUCCESS
;
}
TAOS_RES
*
stmtUseResult
(
TAOS_STMT
*
stmt
)
{
STscStmt
*
pStmt
=
(
STscStmt
*
)
stmt
;
...
...
source/client/src/tmq.c
浏览文件 @
141be560
...
...
@@ -1243,7 +1243,7 @@ tmq_resp_err_t tmq_seek(tmq_t* tmq, const tmq_topic_vgroup_t* offset) {
return
TMQ_RESP_ERR__FAIL
;
}
SMqPollReq
*
tmqBuildConsumeReqImpl
(
tmq_t
*
tmq
,
int64_t
waitTime
,
SMqClientTopic
*
pTopic
,
SMqClientVg
*
pVg
)
{
SMqPollReq
*
tmqBuildConsumeReqImpl
(
tmq_t
*
tmq
,
int64_t
timeout
,
SMqClientTopic
*
pTopic
,
SMqClientVg
*
pVg
)
{
int64_t
reqOffset
;
if
(
pVg
->
currentOffset
>=
0
)
{
reqOffset
=
pVg
->
currentOffset
;
...
...
@@ -1269,7 +1269,7 @@ SMqPollReq* tmqBuildConsumeReqImpl(tmq_t* tmq, int64_t waitTime, SMqClientTopic*
strcpy
(
pReq
->
subKey
+
tlen
+
1
,
pTopic
->
topicName
);
pReq
->
withTbName
=
tmq
->
withTbName
;
pReq
->
waitTime
=
waitTime
;
pReq
->
timeout
=
timeout
;
pReq
->
consumerId
=
tmq
->
consumerId
;
pReq
->
epoch
=
tmq
->
epoch
;
pReq
->
currentOffset
=
reqOffset
;
...
...
@@ -1297,7 +1297,7 @@ SMqRspObj* tmqBuildRspFromWrapper(SMqPollRspWrapper* pWrapper) {
return
pRspObj
;
}
int32_t
tmqPollImpl
(
tmq_t
*
tmq
,
int64_t
waitTime
)
{
int32_t
tmqPollImpl
(
tmq_t
*
tmq
,
int64_t
timeout
)
{
/*printf("call poll\n");*/
for
(
int
i
=
0
;
i
<
taosArrayGetSize
(
tmq
->
clientTopics
);
i
++
)
{
SMqClientTopic
*
pTopic
=
taosArrayGet
(
tmq
->
clientTopics
,
i
);
...
...
@@ -1318,7 +1318,7 @@ int32_t tmqPollImpl(tmq_t* tmq, int64_t waitTime) {
#endif
}
atomic_store_32
(
&
pVg
->
vgSkipCnt
,
0
);
SMqPollReq
*
pReq
=
tmqBuildConsumeReqImpl
(
tmq
,
waitTime
,
pTopic
,
pVg
);
SMqPollReq
*
pReq
=
tmqBuildConsumeReqImpl
(
tmq
,
timeout
,
pTopic
,
pVg
);
if
(
pReq
==
NULL
)
{
atomic_store_32
(
&
pVg
->
vgStatus
,
TMQ_VG_STATUS__IDLE
);
tsem_post
(
&
tmq
->
rspSem
);
...
...
@@ -1388,7 +1388,7 @@ int32_t tmqHandleNoPollRsp(tmq_t* tmq, SMqRspWrapper* rspWrapper, bool* pReset)
return
0
;
}
SMqRspObj
*
tmqHandleAllRsp
(
tmq_t
*
tmq
,
int64_t
waitTime
,
bool
pollIfReset
)
{
SMqRspObj
*
tmqHandleAllRsp
(
tmq_t
*
tmq
,
int64_t
timeout
,
bool
pollIfReset
)
{
while
(
1
)
{
SMqRspWrapper
*
rspWrapper
=
NULL
;
taosGetQitem
(
tmq
->
qall
,
(
void
**
)
&
rspWrapper
);
...
...
@@ -1428,17 +1428,17 @@ SMqRspObj* tmqHandleAllRsp(tmq_t* tmq, int64_t waitTime, bool pollIfReset) {
taosFreeQitem
(
rspWrapper
);
if
(
pollIfReset
&&
reset
)
{
tscDebug
(
"consumer %ld reset and repoll"
,
tmq
->
consumerId
);
tmqPollImpl
(
tmq
,
waitTime
);
tmqPollImpl
(
tmq
,
timeout
);
}
}
}
}
TAOS_RES
*
tmq_consumer_poll
(
tmq_t
*
tmq
,
int64_t
wait_time
)
{
TAOS_RES
*
tmq_consumer_poll
(
tmq_t
*
tmq
,
int64_t
timeout
)
{
SMqRspObj
*
rspObj
;
int64_t
startTime
=
taosGetTimestampMs
();
rspObj
=
tmqHandleAllRsp
(
tmq
,
wait_time
,
false
);
rspObj
=
tmqHandleAllRsp
(
tmq
,
timeout
,
false
);
if
(
rspObj
)
{
return
(
TAOS_RES
*
)
rspObj
;
}
...
...
@@ -1450,16 +1450,16 @@ TAOS_RES* tmq_consumer_poll(tmq_t* tmq, int64_t wait_time) {
while
(
1
)
{
tmqHandleAllDelayedTask
(
tmq
);
if
(
tmqPollImpl
(
tmq
,
wait_time
)
<
0
)
return
NULL
;
if
(
tmqPollImpl
(
tmq
,
timeout
)
<
0
)
return
NULL
;
rspObj
=
tmqHandleAllRsp
(
tmq
,
wait_time
,
false
);
rspObj
=
tmqHandleAllRsp
(
tmq
,
timeout
,
false
);
if
(
rspObj
)
{
return
(
TAOS_RES
*
)
rspObj
;
}
if
(
wait_time
!=
0
)
{
if
(
timeout
!=
0
)
{
int64_t
endTime
=
taosGetTimestampMs
();
int64_t
leftTime
=
endTime
-
startTime
;
if
(
leftTime
>
wait_time
)
{
if
(
leftTime
>
timeout
)
{
tscDebug
(
"consumer %ld (epoch %d) timeout, no rsp"
,
tmq
->
consumerId
,
tmq
->
epoch
);
return
NULL
;
}
...
...
@@ -1474,10 +1474,7 @@ TAOS_RES* tmq_consumer_poll(tmq_t* tmq, int64_t wait_time) {
tmq_resp_err_t
tmq_consumer_close
(
tmq_t
*
tmq
)
{
if
(
tmq
->
status
==
TMQ_CONSUMER_STATUS__READY
)
{
tmq_resp_err_t
rsp
=
tmq_commit_sync
(
tmq
,
NULL
);
if
(
rsp
==
TMQ_RESP_ERR__SUCCESS
)
{
// TODO: free resources
return
TMQ_RESP_ERR__SUCCESS
;
}
else
{
if
(
rsp
==
TMQ_RESP_ERR__FAIL
)
{
return
TMQ_RESP_ERR__FAIL
;
}
...
...
@@ -1485,10 +1482,7 @@ tmq_resp_err_t tmq_consumer_close(tmq_t* tmq) {
rsp
=
tmq_subscribe
(
tmq
,
lst
);
tmq_list_destroy
(
lst
);
if
(
rsp
==
TMQ_RESP_ERR__SUCCESS
)
{
// TODO: free resources
return
TMQ_RESP_ERR__SUCCESS
;
}
else
{
if
(
rsp
==
TMQ_RESP_ERR__FAIL
)
{
return
TMQ_RESP_ERR__FAIL
;
}
}
...
...
source/common/src/tdatablock.c
浏览文件 @
141be560
...
...
@@ -116,22 +116,23 @@ int32_t colDataAppend(SColumnInfoData* pColumnInfoData, uint32_t currentRow, con
int32_t
type
=
pColumnInfoData
->
info
.
type
;
if
(
IS_VAR_DATA_TYPE
(
type
))
{
int32_t
dataLen
=
varDataTLen
(
pData
)
;
int32_t
dataLen
=
0
;
if
(
type
==
TSDB_DATA_TYPE_JSON
)
{
if
(
*
pData
==
TSDB_DATA_TYPE_NULL
)
{
dataLen
=
0
;
dataLen
=
CHAR_BYTES
;
}
else
if
(
*
pData
==
TSDB_DATA_TYPE_NCHAR
)
{
dataLen
=
varDataTLen
(
pData
+
CHAR_BYTES
);
dataLen
=
varDataTLen
(
pData
+
CHAR_BYTES
)
+
CHAR_BYTES
;
}
else
if
(
*
pData
==
TSDB_DATA_TYPE_DOUBLE
)
{
dataLen
=
DOUBLE_BYTES
;
dataLen
=
DOUBLE_BYTES
+
CHAR_BYTES
;
}
else
if
(
*
pData
==
TSDB_DATA_TYPE_BOOL
)
{
dataLen
=
CHAR_BYTES
;
}
else
if
(
*
pData
==
T
SDB_DATA_TYPE_JSON
)
{
dataLen
=
kvRowLen
(
pData
+
CHAR_BYTES
)
;
dataLen
=
CHAR_BYTES
+
CHAR_BYTES
;
}
else
if
(
*
pData
==
T
D_TAG_JSON
)
{
// json string
dataLen
=
((
STag
*
)(
pData
))
->
len
;
}
else
{
ASSERT
(
0
);
}
dataLen
+=
CHAR_BYTES
;
}
else
{
dataLen
=
varDataTLen
(
pData
);
}
SVarColAttr
*
pAttr
=
&
pColumnInfoData
->
varmeta
;
...
...
@@ -1634,6 +1635,11 @@ int32_t buildSubmitReqFromDataBlock(SSubmitReq** pReq, const SArray* pDataBlocks
SSubmitReq
*
tdBlockToSubmit
(
const
SArray
*
pBlocks
,
const
STSchema
*
pTSchema
,
bool
createTb
,
int64_t
suid
,
const
char
*
stbFullName
,
int32_t
vgId
)
{
SSubmitReq
*
ret
=
NULL
;
SArray
*
tagArray
=
taosArrayInit
(
1
,
sizeof
(
STagVal
));
if
(
!
tagArray
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
NULL
;
}
// cal size
int32_t
cap
=
sizeof
(
SSubmitReq
);
...
...
@@ -1655,18 +1661,33 @@ SSubmitReq* tdBlockToSubmit(const SArray* pBlocks, const STSchema* pTSchema, boo
createTbReq
.
type
=
TSDB_CHILD_TABLE
;
createTbReq
.
ctb
.
suid
=
suid
;
SKVRowBuilder
kvRowBuilder
=
{
0
};
if
(
tdInitKVRowBuilder
(
&
kvRowBuilder
)
<
0
)
{
ASSERT
(
0
);
STagVal
tagVal
=
{.
cid
=
1
,
.
type
=
TSDB_DATA_TYPE_UBIGINT
,
.
pData
=
(
uint8_t
*
)
&
pDataBlock
->
info
.
groupId
,
.
nData
=
sizeof
(
uint64_t
)};
STag
*
pTag
=
NULL
;
taosArrayClear
(
tagArray
);
taosArrayPush
(
tagArray
,
&
tagVal
);
tTagNew
(
tagArray
,
1
,
false
,
&
pTag
);
if
(
!
pTag
)
{
tdDestroySVCreateTbReq
(
&
createTbReq
);
taosArrayDestroy
(
tagArray
);
return
NULL
;
}
tdAddColToKVRow
(
&
kvRowBuilder
,
1
,
&
pDataBlock
->
info
.
groupId
,
sizeof
(
uint64_t
));
createTbReq
.
ctb
.
pTag
=
tdGetKVRowFromBuilder
(
&
kvRowBuilder
);
tdDestroyKVRowBuilder
(
&
kvRowBuilder
);
createTbReq
.
ctb
.
pTag
=
(
uint8_t
*
)
pTag
;
int32_t
code
;
tEncodeSize
(
tEncodeSVCreateTbReq
,
&
createTbReq
,
schemaLen
,
code
);
if
(
code
<
0
)
return
NULL
;
taosMemoryFree
(
cname
);
tdDestroySVCreateTbReq
(
&
createTbReq
);
if
(
code
<
0
)
{
tdDestroySVCreateTbReq
(
&
createTbReq
);
taosArrayDestroy
(
tagArray
);
return
NULL
;
}
}
cap
+=
sizeof
(
SSubmitBlk
)
+
schemaLen
+
rows
*
maxLen
;
...
...
@@ -1709,22 +1730,42 @@ SSubmitReq* tdBlockToSubmit(const SArray* pBlocks, const STSchema* pTSchema, boo
createTbReq
.
type
=
TSDB_CHILD_TABLE
;
createTbReq
.
ctb
.
suid
=
suid
;
SKVRowBuilder
kvRowBuilder
=
{
0
};
if
(
tdInitKVRowBuilder
(
&
kvRowBuilder
)
<
0
)
{
ASSERT
(
0
);
STagVal
tagVal
=
{.
cid
=
1
,
.
type
=
TSDB_DATA_TYPE_UBIGINT
,
.
pData
=
(
uint8_t
*
)
&
pDataBlock
->
info
.
groupId
,
.
nData
=
sizeof
(
uint64_t
)};
taosArrayClear
(
tagArray
);
taosArrayPush
(
tagArray
,
&
tagVal
);
STag
*
pTag
=
NULL
;
tTagNew
(
tagArray
,
1
,
false
,
&
pTag
);
if
(
!
pTag
)
{
tdDestroySVCreateTbReq
(
&
createTbReq
);
taosArrayDestroy
(
tagArray
);
taosMemoryFreeClear
(
ret
);
return
NULL
;
}
tdAddColToKVRow
(
&
kvRowBuilder
,
1
,
&
pDataBlock
->
info
.
groupId
,
sizeof
(
uint64_t
));
createTbReq
.
ctb
.
pTag
=
tdGetKVRowFromBuilder
(
&
kvRowBuilder
);
tdDestroyKVRowBuilder
(
&
kvRowBuilder
);
createTbReq
.
ctb
.
pTag
=
(
uint8_t
*
)
pTag
;
int32_t
code
;
tEncodeSize
(
tEncodeSVCreateTbReq
,
&
createTbReq
,
schemaLen
,
code
);
if
(
code
<
0
)
return
NULL
;
if
(
code
<
0
)
{
tdDestroySVCreateTbReq
(
&
createTbReq
);
taosArrayDestroy
(
tagArray
);
taosMemoryFreeClear
(
ret
);
return
NULL
;
}
SEncoder
encoder
=
{
0
};
tEncoderInit
(
&
encoder
,
blockData
,
schemaLen
);
if
(
tEncodeSVCreateTbReq
(
&
encoder
,
&
createTbReq
)
<
0
)
return
NULL
;
code
=
tEncodeSVCreateTbReq
(
&
encoder
,
&
createTbReq
)
;
tEncoderClear
(
&
encoder
);
tdDestroySVCreateTbReq
(
&
createTbReq
);
if
(
code
<
0
)
{
taosArrayDestroy
(
tagArray
);
taosMemoryFreeClear
(
ret
);
return
NULL
;
}
}
blkHead
->
schemaLen
=
htonl
(
schemaLen
);
...
...
@@ -1759,5 +1800,6 @@ SSubmitReq* tdBlockToSubmit(const SArray* pBlocks, const STSchema* pTSchema, boo
}
ret
->
length
=
htonl
(
ret
->
length
);
taosArrayDestroy
(
tagArray
);
return
ret
;
}
source/common/src/tdataformat.c
浏览文件 @
141be560
此差异已折叠。
点击以展开。
source/common/src/tmsg.c
浏览文件 @
141be560
...
...
@@ -2956,7 +2956,6 @@ int32_t tSerializeSCreateVnodeReq(void *buf, int32_t bufLen, SCreateVnodeReq *pR
if
(
tEncodeI8
(
&
encoder
,
pReq
->
compression
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
strict
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
cacheLastRow
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
isTsma
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
standby
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
replica
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
selfIndex
)
<
0
)
return
-
1
;
...
...
@@ -2973,6 +2972,12 @@ int32_t tSerializeSCreateVnodeReq(void *buf, int32_t bufLen, SCreateVnodeReq *pR
if
(
tEncodeI8
(
&
encoder
,
pRetension
->
keepUnit
)
<
0
)
return
-
1
;
}
if
(
tEncodeI8
(
&
encoder
,
pReq
->
isTsma
)
<
0
)
return
-
1
;
if
(
pReq
->
isTsma
)
{
uint32_t
tsmaLen
=
(
uint32_t
)(
htonl
(((
SMsgHead
*
)
pReq
->
pTsma
)
->
contLen
));
if
(
tEncodeBinary
(
&
encoder
,
(
const
uint8_t
*
)
pReq
->
pTsma
,
tsmaLen
)
<
0
)
return
-
1
;
}
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
...
...
@@ -3008,7 +3013,6 @@ int32_t tDeserializeSCreateVnodeReq(void *buf, int32_t bufLen, SCreateVnodeReq *
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
compression
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
strict
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
cacheLastRow
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
isTsma
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
standby
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
replica
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
selfIndex
)
<
0
)
return
-
1
;
...
...
@@ -3036,6 +3040,11 @@ int32_t tDeserializeSCreateVnodeReq(void *buf, int32_t bufLen, SCreateVnodeReq *
}
}
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
isTsma
)
<
0
)
return
-
1
;
if
(
pReq
->
isTsma
)
{
if
(
tDecodeBinaryAlloc
(
&
decoder
,
&
pReq
->
pTsma
,
NULL
)
<
0
)
return
-
1
;
}
tEndDecode
(
&
decoder
);
tDecoderClear
(
&
decoder
);
return
0
;
...
...
@@ -3044,6 +3053,9 @@ int32_t tDeserializeSCreateVnodeReq(void *buf, int32_t bufLen, SCreateVnodeReq *
int32_t
tFreeSCreateVnodeReq
(
SCreateVnodeReq
*
pReq
)
{
taosArrayDestroy
(
pReq
->
pRetensions
);
pReq
->
pRetensions
=
NULL
;
if
(
pReq
->
isTsma
)
{
taosMemoryFreeClear
(
pReq
->
pTsma
);
}
return
0
;
}
...
...
@@ -3642,6 +3654,7 @@ int32_t tEncodeTSma(SEncoder *pCoder, const STSma *pSma) {
if
(
tEncodeI8
(
pCoder
,
pSma
->
intervalUnit
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
pCoder
,
pSma
->
slidingUnit
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
pCoder
,
pSma
->
timezoneInt
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
pCoder
,
pSma
->
dstVgId
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
pCoder
,
pSma
->
indexName
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
pCoder
,
pSma
->
exprLen
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
pCoder
,
pSma
->
tagsFilterLen
)
<
0
)
return
-
1
;
...
...
@@ -3664,6 +3677,7 @@ int32_t tDecodeTSma(SDecoder *pCoder, STSma *pSma) {
if
(
tDecodeI8
(
pCoder
,
&
pSma
->
version
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
pCoder
,
&
pSma
->
intervalUnit
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
pCoder
,
&
pSma
->
slidingUnit
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
pCoder
,
&
pSma
->
dstVgId
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
pCoder
,
&
pSma
->
timezoneInt
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
pCoder
,
pSma
->
indexName
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
pCoder
,
&
pSma
->
exprLen
)
<
0
)
return
-
1
;
...
...
@@ -3897,7 +3911,7 @@ int tEncodeSVCreateTbReq(SEncoder *pCoder, const SVCreateTbReq *pReq) {
if
(
pReq
->
type
==
TSDB_CHILD_TABLE
)
{
if
(
tEncodeI64
(
pCoder
,
pReq
->
ctb
.
suid
)
<
0
)
return
-
1
;
if
(
tEncode
Binary
(
pCoder
,
pReq
->
ctb
.
pTag
,
kvRowLen
(
pReq
->
ctb
.
pTag
)
)
<
0
)
return
-
1
;
if
(
tEncode
Tag
(
pCoder
,
(
const
STag
*
)
pReq
->
ctb
.
pTag
)
<
0
)
return
-
1
;
}
else
if
(
pReq
->
type
==
TSDB_NORMAL_TABLE
)
{
if
(
tEncodeSSchemaWrapper
(
pCoder
,
&
pReq
->
ntb
.
schemaRow
)
<
0
)
return
-
1
;
}
else
{
...
...
@@ -3909,8 +3923,6 @@ int tEncodeSVCreateTbReq(SEncoder *pCoder, const SVCreateTbReq *pReq) {
}
int
tDecodeSVCreateTbReq
(
SDecoder
*
pCoder
,
SVCreateTbReq
*
pReq
)
{
uint32_t
len
;
if
(
tStartDecode
(
pCoder
)
<
0
)
return
-
1
;
if
(
tDecodeI32v
(
pCoder
,
&
pReq
->
flags
)
<
0
)
return
-
1
;
...
...
@@ -3922,7 +3934,7 @@ int tDecodeSVCreateTbReq(SDecoder *pCoder, SVCreateTbReq *pReq) {
if
(
pReq
->
type
==
TSDB_CHILD_TABLE
)
{
if
(
tDecodeI64
(
pCoder
,
&
pReq
->
ctb
.
suid
)
<
0
)
return
-
1
;
if
(
tDecode
Binary
(
pCoder
,
&
pReq
->
ctb
.
pTag
,
&
len
)
<
0
)
return
-
1
;
if
(
tDecode
Tag
(
pCoder
,
(
STag
**
)
&
pReq
->
ctb
.
pTag
)
<
0
)
return
-
1
;
}
else
if
(
pReq
->
type
==
TSDB_NORMAL_TABLE
)
{
if
(
tDecodeSSchemaWrapper
(
pCoder
,
&
pReq
->
ntb
.
schemaRow
)
<
0
)
return
-
1
;
}
else
{
...
...
source/dnode/mgmt/mgmt_vnode/src/vmHandle.c
浏览文件 @
141be560
...
...
@@ -140,6 +140,7 @@ static void vmGenerateVnodeCfg(SCreateVnodeReq *pCreate, SVnodeCfg *pCfg) {
pCfg
->
szCache
=
pCreate
->
pages
;
pCfg
->
szBuf
=
(
uint64_t
)
pCreate
->
buffer
*
1024
*
1024
;
pCfg
->
isWeak
=
true
;
pCfg
->
isTsma
=
pCreate
->
isTsma
;
pCfg
->
tsdbCfg
.
compression
=
pCreate
->
compression
;
pCfg
->
tsdbCfg
.
precision
=
pCreate
->
precision
;
pCfg
->
tsdbCfg
.
days
=
pCreate
->
daysPerFile
;
...
...
@@ -149,8 +150,13 @@ static void vmGenerateVnodeCfg(SCreateVnodeReq *pCreate, SVnodeCfg *pCfg) {
pCfg
->
tsdbCfg
.
minRows
=
pCreate
->
minRows
;
pCfg
->
tsdbCfg
.
maxRows
=
pCreate
->
maxRows
;
for
(
size_t
i
=
0
;
i
<
taosArrayGetSize
(
pCreate
->
pRetensions
);
++
i
)
{
memcpy
(
&
pCfg
->
tsdbCfg
.
retentions
[
i
],
taosArrayGet
(
pCreate
->
pRetensions
,
i
),
sizeof
(
SRetention
));
SRetention
*
pRetention
=
&
pCfg
->
tsdbCfg
.
retentions
[
i
];
memcpy
(
pRetention
,
taosArrayGet
(
pCreate
->
pRetensions
,
i
),
sizeof
(
SRetention
));
if
(
i
==
0
)
{
if
((
pRetention
->
freq
>
0
&&
pRetention
->
keep
>
0
))
pCfg
->
isRsma
=
1
;
}
}
pCfg
->
walCfg
.
vgId
=
pCreate
->
vgId
;
pCfg
->
hashBegin
=
pCreate
->
hashBegin
;
pCfg
->
hashEnd
=
pCreate
->
hashEnd
;
...
...
@@ -209,7 +215,7 @@ int32_t vmProcessCreateVnodeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
SVnode
*
pImpl
=
vnodeOpen
(
path
,
pMgmt
->
pTfs
,
pMgmt
->
msgCb
);
if
(
pImpl
==
NULL
)
{
dError
(
"vgId:%d, failed to
create
vnode since %s"
,
createReq
.
vgId
,
terrstr
());
dError
(
"vgId:%d, failed to
open
vnode since %s"
,
createReq
.
vgId
,
terrstr
());
code
=
terrno
;
goto
_OVER
;
}
...
...
@@ -217,9 +223,20 @@ int32_t vmProcessCreateVnodeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
code
=
vmOpenVnode
(
pMgmt
,
&
wrapperCfg
,
pImpl
);
if
(
code
!=
0
)
{
dError
(
"vgId:%d, failed to open vnode since %s"
,
createReq
.
vgId
,
terrstr
());
code
=
terrno
;
goto
_OVER
;
}
if
(
createReq
.
isTsma
)
{
SMsgHead
*
smaMsg
=
createReq
.
pTsma
;
uint32_t
contLen
=
(
uint32_t
)(
htonl
(
smaMsg
->
contLen
)
-
sizeof
(
SMsgHead
));
if
(
vnodeProcessCreateTSma
(
pImpl
,
POINTER_SHIFT
(
smaMsg
,
sizeof
(
SMsgHead
)),
contLen
)
<
0
)
{
dError
(
"vgId:%d, failed to create tsma since %s"
,
createReq
.
vgId
,
terrstr
());
code
=
terrno
;
goto
_OVER
;
};
}
code
=
vnodeStart
(
pImpl
);
if
(
code
!=
0
)
{
dError
(
"vgId:%d, failed to start sync since %s"
,
createReq
.
vgId
,
terrstr
());
...
...
@@ -227,7 +244,10 @@ int32_t vmProcessCreateVnodeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
}
code
=
vmWriteVnodeListToFile
(
pMgmt
);
if
(
code
!=
0
)
goto
_OVER
;
if
(
code
!=
0
)
{
code
=
terrno
;
goto
_OVER
;
}
_OVER:
if
(
code
!=
0
)
{
...
...
source/dnode/mnode/impl/inc/mndDef.h
浏览文件 @
141be560
...
...
@@ -293,6 +293,7 @@ typedef struct {
int8_t
isTsma
;
int8_t
replica
;
SVnodeGid
vnodeGid
[
TSDB_MAX_REPLICA
];
void
*
pTsma
;
}
SVgObj
;
typedef
struct
{
...
...
source/dnode/mnode/impl/src/mndMain.c
浏览文件 @
141be560
...
...
@@ -369,7 +369,7 @@ int32_t mndProcessSyncMsg(SRpcMsg *pMsg) {
mError
(
"failed to process sync msg:%p type:%s since %s"
,
pMsg
,
TMSG_INFO
(
pMsg
->
msgType
),
terrstr
());
return
TAOS_SYNC_PROPOSE_OTHER_ERROR
;
}
char
logBuf
[
512
]
=
{
0
};
char
*
syncNodeStr
=
sync2SimpleStr
(
pMgmt
->
sync
);
snprintf
(
logBuf
,
sizeof
(
logBuf
),
"==vnodeProcessSyncReq== msgType:%d, syncNode: %s"
,
pMsg
->
msgType
,
syncNodeStr
);
...
...
@@ -472,7 +472,7 @@ int32_t mndProcessRpcMsg(SRpcMsg *pMsg) {
}
else
if
(
code
==
0
)
{
mTrace
(
"msg:%p, successfully processed and response"
,
pMsg
);
}
else
{
m
Debug
(
"msg:%p, failed to process since %s, app:%p type:%s"
,
pMsg
,
terrstr
(),
pMsg
->
info
.
ahandle
,
m
Error
(
"msg:%p, failed to process since %s, app:%p type:%s"
,
pMsg
,
terrstr
(),
pMsg
->
info
.
ahandle
,
TMSG_INFO
(
pMsg
->
msgType
));
}
...
...
@@ -686,4 +686,4 @@ void mndReleaseSyncRef(SMnode *pMnode) {
int32_t
ref
=
atomic_sub_fetch_32
(
&
pMnode
->
syncRef
,
1
);
mTrace
(
"mnode sync is released, ref:%d"
,
ref
);
taosThreadRwlockUnlock
(
&
pMnode
->
lock
);
}
\ No newline at end of file
}
source/dnode/mnode/impl/src/mndSma.c
浏览文件 @
141be560
...
...
@@ -409,7 +409,8 @@ static int32_t mndSetCreateSmaRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj
return
0
;
}
static
int32_t
mndSetCreateSmaVgroupRedoActions
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SDbObj
*
pDb
,
SVgObj
*
pVgroup
)
{
static
int32_t
mndSetCreateSmaVgroupRedoActions
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SDbObj
*
pDb
,
SVgObj
*
pVgroup
,
SSmaObj
*
pSma
)
{
SVnodeGid
*
pVgid
=
pVgroup
->
vnodeGid
+
0
;
SDnodeObj
*
pDnode
=
mndAcquireDnode
(
pMnode
,
pVgid
->
dnodeId
);
if
(
pDnode
==
NULL
)
return
-
1
;
...
...
@@ -419,9 +420,14 @@ static int32_t mndSetCreateSmaVgroupRedoActions(SMnode *pMnode, STrans *pTrans,
mndReleaseDnode
(
pMnode
,
pDnode
);
// todo add sma info here
int32_t
smaContLen
=
0
;
void
*
pSmaReq
=
mndBuildVCreateSmaReq
(
pMnode
,
pVgroup
,
pSma
,
&
smaContLen
);
if
(
pSmaReq
==
NULL
)
return
-
1
;
pVgroup
->
pTsma
=
pSmaReq
;
int32_t
contLen
=
0
;
void
*
pReq
=
mndBuildCreateVnodeReq
(
pMnode
,
pDnode
,
pDb
,
pVgroup
,
&
contLen
,
false
);
taosMemoryFreeClear
(
pSmaReq
);
if
(
pReq
==
NULL
)
return
-
1
;
action
.
pCont
=
pReq
;
...
...
@@ -514,7 +520,7 @@ static int32_t mndCreateSma(SMnode *pMnode, SRpcMsg *pReq, SMCreateSmaReq *pCrea
if
(
mndSetCreateSmaCommitLogs
(
pMnode
,
pTrans
,
&
smaObj
)
!=
0
)
goto
_OVER
;
if
(
mndSetCreateSmaVgroupCommitLogs
(
pMnode
,
pTrans
,
&
streamObj
.
fixedSinkVg
)
!=
0
)
goto
_OVER
;
if
(
mndSetCreateSmaRedoActions
(
pMnode
,
pTrans
,
pDb
,
&
smaObj
)
!=
0
)
goto
_OVER
;
if
(
mndSetCreateSmaVgroupRedoActions
(
pMnode
,
pTrans
,
pDb
,
&
streamObj
.
fixedSinkVg
)
!=
0
)
goto
_OVER
;
if
(
mndSetCreateSmaVgroupRedoActions
(
pMnode
,
pTrans
,
pDb
,
&
streamObj
.
fixedSinkVg
,
&
smaObj
)
!=
0
)
goto
_OVER
;
if
(
mndAddStreamToTrans
(
pMnode
,
&
streamObj
,
pCreate
->
ast
,
STREAM_TRIGGER_AT_ONCE
,
0
,
pTrans
)
!=
0
)
goto
_OVER
;
if
(
mndTransPrepare
(
pMnode
,
pTrans
)
!=
0
)
goto
_OVER
;
...
...
source/dnode/mnode/impl/src/mndVgroup.c
浏览文件 @
141be560
...
...
@@ -220,6 +220,8 @@ void *mndBuildCreateVnodeReq(SMnode *pMnode, SDnodeObj *pDnode, SDbObj *pDb, SVg
createReq
.
numOfRetensions
=
pDb
->
cfg
.
numOfRetensions
;
createReq
.
pRetensions
=
pDb
->
cfg
.
pRetensions
;
createReq
.
standby
=
standby
;
createReq
.
isTsma
=
pVgroup
->
isTsma
;
createReq
.
pTsma
=
pVgroup
->
pTsma
;
for
(
int32_t
v
=
0
;
v
<
pVgroup
->
replica
;
++
v
)
{
SReplica
*
pReplica
=
&
createReq
.
replicas
[
v
];
...
...
source/dnode/mnode/impl/test/user/CMakeLists.txt
浏览文件 @
141be560
...
...
@@ -5,7 +5,9 @@ target_link_libraries(
PUBLIC sut
)
add_test
(
NAME userTest
COMMAND userTest
)
if
(
NOT TD_WINDOWS
)
add_test
(
NAME userTest
COMMAND userTest
)
endif
(
NOT TD_WINDOWS
)
source/dnode/vnode/CMakeLists.txt
浏览文件 @
141be560
...
...
@@ -35,7 +35,6 @@ target_sources(
"src/sma/smaTimeRange.c"
# tsdb
# "src/tsdb/tsdbTDBImpl.c"
"src/tsdb/tsdbCommit.c"
"src/tsdb/tsdbCommit2.c"
"src/tsdb/tsdbFile.c"
...
...
@@ -45,17 +44,17 @@ target_sources(
"src/tsdb/tsdbMemTable2.c"
"src/tsdb/tsdbRead.c"
"src/tsdb/tsdbReadImpl.c"
# "src/tsdb/tsdbSma.c"
"src/tsdb/tsdbWrite.c"
"src/tsdb/tsdbSnapshot.c"
# tq
"src/tq/tq.c"
"src/tq/tqExec.c"
"src/tq/tqCommit.c"
"src/tq/tqOffset.c"
"src/tq/tqPush.c"
"src/tq/tqMeta.c"
"src/tq/tqRead.c"
"src/tq/tqOffset.c"
#"src/tq/tqPush.c"
#"src/tq/tqCommit.c"
)
target_include_directories
(
vnode
...
...
source/dnode/vnode/inc/vnode.h
浏览文件 @
141be560
...
...
@@ -68,6 +68,7 @@ void vnodeGetInfo(SVnode *pVnode, const char **dbname, int32_t *vgId);
int32_t
vnodeSnapshotReaderOpen
(
SVnode
*
pVnode
,
SVSnapshotReader
**
ppReader
,
int64_t
sver
,
int64_t
ever
);
int32_t
vnodeSnapshotReaderClose
(
SVSnapshotReader
*
pReader
);
int32_t
vnodeSnapshotRead
(
SVSnapshotReader
*
pReader
,
const
void
**
ppData
,
uint32_t
*
nData
);
int32_t
vnodeProcessCreateTSma
(
SVnode
*
pVnode
,
void
*
pCont
,
uint32_t
contLen
);
// meta
typedef
struct
SMeta
SMeta
;
// todo: remove
...
...
@@ -78,7 +79,7 @@ void metaReaderInit(SMetaReader *pReader, SMeta *pMeta, int32_t flags);
void
metaReaderClear
(
SMetaReader
*
pReader
);
int32_t
metaGetTableEntryByUid
(
SMetaReader
*
pReader
,
tb_uid_t
uid
);
int32_t
metaReadNext
(
SMetaReader
*
pReader
);
const
void
*
metaGetTableTagVal
(
SMetaEntry
*
pEntry
,
int16_t
cid
);
const
void
*
metaGetTableTagVal
(
SMetaEntry
*
pEntry
,
int16_t
type
,
STagVal
*
tagVal
);
typedef
struct
SMetaFltParam
{
tb_uid_t
suid
;
...
...
@@ -171,13 +172,15 @@ struct SVnodeCfg {
uint64_t
szBuf
;
bool
isHeap
;
bool
isWeak
;
int8_t
isTsma
;
int8_t
isRsma
;
int8_t
hashMethod
;
int8_t
standby
;
STsdbCfg
tsdbCfg
;
SWalCfg
walCfg
;
SSyncCfg
syncCfg
;
uint32_t
hashBegin
;
uint32_t
hashEnd
;
int8_t
hashMethod
;
int8_t
standby
;
};
typedef
struct
{
...
...
source/dnode/vnode/src/inc/meta.h
浏览文件 @
141be560
...
...
@@ -117,7 +117,7 @@ typedef struct {
}
SSmaIdxKey
;
// metaTable ==================
int
metaCreateTagIdxKey
(
tb_uid_t
suid
,
int32_t
cid
,
const
void
*
pTagData
,
int8_t
type
,
tb_uid_t
uid
,
int
metaCreateTagIdxKey
(
tb_uid_t
suid
,
int32_t
cid
,
const
void
*
pTagData
,
int
32_t
nTagData
,
int
8_t
type
,
tb_uid_t
uid
,
STagIdxKey
**
ppTagIdxKey
,
int32_t
*
nTagIdxKey
);
#ifndef META_REFACT
...
...
source/dnode/vnode/src/inc/tq.h
浏览文件 @
141be560
...
...
@@ -66,12 +66,12 @@ struct STqReadHandle {
// tqPush
typedef
struct
{
int64_t
consumerId
;
int32_t
epoch
;
int32_t
skipLogNum
;
int64_t
reqOffset
;
SR
WLatch
lock
;
SR
pcMsg
*
handle
;
int64_t
consumerId
;
int32_t
epoch
;
int32_t
skipLogNum
;
int64_t
reqOffset
;
SR
pcHandleInfo
info
;
SR
WLatch
lock
;
}
STqPushHandle
;
#if 0
...
...
@@ -168,6 +168,13 @@ int64_t tqFetchLog(STQ* pTq, STqHandle* pHandle, int64_t* fetchOffset, SWalHead*
int32_t
tqDataExec
(
STQ
*
pTq
,
STqExecHandle
*
pExec
,
SSubmitReq
*
pReq
,
SMqDataBlkRsp
*
pRsp
,
int32_t
workerId
);
// tqMeta
int32_t
tqMetaOpen
(
STQ
*
pTq
);
int32_t
tqMetaClose
(
STQ
*
pTq
);
int32_t
tqMetaSaveHandle
(
STQ
*
pTq
,
const
char
*
key
,
const
STqHandle
*
pHandle
);
int32_t
tqMetaDeleteHandle
(
STQ
*
pTq
,
const
char
*
key
);
// tqOffset
STqOffsetStore
*
STqOffsetOpen
(
STqOffsetCfg
*
);
void
STqOffsetClose
(
STqOffsetStore
*
);
...
...
source/dnode/vnode/src/inc/tsdb.h
浏览文件 @
141be560
...
...
@@ -32,14 +32,27 @@ extern "C" {
#define tsdbTrace(...) do { if (tsdbDebugFlag & DEBUG_TRACE) { taosPrintLog("TSDB ", DEBUG_TRACE, tsdbDebugFlag, __VA_ARGS__); }} while(0)
// clang-format on
typedef
struct
TSDBROW
TSDBROW
;
typedef
struct
TSDBKEY
TSDBKEY
;
typedef
struct
SDelOp
SDelOp
;
static
int
tsdbKeyCmprFn
(
const
void
*
p1
,
const
void
*
p2
);
// tsdbMemTable2.c ==============================================================================================
typedef
struct
SMemTable
SMemTable
;
int32_t
tsdbMemTableCreate2
(
STsdb
*
pTsdb
,
SMemTable
**
ppMemTable
);
void
tsdbMemTableDestroy2
(
SMemTable
*
pMemTable
);
// tsdbMemTable ================
typedef
struct
STsdbRow
STsdbRow
;
typedef
struct
STbData
STbData
;
typedef
struct
STsdbMemTable
STsdbMemTable
;
typedef
struct
SMergeInfo
SMergeInfo
;
typedef
struct
STable
STable
;
int
tsdbMemTableCreate
(
STsdb
*
pTsdb
,
STsdbMemTable
**
ppMemTable
);
void
tsdbMemTableDestroy
(
STsdb
*
pTsdb
,
STsdb
MemTable
*
pMemTable
);
void
tsdbMemTableDestroy
(
STsdbMemTable
*
pMemTable
);
int
tsdbLoadDataFromCache
(
STsdb
*
pTsdb
,
STable
*
pTable
,
SSkipListIterator
*
pIter
,
TSKEY
maxKey
,
int
maxRowsToRead
,
SDataCols
*
pCols
,
TKEY
*
filterKeys
,
int
nFilterKeys
,
bool
keepDup
,
SMergeInfo
*
pMergeInfo
);
...
...
@@ -845,6 +858,42 @@ static FORCE_INLINE int tsdbUnLockFS(STsdbFS *pFs) {
return
0
;
}
struct
TSDBROW
{
int64_t
version
;
STSRow2
tsRow
;
};
struct
TSDBKEY
{
int64_t
version
;
TSKEY
ts
;
};
struct
SDelOp
{
int64_t
version
;
TSKEY
sKey
;
// included
TSKEY
eKey
;
// included
SDelOp
*
pNext
;
};
static
FORCE_INLINE
int
tsdbKeyCmprFn
(
const
void
*
p1
,
const
void
*
p2
)
{
TSDBKEY
*
pKey1
=
(
TSDBKEY
*
)
p1
;
TSDBKEY
*
pKey2
=
(
TSDBKEY
*
)
p2
;
if
(
pKey1
->
ts
<
pKey2
->
ts
)
{
return
-
1
;
}
else
if
(
pKey1
->
ts
>
pKey2
->
ts
)
{
return
1
;
}
if
(
pKey1
->
version
<
pKey2
->
version
)
{
return
-
1
;
}
else
if
(
pKey1
->
version
>
pKey2
->
version
)
{
return
1
;
}
return
0
;
}
#endif
#ifdef __cplusplus
...
...
source/dnode/vnode/src/inc/vnodeInt.h
浏览文件 @
141be560
...
...
@@ -239,6 +239,8 @@ struct SVnode {
#define VND_RSMA1(vnd) ((vnd)->pSma->pRSmaTsdb1)
#define VND_RSMA2(vnd) ((vnd)->pSma->pRSmaTsdb2)
#define VND_RETENTIONS(vnd) (&(vnd)->config.tsdbCfg.retentions)
#define VND_IS_RSMA(v) ((v)->config.isRsma == 1)
#define VND_IS_TSMA(v) ((v)->config.isTsma == 1)
struct
STbUidStore
{
tb_uid_t
suid
;
...
...
@@ -271,11 +273,6 @@ struct SSma {
#define SMA_RSMA_TSDB1(s) ((s)->pRSmaTsdb1)
#define SMA_RSMA_TSDB2(s) ((s)->pRSmaTsdb2)
static
FORCE_INLINE
bool
vnodeIsRollup
(
SVnode
*
pVnode
)
{
SRetention
*
pRetention
=
&
(
pVnode
->
config
.
tsdbCfg
.
retentions
[
0
]);
return
(
pRetention
->
freq
>
0
&&
pRetention
->
keep
>
0
);
}
// sma
void
smaHandleRes
(
void
*
pVnode
,
int64_t
smaId
,
const
SArray
*
data
);
...
...
source/dnode/vnode/src/meta/metaEntry.c
浏览文件 @
141be560
...
...
@@ -30,7 +30,7 @@ int metaEncodeEntry(SEncoder *pCoder, const SMetaEntry *pME) {
if
(
tEncodeI64
(
pCoder
,
pME
->
ctbEntry
.
ctime
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
pCoder
,
pME
->
ctbEntry
.
ttlDays
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
pCoder
,
pME
->
ctbEntry
.
suid
)
<
0
)
return
-
1
;
if
(
tEncode
Binary
(
pCoder
,
pME
->
ctbEntry
.
pTags
,
kvRowLen
(
pME
->
ctbEntry
.
pTags
)
)
<
0
)
return
-
1
;
if
(
tEncode
Tag
(
pCoder
,
(
const
STag
*
)
pME
->
ctbEntry
.
pTags
)
<
0
)
return
-
1
;
}
else
if
(
pME
->
type
==
TSDB_NORMAL_TABLE
)
{
if
(
tEncodeI64
(
pCoder
,
pME
->
ntbEntry
.
ctime
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
pCoder
,
pME
->
ntbEntry
.
ttlDays
)
<
0
)
return
-
1
;
...
...
@@ -47,7 +47,6 @@ int metaEncodeEntry(SEncoder *pCoder, const SMetaEntry *pME) {
}
int
metaDecodeEntry
(
SDecoder
*
pCoder
,
SMetaEntry
*
pME
)
{
uint32_t
len
;
if
(
tStartDecode
(
pCoder
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
pCoder
,
&
pME
->
version
)
<
0
)
return
-
1
;
...
...
@@ -62,7 +61,7 @@ int metaDecodeEntry(SDecoder *pCoder, SMetaEntry *pME) {
if
(
tDecodeI64
(
pCoder
,
&
pME
->
ctbEntry
.
ctime
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
pCoder
,
&
pME
->
ctbEntry
.
ttlDays
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
pCoder
,
&
pME
->
ctbEntry
.
suid
)
<
0
)
return
-
1
;
if
(
tDecode
Binary
(
pCoder
,
&
pME
->
ctbEntry
.
pTags
,
&
len
)
<
0
)
return
-
1
;
// (TODO)
if
(
tDecode
Tag
(
pCoder
,
(
STag
**
)
&
pME
->
ctbEntry
.
pTags
)
<
0
)
return
-
1
;
// (TODO)
}
else
if
(
pME
->
type
==
TSDB_NORMAL_TABLE
)
{
if
(
tDecodeI64
(
pCoder
,
&
pME
->
ntbEntry
.
ctime
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
pCoder
,
&
pME
->
ntbEntry
.
ttlDays
)
<
0
)
return
-
1
;
...
...
source/dnode/vnode/src/meta/metaQuery.c
浏览文件 @
141be560
...
...
@@ -573,10 +573,23 @@ SArray *metaGetSmaTbUids(SMeta *pMeta) {
#endif
const
void
*
metaGetTableTagVal
(
SMetaEntry
*
pEntry
,
int16_t
cid
)
{
const
void
*
metaGetTableTagVal
(
SMetaEntry
*
pEntry
,
int16_t
type
,
STagVal
*
val
)
{
ASSERT
(
pEntry
->
type
==
TSDB_CHILD_TABLE
);
return
tdGetKVRowValOfCol
((
const
SKVRow
)
pEntry
->
ctbEntry
.
pTags
,
cid
);
STag
*
tag
=
(
STag
*
)
pEntry
->
ctbEntry
.
pTags
;
if
(
type
==
TSDB_DATA_TYPE_JSON
){
if
(
tag
->
nTag
==
0
){
return
NULL
;
}
return
tag
;
}
bool
find
=
tTagGet
(
tag
,
val
);
if
(
!
find
){
return
NULL
;
}
return
val
;
}
typedef
struct
{
SMeta
*
pMeta
;
TBC
*
pCur
;
...
...
@@ -609,7 +622,13 @@ int32_t metaFilteTableIds(SMeta *pMeta, SMetaFltParam *param, SArray *pUids) {
STagIdxKey
*
pKey
=
NULL
;
int32_t
nKey
=
0
;
ret
=
metaCreateTagIdxKey
(
pCursor
->
suid
,
pCursor
->
cid
,
param
->
val
,
pCursor
->
type
,
int32_t
nTagData
=
0
;
if
(
IS_VAR_DATA_TYPE
(
param
->
type
)){
nTagData
=
strlen
(
param
->
val
);
}
else
{
nTagData
=
tDataTypes
[
param
->
type
].
bytes
;
}
ret
=
metaCreateTagIdxKey
(
pCursor
->
suid
,
pCursor
->
cid
,
param
->
val
,
nTagData
,
pCursor
->
type
,
param
->
reverse
?
INT64_MAX
:
INT64_MIN
,
&
pKey
,
&
nKey
);
if
(
ret
!=
0
)
{
goto
END
;
...
...
@@ -651,4 +670,4 @@ END:
taosMemoryFree
(
pCursor
);
return
ret
;
}
}
\ No newline at end of file
source/dnode/vnode/src/meta/metaTable.c
浏览文件 @
141be560
...
...
@@ -31,9 +31,9 @@ int metaCreateSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) {
int
vLen
=
0
;
const
void
*
pKey
=
NULL
;
const
void
*
pVal
=
NULL
;
void
*
pBuf
=
NULL
;
void
*
pBuf
=
NULL
;
int32_t
szBuf
=
0
;
void
*
p
=
NULL
;
void
*
p
=
NULL
;
SMetaReader
mr
=
{
0
};
// validate req
...
...
@@ -87,7 +87,7 @@ int metaDropSTable(SMeta *pMeta, int64_t verison, SVDropStbReq *pReq) {
}
// drop all child tables
TBC
*
pCtbIdxc
=
NULL
;
TBC
*
pCtbIdxc
=
NULL
;
SArray
*
pArray
=
taosArrayInit
(
8
,
sizeof
(
tb_uid_t
));
tdbTbcOpen
(
pMeta
->
pCtbIdx
,
&
pCtbIdxc
,
&
pMeta
->
txn
);
...
...
@@ -142,8 +142,8 @@ _exit:
int
metaAlterSTable
(
SMeta
*
pMeta
,
int64_t
version
,
SVCreateStbReq
*
pReq
)
{
SMetaEntry
oStbEntry
=
{
0
};
SMetaEntry
nStbEntry
=
{
0
};
TBC
*
pUidIdxc
=
NULL
;
TBC
*
pTbDbc
=
NULL
;
TBC
*
pUidIdxc
=
NULL
;
TBC
*
pTbDbc
=
NULL
;
const
void
*
pData
;
int
nData
;
int64_t
oversion
;
...
...
@@ -262,7 +262,7 @@ _err:
}
int
metaDropTable
(
SMeta
*
pMeta
,
int64_t
version
,
SVDropTbReq
*
pReq
,
SArray
*
tbUids
)
{
void
*
pData
=
NULL
;
void
*
pData
=
NULL
;
int
nData
=
0
;
int
rc
=
0
;
tb_uid_t
uid
;
...
...
@@ -288,7 +288,7 @@ int metaDropTable(SMeta *pMeta, int64_t version, SVDropTbReq *pReq, SArray *tbUi
}
static
int
metaDropTableByUid
(
SMeta
*
pMeta
,
tb_uid_t
uid
,
int
*
type
)
{
void
*
pData
=
NULL
;
void
*
pData
=
NULL
;
int
nData
=
0
;
int
rc
=
0
;
int64_t
version
;
...
...
@@ -324,14 +324,14 @@ static int metaDropTableByUid(SMeta *pMeta, tb_uid_t uid, int *type) {
}
static
int
metaAlterTableColumn
(
SMeta
*
pMeta
,
int64_t
version
,
SVAlterTbReq
*
pAlterTbReq
)
{
void
*
pVal
=
NULL
;
void
*
pVal
=
NULL
;
int
nVal
=
0
;
const
void
*
pData
=
NULL
;
const
void
*
pData
=
NULL
;
int
nData
=
0
;
int
ret
=
0
;
tb_uid_t
uid
;
int64_t
oversion
;
SSchema
*
pColumn
=
NULL
;
SSchema
*
pColumn
=
NULL
;
SMetaEntry
entry
=
{
0
};
SSchemaWrapper
*
pSchema
;
int
c
;
...
...
@@ -479,7 +479,7 @@ _err:
static
int
metaUpdateTableTagVal
(
SMeta
*
pMeta
,
int64_t
version
,
SVAlterTbReq
*
pAlterTbReq
)
{
SMetaEntry
ctbEntry
=
{
0
};
SMetaEntry
stbEntry
=
{
0
};
void
*
pVal
=
NULL
;
void
*
pVal
=
NULL
;
int
nVal
=
0
;
int
ret
;
int
c
;
...
...
@@ -510,7 +510,7 @@ static int metaUpdateTableTagVal(SMeta *pMeta, int64_t version, SVAlterTbReq *pA
oversion
=
*
(
int64_t
*
)
pData
;
// search table.db
TBC
*
pTbDbc
=
NULL
;
TBC
*
pTbDbc
=
NULL
;
SDecoder
dc1
=
{
0
};
SDecoder
dc2
=
{
0
};
...
...
@@ -534,7 +534,7 @@ static int metaUpdateTableTagVal(SMeta *pMeta, int64_t version, SVAlterTbReq *pA
metaDecodeEntry
(
&
dc2
,
&
stbEntry
);
SSchemaWrapper
*
pTagSchema
=
&
stbEntry
.
stbEntry
.
schemaTag
;
SSchema
*
pColumn
=
NULL
;
SSchema
*
pColumn
=
NULL
;
int32_t
iCol
=
0
;
for
(;;)
{
pColumn
=
NULL
;
...
...
@@ -563,29 +563,39 @@ static int metaUpdateTableTagVal(SMeta *pMeta, int64_t version, SVAlterTbReq *pA
}
memcpy
((
void
*
)
ctbEntry
.
ctbEntry
.
pTags
,
pAlterTbReq
->
pTagVal
,
pAlterTbReq
->
nTagVal
);
}
else
{
SKVRowBuilder
kvrb
=
{
0
};
const
SKVRow
pOldTag
=
(
const
SKVRow
)
ctbEntry
.
ctbEntry
.
pTags
;
SKVRow
pNewTag
=
NULL
;
tdInitKVRowBuilder
(
&
kvrb
);
const
STag
*
pOldTag
=
(
const
STag
*
)
ctbEntry
.
ctbEntry
.
pTags
;
STag
*
pNewTag
=
NULL
;
SArray
*
pTagArray
=
taosArrayInit
(
pTagSchema
->
nCols
,
sizeof
(
STagVal
));
if
(
!
pTagArray
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_err
;
}
for
(
int32_t
i
=
0
;
i
<
pTagSchema
->
nCols
;
i
++
)
{
SSchema
*
pCol
=
&
pTagSchema
->
pSchema
[
i
];
if
(
iCol
==
i
)
{
tdAddColToKVRow
(
&
kvrb
,
pCol
->
colId
,
pAlterTbReq
->
pTagVal
,
pAlterTbReq
->
nTagVal
);
STagVal
val
=
{
0
};
val
.
type
=
pCol
->
type
;
val
.
cid
=
pCol
->
colId
;
if
(
IS_VAR_DATA_TYPE
(
pCol
->
type
))
{
val
.
pData
=
pAlterTbReq
->
pTagVal
;
val
.
nData
=
pAlterTbReq
->
nTagVal
;
}
else
{
memcpy
(
&
val
.
i64
,
pAlterTbReq
->
pTagVal
,
pAlterTbReq
->
nTagVal
);
}
taosArrayPush
(
pTagArray
,
&
val
);
}
else
{
void
*
p
=
tdGetKVRowValOfCol
(
pOldTag
,
pCol
->
colId
);
if
(
p
)
{
if
(
IS_VAR_DATA_TYPE
(
pCol
->
type
))
{
tdAddColToKVRow
(
&
kvrb
,
pCol
->
colId
,
p
,
varDataTLen
(
p
));
}
else
{
tdAddColToKVRow
(
&
kvrb
,
pCol
->
colId
,
p
,
pCol
->
bytes
);
}
STagVal
val
=
{
0
};
if
(
tTagGet
(
pOldTag
,
&
val
))
{
taosArrayPush
(
pTagArray
,
&
val
);
}
}
}
ctbEntry
.
ctbEntry
.
pTags
=
tdGetKVRowFromBuilder
(
&
kvrb
);
tdDestroyKVRowBuilder
(
&
kvrb
);
if
((
terrno
=
tTagNew
(
pTagArray
,
pTagSchema
->
version
,
false
,
&
pNewTag
))
<
0
)
{
taosArrayDestroy
(
pTagArray
);
goto
_err
;
}
ctbEntry
.
ctbEntry
.
pTags
=
(
uint8_t
*
)
pNewTag
;
taosArrayDestroy
(
pTagArray
);
}
// save to table.db
...
...
@@ -639,8 +649,8 @@ int metaAlterTable(SMeta *pMeta, int64_t version, SVAlterTbReq *pReq) {
static
int
metaSaveToTbDb
(
SMeta
*
pMeta
,
const
SMetaEntry
*
pME
)
{
STbDbKey
tbDbKey
;
void
*
pKey
=
NULL
;
void
*
pVal
=
NULL
;
void
*
pKey
=
NULL
;
void
*
pVal
=
NULL
;
int
kLen
=
0
;
int
vLen
=
0
;
SEncoder
coder
=
{
0
};
...
...
@@ -721,17 +731,17 @@ static int metaUpdateCtbIdx(SMeta *pMeta, const SMetaEntry *pME) {
return
tdbTbInsert
(
pMeta
->
pCtbIdx
,
&
ctbIdxKey
,
sizeof
(
ctbIdxKey
),
NULL
,
0
,
&
pMeta
->
txn
);
}
int
metaCreateTagIdxKey
(
tb_uid_t
suid
,
int32_t
cid
,
const
void
*
pTagData
,
int8_t
type
,
tb_uid_t
uid
,
int
metaCreateTagIdxKey
(
tb_uid_t
suid
,
int32_t
cid
,
const
void
*
pTagData
,
int
32_t
nTagData
,
int
8_t
type
,
tb_uid_t
uid
,
STagIdxKey
**
ppTagIdxKey
,
int32_t
*
nTagIdxKey
)
{
int32_t
nTagData
=
0
;
if
(
pTagData
)
{
if
(
IS_VAR_DATA_TYPE
(
type
))
{
nTagData
=
varDataTLen
(
pTagData
);
}
else
{
nTagData
=
tDataTypes
[
type
].
bytes
;
}
}
//
int32_t nTagData = 0;
//
if (pTagData) {
//
if (IS_VAR_DATA_TYPE(type)) {
//
nTagData = varDataTLen(pTagData);
//
} else {
//
nTagData = tDataTypes[type].bytes;
//
}
//
}
*
nTagIdxKey
=
sizeof
(
STagIdxKey
)
+
nTagData
+
sizeof
(
tb_uid_t
);
*
ppTagIdxKey
=
(
STagIdxKey
*
)
taosMemoryMalloc
(
*
nTagIdxKey
);
...
...
@@ -755,14 +765,15 @@ static void metaDestroyTagIdxKey(STagIdxKey *pTagIdxKey) {
}
static
int
metaUpdateTagIdx
(
SMeta
*
pMeta
,
const
SMetaEntry
*
pCtbEntry
)
{
void
*
pData
=
NULL
;
void
*
pData
=
NULL
;
int
nData
=
0
;
STbDbKey
tbDbKey
=
{
0
};
SMetaEntry
stbEntry
=
{
0
};
STagIdxKey
*
pTagIdxKey
=
NULL
;
STagIdxKey
*
pTagIdxKey
=
NULL
;
int32_t
nTagIdxKey
;
const
SSchema
*
pTagColumn
;
// = &stbEntry.stbEntry.schema.pSchema[0];
const
void
*
pTagData
=
NULL
;
//
const
void
*
pTagData
=
NULL
;
//
int32_t
nTagData
=
0
;
SDecoder
dc
=
{
0
};
// get super table
...
...
@@ -775,7 +786,21 @@ static int metaUpdateTagIdx(SMeta *pMeta, const SMetaEntry *pCtbEntry) {
metaDecodeEntry
(
&
dc
,
&
stbEntry
);
pTagColumn
=
&
stbEntry
.
stbEntry
.
schemaTag
.
pSchema
[
0
];
pTagData
=
tdGetKVRowValOfCol
((
const
SKVRow
)
pCtbEntry
->
ctbEntry
.
pTags
,
pTagColumn
->
colId
);
STagVal
tagVal
=
{.
cid
=
pTagColumn
->
colId
};
if
(
pTagColumn
->
type
!=
TSDB_DATA_TYPE_JSON
)
{
tTagGet
((
const
STag
*
)
pCtbEntry
->
ctbEntry
.
pTags
,
&
tagVal
);
if
(
IS_VAR_DATA_TYPE
(
pTagColumn
->
type
))
{
pTagData
=
tagVal
.
pData
;
nTagData
=
(
int32_t
)
tagVal
.
nData
;
}
else
{
pTagData
=
&
(
tagVal
.
i64
);
nTagData
=
tDataTypes
[
pTagColumn
->
type
].
bytes
;
}
}
else
{
// pTagData = pCtbEntry->ctbEntry.pTags;
// nTagData = ((const STag *)pCtbEntry->ctbEntry.pTags)->len;
}
// update tag index
#ifdef USE_INVERTED_INDEX
...
...
@@ -790,8 +815,8 @@ static int metaUpdateTagIdx(SMeta *pMeta, const SMetaEntry *pCtbEntry) {
int
ret
=
indexPut
((
SIndex
*
)
pMeta
->
pTagIvtIdx
,
tmGroup
,
tuid
);
indexMultiTermDestroy
(
tmGroup
);
#else
if
(
metaCreateTagIdxKey
(
pCtbEntry
->
ctbEntry
.
suid
,
pTagColumn
->
colId
,
pTagData
,
pTagColumn
->
type
,
pCtbEntry
->
uid
,
&
pTagIdxKey
,
&
nTagIdxKey
)
<
0
)
{
if
(
metaCreateTagIdxKey
(
pCtbEntry
->
ctbEntry
.
suid
,
pTagColumn
->
colId
,
pTagData
,
nTagData
,
pTagColumn
->
type
,
pCtbEntry
->
uid
,
&
pTagIdxKey
,
&
nTagIdxKey
)
<
0
)
{
return
-
1
;
}
tdbTbInsert
(
pMeta
->
pTagIdx
,
pTagIdxKey
,
nTagIdxKey
,
NULL
,
0
,
&
pMeta
->
txn
);
...
...
@@ -804,7 +829,7 @@ static int metaUpdateTagIdx(SMeta *pMeta, const SMetaEntry *pCtbEntry) {
static
int
metaSaveToSkmDb
(
SMeta
*
pMeta
,
const
SMetaEntry
*
pME
)
{
SEncoder
coder
=
{
0
};
void
*
pVal
=
NULL
;
void
*
pVal
=
NULL
;
int
vLen
=
0
;
int
rcode
=
0
;
SSkmDbKey
skmDbKey
=
{
0
};
...
...
source/dnode/vnode/src/sma/smaOpen.c
浏览文件 @
141be560
...
...
@@ -104,7 +104,7 @@ int32_t smaOpen(SVnode *pVnode) {
taosThreadMutexInit
(
&
pSma
->
mutex
,
NULL
);
pSma
->
locked
=
false
;
if
(
vnodeIsRollup
(
pVnode
))
{
if
(
VND_IS_RSMA
(
pVnode
))
{
STsdbKeepCfg
keepCfg
=
{
0
};
for
(
int
i
=
0
;
i
<
TSDB_RETENTION_MAX
;
++
i
)
{
if
(
i
==
TSDB_RETENTION_L0
)
{
...
...
source/dnode/vnode/src/sma/smaRollup.c
浏览文件 @
141be560
...
...
@@ -414,7 +414,7 @@ static FORCE_INLINE int32_t tdExecuteRSmaImpl(SSma *pSma, const void *pMsg, int3
}
taosMemoryFreeClear
(
pReq
);
}
else
{
sma
Warn
(
"vgId:%d no rsma % "
PRIi8
" data generated since %s"
,
SMA_VID
(
pSma
),
level
,
tstrerror
(
terrno
));
sma
Debug
(
"vgId:%d no rsma % "
PRIi8
" data generated since %s"
,
SMA_VID
(
pSma
),
level
,
tstrerror
(
terrno
));
}
taosArrayDestroy
(
pResult
);
...
...
source/dnode/vnode/src/tq/tq.c
浏览文件 @
141be560
...
...
@@ -14,7 +14,6 @@
*/
#include "tq.h"
#include "tdbInt.h"
int32_t
tqInit
()
{
int8_t
old
;
...
...
@@ -47,51 +46,6 @@ void tqCleanUp() {
}
}
int
tqExecKeyCompare
(
const
void
*
pKey1
,
int32_t
kLen1
,
const
void
*
pKey2
,
int32_t
kLen2
)
{
return
strcmp
(
pKey1
,
pKey2
);
}
int32_t
tqStoreHandle
(
STQ
*
pTq
,
const
char
*
key
,
const
STqHandle
*
pHandle
)
{
int32_t
code
;
int32_t
vlen
;
tEncodeSize
(
tEncodeSTqHandle
,
pHandle
,
vlen
,
code
);
ASSERT
(
code
==
0
);
void
*
buf
=
taosMemoryCalloc
(
1
,
vlen
);
if
(
buf
==
NULL
)
{
ASSERT
(
0
);
}
SEncoder
encoder
;
tEncoderInit
(
&
encoder
,
buf
,
vlen
);
if
(
tEncodeSTqHandle
(
&
encoder
,
pHandle
)
<
0
)
{
ASSERT
(
0
);
}
TXN
txn
;
if
(
tdbTxnOpen
(
&
txn
,
0
,
tdbDefaultMalloc
,
tdbDefaultFree
,
NULL
,
TDB_TXN_WRITE
|
TDB_TXN_READ_UNCOMMITTED
)
<
0
)
{
ASSERT
(
0
);
}
if
(
tdbBegin
(
pTq
->
pMetaStore
,
&
txn
)
<
0
)
{
ASSERT
(
0
);
}
if
(
tdbTbUpsert
(
pTq
->
pExecStore
,
key
,
(
int
)
strlen
(
key
),
buf
,
vlen
,
&
txn
)
<
0
)
{
ASSERT
(
0
);
}
if
(
tdbCommit
(
pTq
->
pMetaStore
,
&
txn
)
<
0
)
{
ASSERT
(
0
);
}
tEncoderClear
(
&
encoder
);
taosMemoryFree
(
buf
);
return
0
;
}
STQ
*
tqOpen
(
const
char
*
path
,
SVnode
*
pVnode
,
SWal
*
pWal
)
{
STQ
*
pTq
=
taosMemoryMalloc
(
sizeof
(
STQ
));
if
(
pTq
==
NULL
)
{
...
...
@@ -108,60 +62,7 @@ STQ* tqOpen(const char* path, SVnode* pVnode, SWal* pWal) {
pTq
->
pushMgr
=
taosHashInit
(
64
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BIGINT
),
true
,
HASH_ENTRY_LOCK
);
if
(
tdbOpen
(
path
,
16
*
1024
,
1
,
&
pTq
->
pMetaStore
)
<
0
)
{
ASSERT
(
0
);
}
if
(
tdbTbOpen
(
"handles"
,
-
1
,
-
1
,
tqExecKeyCompare
,
pTq
->
pMetaStore
,
&
pTq
->
pExecStore
)
<
0
)
{
ASSERT
(
0
);
}
TXN
txn
;
if
(
tdbTxnOpen
(
&
txn
,
0
,
tdbDefaultMalloc
,
tdbDefaultFree
,
NULL
,
0
)
<
0
)
{
ASSERT
(
0
);
}
TBC
*
pCur
;
if
(
tdbTbcOpen
(
pTq
->
pExecStore
,
&
pCur
,
&
txn
)
<
0
)
{
ASSERT
(
0
);
}
void
*
pKey
;
int
kLen
;
void
*
pVal
;
int
vLen
;
tdbTbcMoveToFirst
(
pCur
);
SDecoder
decoder
;
while
(
tdbTbcNext
(
pCur
,
&
pKey
,
&
kLen
,
&
pVal
,
&
vLen
)
==
0
)
{
STqHandle
handle
;
tDecoderInit
(
&
decoder
,
(
uint8_t
*
)
pVal
,
vLen
);
tDecodeSTqHandle
(
&
decoder
,
&
handle
);
handle
.
pWalReader
=
walOpenReadHandle
(
pTq
->
pVnode
->
pWal
);
for
(
int32_t
i
=
0
;
i
<
5
;
i
++
)
{
handle
.
execHandle
.
pExecReader
[
i
]
=
tqInitSubmitMsgScanner
(
pTq
->
pVnode
->
pMeta
);
}
if
(
handle
.
execHandle
.
subType
==
TOPIC_SUB_TYPE__COLUMN
)
{
for
(
int32_t
i
=
0
;
i
<
5
;
i
++
)
{
SReadHandle
reader
=
{
.
reader
=
handle
.
execHandle
.
pExecReader
[
i
],
.
meta
=
pTq
->
pVnode
->
pMeta
,
.
pMsgCb
=
&
pTq
->
pVnode
->
msgCb
,
};
handle
.
execHandle
.
exec
.
execCol
.
task
[
i
]
=
qCreateStreamExecTaskInfo
(
handle
.
execHandle
.
exec
.
execCol
.
qmsg
,
&
reader
);
ASSERT
(
handle
.
execHandle
.
exec
.
execCol
.
task
[
i
]);
}
}
else
{
handle
.
execHandle
.
exec
.
execDb
.
pFilterOutTbUid
=
taosHashInit
(
64
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BIGINT
),
false
,
HASH_NO_LOCK
);
}
taosHashPut
(
pTq
->
handles
,
pKey
,
kLen
,
&
handle
,
sizeof
(
STqHandle
));
}
if
(
tdbTxnClose
(
&
txn
)
<
0
)
{
if
(
tqMetaOpen
(
pTq
)
<
0
)
{
ASSERT
(
0
);
}
...
...
@@ -174,46 +75,12 @@ void tqClose(STQ* pTq) {
taosHashCleanup
(
pTq
->
handles
);
taosHashCleanup
(
pTq
->
pStreamTasks
);
taosHashCleanup
(
pTq
->
pushMgr
);
t
dbClose
(
pTq
->
pMetaStore
);
t
qMetaClose
(
pTq
);
taosMemoryFree
(
pTq
);
}
// TODO
}
#if 0
int32_t tEncodeSTqExec(SEncoder* pEncoder, const STqExec* pExec) {
if (tStartEncode(pEncoder) < 0) return -1;
if (tEncodeCStr(pEncoder, pExec->subKey) < 0) return -1;
if (tEncodeI64(pEncoder, pExec->consumerId) < 0) return -1;
if (tEncodeI32(pEncoder, pExec->epoch) < 0) return -1;
if (tEncodeI8(pEncoder, pExec->subType) < 0) return -1;
/*if (tEncodeI8(pEncoder, pExec->withTbName) < 0) return -1;*/
/*if (tEncodeI8(pEncoder, pExec->withSchema) < 0) return -1;*/
/*if (tEncodeI8(pEncoder, pExec->withTag) < 0) return -1;*/
if (pExec->subType == TOPIC_SUB_TYPE__COLUMN) {
if (tEncodeCStr(pEncoder, pExec->qmsg) < 0) return -1;
}
tEndEncode(pEncoder);
return pEncoder->pos;
}
int32_t tDecodeSTqExec(SDecoder* pDecoder, STqExec* pExec) {
if (tStartDecode(pDecoder) < 0) return -1;
if (tDecodeCStrTo(pDecoder, pExec->subKey) < 0) return -1;
if (tDecodeI64(pDecoder, &pExec->consumerId) < 0) return -1;
if (tDecodeI32(pDecoder, &pExec->epoch) < 0) return -1;
if (tDecodeI8(pDecoder, &pExec->subType) < 0) return -1;
/*if (tDecodeI8(pDecoder, &pExec->withTbName) < 0) return -1;*/
/*if (tDecodeI8(pDecoder, &pExec->withSchema) < 0) return -1;*/
/*if (tDecodeI8(pDecoder, &pExec->withTag) < 0) return -1;*/
if (pExec->subType == TOPIC_SUB_TYPE__COLUMN) {
if (tDecodeCStrAlloc(pDecoder, &pExec->qmsg) < 0) return -1;
}
tEndDecode(pDecoder);
return 0;
}
#endif
int32_t
tEncodeSTqHandle
(
SEncoder
*
pEncoder
,
const
STqHandle
*
pHandle
)
{
if
(
tStartEncode
(
pEncoder
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
pEncoder
,
pHandle
->
subKey
)
<
0
)
return
-
1
;
...
...
@@ -290,9 +157,6 @@ int32_t tqPushMsgNew(STQ* pTq, void* msg, int32_t msgLen, tmsg_t msgType, int64_
taosWLockLatch
(
&
pHandle
->
pushHandle
.
lock
);
SRpcMsg
*
pMsg
=
atomic_load_ptr
(
&
pHandle
->
pushHandle
.
handle
);
ASSERT
(
pMsg
);
SMqDataBlkRsp
rsp
=
{
0
};
rsp
.
reqOffset
=
pHandle
->
pushHandle
.
reqOffset
;
rsp
.
blockData
=
taosArrayInit
(
0
,
sizeof
(
void
*
));
...
...
@@ -318,7 +182,7 @@ int32_t tqPushMsgNew(STQ* pTq, void* msg, int32_t msgLen, tmsg_t msgType, int64_
int32_t
tlen
=
sizeof
(
SMqRspHead
)
+
tEncodeSMqDataBlkRsp
(
NULL
,
&
rsp
);
void
*
buf
=
rpcMallocCont
(
tlen
);
if
(
buf
==
NULL
)
{
pMsg
->
code
=
-
1
;
// todo free
return
-
1
;
}
...
...
@@ -329,10 +193,15 @@ int32_t tqPushMsgNew(STQ* pTq, void* msg, int32_t msgLen, tmsg_t msgType, int64_
void
*
abuf
=
POINTER_SHIFT
(
buf
,
sizeof
(
SMqRspHead
));
tEncodeSMqDataBlkRsp
(
&
abuf
,
&
rsp
);
SRpcMsg
resp
=
{.
info
=
handleInfo
,
.
pCont
=
buf
,
.
contLen
=
tlen
,
.
code
=
0
};
SRpcMsg
resp
=
{
.
info
=
pHandle
->
pushHandle
.
info
,
.
pCont
=
buf
,
.
contLen
=
tlen
,
.
code
=
0
,
};
tmsgSendRsp
(
&
resp
);
atomic_store_ptr
(
&
pHandle
->
pushHandle
.
handle
,
NULL
);
memset
(
&
pHandle
->
pushHandle
.
info
,
0
,
sizeof
(
SRpcHandleInfo
)
);
taosWUnLockLatch
(
&
pHandle
->
pushHandle
.
lock
);
tqDebug
(
"vg %d offset %ld from consumer %ld (epoch %d) send rsp, block num: %d, reqOffset: %ld, rspOffset: %ld"
,
...
...
@@ -374,7 +243,7 @@ int tqCommit(STQ* pTq) {
int32_t
tqProcessPollReq
(
STQ
*
pTq
,
SRpcMsg
*
pMsg
,
int32_t
workerId
)
{
SMqPollReq
*
pReq
=
pMsg
->
pCont
;
int64_t
consumerId
=
pReq
->
consumerId
;
int64_t
waitTime
=
pReq
->
waitTime
;
int64_t
waitTime
=
pReq
->
timeout
;
int32_t
reqEpoch
=
pReq
->
epoch
;
int64_t
fetchOffset
;
...
...
@@ -410,24 +279,22 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg, int32_t workerId) {
rsp
.
blockData
=
taosArrayInit
(
0
,
sizeof
(
void
*
));
rsp
.
blockDataLen
=
taosArrayInit
(
0
,
sizeof
(
int32_t
));
rsp
.
blockSchema
=
taosArrayInit
(
0
,
sizeof
(
void
*
));
rsp
.
blockTbName
=
taosArrayInit
(
0
,
sizeof
(
void
*
));
rsp
.
withTbName
=
pReq
->
withTbName
;
if
(
rsp
.
withTbName
)
{
rsp
.
blockTbName
=
taosArrayInit
(
0
,
sizeof
(
void
*
));
}
if
(
pHandle
->
execHandle
.
subType
==
TOPIC_SUB_TYPE__COLUMN
)
{
rsp
.
withSchema
=
false
;
rsp
.
withTag
=
false
;
}
else
{
rsp
.
withSchema
=
true
;
rsp
.
blockSchema
=
taosArrayInit
(
0
,
sizeof
(
void
*
));
rsp
.
withTag
=
false
;
}
/*int8_t withTbName = pExec->withTbName;*/
/*if (pReq->withTbName != -1) {*/
/*withTbName = pReq->withTbName;*/
/*}*/
/*rsp.withTbName = withTbName;*/
while
(
1
)
{
consumerEpoch
=
atomic_load_32
(
&
pHandle
->
epoch
);
if
(
consumerEpoch
>
reqEpoch
)
{
...
...
@@ -443,15 +310,6 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg, int32_t workerId) {
SWalReadHead
*
pHead
=
&
pHeadWithCkSum
->
head
;
#if 0
SWalReadHead* pHead;
if (walReadWithHandle_s(pExec->pWalReader, fetchOffset, &pHead) < 0) {
// TODO: no more log, set timer to wait blocking time
// if data inserted during waiting, launch query and
// response to user
tqDebug("tmq poll: consumer %ld (epoch %d) vg %d offset %ld, no more log to return", consumerId, pReq->epoch,
TD_VID(pTq->pVnode), fetchOffset);
#if 0
// add to pushMgr
taosWLockLatch(&pExec->pushHandle.lock);
...
...
@@ -473,10 +331,6 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg, int32_t workerId) {
return 0;
#endif
break;
}
#endif
tqDebug
(
"tmq poll: consumer %ld (epoch %d) iter log, vg %d offset %ld msgType %d"
,
consumerId
,
pReq
->
epoch
,
TD_VID
(
pTq
->
pVnode
),
fetchOffset
,
pHead
->
msgType
);
...
...
@@ -533,8 +387,14 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg, int32_t workerId) {
// TODO wrap in destroy func
taosArrayDestroy
(
rsp
.
blockData
);
taosArrayDestroy
(
rsp
.
blockDataLen
);
taosArrayDestroyP
(
rsp
.
blockSchema
,
(
FDelete
)
tDeleteSSchemaWrapper
);
taosArrayDestroyP
(
rsp
.
blockTbName
,
(
FDelete
)
taosMemoryFree
);
if
(
rsp
.
withSchema
)
{
taosArrayDestroyP
(
rsp
.
blockSchema
,
(
FDelete
)
tDeleteSSchemaWrapper
);
}
if
(
rsp
.
withTbName
)
{
taosArrayDestroyP
(
rsp
.
blockTbName
,
(
FDelete
)
taosMemoryFree
);
}
return
0
;
}
...
...
@@ -545,24 +405,9 @@ int32_t tqProcessVgDeleteReq(STQ* pTq, char* msg, int32_t msgLen) {
int32_t
code
=
taosHashRemove
(
pTq
->
handles
,
pReq
->
subKey
,
strlen
(
pReq
->
subKey
));
ASSERT
(
code
==
0
);
TXN
txn
;
if
(
tdbTxnOpen
(
&
txn
,
0
,
tdbDefaultMalloc
,
tdbDefaultFree
,
NULL
,
TDB_TXN_WRITE
|
TDB_TXN_READ_UNCOMMITTED
)
<
0
)
{
ASSERT
(
0
);
}
if
(
tdbBegin
(
pTq
->
pMetaStore
,
&
txn
)
<
0
)
{
if
(
tqMetaDeleteHandle
(
pTq
,
pReq
->
subKey
)
<
0
)
{
ASSERT
(
0
);
}
if
(
tdbTbDelete
(
pTq
->
pExecStore
,
pReq
->
subKey
,
(
int
)
strlen
(
pReq
->
subKey
),
&
txn
)
<
0
)
{
/*ASSERT(0);*/
}
if
(
tdbCommit
(
pTq
->
pMetaStore
,
&
txn
)
<
0
)
{
ASSERT
(
0
);
}
return
0
;
}
...
...
@@ -620,7 +465,7 @@ int32_t tqProcessVgChangeReq(STQ* pTq, char* msg, int32_t msgLen) {
atomic_add_fetch_32
(
&
pHandle
->
epoch
,
1
);
}
if
(
tq
Stor
eHandle
(
pTq
,
req
.
subKey
,
pHandle
)
<
0
)
{
if
(
tq
MetaSav
eHandle
(
pTq
,
req
.
subKey
,
pHandle
)
<
0
)
{
// TODO
}
return
0
;
...
...
source/dnode/vnode/src/tq/tqMeta.c
浏览文件 @
141be560
此差异已折叠。
点击以展开。
source/dnode/vnode/src/tq/tqPush.c
浏览文件 @
141be560
...
...
@@ -12,3 +12,5 @@
* 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/>.
*/
#include "tq.h"
source/dnode/vnode/src/tsdb/tsdbCommit.c
浏览文件 @
141be560
...
...
@@ -238,7 +238,7 @@ static void tsdbStartCommit(STsdb *pRepo) {
static
void
tsdbEndCommit
(
STsdb
*
pTsdb
,
int
eno
)
{
tsdbEndFSTxn
(
pTsdb
);
tsdbMemTableDestroy
(
pTsdb
,
pTsdb
->
imem
);
tsdbMemTableDestroy
(
pTsdb
->
imem
);
pTsdb
->
imem
=
NULL
;
tsdbInfo
(
"vgId:%d commit over, %s"
,
REPO_ID
(
pTsdb
),
(
eno
==
TSDB_CODE_SUCCESS
)
?
"succeed"
:
"failed"
);
}
...
...
source/dnode/vnode/src/tsdb/tsdbDelete.c
0 → 100644
浏览文件 @
141be560
/*
* 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/>.
*/
\ No newline at end of file
source/dnode/vnode/src/tsdb/tsdbMemTable.c
浏览文件 @
141be560
此差异已折叠。
点击以展开。
source/dnode/vnode/src/tsdb/tsdbMemTable2.c
浏览文件 @
141be560
此差异已折叠。
点击以展开。
source/dnode/vnode/src/tsdb/tsdbRead.c
浏览文件 @
141be560
...
...
@@ -333,7 +333,7 @@ static void setQueryTimewindow(STsdbReadHandle* pTsdbReadHandle, SQueryTableData
}
static
STsdb
*
getTsdbByRetentions
(
SVnode
*
pVnode
,
STsdbReadHandle
*
pReadHandle
,
TSKEY
winSKey
,
SRetention
*
retentions
)
{
if
(
vnodeIsRollup
(
pVnode
))
{
if
(
VND_IS_RSMA
(
pVnode
))
{
int
level
=
0
;
int64_t
now
=
taosGetTimestamp
(
pVnode
->
config
.
tsdbCfg
.
precision
);
...
...
source/dnode/vnode/src/tsdb/tsdbSma.c
已删除
100644 → 0
浏览文件 @
7fcfd45a
此差异已折叠。
点击以展开。
source/dnode/vnode/src/tsdb/tsdbTDBImpl.c
已删除
100644 → 0
浏览文件 @
7fcfd45a
此差异已折叠。
点击以展开。
source/dnode/vnode/src/vnd/vnodeCfg.c
浏览文件 @
141be560
...
...
@@ -56,6 +56,8 @@ int vnodeEncodeConfig(const void *pObj, SJson *pJson) {
if
(
tjsonAddIntegerToObject
(
pJson
,
"szBuf"
,
pCfg
->
szBuf
)
<
0
)
return
-
1
;
if
(
tjsonAddIntegerToObject
(
pJson
,
"isHeap"
,
pCfg
->
isHeap
)
<
0
)
return
-
1
;
if
(
tjsonAddIntegerToObject
(
pJson
,
"isWeak"
,
pCfg
->
isWeak
)
<
0
)
return
-
1
;
if
(
tjsonAddIntegerToObject
(
pJson
,
"isTsma"
,
pCfg
->
isTsma
)
<
0
)
return
-
1
;
if
(
tjsonAddIntegerToObject
(
pJson
,
"isRsma"
,
pCfg
->
isRsma
)
<
0
)
return
-
1
;
if
(
tjsonAddIntegerToObject
(
pJson
,
"precision"
,
pCfg
->
tsdbCfg
.
precision
)
<
0
)
return
-
1
;
if
(
tjsonAddIntegerToObject
(
pJson
,
"update"
,
pCfg
->
tsdbCfg
.
update
)
<
0
)
return
-
1
;
if
(
tjsonAddIntegerToObject
(
pJson
,
"compression"
,
pCfg
->
tsdbCfg
.
compression
)
<
0
)
return
-
1
;
...
...
@@ -130,6 +132,10 @@ int vnodeDecodeConfig(const SJson *pJson, void *pObj) {
if
(
code
<
0
)
return
-
1
;
tjsonGetNumberValue
(
pJson
,
"isWeak"
,
pCfg
->
isWeak
,
code
);
if
(
code
<
0
)
return
-
1
;
tjsonGetNumberValue
(
pJson
,
"isTsma"
,
pCfg
->
isTsma
,
code
);
if
(
code
<
0
)
return
-
1
;
tjsonGetNumberValue
(
pJson
,
"isRsma"
,
pCfg
->
isRsma
,
code
);
if
(
code
<
0
)
return
-
1
;
tjsonGetNumberValue
(
pJson
,
"precision"
,
pCfg
->
tsdbCfg
.
precision
,
code
);
if
(
code
<
0
)
return
-
1
;
tjsonGetNumberValue
(
pJson
,
"update"
,
pCfg
->
tsdbCfg
.
update
,
code
);
...
...
source/dnode/vnode/src/vnd/vnodeCommit.c
浏览文件 @
141be560
...
...
@@ -230,7 +230,7 @@ int vnodeCommit(SVnode *pVnode) {
return
-
1
;
}
if
(
vnodeIsRollup
(
pVnode
))
{
if
(
VND_IS_RSMA
(
pVnode
))
{
if
(
tsdbCommit
(
VND_RSMA0
(
pVnode
))
<
0
)
{
ASSERT
(
0
);
return
-
1
;
...
...
@@ -250,7 +250,6 @@ int vnodeCommit(SVnode *pVnode) {
}
}
if
(
tqCommit
(
pVnode
->
pTq
)
<
0
)
{
ASSERT
(
0
);
return
-
1
;
...
...
source/dnode/vnode/src/vnd/vnodeOpen.c
浏览文件 @
141be560
...
...
@@ -97,7 +97,7 @@ SVnode *vnodeOpen(const char *path, STfs *pTfs, SMsgCb msgCb) {
}
// open tsdb
if
(
!
vnodeIsRollup
(
pVnode
)
&&
tsdbOpen
(
pVnode
,
&
VND_TSDB
(
pVnode
),
VNODE_TSDB_DIR
,
TSDB_TYPE_TSDB
)
<
0
)
{
if
(
!
VND_IS_RSMA
(
pVnode
)
&&
tsdbOpen
(
pVnode
,
&
VND_TSDB
(
pVnode
),
VNODE_TSDB_DIR
,
NULL
)
<
0
)
{
vError
(
"vgId:%d failed to open vnode tsdb since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
goto
_err
;
}
...
...
source/dnode/vnode/src/vnd/vnodeSvr.c
浏览文件 @
141be560
此差异已折叠。
点击以展开。
source/dnode/vnode/test/tsdbSmaTest.cpp
浏览文件 @
141be560
...
...
@@ -368,7 +368,7 @@ TEST(testCase, tSma_Data_Insert_Query_Test) {
SDiskCfg
pDisks
=
{
0
};
pDisks
.
level
=
0
;
pDisks
.
primary
=
1
;
strncpy
(
pDisks
.
dir
,
"/var/lib/taos"
,
TSDB_FILENAME_LEN
);
strncpy
(
pDisks
.
dir
,
TD_DATA_DIR_PATH
,
TSDB_FILENAME_LEN
);
int32_t
numOfDisks
=
1
;
pTsdb
->
pTfs
=
tfsOpen
(
&
pDisks
,
numOfDisks
);
EXPECT_NE
(
pTsdb
->
pTfs
,
nullptr
);
...
...
source/libs/catalog/test/catalogTests.cpp
浏览文件 @
141be560
...
...
@@ -137,7 +137,7 @@ void ctgTestInitLogFile() {
tsAsyncLog
=
0
;
qDebugFlag
=
159
;
strcpy
(
tsLogDir
,
"/var/log/taos"
);
strcpy
(
tsLogDir
,
TD_LOG_DIR_PATH
);
ctgdEnableDebug
(
"api"
);
ctgdEnableDebug
(
"meta"
);
...
...
source/libs/executor/src/scanoperator.c
浏览文件 @
141be560
此差异已折叠。
点击以展开。
source/libs/function/src/builtinsimpl.c
浏览文件 @
141be560
...
...
@@ -1646,8 +1646,8 @@ bool leastSQRFunctionSetup(SqlFunctionCtx* pCtx, SResultRowEntryInfo* pResultInf
pInfo
->
startVal
=
IS_FLOAT_TYPE
(
pCtx
->
param
[
1
].
param
.
nType
)
?
pCtx
->
param
[
1
].
param
.
d
:
(
double
)
pCtx
->
param
[
1
].
param
.
i
;
pInfo
->
stepVal
=
IS_FLOAT_TYPE
(
pCtx
->
param
[
1
].
param
.
nType
)
?
pCtx
->
param
[
2
].
param
.
d
:
(
double
)
pCtx
->
param
[
1
].
param
.
i
;
pInfo
->
stepVal
=
IS_FLOAT_TYPE
(
pCtx
->
param
[
2
].
param
.
nType
)
?
pCtx
->
param
[
2
].
param
.
d
:
(
double
)
pCtx
->
param
[
2
].
param
.
i
;
return
true
;
}
...
...
source/libs/parser/inc/parUtil.h
浏览文件 @
141be560
此差异已折叠。
点击以展开。
source/libs/parser/inc/sql.y
浏览文件 @
141be560
此差异已折叠。
点击以展开。
source/libs/parser/src/parInsert.c
浏览文件 @
141be560
此差异已折叠。
点击以展开。
source/libs/parser/src/parTranslater.c
浏览文件 @
141be560
此差异已折叠。
点击以展开。
source/libs/parser/src/parUtil.c
浏览文件 @
141be560
此差异已折叠。
点击以展开。
source/libs/parser/src/parser.c
浏览文件 @
141be560
此差异已折叠。
点击以展开。
source/libs/parser/src/sql.c
浏览文件 @
141be560
此差异已折叠。
点击以展开。
source/libs/qworker/test/qworkerTests.cpp
浏览文件 @
141be560
此差异已折叠。
点击以展开。
source/libs/scalar/src/sclvector.c
浏览文件 @
141be560
此差异已折叠。
点击以展开。
source/libs/scalar/test/filter/filterTests.cpp
浏览文件 @
141be560
此差异已折叠。
点击以展开。
source/libs/scalar/test/scalar/scalarTests.cpp
浏览文件 @
141be560
此差异已折叠。
点击以展开。
source/libs/scheduler/test/schedulerTests.cpp
浏览文件 @
141be560
此差异已折叠。
点击以展开。
source/os/CMakeLists.txt
浏览文件 @
141be560
此差异已折叠。
点击以展开。
source/os/src/osEnv.c
浏览文件 @
141be560
此差异已折叠。
点击以展开。
source/util/src/terror.c
浏览文件 @
141be560
此差异已折叠。
点击以展开。
tests/pytest/util/dnodes.py
浏览文件 @
141be560
此差异已折叠。
点击以展开。
tests/script/api/batchprepare.c
浏览文件 @
141be560
此差异已折叠。
点击以展开。
tests/system-test/0-others/taosShell.py
浏览文件 @
141be560
此差异已折叠。
点击以展开。
tests/system-test/0-others/taosShellError.py
浏览文件 @
141be560
此差异已折叠。
点击以展开。
tests/system-test/0-others/taosShellNetChk.py
浏览文件 @
141be560
此差异已折叠。
点击以展开。
taos-tools
@
717f5aaa
比较
4d83d8c6
...
717f5aaa
Subproject commit
4d83d8c62973506f760bcaa3a33f4665ed9046d0
Subproject commit
717f5aaa5f0a1b4d92bb2ae68858fec554fb5eda
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录