Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
58eac469
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
58eac469
编写于
4月 03, 2021
作者:
P
Ping Xiao
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'develop' into xiaoping/add_test_case
上级
8904a164
a8d53d1f
变更
17
展开全部
显示空白变更内容
内联
并排
Showing
17 changed file
with
635 addition
and
411 deletion
+635
-411
documentation20/cn/02.getting-started/docs.md
documentation20/cn/02.getting-started/docs.md
+4
-4
src/dnode/src/dnodeVWrite.c
src/dnode/src/dnodeVWrite.c
+1
-1
src/kit/taosdemo/taosdemo.c
src/kit/taosdemo/taosdemo.c
+297
-255
src/kit/taosdump/taosdump.c
src/kit/taosdump/taosdump.c
+182
-127
src/query/inc/qExecutor.h
src/query/inc/qExecutor.h
+2
-1
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+8
-5
src/query/src/qUtil.c
src/query/src/qUtil.c
+4
-7
src/sync/inc/syncInt.h
src/sync/inc/syncInt.h
+1
-1
src/sync/src/syncMain.c
src/sync/src/syncMain.c
+6
-1
src/vnode/src/vnodeWrite.c
src/vnode/src/vnodeWrite.c
+5
-1
tests/pytest/tools/insert-tblimit-tboffset-createdb.json
tests/pytest/tools/insert-tblimit-tboffset-createdb.json
+57
-0
tests/pytest/tools/insert-tblimit-tboffset-insertrec.json
tests/pytest/tools/insert-tblimit-tboffset-insertrec.json
+59
-0
tests/pytest/tools/insert-tblimit-tboffset0.json
tests/pytest/tools/insert-tblimit-tboffset0.json
+2
-2
tests/pytest/tools/insert-tblimit1-tboffset.json
tests/pytest/tools/insert-tblimit1-tboffset.json
+2
-2
tests/pytest/tools/taosdemo-sampledata.json
tests/pytest/tools/taosdemo-sampledata.json
+0
-2
tests/pytest/tools/taosdemoTestLimitOffset.py
tests/pytest/tools/taosdemoTestLimitOffset.py
+4
-1
tests/pytest/tools/taosdemoTestSampleData.py
tests/pytest/tools/taosdemoTestSampleData.py
+1
-1
未找到文件。
documentation20/cn/02.getting-started/docs.md
浏览文件 @
58eac469
...
...
@@ -101,7 +101,7 @@ $ taos -h 192.168.0.1 -s "use db; show tables;"
### 运行SQL命令脚本
TDengine
终端可以通过
`source`
命令来运行SQL
命令脚本.
TDengine
终端可以通过
`source`
命令来运行 SQL
命令脚本.
```
mysql
taos> source <filename>;
...
...
@@ -109,10 +109,10 @@ taos> source <filename>;
### Shell小技巧
-
可以使用上下光标键查看
已经历史输入的命
令
-
修改用户密码。在
shell中使用alter user命
令
-
可以使用上下光标键查看
历史输入的指
令
-
修改用户密码。在
shell 中使用 alter user 指
令
-
ctrl+c 中止正在进行中的查询
-
执行
`RESET QUERY CACHE`
清空本地缓存的表的
schema
-
执行
`RESET QUERY CACHE`
清空本地缓存的表
schema
## <a class="anchor" id="demo"></a>TDengine 极速体验
...
...
src/dnode/src/dnodeVWrite.c
浏览文件 @
58eac469
...
...
@@ -222,7 +222,7 @@ static void *dnodeProcessVWriteQueue(void *wparam) {
dnodeSendRpcVWriteRsp
(
pVnode
,
pWrite
,
pWrite
->
code
);
}
else
{
if
(
qtype
==
TAOS_QTYPE_FWD
)
{
vnodeConfirmForward
(
pVnode
,
pWrite
->
pHead
.
version
,
0
,
pWrite
->
pHead
.
msgType
!=
TSDB_MSG_TYPE_SUBMIT
);
vnodeConfirmForward
(
pVnode
,
pWrite
->
pHead
.
version
,
pWrite
->
code
,
pWrite
->
pHead
.
msgType
!=
TSDB_MSG_TYPE_SUBMIT
);
}
if
(
pWrite
->
rspRet
.
rsp
)
{
rpcFreeCont
(
pWrite
->
rspRet
.
rsp
);
...
...
src/kit/taosdemo/taosdemo.c
浏览文件 @
58eac469
此差异已折叠。
点击以展开。
src/kit/taosdump/taosdump.c
浏览文件 @
58eac469
...
...
@@ -39,6 +39,22 @@ typedef struct {
int8_t
type
;
}
SOColInfo
;
#define debugPrint(fmt, ...) \
do { if (g_args.debug_print || g_args.verbose_print) \
fprintf(stderr, "DEBG: "fmt, __VA_ARGS__); } while(0)
#define verbosePrint(fmt, ...) \
do { if (g_args.verbose_print) \
fprintf(stderr, "VERB: "fmt, __VA_ARGS__); } while(0)
#define performancePrint(fmt, ...) \
do { if (g_args.performance_print) \
fprintf(stderr, "VERB: "fmt, __VA_ARGS__); } while(0)
#define errorPrint(fmt, ...) \
do { fprintf(stderr, "ERROR: "fmt, __VA_ARGS__); } while(0)
// -------------------------- SHOW DATABASE INTERFACE-----------------------
enum
_show_db_index
{
TSDB_SHOW_DB_NAME_INDEX
,
...
...
@@ -199,16 +215,18 @@ static struct argp_option options[] = {
{
"schemaonly"
,
's'
,
0
,
0
,
"Only dump schema."
,
3
},
{
"with-property"
,
'M'
,
0
,
0
,
"Dump schema with properties."
,
3
},
{
"start-time"
,
'S'
,
"START_TIME"
,
0
,
"Start time to dump."
,
3
},
{
"end-time"
,
'E'
,
"END_TIME"
,
0
,
"End time to dump.
"
,
3
},
{
"end-time"
,
'E'
,
"END_TIME"
,
0
,
"End time to dump.
Epoch or ISO8601/RFC3339 format is acceptable. For example: 2017-10-01T18:00:00+0800"
,
3
},
{
"data-batch"
,
'N'
,
"DATA_BATCH"
,
0
,
"Number of data point per insert statement. Default is 1."
,
3
},
{
"max-sql-len"
,
'L'
,
"SQL_LEN"
,
0
,
"Max length of one sql. Default is 65480."
,
3
},
{
"table-batch"
,
't'
,
"TABLE_BATCH"
,
0
,
"Number of table dumpout into one output file. Default is 1."
,
3
},
{
"thread_num"
,
'T'
,
"THREAD_NUM"
,
0
,
"Number of thread for dump in file. Default is 5."
,
3
},
{
"allow-sys"
,
'a'
,
0
,
0
,
"Allow to dump sys database"
,
3
},
{
"debug"
,
'g'
,
0
,
0
,
"Print debug info."
,
1
},
{
"verbose"
,
'v'
,
0
,
0
,
"Print verbose debug info."
,
1
},
{
0
}};
/* Used by main to communicate with parse_opt. */
struct
arguments
{
typedef
struct
arguments
{
// connection option
char
*
host
;
char
*
user
;
...
...
@@ -240,7 +258,10 @@ struct arguments {
char
**
arg_list
;
int
arg_list_len
;
bool
isDumpIn
;
};
bool
debug_print
;
bool
verbose_print
;
bool
performance_print
;
}
SArguments
;
/* Parse a single option. */
static
error_t
parse_opt
(
int
key
,
char
*
arg
,
struct
argp_state
*
state
)
{
...
...
@@ -286,6 +307,9 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) {
tstrncpy
(
arguments
->
outpath
,
full_path
.
we_wordv
[
0
],
TSDB_FILENAME_LEN
);
wordfree
(
&
full_path
);
break
;
case
'g'
:
arguments
->
debug_print
=
true
;
break
;
case
'i'
:
arguments
->
isDumpIn
=
true
;
if
(
wordexp
(
arg
,
&
full_path
,
0
)
!=
0
)
{
...
...
@@ -387,7 +411,7 @@ int taosCheckParam(struct arguments *arguments);
void
taosFreeDbInfos
();
static
void
taosStartDumpOutWorkThreads
(
void
*
taosCon
,
struct
arguments
*
args
,
int32_t
numOfThread
,
char
*
dbName
);
struct
arguments
tsArgument
s
=
{
struct
arguments
g_arg
s
=
{
// connection option
NULL
,
"root"
,
...
...
@@ -421,7 +445,10 @@ struct arguments tsArguments = {
0
,
NULL
,
0
,
false
false
,
false
,
// debug_print
false
,
// verbose_print
false
// performance_print
};
static
int
queryDbImpl
(
TAOS
*
taos
,
char
*
command
)
{
...
...
@@ -453,13 +480,40 @@ static int queryDbImpl(TAOS *taos, char *command) {
return
0
;
}
static
void
parse_args
(
int
argc
,
char
*
argv
[],
SArguments
*
arguments
)
{
for
(
int
i
=
1
;
i
<
argc
;
i
++
)
{
if
(
strcmp
(
argv
[
i
],
"-E"
)
==
0
)
{
char
*
tmp
=
argv
[
++
i
];
int64_t
tmpEpoch
;
if
(
strchr
(
tmp
,
':'
)
&&
strchr
(
tmp
,
'-'
))
{
if
(
TSDB_CODE_SUCCESS
!=
taosParseTime
(
tmp
,
&
tmpEpoch
,
strlen
(
tmp
),
TSDB_TIME_PRECISION_MILLI
,
0
))
{
fprintf
(
stderr
,
"Input end time error!
\n
"
);
return
;
}
}
else
{
tmpEpoch
=
atoll
(
tmp
);
}
sprintf
(
argv
[
i
],
"%"
PRId64
""
,
tmpEpoch
);
debugPrint
(
"%s() LN%d, tmp is: %s, argv[%d]: %s
\n
"
,
__func__
,
__LINE__
,
tmp
,
i
,
argv
[
i
]);
}
else
if
(
strcmp
(
argv
[
i
],
"-g"
)
==
0
)
{
arguments
->
debug_print
=
true
;
}
}
}
int
main
(
int
argc
,
char
*
argv
[])
{
/* Parse our arguments; every option seen by parse_opt will be
reflected in arguments. */
argp_parse
(
&
argp
,
argc
,
argv
,
0
,
0
,
&
tsArguments
);
parse_args
(
argc
,
argv
,
&
g_args
);
argp_parse
(
&
argp
,
argc
,
argv
,
0
,
0
,
&
g_args
);
if
(
tsArgument
s
.
abort
)
{
if
(
g_arg
s
.
abort
)
{
#ifndef _ALPINE
error
(
10
,
0
,
"ABORTED"
);
#else
...
...
@@ -469,81 +523,82 @@ int main(int argc, char *argv[]) {
printf
(
"====== arguments config ======
\n
"
);
{
printf
(
"host: %s
\n
"
,
tsArguments
.
host
);
printf
(
"user: %s
\n
"
,
tsArguments
.
user
);
printf
(
"password: %s
\n
"
,
tsArguments
.
password
);
printf
(
"port: %u
\n
"
,
tsArguments
.
port
);
printf
(
"cversion: %s
\n
"
,
tsArguments
.
cversion
);
printf
(
"mysqlFlag: %d
\n
"
,
tsArguments
.
mysqlFlag
);
printf
(
"outpath: %s
\n
"
,
tsArguments
.
outpath
);
printf
(
"inpath: %s
\n
"
,
tsArguments
.
inpath
);
printf
(
"resultFile: %s
\n
"
,
tsArguments
.
resultFile
);
printf
(
"encode: %s
\n
"
,
tsArguments
.
encode
);
printf
(
"all_databases: %d
\n
"
,
tsArguments
.
all_databases
);
printf
(
"databases: %d
\n
"
,
tsArguments
.
databases
);
printf
(
"schemaonly: %d
\n
"
,
tsArguments
.
schemaonly
);
printf
(
"with_property: %d
\n
"
,
tsArguments
.
with_property
);
printf
(
"start_time: %"
PRId64
"
\n
"
,
tsArguments
.
start_time
);
printf
(
"end_time: %"
PRId64
"
\n
"
,
tsArguments
.
end_time
);
printf
(
"data_batch: %d
\n
"
,
tsArguments
.
data_batch
);
printf
(
"max_sql_len: %d
\n
"
,
tsArguments
.
max_sql_len
);
printf
(
"table_batch: %d
\n
"
,
tsArguments
.
table_batch
);
printf
(
"thread_num: %d
\n
"
,
tsArguments
.
thread_num
);
printf
(
"allow_sys: %d
\n
"
,
tsArguments
.
allow_sys
);
printf
(
"abort: %d
\n
"
,
tsArguments
.
abort
);
printf
(
"isDumpIn: %d
\n
"
,
tsArguments
.
isDumpIn
);
printf
(
"arg_list_len: %d
\n
"
,
tsArguments
.
arg_list_len
);
for
(
int32_t
i
=
0
;
i
<
tsArguments
.
arg_list_len
;
i
++
)
{
printf
(
"arg_list[%d]: %s
\n
"
,
i
,
tsArguments
.
arg_list
[
i
]);
printf
(
"host: %s
\n
"
,
g_args
.
host
);
printf
(
"user: %s
\n
"
,
g_args
.
user
);
printf
(
"password: %s
\n
"
,
g_args
.
password
);
printf
(
"port: %u
\n
"
,
g_args
.
port
);
printf
(
"cversion: %s
\n
"
,
g_args
.
cversion
);
printf
(
"mysqlFlag: %d
\n
"
,
g_args
.
mysqlFlag
);
printf
(
"outpath: %s
\n
"
,
g_args
.
outpath
);
printf
(
"inpath: %s
\n
"
,
g_args
.
inpath
);
printf
(
"resultFile: %s
\n
"
,
g_args
.
resultFile
);
printf
(
"encode: %s
\n
"
,
g_args
.
encode
);
printf
(
"all_databases: %d
\n
"
,
g_args
.
all_databases
);
printf
(
"databases: %d
\n
"
,
g_args
.
databases
);
printf
(
"schemaonly: %d
\n
"
,
g_args
.
schemaonly
);
printf
(
"with_property: %d
\n
"
,
g_args
.
with_property
);
printf
(
"start_time: %"
PRId64
"
\n
"
,
g_args
.
start_time
);
printf
(
"end_time: %"
PRId64
"
\n
"
,
g_args
.
end_time
);
printf
(
"data_batch: %d
\n
"
,
g_args
.
data_batch
);
printf
(
"max_sql_len: %d
\n
"
,
g_args
.
max_sql_len
);
printf
(
"table_batch: %d
\n
"
,
g_args
.
table_batch
);
printf
(
"thread_num: %d
\n
"
,
g_args
.
thread_num
);
printf
(
"allow_sys: %d
\n
"
,
g_args
.
allow_sys
);
printf
(
"abort: %d
\n
"
,
g_args
.
abort
);
printf
(
"isDumpIn: %d
\n
"
,
g_args
.
isDumpIn
);
printf
(
"arg_list_len: %d
\n
"
,
g_args
.
arg_list_len
);
printf
(
"debug_print: %d
\n
"
,
g_args
.
debug_print
);
for
(
int32_t
i
=
0
;
i
<
g_args
.
arg_list_len
;
i
++
)
{
printf
(
"arg_list[%d]: %s
\n
"
,
i
,
g_args
.
arg_list
[
i
]);
}
}
printf
(
"==============================
\n
"
);
if
(
tsArgument
s
.
cversion
[
0
]
!=
0
){
tstrncpy
(
version
,
tsArgument
s
.
cversion
,
11
);
if
(
g_arg
s
.
cversion
[
0
]
!=
0
){
tstrncpy
(
version
,
g_arg
s
.
cversion
,
11
);
}
if
(
taosCheckParam
(
&
tsArgument
s
)
<
0
)
{
if
(
taosCheckParam
(
&
g_arg
s
)
<
0
)
{
exit
(
EXIT_FAILURE
);
}
g_fpOfResult
=
fopen
(
tsArgument
s
.
resultFile
,
"a"
);
g_fpOfResult
=
fopen
(
g_arg
s
.
resultFile
,
"a"
);
if
(
NULL
==
g_fpOfResult
)
{
fprintf
(
stderr
,
"Failed to open %s for save result
\n
"
,
tsArgument
s
.
resultFile
);
fprintf
(
stderr
,
"Failed to open %s for save result
\n
"
,
g_arg
s
.
resultFile
);
return
1
;
};
fprintf
(
g_fpOfResult
,
"#############################################################################
\n
"
);
fprintf
(
g_fpOfResult
,
"============================== arguments config =============================
\n
"
);
{
fprintf
(
g_fpOfResult
,
"host: %s
\n
"
,
tsArgument
s
.
host
);
fprintf
(
g_fpOfResult
,
"user: %s
\n
"
,
tsArgument
s
.
user
);
fprintf
(
g_fpOfResult
,
"password: %s
\n
"
,
tsArgument
s
.
password
);
fprintf
(
g_fpOfResult
,
"port: %u
\n
"
,
tsArgument
s
.
port
);
fprintf
(
g_fpOfResult
,
"cversion: %s
\n
"
,
tsArguments
.
cversion
);
fprintf
(
g_fpOfResult
,
"mysqlFlag: %d
\n
"
,
tsArguments
.
mysqlFlag
);
fprintf
(
g_fpOfResult
,
"outpath: %s
\n
"
,
tsArgument
s
.
outpath
);
fprintf
(
g_fpOfResult
,
"inpath: %s
\n
"
,
tsArgument
s
.
inpath
);
fprintf
(
g_fpOfResult
,
"resultFile: %s
\n
"
,
tsArgument
s
.
resultFile
);
fprintf
(
g_fpOfResult
,
"encode: %s
\n
"
,
tsArgument
s
.
encode
);
fprintf
(
g_fpOfResult
,
"all_databases: %d
\n
"
,
tsArgument
s
.
all_databases
);
fprintf
(
g_fpOfResult
,
"databases: %d
\n
"
,
tsArgument
s
.
databases
);
fprintf
(
g_fpOfResult
,
"schemaonly: %d
\n
"
,
tsArgument
s
.
schemaonly
);
fprintf
(
g_fpOfResult
,
"with_property: %d
\n
"
,
tsArgument
s
.
with_property
);
fprintf
(
g_fpOfResult
,
"start_time: %"
PRId64
"
\n
"
,
tsArgument
s
.
start_time
);
fprintf
(
g_fpOfResult
,
"end_time: %"
PRId64
"
\n
"
,
tsArgument
s
.
end_time
);
fprintf
(
g_fpOfResult
,
"data_batch: %d
\n
"
,
tsArgument
s
.
data_batch
);
fprintf
(
g_fpOfResult
,
"max_sql_len: %d
\n
"
,
tsArgument
s
.
max_sql_len
);
fprintf
(
g_fpOfResult
,
"table_batch: %d
\n
"
,
tsArgument
s
.
table_batch
);
fprintf
(
g_fpOfResult
,
"thread_num: %d
\n
"
,
tsArguments
.
thread_num
);
fprintf
(
g_fpOfResult
,
"allow_sys: %d
\n
"
,
tsArgument
s
.
allow_sys
);
fprintf
(
g_fpOfResult
,
"abort: %d
\n
"
,
tsArgument
s
.
abort
);
fprintf
(
g_fpOfResult
,
"isDumpIn: %d
\n
"
,
tsArgument
s
.
isDumpIn
);
fprintf
(
g_fpOfResult
,
"arg_list_len: %d
\n
"
,
tsArgument
s
.
arg_list_len
);
for
(
int32_t
i
=
0
;
i
<
tsArgument
s
.
arg_list_len
;
i
++
)
{
fprintf
(
g_fpOfResult
,
"arg_list[%d]: %s
\n
"
,
i
,
tsArgument
s
.
arg_list
[
i
]);
fprintf
(
g_fpOfResult
,
"host: %s
\n
"
,
g_arg
s
.
host
);
fprintf
(
g_fpOfResult
,
"user: %s
\n
"
,
g_arg
s
.
user
);
fprintf
(
g_fpOfResult
,
"password: %s
\n
"
,
g_arg
s
.
password
);
fprintf
(
g_fpOfResult
,
"port: %u
\n
"
,
g_arg
s
.
port
);
fprintf
(
g_fpOfResult
,
"cversion: %s
\n
"
,
g_args
.
cversion
);
fprintf
(
g_fpOfResult
,
"mysqlFlag: %d
\n
"
,
g_args
.
mysqlFlag
);
fprintf
(
g_fpOfResult
,
"outpath: %s
\n
"
,
g_arg
s
.
outpath
);
fprintf
(
g_fpOfResult
,
"inpath: %s
\n
"
,
g_arg
s
.
inpath
);
fprintf
(
g_fpOfResult
,
"resultFile: %s
\n
"
,
g_arg
s
.
resultFile
);
fprintf
(
g_fpOfResult
,
"encode: %s
\n
"
,
g_arg
s
.
encode
);
fprintf
(
g_fpOfResult
,
"all_databases: %d
\n
"
,
g_arg
s
.
all_databases
);
fprintf
(
g_fpOfResult
,
"databases: %d
\n
"
,
g_arg
s
.
databases
);
fprintf
(
g_fpOfResult
,
"schemaonly: %d
\n
"
,
g_arg
s
.
schemaonly
);
fprintf
(
g_fpOfResult
,
"with_property: %d
\n
"
,
g_arg
s
.
with_property
);
fprintf
(
g_fpOfResult
,
"start_time: %"
PRId64
"
\n
"
,
g_arg
s
.
start_time
);
fprintf
(
g_fpOfResult
,
"end_time: %"
PRId64
"
\n
"
,
g_arg
s
.
end_time
);
fprintf
(
g_fpOfResult
,
"data_batch: %d
\n
"
,
g_arg
s
.
data_batch
);
fprintf
(
g_fpOfResult
,
"max_sql_len: %d
\n
"
,
g_arg
s
.
max_sql_len
);
fprintf
(
g_fpOfResult
,
"table_batch: %d
\n
"
,
g_arg
s
.
table_batch
);
fprintf
(
g_fpOfResult
,
"thread_num: %d
\n
"
,
g_args
.
thread_num
);
fprintf
(
g_fpOfResult
,
"allow_sys: %d
\n
"
,
g_arg
s
.
allow_sys
);
fprintf
(
g_fpOfResult
,
"abort: %d
\n
"
,
g_arg
s
.
abort
);
fprintf
(
g_fpOfResult
,
"isDumpIn: %d
\n
"
,
g_arg
s
.
isDumpIn
);
fprintf
(
g_fpOfResult
,
"arg_list_len: %d
\n
"
,
g_arg
s
.
arg_list_len
);
for
(
int32_t
i
=
0
;
i
<
g_arg
s
.
arg_list_len
;
i
++
)
{
fprintf
(
g_fpOfResult
,
"arg_list[%d]: %s
\n
"
,
i
,
g_arg
s
.
arg_list
[
i
]);
}
}
...
...
@@ -552,11 +607,11 @@ int main(int argc, char *argv[]) {
time_t
tTime
=
time
(
NULL
);
struct
tm
tm
=
*
localtime
(
&
tTime
);
if
(
tsArguments
.
isDumpIn
)
{
if
(
g_args
.
isDumpIn
)
{
fprintf
(
g_fpOfResult
,
"============================== DUMP IN ==============================
\n
"
);
fprintf
(
g_fpOfResult
,
"# DumpIn start time: %d-%02d-%02d %02d:%02d:%02d
\n
"
,
tm
.
tm_year
+
1900
,
tm
.
tm_mon
+
1
,
tm
.
tm_mday
,
tm
.
tm_hour
,
tm
.
tm_min
,
tm
.
tm_sec
);
if
(
taosDumpIn
(
&
tsArgument
s
)
<
0
)
{
if
(
taosDumpIn
(
&
g_arg
s
)
<
0
)
{
fprintf
(
g_fpOfResult
,
"
\n
"
);
fclose
(
g_fpOfResult
);
return
-
1
;
...
...
@@ -565,7 +620,7 @@ int main(int argc, char *argv[]) {
fprintf
(
g_fpOfResult
,
"============================== DUMP OUT ==============================
\n
"
);
fprintf
(
g_fpOfResult
,
"# DumpOut start time: %d-%02d-%02d %02d:%02d:%02d
\n
"
,
tm
.
tm_year
+
1900
,
tm
.
tm_mon
+
1
,
tm
.
tm_mday
,
tm
.
tm_hour
,
tm
.
tm_min
,
tm
.
tm_sec
);
if
(
taosDumpOut
(
&
tsArgument
s
)
<
0
)
{
if
(
taosDumpOut
(
&
g_arg
s
)
<
0
)
{
fprintf
(
g_fpOfResult
,
"
\n
"
);
fclose
(
g_fpOfResult
);
return
-
1
;
...
...
@@ -1236,8 +1291,8 @@ void* taosDumpOutWorkThreadFp(void *arg)
FILE
*
fp
=
NULL
;
memset
(
tmpBuf
,
0
,
TSDB_FILENAME_LEN
+
128
);
if
(
tsArgument
s
.
outpath
[
0
]
!=
0
)
{
sprintf
(
tmpBuf
,
"%s/%s.tables.%d.sql"
,
tsArgument
s
.
outpath
,
pThread
->
dbName
,
pThread
->
threadIndex
);
if
(
g_arg
s
.
outpath
[
0
]
!=
0
)
{
sprintf
(
tmpBuf
,
"%s/%s.tables.%d.sql"
,
g_arg
s
.
outpath
,
pThread
->
dbName
,
pThread
->
threadIndex
);
}
else
{
sprintf
(
tmpBuf
,
"%s.tables.%d.sql"
,
pThread
->
dbName
,
pThread
->
threadIndex
);
}
...
...
@@ -1270,7 +1325,7 @@ void* taosDumpOutWorkThreadFp(void *arg)
ssize_t
readLen
=
read
(
fd
,
&
tableRecord
,
sizeof
(
STableRecord
));
if
(
readLen
<=
0
)
break
;
int
ret
=
taosDumpTable
(
tableRecord
.
name
,
tableRecord
.
metric
,
&
tsArgument
s
,
fp
,
pThread
->
taosCon
,
pThread
->
dbName
);
int
ret
=
taosDumpTable
(
tableRecord
.
name
,
tableRecord
.
metric
,
&
g_arg
s
,
fp
,
pThread
->
taosCon
,
pThread
->
dbName
);
if
(
ret
>=
0
)
{
// TODO: sum table count and table rows by self
pThread
->
tablesOfDumpOut
++
;
...
...
@@ -1282,13 +1337,13 @@ void* taosDumpOutWorkThreadFp(void *arg)
}
tablesInOneFile
++
;
if
(
tablesInOneFile
>=
tsArgument
s
.
table_batch
)
{
if
(
tablesInOneFile
>=
g_arg
s
.
table_batch
)
{
fclose
(
fp
);
tablesInOneFile
=
0
;
memset
(
tmpBuf
,
0
,
TSDB_FILENAME_LEN
+
128
);
if
(
tsArgument
s
.
outpath
[
0
]
!=
0
)
{
sprintf
(
tmpBuf
,
"%s/%s.tables.%d-%d.sql"
,
tsArgument
s
.
outpath
,
pThread
->
dbName
,
pThread
->
threadIndex
,
fileNameIndex
);
if
(
g_arg
s
.
outpath
[
0
]
!=
0
)
{
sprintf
(
tmpBuf
,
"%s/%s.tables.%d-%d.sql"
,
g_arg
s
.
outpath
,
pThread
->
dbName
,
pThread
->
threadIndex
,
fileNameIndex
);
}
else
{
sprintf
(
tmpBuf
,
"%s.tables.%d-%d.sql"
,
pThread
->
dbName
,
pThread
->
threadIndex
,
fileNameIndex
);
}
...
...
@@ -1491,14 +1546,14 @@ int taosDumpDb(SDbInfo *dbInfo, struct arguments *arguments, FILE *fp, TAOS *tao
taos_free_result
(
res
);
lseek
(
fd
,
0
,
SEEK_SET
);
int
maxThreads
=
tsArgument
s
.
thread_num
;
int
maxThreads
=
g_arg
s
.
thread_num
;
int
tableOfPerFile
;
if
(
numOfTable
<=
tsArgument
s
.
thread_num
)
{
if
(
numOfTable
<=
g_arg
s
.
thread_num
)
{
tableOfPerFile
=
1
;
maxThreads
=
numOfTable
;
}
else
{
tableOfPerFile
=
numOfTable
/
tsArgument
s
.
thread_num
;
if
(
0
!=
numOfTable
%
tsArgument
s
.
thread_num
)
{
tableOfPerFile
=
numOfTable
/
g_arg
s
.
thread_num
;
if
(
0
!=
numOfTable
%
g_arg
s
.
thread_num
)
{
tableOfPerFile
+=
1
;
}
}
...
...
@@ -2214,7 +2269,7 @@ void* taosDumpInWorkThreadFp(void *arg)
continue
;
}
fprintf
(
stderr
,
"Success Open input file: %s
\n
"
,
SQLFileName
);
taosDumpInOneFile
(
pThread
->
taosCon
,
fp
,
tsfCharset
,
tsArgument
s
.
encode
,
SQLFileName
);
taosDumpInOneFile
(
pThread
->
taosCon
,
fp
,
tsfCharset
,
g_arg
s
.
encode
,
SQLFileName
);
}
}
...
...
src/query/inc/qExecutor.h
浏览文件 @
58eac469
...
...
@@ -86,7 +86,8 @@ typedef struct SResultRow {
bool
closed
;
// this result status: closed or opened
uint32_t
numOfRows
;
// number of rows of current time window
SResultRowCellInfo
*
pCellInfo
;
// For each result column, there is a resultInfo
union
{
STimeWindow
win
;
char
*
key
;};
// start key of current result row
STimeWindow
win
;
char
*
key
;
// start key of current result row
}
SResultRow
;
typedef
struct
SGroupResInfo
{
...
...
src/query/src/qExecutor.c
浏览文件 @
58eac469
...
...
@@ -1876,14 +1876,15 @@ static void teardownQueryRuntimeEnv(SQueryRuntimeEnv *pRuntimeEnv) {
taosHashCleanup
(
pRuntimeEnv
->
pResultRowHashTable
);
pRuntimeEnv
->
pResultRowHashTable
=
NULL
;
pRuntimeEnv
->
pool
=
destroyResultRowPool
(
pRuntimeEnv
->
pool
);
taosArrayDestroyEx
(
pRuntimeEnv
->
prevResult
,
freeInterResult
);
pRuntimeEnv
->
prevResult
=
NULL
;
taosHashCleanup
(
pRuntimeEnv
->
pTableRetrieveTsMap
);
pRuntimeEnv
->
pTableRetrieveTsMap
=
NULL
;
destroyOperatorInfo
(
pRuntimeEnv
->
proot
);
pRuntimeEnv
->
pool
=
destroyResultRowPool
(
pRuntimeEnv
->
pool
);
taosArrayDestroyEx
(
pRuntimeEnv
->
prevResult
,
freeInterResult
);
pRuntimeEnv
->
prevResult
=
NULL
;
}
static
bool
needBuildResAfterQueryComplete
(
SQInfo
*
pQInfo
)
{
...
...
@@ -6463,6 +6464,9 @@ void freeQInfo(SQInfo *pQInfo) {
SQueryRuntimeEnv
*
pRuntimeEnv
=
&
pQInfo
->
runtimeEnv
;
releaseQueryBuf
(
pRuntimeEnv
->
tableqinfoGroupInfo
.
numOfTables
);
doDestroyTableQueryInfo
(
&
pRuntimeEnv
->
tableqinfoGroupInfo
);
teardownQueryRuntimeEnv
(
&
pQInfo
->
runtimeEnv
);
SQuery
*
pQuery
=
pQInfo
->
runtimeEnv
.
pQuery
;
...
...
@@ -6498,7 +6502,6 @@ void freeQInfo(SQInfo *pQInfo) {
}
}
doDestroyTableQueryInfo
(
&
pRuntimeEnv
->
tableqinfoGroupInfo
);
tfree
(
pQInfo
->
pBuf
);
tfree
(
pQInfo
->
sql
);
...
...
src/query/src/qUtil.c
浏览文件 @
58eac469
...
...
@@ -66,8 +66,8 @@ void cleanupResultRowInfo(SResultRowInfo *pResultRowInfo) {
return
;
}
if
(
pResultRowInfo
->
type
==
TSDB_DATA_TYPE_BINARY
||
pResultRowInfo
->
type
==
TSDB_DATA_TYPE_NCHAR
)
{
for
(
int32_t
i
=
0
;
i
<
pResultRowInfo
->
size
;
++
i
)
{
if
(
pResultRowInfo
->
pResult
[
i
])
{
tfree
(
pResultRowInfo
->
pResult
[
i
]
->
key
);
}
}
...
...
@@ -153,11 +153,8 @@ void clearResultRow(SQueryRuntimeEnv *pRuntimeEnv, SResultRow *pResultRow, int16
pResultRow
->
offset
=
-
1
;
pResultRow
->
closed
=
false
;
if
(
type
==
TSDB_DATA_TYPE_BINARY
||
type
==
TSDB_DATA_TYPE_NCHAR
)
{
tfree
(
pResultRow
->
key
);
}
else
{
pResultRow
->
win
=
TSWINDOW_INITIALIZER
;
}
}
// TODO refactor: use macro
...
...
src/sync/inc/syncInt.h
浏览文件 @
58eac469
...
...
@@ -35,7 +35,7 @@ extern "C" {
#define SYNC_MAX_SIZE (TSDB_MAX_WAL_SIZE + sizeof(SWalHead) + sizeof(SSyncHead) + 16)
#define SYNC_RECV_BUFFER_SIZE (5*1024*1024)
#define SYNC_MAX_FWDS
512
#define SYNC_MAX_FWDS
1024
#define SYNC_FWD_TIMER 300
#define SYNC_ROLE_TIMER 15000 // ms
#define SYNC_CHECK_INTERVAL 1000 // ms
...
...
src/sync/src/syncMain.c
浏览文件 @
58eac469
...
...
@@ -1459,7 +1459,12 @@ static int32_t syncForwardToPeerImpl(SSyncNode *pNode, void *data, void *mhandle
if
((
pNode
->
quorum
>
1
||
force
)
&&
code
==
0
)
{
code
=
syncSaveFwdInfo
(
pNode
,
pWalHead
->
version
,
mhandle
);
if
(
code
>=
0
)
code
=
1
;
if
(
code
>=
0
)
{
code
=
1
;
}
else
{
pthread_mutex_unlock
(
&
pNode
->
mutex
);
return
code
;
}
}
int32_t
retLen
=
taosWriteMsg
(
pPeer
->
peerFd
,
pSyncHead
,
fwdLen
);
...
...
src/vnode/src/vnodeWrite.c
浏览文件 @
58eac469
...
...
@@ -91,13 +91,17 @@ int32_t vnodeProcessWrite(void *vparam, void *wparam, int32_t qtype, void *rpara
int32_t
syncCode
=
0
;
bool
force
=
(
pWrite
==
NULL
?
false
:
pWrite
->
pHead
.
msgType
!=
TSDB_MSG_TYPE_SUBMIT
);
syncCode
=
syncForwardToPeer
(
pVnode
->
sync
,
pHead
,
pWrite
,
qtype
,
force
);
if
(
syncCode
<
0
)
return
syncCode
;
if
(
syncCode
<
0
)
{
pHead
->
version
=
0
;
return
syncCode
;
}
// write into WAL
code
=
walWrite
(
pVnode
->
wal
,
pHead
);
if
(
code
<
0
)
{
if
(
syncCode
>
0
)
atomic_sub_fetch_32
(
&
pWrite
->
processedCount
,
1
);
vError
(
"vgId:%d, hver:%"
PRIu64
" vver:%"
PRIu64
" code:0x%x"
,
pVnode
->
vgId
,
pHead
->
version
,
pVnode
->
version
,
code
);
pHead
->
version
=
0
;
return
code
;
}
...
...
tests/pytest/tools/insert-tblimit-tboffset-createdb.json
0 → 100644
浏览文件 @
58eac469
{
"filetype"
:
"insert"
,
"cfgdir"
:
"/etc/taos"
,
"host"
:
"127.0.0.1"
,
"port"
:
6030
,
"user"
:
"root"
,
"password"
:
"taosdata"
,
"thread_count"
:
4
,
"thread_count_create_tbl"
:
4
,
"result_file"
:
"./insert_res.txt"
,
"confirm_parameter_prompt"
:
"no"
,
"insert_interval"
:
0
,
"num_of_records_per_req"
:
100
,
"max_sql_len"
:
1024000
,
"databases"
:
[{
"dbinfo"
:
{
"name"
:
"db"
,
"drop"
:
"yes"
,
"replica"
:
1
,
"days"
:
10
,
"cache"
:
16
,
"blocks"
:
8
,
"precision"
:
"ms"
,
"keep"
:
365
,
"minRows"
:
100
,
"maxRows"
:
4096
,
"comp"
:
2
,
"walLevel"
:
1
,
"cachelast"
:
0
,
"quorum"
:
1
,
"fsync"
:
3000
,
"update"
:
0
},
"super_tables"
:
[{
"name"
:
"stb"
,
"child_table_exists"
:
"no"
,
"childtable_count"
:
100
,
"childtable_prefix"
:
"stb_"
,
"auto_create_table"
:
"no"
,
"data_source"
:
"rand"
,
"insert_mode"
:
"taosc"
,
"insert_rows"
:
0
,
"multi_thread_write_one_tbl"
:
"no"
,
"number_of_tbl_in_one_sql"
:
0
,
"max_sql_len"
:
1024000
,
"disorder_ratio"
:
0
,
"disorder_range"
:
1000
,
"timestamp_step"
:
1
,
"start_timestamp"
:
"2020-10-01 00:00:00.000"
,
"sample_format"
:
"csv"
,
"sample_file"
:
"./sample.csv"
,
"tags_file"
:
""
,
"columns"
:
[{
"type"
:
"INT"
},
{
"type"
:
"DOUBLE"
,
"count"
:
10
},
{
"type"
:
"BINARY"
,
"len"
:
16
,
"count"
:
3
},
{
"type"
:
"BINARY"
,
"len"
:
32
,
"count"
:
6
}],
"tags"
:
[{
"type"
:
"TINYINT"
,
"count"
:
2
},
{
"type"
:
"BINARY"
,
"len"
:
16
,
"count"
:
5
}]
}]
}]
}
tests/pytest/tools/insert-tblimit-tboffset-insertrec.json
0 → 100644
浏览文件 @
58eac469
{
"filetype"
:
"insert"
,
"cfgdir"
:
"/etc/taos"
,
"host"
:
"127.0.0.1"
,
"port"
:
6030
,
"user"
:
"root"
,
"password"
:
"taosdata"
,
"thread_count"
:
4
,
"thread_count_create_tbl"
:
4
,
"result_file"
:
"./insert_res.txt"
,
"confirm_parameter_prompt"
:
"no"
,
"insert_interval"
:
0
,
"num_of_records_per_req"
:
100
,
"max_sql_len"
:
1024000
,
"databases"
:
[{
"dbinfo"
:
{
"name"
:
"db"
,
"drop"
:
"no"
,
"replica"
:
1
,
"days"
:
10
,
"cache"
:
16
,
"blocks"
:
8
,
"precision"
:
"ms"
,
"keep"
:
365
,
"minRows"
:
100
,
"maxRows"
:
4096
,
"comp"
:
2
,
"walLevel"
:
1
,
"cachelast"
:
0
,
"quorum"
:
1
,
"fsync"
:
3000
,
"update"
:
0
},
"super_tables"
:
[{
"name"
:
"stb"
,
"child_table_exists"
:
"yes"
,
"childtable_count"
:
100
,
"childtable_prefix"
:
"stb_"
,
"auto_create_table"
:
"no"
,
"data_source"
:
"rand"
,
"insert_mode"
:
"taosc"
,
"insert_rows"
:
1000
,
"childtable_limit"
:
33
,
"childtable_offset"
:
33
,
"multi_thread_write_one_tbl"
:
"no"
,
"number_of_tbl_in_one_sql"
:
0
,
"max_sql_len"
:
1024000
,
"disorder_ratio"
:
0
,
"disorder_range"
:
1000
,
"timestamp_step"
:
1
,
"start_timestamp"
:
"2020-10-01 00:00:00.000"
,
"sample_format"
:
"csv"
,
"sample_file"
:
"./sample.csv"
,
"tags_file"
:
""
,
"columns"
:
[{
"type"
:
"INT"
},
{
"type"
:
"DOUBLE"
,
"count"
:
10
},
{
"type"
:
"BINARY"
,
"len"
:
16
,
"count"
:
3
},
{
"type"
:
"BINARY"
,
"len"
:
32
,
"count"
:
6
}],
"tags"
:
[{
"type"
:
"TINYINT"
,
"count"
:
2
},
{
"type"
:
"BINARY"
,
"len"
:
16
,
"count"
:
5
}]
}]
}]
}
tests/pytest/tools/insert-tblimit-tboffset0.json
浏览文件 @
58eac469
...
...
@@ -15,7 +15,7 @@
"databases"
:
[{
"dbinfo"
:
{
"name"
:
"db"
,
"drop"
:
"
yes
"
,
"drop"
:
"
no
"
,
"replica"
:
1
,
"days"
:
10
,
"cache"
:
16
,
...
...
@@ -33,7 +33,7 @@
},
"super_tables"
:
[{
"name"
:
"stb"
,
"child_table_exists"
:
"
no
"
,
"child_table_exists"
:
"
yes
"
,
"childtable_count"
:
100
,
"childtable_prefix"
:
"stb_"
,
"auto_create_table"
:
"no"
,
...
...
tests/pytest/tools/insert-tblimit1-tboffset.json
浏览文件 @
58eac469
...
...
@@ -15,7 +15,7 @@
"databases"
:
[{
"dbinfo"
:
{
"name"
:
"db"
,
"drop"
:
"
yes
"
,
"drop"
:
"
no
"
,
"replica"
:
1
,
"days"
:
10
,
"cache"
:
16
,
...
...
@@ -33,7 +33,7 @@
},
"super_tables"
:
[{
"name"
:
"stb"
,
"child_table_exists"
:
"
no
"
,
"child_table_exists"
:
"
yes
"
,
"childtable_count"
:
100
,
"childtable_prefix"
:
"stb_"
,
"auto_create_table"
:
"no"
,
...
...
tests/pytest/tools/taosdemo-sampledata.json
浏览文件 @
58eac469
...
...
@@ -16,8 +16,6 @@
"name"
:
"stb"
,
"child_table_exists"
:
"no"
,
"childtable_count"
:
20
,
"childtable_limit"
:
10
,
"childtable_offset"
:
0
,
"childtable_prefix"
:
"t_"
,
"auto_create_table"
:
"no"
,
"data_source"
:
"sample"
,
...
...
tests/pytest/tools/taosdemoTestLimitOffset.py
浏览文件 @
58eac469
...
...
@@ -51,7 +51,8 @@ class TDTestCase:
else
:
tdLog
.
info
(
"taosd found in %s"
%
buildPath
)
binPath
=
buildPath
+
"/build/bin/"
os
.
system
(
"%staosdemo -f tools/insert-tblimit-tboffset.json"
%
binPath
)
os
.
system
(
"%staosdemo -f tools/insert-tblimit-tboffset-createdb.json"
%
binPath
)
os
.
system
(
"%staosdemo -f tools/insert-tblimit-tboffset-insertrec.json"
%
binPath
)
tdSql
.
execute
(
"use db"
)
tdSql
.
query
(
"select count(tbname) from db.stb"
)
...
...
@@ -59,6 +60,7 @@ class TDTestCase:
tdSql
.
query
(
"select count(*) from db.stb"
)
tdSql
.
checkData
(
0
,
0
,
33000
)
os
.
system
(
"%staosdemo -f tools/insert-tblimit-tboffset-createdb.json"
%
binPath
)
os
.
system
(
"%staosdemo -f tools/insert-tblimit-tboffset0.json"
%
binPath
)
tdSql
.
execute
(
"reset query cache"
)
...
...
@@ -68,6 +70,7 @@ class TDTestCase:
tdSql
.
query
(
"select count(*) from db.stb"
)
tdSql
.
checkData
(
0
,
0
,
20000
)
os
.
system
(
"%staosdemo -f tools/insert-tblimit-tboffset-createdb.json"
%
binPath
)
os
.
system
(
"%staosdemo -f tools/insert-tblimit1-tboffset.json"
%
binPath
)
tdSql
.
execute
(
"reset query cache"
)
...
...
tests/pytest/tools/taosdemoTestSampleData.py
浏览文件 @
58eac469
...
...
@@ -57,7 +57,7 @@ class TDTestCase:
tdSql
.
query
(
"select count(tbname) from db.stb"
)
tdSql
.
checkData
(
0
,
0
,
20
)
tdSql
.
query
(
"select count(*) from db.stb"
)
tdSql
.
checkData
(
0
,
0
,
2
00
)
tdSql
.
checkData
(
0
,
0
,
4
00
)
def
stop
(
self
):
tdSql
.
close
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录