Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
4ff1ca4b
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看板
提交
4ff1ca4b
编写于
5月 18, 2020
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
差异文件
merge develop
上级
4d83bb3e
6715fb72
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
188 addition
and
155 deletion
+188
-155
src/client/src/tscServer.c
src/client/src/tscServer.c
+7
-6
src/common/inc/qsqltype.h
src/common/inc/qsqltype.h
+111
-0
src/common/src/sqlcmdstr.c
src/common/src/sqlcmdstr.c
+18
-0
src/kit/shell/inc/shell.h
src/kit/shell/inc/shell.h
+11
-12
src/kit/shell/src/shellEngine.c
src/kit/shell/src/shellEngine.c
+2
-2
src/kit/shell/src/shellImport.c
src/kit/shell/src/shellImport.c
+2
-2
src/kit/shell/src/shellLinux.c
src/kit/shell/src/shellLinux.c
+2
-2
src/kit/shell/src/shellMain.c
src/kit/shell/src/shellMain.c
+1
-1
src/kit/taosdemo/taosdemo.c
src/kit/taosdemo/taosdemo.c
+4
-4
src/kit/taosdump/taosdump.c
src/kit/taosdump/taosdump.c
+22
-22
src/query/inc/qsqltype.h
src/query/inc/qsqltype.h
+0
-96
src/rpc/src/rpcMain.c
src/rpc/src/rpcMain.c
+1
-1
src/tsdb/inc/tsdbMain.h
src/tsdb/inc/tsdbMain.h
+5
-5
src/tsdb/src/tsdbRWHelper.c
src/tsdb/src/tsdbRWHelper.c
+2
-2
未找到文件。
src/client/src/tscServer.c
浏览文件 @
4ff1ca4b
...
...
@@ -27,6 +27,7 @@
#include "ttimer.h"
#include "tutil.h"
#include "tscLog.h"
#include "qsqltype.h"
#define TSC_MGMT_VNODE 999
...
...
@@ -207,7 +208,7 @@ int tscSendMsgToServer(SSqlObj *pSql) {
memcpy
(
pMsg
,
pSql
->
cmd
.
payload
,
pSql
->
cmd
.
payloadLen
);
}
tscTrace
(
"%p msg:%s is sent to server"
,
pSql
,
taosMsg
[
pSql
->
cmd
.
msgType
]);
//
tscTrace("%p msg:%s is sent to server", pSql, taosMsg[pSql->cmd.msgType]);
SRpcMsg
rpcMsg
=
{
.
msgType
=
pSql
->
cmd
.
msgType
,
...
...
@@ -235,7 +236,7 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcIpSet *pIpSet) {
SSqlRes
*
pRes
=
&
pSql
->
res
;
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
STscObj
*
pObj
=
pSql
->
pTscObj
;
tscTrace
(
"%p msg:%s is received from server"
,
pSql
,
taosMsg
[
rpcMsg
->
msgType
]);
//
tscTrace("%p msg:%s is received from server", pSql, taosMsg[rpcMsg->msgType]);
if
(
pSql
->
freed
||
pObj
->
signature
!=
pObj
)
{
tscTrace
(
"%p sql is already released or DB connection is closed, freed:%d pObj:%p signature:%p"
,
pSql
,
pSql
->
freed
,
...
...
@@ -340,10 +341,10 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcIpSet *pIpSet) {
pMsg
->
numOfFailedBlocks
=
htonl
(
pMsg
->
numOfFailedBlocks
);
pRes
->
numOfRows
+=
pMsg
->
affectedRows
;
tscTrace
(
"%p
cmd:%d code:%s, inserted rows:%d, rsp len:%d"
,
pSql
,
pCmd
->
command
,
tstrerror
(
pRes
->
code
),
pMsg
->
affectedRows
,
pRes
->
rspLen
);
tscTrace
(
"%p
SQL cmd:%s, code:%s inserted rows:%d rspLen:%d"
,
pSql
,
sqlCmd
[
pCmd
->
command
],
tstrerror
(
pRes
->
code
),
pMsg
->
affectedRows
,
pRes
->
rspLen
);
}
else
{
tscTrace
(
"%p
cmd:%d code:%s rsp len:%d"
,
pSql
,
pCmd
->
command
,
tstrerror
(
pRes
->
code
),
pRes
->
rspLen
);
tscTrace
(
"%p
SQL cmd:%s, code:%s rspLen:%d"
,
pSql
,
sqlCmd
[
pCmd
->
command
]
,
tstrerror
(
pRes
->
code
),
pRes
->
rspLen
);
}
}
...
...
@@ -426,7 +427,7 @@ int tscProcessSql(SSqlObj *pSql) {
assert
((
pQueryInfo
->
numOfTables
==
0
&&
pQueryInfo
->
command
==
TSDB_SQL_HB
)
||
pQueryInfo
->
numOfTables
>
0
);
}
tscTrace
(
"%p SQL cmd:%
d will be processed, name:%s, type:%d"
,
pSql
,
pCmd
->
command
,
name
,
type
);
tscTrace
(
"%p SQL cmd:%
s will be processed, name:%s, type:%d"
,
pSql
,
sqlCmd
[
pCmd
->
command
]
,
name
,
type
);
if
(
pCmd
->
command
<
TSDB_SQL_MGMT
)
{
// the pTableMetaInfo cannot be NULL
if
(
pTableMetaInfo
==
NULL
)
{
pSql
->
res
.
code
=
TSDB_CODE_OTHERS
;
...
...
src/common/inc/qsqltype.h
0 → 100644
浏览文件 @
4ff1ca4b
/*
* 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/>.
*/
#ifndef TDENGINE_QSQLCMD_H
#define TDENGINE_QSQLCMD_H
#ifdef __cplusplus
extern
"C"
{
#endif
// sql type
#ifdef TSDB_SQL_C
#define TSDB_DEFINE_SQL_TYPE( name, msg ) msg,
char
*
sqlCmd
[]
=
{
"null"
,
#else
#define TSDB_DEFINE_SQL_TYPE( name, msg ) name,
enum
{
TSDB_SQL_NULL
=
0
,
#endif
TSDB_DEFINE_SQL_TYPE
(
TSDB_SQL_SELECT
,
"select"
)
TSDB_DEFINE_SQL_TYPE
(
TSDB_SQL_FETCH
,
"fetch"
)
TSDB_DEFINE_SQL_TYPE
(
TSDB_SQL_INSERT
,
"insert"
)
// the SQL below is for mgmt node
TSDB_DEFINE_SQL_TYPE
(
TSDB_SQL_MGMT
,
"mgmt"
)
TSDB_DEFINE_SQL_TYPE
(
TSDB_SQL_CREATE_DB
,
"create-db"
)
TSDB_DEFINE_SQL_TYPE
(
TSDB_SQL_CREATE_TABLE
,
"create-table"
)
TSDB_DEFINE_SQL_TYPE
(
TSDB_SQL_DROP_DB
,
"drop-db"
)
TSDB_DEFINE_SQL_TYPE
(
TSDB_SQL_DROP_TABLE
,
"drop-table"
)
TSDB_DEFINE_SQL_TYPE
(
TSDB_SQL_CREATE_ACCT
,
"create-acct"
)
TSDB_DEFINE_SQL_TYPE
(
TSDB_SQL_CREATE_USER
,
"create-user"
)
TSDB_DEFINE_SQL_TYPE
(
TSDB_SQL_DROP_ACCT
,
"drop-acct"
)
TSDB_DEFINE_SQL_TYPE
(
TSDB_SQL_DROP_USER
,
"drop-user"
)
TSDB_DEFINE_SQL_TYPE
(
TSDB_SQL_ALTER_USER
,
"alter-user"
)
TSDB_DEFINE_SQL_TYPE
(
TSDB_SQL_ALTER_ACCT
,
"alter-acct"
)
TSDB_DEFINE_SQL_TYPE
(
TSDB_SQL_ALTER_TABLE
,
"alter-table"
)
TSDB_DEFINE_SQL_TYPE
(
TSDB_SQL_ALTER_DB
,
"alter-db"
)
TSDB_DEFINE_SQL_TYPE
(
TSDB_SQL_CREATE_MNODE
,
"create-mnode"
)
TSDB_DEFINE_SQL_TYPE
(
TSDB_SQL_DROP_MNODE
,
"drop-mnode"
)
TSDB_DEFINE_SQL_TYPE
(
TSDB_SQL_CREATE_DNODE
,
"create-dnode"
)
TSDB_DEFINE_SQL_TYPE
(
TSDB_SQL_DROP_DNODE
,
"drop-dnode"
)
TSDB_DEFINE_SQL_TYPE
(
TSDB_SQL_CFG_DNODE
,
"cfg-dnode"
)
TSDB_DEFINE_SQL_TYPE
(
TSDB_SQL_CFG_MNODE
,
"cfg-mnode"
)
TSDB_DEFINE_SQL_TYPE
(
TSDB_SQL_SHOW
,
"show"
)
TSDB_DEFINE_SQL_TYPE
(
TSDB_SQL_RETRIEVE
,
"retrieve"
)
TSDB_DEFINE_SQL_TYPE
(
TSDB_SQL_KILL_QUERY
,
"kill-query"
)
TSDB_DEFINE_SQL_TYPE
(
TSDB_SQL_KILL_STREAM
,
"kill-stream"
)
TSDB_DEFINE_SQL_TYPE
(
TSDB_SQL_KILL_CONNECTION
,
"kill-connection"
)
// SQL below is for read operation
TSDB_DEFINE_SQL_TYPE
(
TSDB_SQL_READ
,
"read"
)
TSDB_DEFINE_SQL_TYPE
(
TSDB_SQL_CONNECT
,
"connect"
)
TSDB_DEFINE_SQL_TYPE
(
TSDB_SQL_USE_DB
,
"use-db"
)
TSDB_DEFINE_SQL_TYPE
(
TSDB_SQL_META
,
"meta"
)
TSDB_DEFINE_SQL_TYPE
(
TSDB_SQL_STABLEVGROUP
,
"stable-vgroup"
)
TSDB_DEFINE_SQL_TYPE
(
TSDB_SQL_MULTI_META
,
"multi-meta"
)
TSDB_DEFINE_SQL_TYPE
(
TSDB_SQL_HB
,
"heart-beat"
)
// SQL below for client local
TSDB_DEFINE_SQL_TYPE
(
TSDB_SQL_LOCAL
,
"local"
)
TSDB_DEFINE_SQL_TYPE
(
TSDB_SQL_DESCRIBE_TABLE
,
"describe-table"
)
TSDB_DEFINE_SQL_TYPE
(
TSDB_SQL_RETRIEVE_LOCALMERGE
,
"retrieve-localmerge"
)
TSDB_DEFINE_SQL_TYPE
(
TSDB_SQL_TABLE_JOIN_RETRIEVE
,
"join-retrieve"
)
/*
* build empty result instead of accessing dnode to fetch result
* reset the client cache
*/
TSDB_DEFINE_SQL_TYPE
(
TSDB_SQL_RETRIEVE_EMPTY_RESULT
,
"retrieve-empty-result"
)
TSDB_DEFINE_SQL_TYPE
(
TSDB_SQL_RESET_CACHE
,
"reset-cache"
)
TSDB_DEFINE_SQL_TYPE
(
TSDB_SQL_SERV_STATUS
,
"serv-status"
)
TSDB_DEFINE_SQL_TYPE
(
TSDB_SQL_CURRENT_DB
,
"current-db"
)
TSDB_DEFINE_SQL_TYPE
(
TSDB_SQL_SERV_VERSION
,
"serv-version"
)
TSDB_DEFINE_SQL_TYPE
(
TSDB_SQL_CLI_VERSION
,
"cli-version"
)
TSDB_DEFINE_SQL_TYPE
(
TSDB_SQL_CURRENT_USER
,
"current-user "
)
TSDB_DEFINE_SQL_TYPE
(
TSDB_SQL_CFG_LOCAL
,
"cfg-local"
)
TSDB_DEFINE_SQL_TYPE
(
TSDB_SQL_MAX
,
"max"
)
};
// create table operation type
enum
TSQL_TYPE
{
TSQL_CREATE_TABLE
=
0x1
,
TSQL_CREATE_STABLE
=
0x2
,
TSQL_CREATE_TABLE_FROM_STABLE
=
0x3
,
TSQL_CREATE_STREAM
=
0x4
,
};
extern
char
*
sqlCmd
[];
#ifdef __cplusplus
}
#endif
#endif // TDENGINE_QSQLCMD_H
src/common/src/sqlcmdstr.c
0 → 100644
浏览文件 @
4ff1ca4b
/*
* 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/>.
*/
#define TSDB_SQL_C
#include "qsqltype.h"
src/kit/shell/inc/shell.h
浏览文件 @
4ff1ca4b
...
...
@@ -41,14 +41,13 @@
// dynamic config timestamp width according to maximum time precision
extern
int32_t
TIMESTAMP_OUTPUT_LENGTH
;
typedef
struct
History
History
;
struct
History
{
typedef
struct
SShellHistory
{
char
*
hist
[
MAX_HISTORY_SIZE
];
int
hstart
;
int
hend
;
};
}
SShellHistory
;
struct
a
rguments
{
typedef
struct
SShellA
rguments
{
char
*
host
;
char
*
password
;
char
*
user
;
...
...
@@ -62,11 +61,11 @@ struct arguments {
char
*
commands
;
int
abort
;
int
port
;
};
}
SShellArguments
;
/**************** Function declarations ****************/
extern
void
shellParseArgument
(
int
argc
,
char
*
argv
[],
struct
a
rguments
*
arguments
);
extern
TAOS
*
shellInit
(
struct
a
rguments
*
args
);
extern
void
shellParseArgument
(
int
argc
,
char
*
argv
[],
SShellA
rguments
*
arguments
);
extern
TAOS
*
shellInit
(
SShellA
rguments
*
args
);
extern
void
*
shellLoopQuery
(
void
*
arg
);
extern
void
taos_error
(
TAOS
*
con
);
extern
int
regex_match
(
const
char
*
s
,
const
char
*
reg
,
int
cflags
);
...
...
@@ -76,7 +75,7 @@ void shellRunCommandOnServer(TAOS* con, char command[]);
void
read_history
();
void
write_history
();
void
source_file
(
TAOS
*
con
,
char
*
fptr
);
void
source_dir
(
TAOS
*
con
,
struct
a
rguments
*
args
);
void
source_dir
(
TAOS
*
con
,
SShellA
rguments
*
args
);
void
get_history_path
(
char
*
history
);
void
cleanup_handler
(
void
*
arg
);
void
exitShell
();
...
...
@@ -89,12 +88,12 @@ int isCommentLine(char *line);
extern
char
PROMPT_HEADER
[];
extern
char
CONTINUE_PROMPT
[];
extern
int
prompt_size
;
extern
History
history
;
extern
SShellHistory
history
;
extern
struct
termios
oldtio
;
extern
void
set_terminal_mode
();
extern
int
get_old_terminal_mode
(
struct
termios
*
tio
);
extern
void
reset_terminal_mode
();
extern
struct
a
rguments
args
;
extern
TAOS_RES
*
result
;
extern
void
reset_terminal_mode
();
extern
SShellA
rguments
args
;
extern
TAOS_RES
*
result
;
#endif
src/kit/shell/src/shellEngine.c
浏览文件 @
4ff1ca4b
...
...
@@ -33,12 +33,12 @@ char PROMPT_HEADER[] = "taos> ";
char
CONTINUE_PROMPT
[]
=
" -> "
;
int
prompt_size
=
6
;
TAOS_RES
*
result
=
NULL
;
History
history
;
SShell
History
history
;
/*
* FUNCTION: Initialize the shell.
*/
TAOS
*
shellInit
(
struct
a
rguments
*
args
)
{
TAOS
*
shellInit
(
SShellA
rguments
*
args
)
{
printf
(
"
\n
"
);
printf
(
CLIENT_VERSION
,
tsOsName
,
taos_get_client_info
());
fflush
(
stdout
);
...
...
src/kit/shell/src/shellImport.c
浏览文件 @
4ff1ca4b
...
...
@@ -221,7 +221,7 @@ void* shellImportThreadFp(void *arg)
return
NULL
;
}
static
void
shellRunImportThreads
(
struct
a
rguments
*
args
)
static
void
shellRunImportThreads
(
SShellA
rguments
*
args
)
{
pthread_attr_t
thattr
;
ShellThreadObj
*
threadObj
=
(
ShellThreadObj
*
)
calloc
(
args
->
threadNum
,
sizeof
(
ShellThreadObj
));
...
...
@@ -254,7 +254,7 @@ static void shellRunImportThreads(struct arguments* args)
free
(
threadObj
);
}
void
source_dir
(
TAOS
*
con
,
struct
a
rguments
*
args
)
{
void
source_dir
(
TAOS
*
con
,
SShellA
rguments
*
args
)
{
shellGetDirectoryFileList
(
args
->
dir
);
int64_t
start
=
taosGetTimestampMs
();
...
...
src/kit/shell/src/shellLinux.c
浏览文件 @
4ff1ca4b
...
...
@@ -50,7 +50,7 @@ static struct argp_option options[] = {
static
error_t
parse_opt
(
int
key
,
char
*
arg
,
struct
argp_state
*
state
)
{
/* Get the input argument from argp_parse, which we
know is a pointer to our arguments structure. */
struct
a
rguments
*
arguments
=
state
->
input
;
SShellA
rguments
*
arguments
=
state
->
input
;
wordexp_t
full_path
;
switch
(
key
)
{
...
...
@@ -129,7 +129,7 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) {
/* Our argp parser. */
static
struct
argp
argp
=
{
options
,
parse_opt
,
args_doc
,
doc
};
void
shellParseArgument
(
int
argc
,
char
*
argv
[],
struct
a
rguments
*
arguments
)
{
void
shellParseArgument
(
int
argc
,
char
*
argv
[],
SShellA
rguments
*
arguments
)
{
static
char
verType
[
32
]
=
{
0
};
sprintf
(
verType
,
"version: %s
\n
"
,
version
);
...
...
src/kit/shell/src/shellMain.c
浏览文件 @
4ff1ca4b
...
...
@@ -62,7 +62,7 @@ int checkVersion() {
}
// Global configurations
struct
a
rguments
args
=
{
SShellA
rguments
args
=
{
.
host
=
NULL
,
.
password
=
NULL
,
.
user
=
NULL
,
...
...
src/kit/taosdemo/taosdemo.c
浏览文件 @
4ff1ca4b
...
...
@@ -67,7 +67,7 @@ static struct argp_option options[] = {
{
0
}};
/* Used by main to communicate with parse_opt. */
struct
a
rguments
{
typedef
struct
DemoA
rguments
{
char
*
host
;
uint16_t
port
;
char
*
user
;
...
...
@@ -87,13 +87,13 @@ struct arguments {
int
num_of_DPT
;
int
abort
;
char
**
arg_list
;
};
}
SDemoArguments
;
/* Parse a single option. */
static
error_t
parse_opt
(
int
key
,
char
*
arg
,
struct
argp_state
*
state
)
{
/* Get the input argument from argp_parse, which we
know is a pointer to our arguments structure. */
struct
a
rguments
*
arguments
=
state
->
input
;
SDemoA
rguments
*
arguments
=
state
->
input
;
wordexp_t
full_path
;
char
**
sptr
;
switch
(
key
)
{
...
...
@@ -269,7 +269,7 @@ double getCurrentTime();
void
callBack
(
void
*
param
,
TAOS_RES
*
res
,
int
code
);
int
main
(
int
argc
,
char
*
argv
[])
{
struct
a
rguments
arguments
=
{
NULL
,
// host
SDemoA
rguments
arguments
=
{
NULL
,
// host
0
,
// port
"root"
,
// user
"taosdata"
,
// password
...
...
src/kit/taosdump/taosdump.c
浏览文件 @
4ff1ca4b
...
...
@@ -168,7 +168,7 @@ static struct argp_option options[] = {
{
0
}};
/* Used by main to communicate with parse_opt. */
struct
a
rguments
{
typedef
struct
SDumpA
rguments
{
// connection option
char
*
host
;
char
*
user
;
...
...
@@ -193,13 +193,13 @@ struct arguments {
char
**
arg_list
;
int
arg_list_len
;
bool
isDumpIn
;
};
}
SDumpArguments
;
/* Parse a single option. */
static
error_t
parse_opt
(
int
key
,
char
*
arg
,
struct
argp_state
*
state
)
{
/* Get the input argument from argp_parse, which we
know is a pointer to our arguments structure. */
struct
a
rguments
*
arguments
=
state
->
input
;
SDumpA
rguments
*
arguments
=
state
->
input
;
wordexp_t
full_path
;
switch
(
key
)
{
...
...
@@ -296,31 +296,31 @@ char *command = NULL;
char
*
lcommand
=
NULL
;
char
*
buffer
=
NULL
;
int
taosDumpOut
(
struct
a
rguments
*
arguments
);
int
taosDumpOut
(
SDumpA
rguments
*
arguments
);
int
taosDumpIn
(
struct
a
rguments
*
arguments
);
int
taosDumpIn
(
SDumpA
rguments
*
arguments
);
void
taosDumpCreateDbClause
(
SDbInfo
*
dbInfo
,
bool
isDumpProperty
,
FILE
*
fp
);
int
taosDumpDb
(
SDbInfo
*
dbInfo
,
struct
a
rguments
*
arguments
,
FILE
*
fp
);
int
taosDumpDb
(
SDbInfo
*
dbInfo
,
SDumpA
rguments
*
arguments
,
FILE
*
fp
);
void
taosDumpCreateTableClause
(
STableDef
*
tableDes
,
int
numOfCols
,
struct
a
rguments
*
arguments
,
FILE
*
fp
);
void
taosDumpCreateTableClause
(
STableDef
*
tableDes
,
int
numOfCols
,
SDumpA
rguments
*
arguments
,
FILE
*
fp
);
void
taosDumpCreateMTableClause
(
STableDef
*
tableDes
,
char
*
metric
,
int
numOfCols
,
struct
a
rguments
*
arguments
,
void
taosDumpCreateMTableClause
(
STableDef
*
tableDes
,
char
*
metric
,
int
numOfCols
,
SDumpA
rguments
*
arguments
,
FILE
*
fp
);
int32_t
taosDumpTable
(
char
*
table
,
char
*
metric
,
struct
a
rguments
*
arguments
,
FILE
*
fp
);
int32_t
taosDumpTable
(
char
*
table
,
char
*
metric
,
SDumpA
rguments
*
arguments
,
FILE
*
fp
);
int32_t
taosDumpMetric
(
char
*
metric
,
struct
a
rguments
*
arguments
,
FILE
*
fp
);
int32_t
taosDumpMetric
(
char
*
metric
,
SDumpA
rguments
*
arguments
,
FILE
*
fp
);
int
taosDumpTableData
(
FILE
*
fp
,
char
*
tbname
,
struct
a
rguments
*
arguments
);
int
taosDumpTableData
(
FILE
*
fp
,
char
*
tbname
,
SDumpA
rguments
*
arguments
);
int
taosCheckParam
(
struct
a
rguments
*
arguments
);
int
taosCheckParam
(
SDumpA
rguments
*
arguments
);
void
taosFreeDbInfos
();
int
main
(
int
argc
,
char
*
argv
[])
{
struct
a
rguments
arguments
=
{
SDumpA
rguments
arguments
=
{
// connection option
NULL
,
"root"
,
"taosdata"
,
0
,
// output file
...
...
@@ -424,7 +424,7 @@ int taosGetTableRecordInfo(char *table, STableRecordInfo *pTableRecordInfo) {
return
-
1
;
}
int
taosDumpOut
(
struct
a
rguments
*
arguments
)
{
int
taosDumpOut
(
SDumpA
rguments
*
arguments
)
{
TAOS_ROW
row
;
char
*
temp
=
NULL
;
FILE
*
fp
=
NULL
;
...
...
@@ -602,7 +602,7 @@ void taosDumpCreateDbClause(SDbInfo *dbInfo, bool isDumpProperty, FILE *fp) {
fprintf
(
fp
,
"%s
\n\n
"
,
buffer
);
}
int
taosDumpDb
(
SDbInfo
*
dbInfo
,
struct
a
rguments
*
arguments
,
FILE
*
fp
)
{
int
taosDumpDb
(
SDbInfo
*
dbInfo
,
SDumpA
rguments
*
arguments
,
FILE
*
fp
)
{
TAOS_ROW
row
;
int
fd
=
-
1
;
STableRecord
tableRecord
;
...
...
@@ -660,7 +660,7 @@ int taosDumpDb(SDbInfo *dbInfo, struct arguments *arguments, FILE *fp) {
return
0
;
}
void
taosDumpCreateTableClause
(
STableDef
*
tableDes
,
int
numOfCols
,
struct
a
rguments
*
arguments
,
FILE
*
fp
)
{
void
taosDumpCreateTableClause
(
STableDef
*
tableDes
,
int
numOfCols
,
SDumpA
rguments
*
arguments
,
FILE
*
fp
)
{
char
*
pstr
=
NULL
;
pstr
=
buffer
;
int
counter
=
0
;
...
...
@@ -703,7 +703,7 @@ void taosDumpCreateTableClause(STableDef *tableDes, int numOfCols, struct argume
fprintf
(
fp
,
"%s
\n\n
"
,
buffer
);
}
void
taosDumpCreateMTableClause
(
STableDef
*
tableDes
,
char
*
metric
,
int
numOfCols
,
struct
a
rguments
*
arguments
,
void
taosDumpCreateMTableClause
(
STableDef
*
tableDes
,
char
*
metric
,
int
numOfCols
,
SDumpA
rguments
*
arguments
,
FILE
*
fp
)
{
char
*
pstr
=
NULL
;
pstr
=
buffer
;
...
...
@@ -786,7 +786,7 @@ int taosGetTableDes(char *table, STableDef *tableDes) {
return
count
;
}
int32_t
taosDumpTable
(
char
*
table
,
char
*
metric
,
struct
a
rguments
*
arguments
,
FILE
*
fp
)
{
int32_t
taosDumpTable
(
char
*
table
,
char
*
metric
,
SDumpA
rguments
*
arguments
,
FILE
*
fp
)
{
int
count
=
0
;
STableDef
*
tableDes
=
(
STableDef
*
)
calloc
(
1
,
sizeof
(
STableDef
)
+
sizeof
(
SColDes
)
*
TSDB_MAX_COLUMNS
);
...
...
@@ -828,7 +828,7 @@ int32_t taosDumpTable(char *table, char *metric, struct arguments *arguments, FI
return
taosDumpTableData
(
fp
,
table
,
arguments
);
}
int32_t
taosDumpMetric
(
char
*
metric
,
struct
a
rguments
*
arguments
,
FILE
*
fp
)
{
int32_t
taosDumpMetric
(
char
*
metric
,
SDumpA
rguments
*
arguments
,
FILE
*
fp
)
{
TAOS_ROW
row
=
NULL
;
int
fd
=
-
1
;
STableRecord
tableRecord
;
...
...
@@ -877,7 +877,7 @@ int32_t taosDumpMetric(char *metric, struct arguments *arguments, FILE *fp) {
return
0
;
}
int
taosDumpTableData
(
FILE
*
fp
,
char
*
tbname
,
struct
a
rguments
*
arguments
)
{
int
taosDumpTableData
(
FILE
*
fp
,
char
*
tbname
,
SDumpA
rguments
*
arguments
)
{
/* char temp[MAX_COMMAND_SIZE] = "\0"; */
int
count
=
0
;
char
*
pstr
=
NULL
;
...
...
@@ -987,7 +987,7 @@ int taosDumpTableData(FILE *fp, char *tbname, struct arguments *arguments) {
return
0
;
}
int
taosCheckParam
(
struct
a
rguments
*
arguments
)
{
int
taosCheckParam
(
SDumpA
rguments
*
arguments
)
{
if
(
arguments
->
all_databases
&&
arguments
->
databases
)
{
fprintf
(
stderr
,
"conflict option --all-databases and --databases
\n
"
);
return
-
1
;
...
...
@@ -1072,7 +1072,7 @@ void taosReplaceCtrlChar(char *str) {
*
pstr
=
'\0'
;
}
int
taosDumpIn
(
struct
a
rguments
*
arguments
)
{
int
taosDumpIn
(
SDumpA
rguments
*
arguments
)
{
assert
(
arguments
->
isDumpIn
);
int
tsize
=
0
;
...
...
src/query/inc/qsqltype.h
已删除
100644 → 0
浏览文件 @
4d83bb3e
/*
* 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/>.
*/
#ifndef TDENGINE_QSQLCMD_H
#define TDENGINE_QSQLCMD_H
#ifdef __cplusplus
extern
"C"
{
#endif
enum
_sql_type
{
TSDB_SQL_SELECT
=
1
,
TSDB_SQL_FETCH
,
TSDB_SQL_INSERT
,
TSDB_SQL_MGMT
,
// the SQL below is for mgmt node
TSDB_SQL_CREATE_DB
,
TSDB_SQL_CREATE_TABLE
,
TSDB_SQL_DROP_DB
,
TSDB_SQL_DROP_TABLE
,
TSDB_SQL_CREATE_ACCT
,
TSDB_SQL_CREATE_USER
,
// 10
TSDB_SQL_DROP_ACCT
,
TSDB_SQL_DROP_USER
,
TSDB_SQL_ALTER_USER
,
TSDB_SQL_ALTER_ACCT
,
TSDB_SQL_ALTER_TABLE
,
TSDB_SQL_ALTER_DB
,
TSDB_SQL_CREATE_MNODE
,
TSDB_SQL_DROP_MNODE
,
TSDB_SQL_CREATE_DNODE
,
TSDB_SQL_DROP_DNODE
,
// 20
TSDB_SQL_CFG_DNODE
,
TSDB_SQL_CFG_MNODE
,
TSDB_SQL_SHOW
,
TSDB_SQL_RETRIEVE
,
TSDB_SQL_KILL_QUERY
,
TSDB_SQL_KILL_STREAM
,
TSDB_SQL_KILL_CONNECTION
,
TSDB_SQL_READ
,
// SQL below is for read operation
TSDB_SQL_CONNECT
,
TSDB_SQL_USE_DB
,
// 30
TSDB_SQL_META
,
TSDB_SQL_STABLEVGROUP
,
TSDB_SQL_MULTI_META
,
TSDB_SQL_HB
,
TSDB_SQL_LOCAL
,
// SQL below for client local
TSDB_SQL_DESCRIBE_TABLE
,
TSDB_SQL_RETRIEVE_LOCALMERGE
,
TSDB_SQL_TABLE_JOIN_RETRIEVE
,
/*
* build empty result instead of accessing dnode to fetch result
* reset the client cache
*/
TSDB_SQL_RETRIEVE_EMPTY_RESULT
,
TSDB_SQL_RESET_CACHE
,
// 40
TSDB_SQL_SERV_STATUS
,
TSDB_SQL_CURRENT_DB
,
TSDB_SQL_SERV_VERSION
,
TSDB_SQL_CLI_VERSION
,
TSDB_SQL_CURRENT_USER
,
TSDB_SQL_CFG_LOCAL
,
TSDB_SQL_MAX
// 47
};
// create table operation type
enum
TSQL_TYPE
{
TSQL_CREATE_TABLE
=
0x1
,
TSQL_CREATE_STABLE
=
0x2
,
TSQL_CREATE_TABLE_FROM_STABLE
=
0x3
,
TSQL_CREATE_STREAM
=
0x4
,
};
#ifdef __cplusplus
}
#endif
#endif // TDENGINE_QSQLCMD_H
src/rpc/src/rpcMain.c
浏览文件 @
4ff1ca4b
...
...
@@ -1116,7 +1116,7 @@ static void rpcSendMsgToPeer(SRpcConn *pConn, void *msg, int msgLen) {
htonl
(
pHead
->
code
),
msgLen
,
pHead
->
sourceId
,
pHead
->
destId
,
pHead
->
tranId
);
}
tTrace
(
"connection type is: %d"
,
pConn
->
connType
);
//
tTrace("connection type is: %d", pConn->connType);
writtenLen
=
(
*
taosSendData
[
pConn
->
connType
])(
pConn
->
peerIp
,
pConn
->
peerPort
,
pHead
,
msgLen
,
pConn
->
chandle
);
if
(
writtenLen
!=
msgLen
)
{
...
...
src/tsdb/inc/tsdbMain.h
浏览文件 @
4ff1ca4b
...
...
@@ -216,15 +216,15 @@ typedef struct {
uint64_t
tombSize
;
// unused file size
uint32_t
totalBlocks
;
uint32_t
totalSubBlocks
;
}
SFileInfo
;
}
S
Tsdb
FileInfo
;
void
*
tsdbEncodeSFileInfo
(
void
*
buf
,
const
SFileInfo
*
pInfo
);
void
*
tsdbDecodeSFileInfo
(
void
*
buf
,
SFileInfo
*
pInfo
);
void
*
tsdbEncodeSFileInfo
(
void
*
buf
,
const
S
Tsdb
FileInfo
*
pInfo
);
void
*
tsdbDecodeSFileInfo
(
void
*
buf
,
S
Tsdb
FileInfo
*
pInfo
);
typedef
struct
{
int
fd
;
char
fname
[
128
];
SFileInfo
info
;
S
Tsdb
FileInfo
info
;
}
SFile
;
#define TSDB_IS_FILE_OPENED(f) ((f)->fd != -1)
...
...
@@ -357,7 +357,7 @@ SFileGroup *tsdbSearchFGroup(STsdbFileH *pFileH, int fid);
void
tsdbGetKeyRangeOfFileId
(
int32_t
daysPerFile
,
int8_t
precision
,
int32_t
fileId
,
TSKEY
*
minKey
,
TSKEY
*
maxKey
);
// TSDB repository definition
typedef
struct
_tsdb_r
epo
{
typedef
struct
STsdbR
epo
{
char
*
rootDir
;
// TSDB configuration
STsdbCfg
config
;
...
...
src/tsdb/src/tsdbRWHelper.c
浏览文件 @
4ff1ca4b
...
...
@@ -1256,7 +1256,7 @@ int tsdbUpdateFileHeader(SFile *pFile, uint32_t version) {
void
*
tsdbEncodeSFileInfo
(
void
*
buf
,
const
SFileInfo
*
pInfo
)
{
void
*
tsdbEncodeSFileInfo
(
void
*
buf
,
const
S
Tsdb
FileInfo
*
pInfo
)
{
buf
=
taosEncodeFixed32
(
buf
,
pInfo
->
offset
);
buf
=
taosEncodeFixed32
(
buf
,
pInfo
->
len
);
buf
=
taosEncodeFixed64
(
buf
,
pInfo
->
size
);
...
...
@@ -1267,7 +1267,7 @@ void *tsdbEncodeSFileInfo(void *buf, const SFileInfo *pInfo) {
return
buf
;
}
void
*
tsdbDecodeSFileInfo
(
void
*
buf
,
SFileInfo
*
pInfo
)
{
void
*
tsdbDecodeSFileInfo
(
void
*
buf
,
S
Tsdb
FileInfo
*
pInfo
)
{
buf
=
taosDecodeFixed32
(
buf
,
&
(
pInfo
->
offset
));
buf
=
taosDecodeFixed32
(
buf
,
&
(
pInfo
->
len
));
buf
=
taosDecodeFixed64
(
buf
,
&
(
pInfo
->
size
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录