Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
48507aec
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看板
提交
48507aec
编写于
12月 17, 2021
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-11818] support show databases;
上级
52347c07
变更
30
隐藏空白更改
内联
并排
Showing
30 changed file
with
465 addition
and
282 deletion
+465
-282
include/client/taos.h
include/client/taos.h
+2
-2
include/common/taosmsg.h
include/common/taosmsg.h
+2
-3
include/common/tmsgtype.h
include/common/tmsgtype.h
+1
-1
include/os/os.h
include/os/os.h
+1
-0
include/os/osSysinfo.h
include/os/osSysinfo.h
+7
-5
include/util/tmacro.h
include/util/tmacro.h
+0
-42
source/client/inc/clientInt.h
source/client/inc/clientInt.h
+11
-3
source/client/src/clientImpl.c
source/client/src/clientImpl.c
+62
-20
source/client/src/clientMain.c
source/client/src/clientMain.c
+121
-10
source/client/src/clientMsgHandler.c
source/client/src/clientMsgHandler.c
+63
-14
source/client/src/tscEnv.c
source/client/src/tscEnv.c
+6
-2
source/client/test/clientTests.cpp
source/client/test/clientTests.cpp
+52
-8
source/dnode/mnode/impl/src/mndCluster.c
source/dnode/mnode/impl/src/mndCluster.c
+4
-4
source/dnode/mnode/impl/src/mndDb.c
source/dnode/mnode/impl/src/mndDb.c
+19
-19
source/dnode/mnode/impl/src/mndDnode.c
source/dnode/mnode/impl/src/mndDnode.c
+15
-15
source/dnode/mnode/impl/src/mndFunc.c
source/dnode/mnode/impl/src/mndFunc.c
+8
-8
source/dnode/mnode/impl/src/mndMnode.c
source/dnode/mnode/impl/src/mndMnode.c
+9
-9
source/dnode/mnode/impl/src/mndProfile.c
source/dnode/mnode/impl/src/mndProfile.c
+37
-37
source/dnode/mnode/impl/src/mndStb.c
source/dnode/mnode/impl/src/mndStb.c
+6
-6
source/dnode/mnode/impl/src/mndSync.c
source/dnode/mnode/impl/src/mndSync.c
+0
-36
source/dnode/mnode/impl/src/mndUser.c
source/dnode/mnode/impl/src/mndUser.c
+4
-4
source/dnode/mnode/impl/src/mndVgroup.c
source/dnode/mnode/impl/src/mndVgroup.c
+8
-8
source/libs/parser/src/parser.c
source/libs/parser/src/parser.c
+7
-6
source/libs/query/src/querymsg.c
source/libs/query/src/querymsg.c
+2
-2
source/os/src/osSysinfo.c
source/os/src/osSysinfo.c
+5
-5
src/client/src/tscAsync.c
src/client/src/tscAsync.c
+3
-3
src/client/src/tscLocal.c
src/client/src/tscLocal.c
+1
-1
src/client/src/tscServer.c
src/client/src/tscServer.c
+5
-5
src/client/src/tscSql.c
src/client/src/tscSql.c
+3
-3
src/client/src/tscSubquery.c
src/client/src/tscSubquery.c
+1
-1
未找到文件。
include/client/taos.h
浏览文件 @
48507aec
...
...
@@ -80,8 +80,8 @@ typedef enum {
typedef
struct
taosField
{
char
name
[
65
];
uint8_t
type
;
int
16
_t
bytes
;
int8_t
type
;
int
32
_t
bytes
;
}
TAOS_FIELD
;
#ifdef _TD_GO_DLL_
...
...
include/common/taosmsg.h
浏览文件 @
48507aec
...
...
@@ -572,14 +572,13 @@ typedef struct {
}
SRetrieveTableMsg
;
typedef
struct
SRetrieveTableRsp
{
int32_t
numOfRows
;
int64_t
offset
;
// updated offset value for multi-vnode projection query
int64_t
useconds
;
int8_t
completed
;
// all results are returned to client
int8_t
precision
;
int8_t
compressed
;
int8_t
reserved
;
int32_t
compLen
;
int32_t
numOfRows
;
char
data
[];
}
SRetrieveTableRsp
;
...
...
include/common/tmsgtype.h
浏览文件 @
48507aec
...
...
@@ -62,7 +62,7 @@ enum {
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_RETRIEVE
_MNODE
,
"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"
)
...
...
include/os/os.h
浏览文件 @
48507aec
...
...
@@ -46,6 +46,7 @@ extern "C" {
#include <math.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/utsname.h>
#include <dirent.h>
#include <unistd.h>
...
...
include/os/osSysinfo.h
浏览文件 @
48507aec
...
...
@@ -20,6 +20,8 @@
extern
"C"
{
#endif
#include "os.h"
#define TSDB_LOCALE_LEN 64
#define TSDB_TIMEZONE_LEN 96
...
...
@@ -57,11 +59,11 @@ char * taosGetCmdlineByPID(int pid);
void
taosSetCoreDump
(
bool
enable
);
typedef
struct
{
c
onst
char
*
sysname
;
c
onst
char
*
nodename
;
c
onst
char
*
release
;
c
onst
char
*
version
;
c
onst
char
*
machine
;
c
har
sysname
[
_UTSNAME_MACHINE_LENGTH
]
;
c
har
nodename
[
_UTSNAME_MACHINE_LENGTH
]
;
c
har
release
[
_UTSNAME_MACHINE_LENGTH
]
;
c
har
version
[
_UTSNAME_MACHINE_LENGTH
]
;
c
har
machine
[
_UTSNAME_MACHINE_LENGTH
]
;
}
SysNameInfo
;
SysNameInfo
taosGetSysNameInfo
();
...
...
include/util/tmacro.h
已删除
100644 → 0
浏览文件 @
52347c07
/*
* 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 _TD_UTIL_MACRO_H_
#define _TD_UTIL_MACRO_H_
#include "os.h"
#ifdef __cplusplus
extern
"C"
{
#endif
// Module init/clear MACRO definitions
#define TD_MOD_UNINITIALIZED 0
#define TD_MOD_INITIALIZED 1
#define TD_MOD_UNCLEARD 0
#define TD_MOD_CLEARD 1
typedef
int8_t
td_mode_flag_t
;
#define TD_CHECK_AND_SET_MODE_INIT(FLAG) atomic_val_compare_exchange_8((FLAG), TD_MOD_UNINITIALIZED, TD_MOD_INITIALIZED)
#define TD_CHECK_AND_SET_MOD_CLEAR(FLAG) atomic_val_compare_exchange_8((FLAG), TD_MOD_UNCLEARD, TD_MOD_CLEARD)
#ifdef __cplusplus
}
#endif
#endif
/*_TD_UTIL_MACRO_H_*/
\ No newline at end of file
source/client/inc/clientInt.h
浏览文件 @
48507aec
...
...
@@ -20,8 +20,8 @@
extern
"C"
{
#endif
#include <common.h>
#include "taos.h"
#include "common.h"
#include "taosmsg.h"
#include "tdef.h"
#include "tep.h"
...
...
@@ -88,9 +88,15 @@ typedef struct STscObj {
}
STscObj
;
typedef
struct
SClientResultInfo
{
SSDataBlock
*
pData
;
TAOS_FIELD
*
resultFields
;
const
char
*
pMsg
;
const
char
*
pData
;
TAOS_FIELD
*
fields
;
int32_t
numOfCols
;
int32_t
numOfRows
;
int32_t
current
;
int32_t
*
length
;
TAOS_ROW
row
;
char
**
pCol
;
}
SClientResultInfo
;
typedef
struct
SReqBody
{
...
...
@@ -98,6 +104,7 @@ typedef struct SReqBody {
void
*
fp
;
void
*
param
;
int32_t
paramLen
;
int64_t
execId
;
// showId/queryId
SClientResultInfo
*
pResInfo
;
}
SRequestBody
;
...
...
@@ -152,6 +159,7 @@ TAOS *taos_connect_internal(const char *ip, const char *user, const char *pass,
TAOS_RES
*
taos_query_l
(
TAOS
*
taos
,
const
char
*
sql
,
int
sqlLen
);
void
*
doFetchRow
(
SRequestObj
*
pRequest
);
void
setResultDataPtr
(
SClientResultInfo
*
pResultInfo
,
TAOS_FIELD
*
pFields
,
int32_t
numOfCols
,
int32_t
numOfRows
);
#ifdef __cplusplus
}
...
...
source/client/src/clientImpl.c
浏览文件 @
48507aec
...
...
@@ -12,7 +12,7 @@
static
int32_t
initEpSetFromCfg
(
const
char
*
firstEp
,
const
char
*
secondEp
,
SCorEpSet
*
pEpSet
);
static
int32_t
buildConnectMsg
(
SRequestObj
*
pRequest
,
SRequestMsgBody
*
pMsgBody
);
static
void
destroy
ConnectMsg
(
SRequestMsgBody
*
pMsgBody
);
static
void
destroy
RequestMsgBody
(
SRequestMsgBody
*
pMsgBody
);
static
int32_t
sendMsgToServer
(
void
*
pTransporter
,
SEpSet
*
epSet
,
const
SRequestMsgBody
*
pBody
,
int64_t
*
pTransporterId
);
...
...
@@ -99,17 +99,19 @@ TAOS *taos_connect_internal(const char *ip, const char *user, const char *pass,
char
*
key
=
getClusterKey
(
user
,
secretEncrypt
,
ip
,
port
);
SAppInstInfo
*
pInst
=
taosHashGet
(
appInfo
.
pInstMap
,
key
,
strlen
(
key
));
SAppInstInfo
*
*
pInst
=
taosHashGet
(
appInfo
.
pInstMap
,
key
,
strlen
(
key
));
if
(
pInst
==
NULL
)
{
pInst
=
calloc
(
1
,
sizeof
(
struct
SAppInstInfo
));
SAppInstInfo
*
p
=
calloc
(
1
,
sizeof
(
struct
SAppInstInfo
));
pInst
->
mgmtEp
=
epSet
;
pInst
->
pTransporter
=
openTransporter
(
user
,
secretEncrypt
);
p
->
mgmtEp
=
epSet
;
p
->
pTransporter
=
openTransporter
(
user
,
secretEncrypt
);
taosHashPut
(
appInfo
.
pInstMap
,
key
,
strlen
(
key
),
&
p
,
POINTER_BYTES
);
taosHashPut
(
appInfo
.
pInstMap
,
key
,
strlen
(
key
),
&
pInst
,
POINTER_BYTES
)
;
pInst
=
&
p
;
}
return
taosConnectImpl
(
ip
,
user
,
&
secretEncrypt
[
0
],
db
,
port
,
NULL
,
NULL
,
pInst
);
tfree
(
key
);
return
taosConnectImpl
(
ip
,
user
,
&
secretEncrypt
[
0
],
db
,
port
,
NULL
,
NULL
,
*
pInst
);
}
TAOS_RES
*
taos_query_l
(
TAOS
*
taos
,
const
char
*
sql
,
int
sqlLen
)
{
...
...
@@ -163,7 +165,7 @@ TAOS_RES *taos_query_l(TAOS *taos, const char *sql, int sqlLen) {
sendMsgToServer
(
pTscObj
->
pTransporter
,
&
pTscObj
->
pAppInfo
->
mgmtEp
.
epSet
,
&
body
,
&
transporterId
);
tsem_wait
(
&
pRequest
->
body
.
rspSem
);
destroy
ConnectMsg
(
&
body
);
destroy
RequestMsgBody
(
&
body
);
}
else
{
assert
(
0
);
}
...
...
@@ -234,7 +236,7 @@ STscObj* taosConnectImpl(const char *ip, const char *user, const char *auth, con
sendMsgToServer
(
pTscObj
->
pTransporter
,
&
pTscObj
->
pAppInfo
->
mgmtEp
.
epSet
,
&
body
,
&
transporterId
);
tsem_wait
(
&
pRequest
->
body
.
rspSem
);
destroy
ConnectMsg
(
&
body
);
destroy
RequestMsgBody
(
&
body
);
if
(
pRequest
->
code
!=
TSDB_CODE_SUCCESS
)
{
const
char
*
errorMsg
=
(
pRequest
->
code
==
TSDB_CODE_RPC_FQDN_ERROR
)
?
taos_errstr
(
pRequest
)
:
tstrerror
(
terrno
);
...
...
@@ -281,7 +283,7 @@ static int32_t buildConnectMsg(SRequestObj *pRequest, SRequestMsgBody* pMsgBody)
return
0
;
}
static
void
destroy
ConnectMsg
(
SRequestMsgBody
*
pMsgBody
)
{
static
void
destroy
RequestMsgBody
(
SRequestMsgBody
*
pMsgBody
)
{
assert
(
pMsgBody
!=
NULL
);
tfree
(
pMsgBody
->
pData
);
}
...
...
@@ -337,7 +339,14 @@ void processMsgFromServer(void* parent, SRpcMsg* pMsg, SEpSet* pEpSet) {
tscDebug
(
"0x%"
PRIx64
" message:%s, code:%s rspLen:%d, elapsed:%"
PRId64
" ms"
,
pRequest
->
requestId
,
taosMsg
[
pMsg
->
msgType
],
tstrerror
(
pMsg
->
code
),
pMsg
->
contLen
,
pRequest
->
metric
.
rsp
-
pRequest
->
metric
.
start
);
if
(
handleRequestRspFp
[
pRequest
->
type
])
{
pMsg
->
code
=
(
*
handleRequestRspFp
[
pRequest
->
type
])(
pRequest
,
pMsg
->
pCont
,
pMsg
->
contLen
);
char
*
p
=
malloc
(
pMsg
->
contLen
);
if
(
p
==
NULL
)
{
pRequest
->
code
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
terrno
=
pRequest
->
code
;
}
else
{
memcpy
(
p
,
pMsg
->
pCont
,
pMsg
->
contLen
);
pMsg
->
code
=
(
*
handleRequestRspFp
[
pRequest
->
type
])(
pRequest
,
p
,
pMsg
->
contLen
);
}
}
}
else
{
tscError
(
"0x%"
PRIx64
" SQL cmd:%s, code:%s rspLen:%d, elapsed time:%"
PRId64
" ms"
,
pRequest
->
requestId
,
taosMsg
[
pMsg
->
msgType
],
...
...
@@ -381,15 +390,48 @@ void* doFetchRow(SRequestObj* pRequest) {
assert
(
pRequest
!=
NULL
);
SClientResultInfo
*
pResultInfo
=
pRequest
->
body
.
pResInfo
;
if
(
pResultInfo
==
NULL
||
pResultInfo
->
current
>=
pResultInfo
->
pData
->
info
.
rows
)
{
if
(
pResultInfo
==
NULL
)
{
pRequest
->
body
.
pResInfo
=
calloc
(
1
,
sizeof
(
SClientResultInfo
));
// pRequest->body.pResInfo.
if
(
pResultInfo
->
pData
==
NULL
||
pResultInfo
->
current
>=
pResultInfo
->
numOfRows
)
{
pRequest
->
type
=
TSDB_SQL_RETRIEVE_MNODE
;
SRequestMsgBody
body
=
{
0
};
buildRequestMsgFp
[
pRequest
->
type
](
pRequest
,
&
body
);
int64_t
transporterId
=
0
;
STscObj
*
pTscObj
=
pRequest
->
pTscObj
;
sendMsgToServer
(
pTscObj
->
pTransporter
,
&
pTscObj
->
pAppInfo
->
mgmtEp
.
epSet
,
&
body
,
&
transporterId
);
tsem_wait
(
&
pRequest
->
body
.
rspSem
);
destroyRequestMsgBody
(
&
body
);
pResultInfo
->
current
=
0
;
if
(
pResultInfo
->
numOfRows
<=
pResultInfo
->
current
)
{
return
NULL
;
}
}
for
(
int32_t
i
=
0
;
i
<
pResultInfo
->
numOfCols
;
++
i
)
{
pResultInfo
->
row
[
i
]
=
pResultInfo
->
pCol
[
i
]
+
pResultInfo
->
fields
[
i
].
bytes
*
pResultInfo
->
current
;
if
(
IS_VAR_DATA_TYPE
(
pResultInfo
->
fields
[
i
].
type
))
{
pResultInfo
->
length
[
i
]
=
varDataLen
(
pResultInfo
->
row
[
i
]);
pResultInfo
->
row
[
i
]
=
varDataVal
(
pResultInfo
->
row
[
i
]);
}
// current data set are exhausted, fetch more result from node
// if (pRes->row >= pRes->numOfRows && needToFetchNewBlock(pSql)) {
// taos_fetch_rows_a(res, waitForRetrieveRsp, pSql->pTscObj);
// tsem_wait(&pSql->rspSem);
// }
}
pResultInfo
->
current
+=
1
;
return
pResultInfo
->
row
;
}
void
setResultDataPtr
(
SClientResultInfo
*
pResultInfo
,
TAOS_FIELD
*
pFields
,
int32_t
numOfCols
,
int32_t
numOfRows
)
{
assert
(
numOfCols
>
0
&&
pFields
!=
NULL
&&
pResultInfo
!=
NULL
);
if
(
numOfRows
==
0
)
{
return
;
}
int32_t
offset
=
0
;
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
pResultInfo
->
length
[
i
]
=
pResultInfo
->
fields
[
i
].
bytes
;
pResultInfo
->
row
[
i
]
=
pResultInfo
->
pData
+
offset
*
pResultInfo
->
numOfRows
;
pResultInfo
->
pCol
[
i
]
=
pResultInfo
->
row
[
i
];
offset
+=
pResultInfo
->
fields
[
i
].
bytes
;
}
}
\ No newline at end of file
source/client/src/clientMain.c
浏览文件 @
48507aec
...
...
@@ -28,7 +28,6 @@ int taos_options(TSDB_OPTION option, const void *arg, ...) {
}
int
ret
=
taos_options_imp
(
option
,
(
const
char
*
)
arg
);
atomic_store_32
(
&
lock
,
0
);
return
ret
;
}
...
...
@@ -58,18 +57,18 @@ void taos_cleanup(void) {
}
TAOS
*
taos_connect
(
const
char
*
ip
,
const
char
*
user
,
const
char
*
pass
,
const
char
*
db
,
uint16_t
port
)
{
int32_t
p
=
(
port
!=
0
)
?
port
:
tsServerPort
;
int32_t
p
=
(
port
!=
0
)
?
port
:
tsServerPort
;
tscDebug
(
"try to connect to %s:%u, user:%s db:%s"
,
ip
,
p
,
user
,
db
);
if
(
user
==
NULL
)
{
user
=
TSDB_DEFAULT_USER
;
}
tscDebug
(
"try to connect to %s:%u, user:%s db:%s"
,
ip
,
p
,
user
,
db
);
if
(
user
==
NULL
)
{
user
=
TSDB_DEFAULT_USER
;
}
if
(
pass
==
NULL
)
{
pass
=
TSDB_DEFAULT_PASS
;
}
if
(
pass
==
NULL
)
{
pass
=
TSDB_DEFAULT_PASS
;
}
return
taos_connect_internal
(
ip
,
user
,
pass
,
NULL
,
db
,
p
);
return
taos_connect_internal
(
ip
,
user
,
pass
,
NULL
,
db
,
p
);
}
void
taos_close
(
TAOS
*
taos
)
{
...
...
@@ -110,6 +109,34 @@ void taos_free_result(TAOS_RES *res) {
destroyRequest
(
pRequest
);
}
int
taos_field_count
(
TAOS_RES
*
res
)
{
if
(
res
==
NULL
)
{
return
0
;
}
SRequestObj
*
pRequest
=
(
SRequestObj
*
)
res
;
SClientResultInfo
*
pResInfo
=
pRequest
->
body
.
pResInfo
;
if
(
pResInfo
==
NULL
)
{
return
0
;
}
return
pResInfo
->
numOfCols
;
}
int
taos_num_fields
(
TAOS_RES
*
res
)
{
return
taos_field_count
(
res
);
}
TAOS_FIELD
*
taos_fetch_fields
(
TAOS_RES
*
res
)
{
if
(
taos_num_fields
(
res
)
==
0
)
{
return
NULL
;
}
SClientResultInfo
*
pResInfo
=
((
SRequestObj
*
)
res
)
->
body
.
pResInfo
;
return
pResInfo
->
fields
;
}
TAOS_RES
*
taos_query
(
TAOS
*
taos
,
const
char
*
sql
)
{
if
(
taos
==
NULL
||
sql
==
NULL
)
{
return
NULL
;
...
...
@@ -131,3 +158,87 @@ TAOS_ROW taos_fetch_row(TAOS_RES *pRes) {
return
doFetchRow
(
pRequest
);
}
int
taos_print_row
(
char
*
str
,
TAOS_ROW
row
,
TAOS_FIELD
*
fields
,
int
num_fields
)
{
int32_t
len
=
0
;
for
(
int
i
=
0
;
i
<
num_fields
;
++
i
)
{
if
(
i
>
0
)
{
str
[
len
++
]
=
' '
;
}
if
(
row
[
i
]
==
NULL
)
{
len
+=
sprintf
(
str
+
len
,
"%s"
,
TSDB_DATA_NULL_STR
);
continue
;
}
switch
(
fields
[
i
].
type
)
{
case
TSDB_DATA_TYPE_TINYINT
:
len
+=
sprintf
(
str
+
len
,
"%d"
,
*
((
int8_t
*
)
row
[
i
]));
break
;
case
TSDB_DATA_TYPE_UTINYINT
:
len
+=
sprintf
(
str
+
len
,
"%u"
,
*
((
uint8_t
*
)
row
[
i
]));
break
;
case
TSDB_DATA_TYPE_SMALLINT
:
len
+=
sprintf
(
str
+
len
,
"%d"
,
*
((
int16_t
*
)
row
[
i
]));
break
;
case
TSDB_DATA_TYPE_USMALLINT
:
len
+=
sprintf
(
str
+
len
,
"%u"
,
*
((
uint16_t
*
)
row
[
i
]));
break
;
case
TSDB_DATA_TYPE_INT
:
len
+=
sprintf
(
str
+
len
,
"%d"
,
*
((
int32_t
*
)
row
[
i
]));
break
;
case
TSDB_DATA_TYPE_UINT
:
len
+=
sprintf
(
str
+
len
,
"%u"
,
*
((
uint32_t
*
)
row
[
i
]));
break
;
case
TSDB_DATA_TYPE_BIGINT
:
len
+=
sprintf
(
str
+
len
,
"%"
PRId64
,
*
((
int64_t
*
)
row
[
i
]));
break
;
case
TSDB_DATA_TYPE_UBIGINT
:
len
+=
sprintf
(
str
+
len
,
"%"
PRIu64
,
*
((
uint64_t
*
)
row
[
i
]));
break
;
case
TSDB_DATA_TYPE_FLOAT
:
{
float
fv
=
0
;
fv
=
GET_FLOAT_VAL
(
row
[
i
]);
len
+=
sprintf
(
str
+
len
,
"%f"
,
fv
);
}
break
;
case
TSDB_DATA_TYPE_DOUBLE
:
{
double
dv
=
0
;
dv
=
GET_DOUBLE_VAL
(
row
[
i
]);
len
+=
sprintf
(
str
+
len
,
"%lf"
,
dv
);
}
break
;
case
TSDB_DATA_TYPE_BINARY
:
case
TSDB_DATA_TYPE_NCHAR
:
{
int32_t
charLen
=
varDataLen
((
char
*
)
row
[
i
]
-
VARSTR_HEADER_SIZE
);
if
(
fields
[
i
].
type
==
TSDB_DATA_TYPE_BINARY
)
{
assert
(
charLen
<=
fields
[
i
].
bytes
&&
charLen
>=
0
);
}
else
{
assert
(
charLen
<=
fields
[
i
].
bytes
*
TSDB_NCHAR_SIZE
&&
charLen
>=
0
);
}
memcpy
(
str
+
len
,
row
[
i
],
charLen
);
len
+=
charLen
;
}
break
;
case
TSDB_DATA_TYPE_TIMESTAMP
:
len
+=
sprintf
(
str
+
len
,
"%"
PRId64
,
*
((
int64_t
*
)
row
[
i
]));
break
;
case
TSDB_DATA_TYPE_BOOL
:
len
+=
sprintf
(
str
+
len
,
"%d"
,
*
((
int8_t
*
)
row
[
i
]));
default:
break
;
}
}
return
len
;
}
source/client/src/clientMsgHandler.c
浏览文件 @
48507aec
...
...
@@ -529,7 +529,7 @@ int doBuildAndSendMsg(SSqlObj *pSql) {
if (pCmd->command == TSDB_SQL_SELECT ||
pCmd->command == TSDB_SQL_FETCH ||
pCmd->command == TSDB_SQL_RETRIEVE ||
pCmd->command == TSDB_SQL_RETRIEVE
_MNODE
||
pCmd->command == TSDB_SQL_INSERT ||
pCmd->command == TSDB_SQL_CONNECT ||
pCmd->command == TSDB_SQL_HB ||
...
...
@@ -2700,7 +2700,7 @@ int tscProcessRetrieveRspFromNode(SSqlObj *pSql) {
}
STableMetaInfo *pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0);
if ((pCmd->command == TSDB_SQL_RETRIEVE) ||
if ((pCmd->command == TSDB_SQL_RETRIEVE
_MNODE
) ||
((UTIL_TABLE_IS_CHILD_TABLE(pTableMetaInfo) || UTIL_TABLE_IS_NORMAL_TABLE(pTableMetaInfo)) &&
!TSDB_QUERY_HAS_TYPE(pQueryInfo->type, TSDB_QUERY_TYPE_SUBQUERY)) ||
(tscNonOrderedProjectionQueryOnSTable(pQueryInfo, 0) &&
...
...
@@ -3158,6 +3158,9 @@ int processConnectRsp(SRequestObj *pRequest, const char* pMsg, int32_t msgLen) {
pTscObj
->
pAppInfo
->
clusterId
=
pConnect
->
clusterId
;
atomic_add_fetch_64
(
&
pTscObj
->
pAppInfo
->
numOfConns
,
1
);
pRequest
->
body
.
pResInfo
=
calloc
(
1
,
sizeof
(
SClientResultInfo
));
pRequest
->
body
.
pResInfo
->
pMsg
=
pMsg
;
tscDebug
(
"0x%"
PRIx64
" clusterId:%d, totalConn:%"
PRId64
,
pRequest
->
requestId
,
pConnect
->
clusterId
,
pTscObj
->
pAppInfo
->
numOfConns
);
return
0
;
}
...
...
@@ -3217,26 +3220,70 @@ int32_t processShowRsp(SRequestObj *pRequest, const char* pMsg, int32_t msgLen)
SSchema
*
pSchema
=
pMetaMsg
->
pSchema
;
pMetaMsg
->
tuid
=
htobe64
(
pMetaMsg
->
tuid
);
for
(
int
i
=
0
;
i
<
pMetaMsg
->
numOfColumns
;
++
i
)
{
pSchema
->
bytes
=
hton
s
(
pSchema
->
bytes
);
pSchema
->
bytes
=
hton
l
(
pSchema
->
bytes
);
pSchema
++
;
}
STableMeta
*
pTableMeta
=
createTableMetaFromMsg
(
pMetaMsg
);
SSchema
*
pTableSchema
=
pTableMeta
->
schema
;
pSchema
=
pMetaMsg
->
pSchema
;
TAOS_FIELD
*
pFields
=
calloc
(
pMetaMsg
->
numOfColumns
,
sizeof
(
TAOS_FIELD
));
for
(
int32_t
i
=
0
;
i
<
pMetaMsg
->
numOfColumns
;
++
i
)
{
tstrncpy
(
pFields
[
i
].
name
,
pSchema
[
i
].
name
,
tListLen
(
pFields
[
i
].
name
));
pFields
[
i
].
type
=
pSchema
[
i
].
type
;
pFields
[
i
].
bytes
=
pSchema
[
i
].
bytes
;
}
TAOS_FIELD
*
pFields
=
calloc
(
1
,
pTableMeta
->
tableInfo
.
numOfColumns
);
for
(
int16_t
i
=
0
;
i
<
pTableMeta
->
tableInfo
.
numOfColumns
;
++
i
,
++
pSchema
)
{
tstrncpy
(
pFields
[
i
].
name
,
pTableSchema
[
i
].
name
,
tListLen
(
pFields
[
i
].
name
));
pFields
[
i
].
type
=
pTableSchema
[
i
].
type
;
pFields
[
i
].
bytes
=
pTableSchema
[
i
].
bytes
;
if
(
pRequest
->
body
.
pResInfo
==
NULL
)
{
pRequest
->
body
.
pResInfo
=
calloc
(
1
,
sizeof
(
SClientResultInfo
));
}
// pRequest->body.resultFields = pFields
;
// pRequest->body.numOfFields = pTableMeta->tableInfo.numOfColumns
;
pRequest
->
body
.
pResInfo
->
pMsg
=
pMsg
;
SClientResultInfo
*
pResInfo
=
pRequest
->
body
.
pResInfo
;
pResInfo
->
fields
=
pFields
;
pResInfo
->
numOfCols
=
pMetaMsg
->
numOfColumns
;
pResInfo
->
row
=
calloc
(
pResInfo
->
numOfCols
,
POINTER_BYTES
);
pResInfo
->
pCol
=
calloc
(
pResInfo
->
numOfCols
,
POINTER_BYTES
);
pResInfo
->
length
=
calloc
(
pResInfo
->
numOfCols
,
sizeof
(
int32_t
));
pRequest
->
body
.
execId
=
pShow
->
showId
;
return
0
;
}
int
buildRetrieveMnodeMsg
(
SRequestObj
*
pRequest
,
SRequestMsgBody
*
pMsgBody
)
{
pMsgBody
->
msgType
=
TSDB_MSG_TYPE_SHOW_RETRIEVE
;
pMsgBody
->
msgLen
=
sizeof
(
SRetrieveTableMsg
);
pMsgBody
->
requestObjRefId
=
pRequest
->
self
;
SRetrieveTableMsg
*
pRetrieveMsg
=
calloc
(
1
,
sizeof
(
SRetrieveTableMsg
));
pRetrieveMsg
->
showId
=
htonl
(
pRequest
->
body
.
execId
);
pMsgBody
->
pData
=
pRetrieveMsg
;
return
TSDB_CODE_SUCCESS
;
}
int32_t
processRetrieveMnodeRsp
(
SRequestObj
*
pRequest
,
const
char
*
pMsg
,
int32_t
msgLen
)
{
assert
(
msgLen
>=
sizeof
(
SRetrieveTableRsp
));
tfree
(
pRequest
->
body
.
pResInfo
->
pMsg
);
pRequest
->
body
.
pResInfo
->
pMsg
=
pMsg
;
SRetrieveTableRsp
*
pRetrieve
=
(
SRetrieveTableRsp
*
)
pMsg
;
pRetrieve
->
numOfRows
=
htonl
(
pRetrieve
->
numOfRows
);
pRetrieve
->
precision
=
htons
(
pRetrieve
->
precision
);
SClientResultInfo
*
pResInfo
=
pRequest
->
body
.
pResInfo
;
pResInfo
->
numOfRows
=
pRetrieve
->
numOfRows
;
pResInfo
->
pData
=
pRetrieve
->
data
;
// todo fix this in async model
pResInfo
->
current
=
0
;
setResultDataPtr
(
pResInfo
,
pResInfo
->
fields
,
pResInfo
->
numOfCols
,
pResInfo
->
numOfRows
);
tscDebug
(
"0x%"
PRIx64
" numOfRows:%d, complete:%d, qId:0x%"
PRIx64
,
pRequest
->
self
,
pRetrieve
->
numOfRows
,
pRetrieve
->
completed
,
pRequest
->
body
.
execId
);
return
0
;
}
void
initMsgHandleFp
()
{
#if 0
tscBuildMsg[TSDB_SQL_SELECT] = tscBuildQueryMsg;
...
...
@@ -3273,7 +3320,7 @@ void initMsgHandleFp() {
tscBuildMsg[TSDB_SQL_HB] = tscBuildHeartBeatMsg;
tscBuildMsg[TSDB_SQL_SHOW] = tscBuildShowMsg;
tscBuildMsg[TSDB_SQL_RETRIEVE] = tscBuildRetrieveFromMgmtMsg;
tscBuildMsg[TSDB_SQL_RETRIEVE
_MNODE
] = tscBuildRetrieveFromMgmtMsg;
tscBuildMsg[TSDB_SQL_KILL_QUERY] = tscBuildKillMsg;
tscBuildMsg[TSDB_SQL_KILL_STREAM] = tscBuildKillMsg;
tscBuildMsg[TSDB_SQL_KILL_CONNECTION] = tscBuildKillMsg;
...
...
@@ -3291,7 +3338,7 @@ void initMsgHandleFp() {
tscProcessMsgRsp[TSDB_SQL_RETRIEVE_FUNC] = tscProcessRetrieveFuncRsp;
tscProcessMsgRsp[TSDB_SQL_SHOW] = tscProcessShowRsp;
tscProcessMsgRsp[TSDB_SQL_RETRIEVE] = tscProcessRetrieveRspFromNode; // rsp handled by same function.
tscProcessMsgRsp[TSDB_SQL_RETRIEVE
_MNODE
] = tscProcessRetrieveRspFromNode; // rsp handled by same function.
tscProcessMsgRsp[TSDB_SQL_DESCRIBE_TABLE] = tscProcessDescribeTableRsp;
tscProcessMsgRsp[TSDB_SQL_CURRENT_DB] = tscProcessLocalRetrieveRsp;
...
...
@@ -3321,4 +3368,6 @@ void initMsgHandleFp() {
buildRequestMsgFp
[
TSDB_SQL_SHOW
]
=
buildShowMsg
;
handleRequestRspFp
[
TSDB_SQL_SHOW
]
=
processShowRsp
;
buildRequestMsgFp
[
TSDB_SQL_RETRIEVE_MNODE
]
=
buildRetrieveMnodeMsg
;
handleRequestRspFp
[
TSDB_SQL_RETRIEVE_MNODE
]
=
processRetrieveMnodeRsp
;
}
\ No newline at end of file
source/client/src/tscEnv.c
浏览文件 @
48507aec
...
...
@@ -127,8 +127,6 @@ void destroyTscObj(void *pObj) {
atomic_sub_fetch_64
(
&
pTscObj
->
pAppInfo
->
numOfConns
,
1
);
tscDebug
(
"connObj 0x%"
PRIx64
" destroyed, totalConn:%"
PRId64
,
pTscObj
->
id
,
pTscObj
->
pAppInfo
->
numOfConns
);
closeTransporter
(
pTscObj
);
pthread_mutex_destroy
(
&
pTscObj
->
mutex
);
tfree
(
pTscObj
);
}
...
...
@@ -190,6 +188,12 @@ static void doDestroyRequest(void* p) {
tfree
(
pRequest
->
sqlstr
);
tfree
(
pRequest
->
pInfo
);
if
(
pRequest
->
body
.
pResInfo
!=
NULL
)
{
tfree
(
pRequest
->
body
.
pResInfo
->
pData
);
tfree
(
pRequest
->
body
.
pResInfo
->
pMsg
);
tfree
(
pRequest
->
body
.
pResInfo
);
}
deregisterRequest
(
pRequest
);
tfree
(
pRequest
);
}
...
...
source/client/test/clientTests.cpp
浏览文件 @
48507aec
...
...
@@ -23,6 +23,7 @@
#pragma GCC diagnostic ignored "-Wunused-variable"
#pragma GCC diagnostic ignored "-Wsign-compare"
#include "../inc/clientInt.h"
#include "taos.h"
namespace
{
...
...
@@ -34,19 +35,62 @@ int main(int argc, char** argv) {
}
TEST
(
testCase
,
driverInit_Test
)
{
taos_init
();
}
TEST
(
testCase
,
connect_Test
)
{
TAOS
*
pConn
=
taos_connect
(
"ubuntu"
,
"root"
,
"taosdata"
,
NULL
,
0
);
assert
(
pConn
!=
NULL
);
taos_close
(
pConn
);
}
TEST
(
testCase
,
create_user_Test
)
{
TAOS
*
pConn
=
taos_connect
(
"ubuntu"
,
"root"
,
"taosdata"
,
NULL
,
0
);
assert
(
pConn
!=
NULL
);
// TAOS_RES* pRes = taos_query(pConn, "create user abc pass 'abc'");
// if (taos_errno(pRes) != TSDB_CODE_SUCCESS) {
// printf("failed to create user, reason:%s\n", taos_errstr(pRes));
TAOS_RES
*
pRes
=
taos_query
(
pConn
,
"create user abc pass 'abc'"
);
if
(
taos_errno
(
pRes
)
!=
TSDB_CODE_SUCCESS
)
{
printf
(
"failed to create user, reason:%s
\n
"
,
taos_errstr
(
pRes
));
}
taos_free_result
(
pRes
);
taos_close
(
pConn
);
}
//TEST(testCase, show_user_Test) {
// TAOS* pConn = taos_connect("ubuntu", "root", "taosdata", NULL, 0);
// assert(pConn != NULL);
//
// TAOS_RES* pRes = taos_query(pConn, "show users");
// TAOS_ROW pRow = NULL;
//
// TAOS_FIELD* pFields = taos_fetch_fields(pRes);
// int32_t numOfFields = taos_num_fields(pRes);
//
// char str[512] = {0};
// while((pRow = taos_fetch_row(pRes)) != NULL) {
// int32_t code = taos_print_row(str, pRow, pFields, numOfFields);
// printf("%s\n", str);
// }
//
// taos_free_result(pRes);
// taos_close(pConn);
//}
TEST
(
testCase
,
show_db_Test
)
{
TAOS
*
pConn
=
taos_connect
(
"ubuntu"
,
"root"
,
"taosdata"
,
NULL
,
0
);
assert
(
pConn
!=
NULL
);
TAOS_RES
*
pRes
=
taos_query
(
pConn
,
"show databases"
);
TAOS_ROW
pRow
=
NULL
;
TAOS_RES
*
pRes
=
taos_query
(
pConn
,
"show users"
);
TAOS_ROW
pRow
=
taos_fetch_row
(
pRes
);
assert
(
pRow
!=
NULL
);
TAOS_FIELD
*
pFields
=
taos_fetch_fields
(
pRes
);
int32_t
numOfFields
=
taos_num_fields
(
pRes
);
char
str
[
512
]
=
{
0
};
while
((
pRow
=
taos_fetch_row
(
pRes
))
!=
NULL
)
{
int32_t
code
=
taos_print_row
(
str
,
pRow
,
pFields
,
numOfFields
);
printf
(
"%s
\n
"
,
str
);
}
taos_close
(
pConn
);
}
\ No newline at end of file
}
source/dnode/mnode/impl/src/mndCluster.c
浏览文件 @
48507aec
...
...
@@ -143,22 +143,22 @@ static int32_t mndGetClusterMeta(SMnodeMsg *pMsg, SShowObj *pShow, STableMetaMsg
pShow
->
bytes
[
cols
]
=
4
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_INT
;
strcpy
(
pSchema
[
cols
].
name
,
"id"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
TSDB_CLUSTER_ID_LEN
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"name"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
8
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_TIMESTAMP
;
strcpy
(
pSchema
[
cols
].
name
,
"create_time"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pMeta
->
numOfColumns
=
hton
s
(
cols
);
pMeta
->
numOfColumns
=
hton
l
(
cols
);
strcpy
(
pMeta
->
tbFname
,
mndShowStr
(
pShow
->
type
));
pShow
->
numOfColumns
=
cols
;
...
...
source/dnode/mnode/impl/src/mndDb.c
浏览文件 @
48507aec
...
...
@@ -709,100 +709,100 @@ static int32_t mndGetDbMeta(SMnodeMsg *pMsg, SShowObj *pShow, STableMetaMsg *pMe
pShow
->
bytes
[
cols
]
=
(
TSDB_DB_NAME_LEN
-
1
)
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"name"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
8
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_TIMESTAMP
;
strcpy
(
pSchema
[
cols
].
name
,
"create
time"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
strcpy
(
pSchema
[
cols
].
name
,
"create
_
time"
);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
2
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_SMALLINT
;
strcpy
(
pSchema
[
cols
].
name
,
"replica"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
2
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_SMALLINT
;
strcpy
(
pSchema
[
cols
].
name
,
"quorum"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
2
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_SMALLINT
;
strcpy
(
pSchema
[
cols
].
name
,
"days"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
24
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"keep0,keep1,keep2"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
4
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_INT
;
strcpy
(
pSchema
[
cols
].
name
,
"cache
(MB)
"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
strcpy
(
pSchema
[
cols
].
name
,
"cache"
);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
4
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_INT
;
strcpy
(
pSchema
[
cols
].
name
,
"blocks"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
4
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_INT
;
strcpy
(
pSchema
[
cols
].
name
,
"minrows"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
4
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_INT
;
strcpy
(
pSchema
[
cols
].
name
,
"maxrows"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
1
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_TINYINT
;
strcpy
(
pSchema
[
cols
].
name
,
"wallevel"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
4
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_INT
;
strcpy
(
pSchema
[
cols
].
name
,
"fsync"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
1
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_TINYINT
;
strcpy
(
pSchema
[
cols
].
name
,
"comp"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
1
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_TINYINT
;
strcpy
(
pSchema
[
cols
].
name
,
"cachelast"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
3
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"precision"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
1
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_TINYINT
;
strcpy
(
pSchema
[
cols
].
name
,
"update"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pMeta
->
numOfColumns
=
hton
s
(
cols
);
pMeta
->
numOfColumns
=
hton
l
(
cols
);
pShow
->
numOfColumns
=
cols
;
pShow
->
offset
[
0
]
=
0
;
...
...
source/dnode/mnode/impl/src/mndDnode.c
浏览文件 @
48507aec
...
...
@@ -552,16 +552,16 @@ static int32_t mndGetConfigMeta(SMnodeMsg *pMsg, SShowObj *pShow, STableMetaMsg
pShow
->
bytes
[
cols
]
=
TSDB_CONFIG_OPTION_LEN
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
tstrncpy
(
pSchema
[
cols
].
name
,
"name"
,
sizeof
(
pSchema
[
cols
].
name
));
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
TSDB_CONIIG_VALUE_LEN
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
tstrncpy
(
pSchema
[
cols
].
name
,
"value"
,
sizeof
(
pSchema
[
cols
].
name
));
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pMeta
->
numOfColumns
=
hton
s
(
cols
);
pMeta
->
numOfColumns
=
hton
l
(
cols
);
pShow
->
numOfColumns
=
cols
;
pShow
->
offset
[
0
]
=
0
;
...
...
@@ -629,46 +629,46 @@ static int32_t mndGetDnodeMeta(SMnodeMsg *pMsg, SShowObj *pShow, STableMetaMsg *
pShow
->
bytes
[
cols
]
=
2
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_SMALLINT
;
strcpy
(
pSchema
[
cols
].
name
,
"id"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
TSDB_EP_LEN
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"end
point"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
strcpy
(
pSchema
[
cols
].
name
,
"endpoint"
);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
2
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_SMALLINT
;
strcpy
(
pSchema
[
cols
].
name
,
"vnodes"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
2
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_SMALLINT
;
strcpy
(
pSchema
[
cols
].
name
,
"max
vnodes"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
strcpy
(
pSchema
[
cols
].
name
,
"max
_
vnodes"
);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
10
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"status"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
8
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_TIMESTAMP
;
strcpy
(
pSchema
[
cols
].
name
,
"create
time"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
strcpy
(
pSchema
[
cols
].
name
,
"create
_
time"
);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
24
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"offline
reason"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
strcpy
(
pSchema
[
cols
].
name
,
"offline
_
reason"
);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pMeta
->
numOfColumns
=
hton
s
(
cols
);
pMeta
->
numOfColumns
=
hton
l
(
cols
);
pShow
->
numOfColumns
=
cols
;
pShow
->
offset
[
0
]
=
0
;
...
...
source/dnode/mnode/impl/src/mndFunc.c
浏览文件 @
48507aec
...
...
@@ -380,46 +380,46 @@ static int32_t mndGetFuncMeta(SMnodeMsg *pMsg, SShowObj *pShow, STableMetaMsg *p
pShow
->
bytes
[
cols
]
=
TSDB_FUNC_NAME_LEN
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"name"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
PATH_MAX
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"comment"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
4
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_INT
;
strcpy
(
pSchema
[
cols
].
name
,
"aggregate"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
TSDB_TYPE_STR_MAX_LEN
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"outputtype"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
8
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_TIMESTAMP
;
strcpy
(
pSchema
[
cols
].
name
,
"create_time"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
4
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_INT
;
strcpy
(
pSchema
[
cols
].
name
,
"code_len"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
4
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_INT
;
strcpy
(
pSchema
[
cols
].
name
,
"bufsize"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pMeta
->
numOfColumns
=
hton
s
(
cols
);
pMeta
->
numOfColumns
=
hton
l
(
cols
);
pShow
->
numOfColumns
=
cols
;
pShow
->
offset
[
0
]
=
0
;
...
...
source/dnode/mnode/impl/src/mndMnode.c
浏览文件 @
48507aec
...
...
@@ -368,34 +368,34 @@ static int32_t mndGetMnodeMeta(SMnodeMsg *pMsg, SShowObj *pShow, STableMetaMsg *
pShow
->
bytes
[
cols
]
=
2
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_SMALLINT
;
strcpy
(
pSchema
[
cols
].
name
,
"id"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
TSDB_EP_LEN
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"end
point"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
strcpy
(
pSchema
[
cols
].
name
,
"endpoint"
);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
12
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"role"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
8
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_TIMESTAMP
;
strcpy
(
pSchema
[
cols
].
name
,
"role
time"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
strcpy
(
pSchema
[
cols
].
name
,
"role
_
time"
);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
8
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_TIMESTAMP
;
strcpy
(
pSchema
[
cols
].
name
,
"create
time"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
strcpy
(
pSchema
[
cols
].
name
,
"create
_
time"
);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pMeta
->
numOfColumns
=
hton
s
(
cols
);
pMeta
->
numOfColumns
=
hton
l
(
cols
);
pShow
->
numOfColumns
=
cols
;
pShow
->
offset
[
0
]
=
0
;
...
...
source/dnode/mnode/impl/src/mndProfile.c
浏览文件 @
48507aec
...
...
@@ -474,48 +474,48 @@ static int32_t mndGetConnsMeta(SMnodeMsg *pMsg, SShowObj *pShow, STableMetaMsg *
pShow
->
bytes
[
cols
]
=
4
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_INT
;
strcpy
(
pSchema
[
cols
].
name
,
"connId"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
TSDB_USER_LEN
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"user"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
// app name
pShow
->
bytes
[
cols
]
=
TSDB_APP_NAME_LEN
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"program"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
// app pid
pShow
->
bytes
[
cols
]
=
4
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_INT
;
strcpy
(
pSchema
[
cols
].
name
,
"pid"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
TSDB_IPv4ADDR_LEN
+
6
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"ip:port"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
8
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_TIMESTAMP
;
strcpy
(
pSchema
[
cols
].
name
,
"login_time"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
8
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_TIMESTAMP
;
strcpy
(
pSchema
[
cols
].
name
,
"last_access"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pMeta
->
numOfColumns
=
hton
s
(
cols
);
pMeta
->
numOfColumns
=
hton
l
(
cols
);
pShow
->
numOfColumns
=
cols
;
pShow
->
offset
[
0
]
=
0
;
...
...
@@ -602,88 +602,88 @@ static int32_t mndGetQueryMeta(SMnodeMsg *pMsg, SShowObj *pShow, STableMetaMsg *
pShow
->
bytes
[
cols
]
=
4
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_INT
;
strcpy
(
pSchema
[
cols
].
name
,
"queryId"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
4
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_INT
;
strcpy
(
pSchema
[
cols
].
name
,
"connId"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
TSDB_USER_LEN
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"user"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
TSDB_IPv4ADDR_LEN
+
6
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"ip:port"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
24
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"qid"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
8
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_TIMESTAMP
;
strcpy
(
pSchema
[
cols
].
name
,
"created_time"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
8
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BIGINT
;
strcpy
(
pSchema
[
cols
].
name
,
"time"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
QUERY_OBJ_ID_SIZE
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"sql_obj_id"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
4
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_INT
;
strcpy
(
pSchema
[
cols
].
name
,
"pid"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
TSDB_EP_LEN
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"ep"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
1
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BOOL
;
strcpy
(
pSchema
[
cols
].
name
,
"stable_query"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
4
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_INT
;
strcpy
(
pSchema
[
cols
].
name
,
"sub_queries"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
TSDB_SHOW_SUBQUERY_LEN
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"sub_query_info"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
TSDB_SHOW_SQL_LEN
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"sql"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pMeta
->
numOfColumns
=
hton
s
(
cols
);
pMeta
->
numOfColumns
=
hton
l
(
cols
);
pShow
->
numOfColumns
=
cols
;
pShow
->
offset
[
0
]
=
0
;
...
...
@@ -818,64 +818,64 @@ static int32_t mndGetStreamMeta(SMnodeMsg *pMsg, SShowObj *pShow, STableMetaMsg
pShow
->
bytes
[
cols
]
=
4
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_INT
;
strcpy
(
pSchema
[
cols
].
name
,
"streamId"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
4
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_INT
;
strcpy
(
pSchema
[
cols
].
name
,
"connId"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
TSDB_USER_LEN
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"user"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
TSDB_TABLE_NAME_LEN
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"dest
table
"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
strcpy
(
pSchema
[
cols
].
name
,
"dest
ination
"
);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
TSDB_IPv4ADDR_LEN
+
6
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"ip:port"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
8
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_TIMESTAMP
;
strcpy
(
pSchema
[
cols
].
name
,
"create
d
time"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
strcpy
(
pSchema
[
cols
].
name
,
"create
_
time"
);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
8
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_TIMESTAMP
;
strcpy
(
pSchema
[
cols
].
name
,
"exec
time
"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
strcpy
(
pSchema
[
cols
].
name
,
"exec"
);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
8
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BIGINT
;
strcpy
(
pSchema
[
cols
].
name
,
"time(us)"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
TSDB_SHOW_SQL_LEN
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"sql"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
4
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_INT
;
strcpy
(
pSchema
[
cols
].
name
,
"cycles"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pMeta
->
numOfColumns
=
hton
s
(
cols
);
pMeta
->
numOfColumns
=
hton
l
(
cols
);
pShow
->
numOfColumns
=
cols
;
pShow
->
offset
[
0
]
=
0
;
...
...
source/dnode/mnode/impl/src/mndStb.c
浏览文件 @
48507aec
...
...
@@ -570,28 +570,28 @@ static int32_t mndGetStbMeta(SMnodeMsg *pMsg, SShowObj *pShow, STableMetaMsg *pM
pShow
->
bytes
[
cols
]
=
TSDB_TABLE_NAME_LEN
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"name"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
8
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_TIMESTAMP
;
strcpy
(
pSchema
[
cols
].
name
,
"create
time"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
strcpy
(
pSchema
[
cols
].
name
,
"create
_
time"
);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
2
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_SMALLINT
;
strcpy
(
pSchema
[
cols
].
name
,
"columns"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
2
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_SMALLINT
;
strcpy
(
pSchema
[
cols
].
name
,
"tags"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pMeta
->
numOfColumns
=
hton
s
(
cols
);
pMeta
->
numOfColumns
=
hton
l
(
cols
);
pShow
->
numOfColumns
=
cols
;
pShow
->
offset
[
0
]
=
0
;
...
...
source/dnode/mnode/impl/src/mndSync.c
已删除
100644 → 0
浏览文件 @
52347c07
/*
* 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 _DEFAULT_SOURCE
#include "os.h"
#include "mndInt.h"
#include "mndTrans.h"
int32_t
mndInitSync
(
SMnode
*
pMnode
)
{
return
0
;
}
void
mndCleanupSync
(
SMnode
*
pMnode
)
{}
int32_t
mndSyncPropose
(
SMnode
*
pMnode
,
SSdbRaw
*
pRaw
)
{
int32_t
code
=
0
;
// int32_t len = sdbGetRawTotalSize(pRaw);
// SSdbRaw *pReceived = calloc(1, len);
// memcpy(pReceived, pRaw, len);
// mDebug("trans:%d, data:%p recv from sync, code:0x%x pMsg:%p", pMsg->id, pReceived, code & 0xFFFF, pMsg);
// mndTransApply(pMnode, pReceived, code);
return
code
;
}
bool
mndIsMaster
(
SMnode
*
pMnode
)
{
return
true
;
}
\ No newline at end of file
source/dnode/mnode/impl/src/mndUser.c
浏览文件 @
48507aec
...
...
@@ -410,25 +410,25 @@ static int32_t mndGetUserMeta(SMnodeMsg *pMsg, SShowObj *pShow, STableMetaMsg *p
pShow
->
bytes
[
cols
]
=
TSDB_USER_LEN
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"name"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
10
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"privilege"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
8
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_TIMESTAMP
;
strcpy
(
pSchema
[
cols
].
name
,
"create time"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
TSDB_USER_LEN
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"account"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pMeta
->
numOfColumns
=
htonl
(
cols
);
...
...
source/dnode/mnode/impl/src/mndVgroup.c
浏览文件 @
48507aec
...
...
@@ -203,30 +203,30 @@ static int32_t mndGetVgroupMeta(SMnodeMsg *pMsg, SShowObj *pShow, STableMetaMsg
pShow
->
bytes
[
cols
]
=
4
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_INT
;
strcpy
(
pSchema
[
cols
].
name
,
"vgId"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
4
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_INT
;
strcpy
(
pSchema
[
cols
].
name
,
"tables"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
for
(
int32_t
i
=
0
;
i
<
pShow
->
replica
;
++
i
)
{
pShow
->
bytes
[
cols
]
=
4
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_SMALLINT
;
snprintf
(
pSchema
[
cols
].
name
,
TSDB_COL_NAME_LEN
,
"v%d_dnode"
,
i
+
1
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
9
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
snprintf
(
pSchema
[
cols
].
name
,
TSDB_COL_NAME_LEN
,
"v%d_status"
,
i
+
1
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
}
pMeta
->
numOfColumns
=
hton
s
(
cols
);
pMeta
->
numOfColumns
=
hton
l
(
cols
);
pShow
->
numOfColumns
=
cols
;
pShow
->
offset
[
0
]
=
0
;
...
...
@@ -309,16 +309,16 @@ static int32_t mndGetVnodeMeta(SMnodeMsg *pMsg, SShowObj *pShow, STableMetaMsg *
pShow
->
bytes
[
cols
]
=
4
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_INT
;
strcpy
(
pSchema
[
cols
].
name
,
"vgId"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
12
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"status"
);
pSchema
[
cols
].
bytes
=
hton
s
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
hton
l
(
pShow
->
bytes
[
cols
]);
cols
++
;
pMeta
->
numOfColumns
=
hton
s
(
cols
);
pMeta
->
numOfColumns
=
hton
l
(
cols
);
pShow
->
numOfColumns
=
cols
;
pShow
->
offset
[
0
]
=
0
;
...
...
source/libs/parser/src/parser.c
浏览文件 @
48507aec
...
...
@@ -32,12 +32,6 @@ bool qIsInsertSql(const char* pStr, size_t length) {
}
int32_t
qParseQuerySql
(
const
char
*
pStr
,
size_t
length
,
int64_t
id
,
int32_t
*
type
,
void
**
pOutput
,
int32_t
*
outputLen
,
char
*
msg
,
int32_t
msgLen
)
{
SQueryStmtInfo
*
pQueryInfo
=
calloc
(
1
,
sizeof
(
SQueryStmtInfo
));
if
(
pQueryInfo
==
NULL
)
{
terrno
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
// set correct error code.
return
terrno
;
}
SSqlInfo
info
=
doGenerateAST
(
pStr
);
if
(
!
info
.
valid
)
{
strncpy
(
msg
,
info
.
msg
,
msgLen
);
...
...
@@ -51,6 +45,12 @@ int32_t qParseQuerySql(const char* pStr, size_t length, int64_t id, int32_t *typ
// do nothing
}
}
else
{
SQueryStmtInfo
*
pQueryInfo
=
calloc
(
1
,
sizeof
(
SQueryStmtInfo
));
if
(
pQueryInfo
==
NULL
)
{
terrno
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
// set correct error code.
return
terrno
;
}
struct
SCatalog
*
pCatalog
=
NULL
;
int32_t
code
=
catalogGetHandle
(
NULL
,
&
pCatalog
);
code
=
qParserValidateSqlNode
(
pCatalog
,
&
info
,
pQueryInfo
,
id
,
msg
,
msgLen
);
...
...
@@ -59,6 +59,7 @@ int32_t qParseQuerySql(const char* pStr, size_t length, int64_t id, int32_t *typ
}
}
destroySqlInfo
(
&
info
);
return
TSDB_CODE_SUCCESS
;
}
...
...
source/libs/query/src/querymsg.c
浏览文件 @
48507aec
...
...
@@ -305,7 +305,7 @@ void msgInit() {
tscBuildMsg[TSDB_SQL_HB] = tscBuildHeartBeatMsg;
tscBuildMsg[TSDB_SQL_SHOW] = tscBuildShowMsg;
tscBuildMsg[TSDB_SQL_RETRIEVE] = tscBuildRetrieveFromMgmtMsg;
tscBuildMsg[TSDB_SQL_RETRIEVE
_MNODE
] = tscBuildRetrieveFromMgmtMsg;
tscBuildMsg[TSDB_SQL_KILL_QUERY] = tscBuildKillMsg;
tscBuildMsg[TSDB_SQL_KILL_STREAM] = tscBuildKillMsg;
tscBuildMsg[TSDB_SQL_KILL_CONNECTION] = tscBuildKillMsg;
...
...
@@ -323,7 +323,7 @@ void msgInit() {
tscProcessMsgRsp[TSDB_SQL_RETRIEVE_FUNC] = tscProcessRetrieveFuncRsp;
tscProcessMsgRsp[TSDB_SQL_SHOW] = tscProcessShowRsp;
tscProcessMsgRsp[TSDB_SQL_RETRIEVE] = tscProcessRetrieveRspFromNode; // rsp handled by same function.
tscProcessMsgRsp[TSDB_SQL_RETRIEVE
_MNODE
] = tscProcessRetrieveRspFromNode; // rsp handled by same function.
tscProcessMsgRsp[TSDB_SQL_DESCRIBE_TABLE] = tscProcessDescribeTableRsp;
tscProcessMsgRsp[TSDB_SQL_CURRENT_DB] = tscProcessLocalRetrieveRsp;
...
...
source/os/src/osSysinfo.c
浏览文件 @
48507aec
...
...
@@ -1120,11 +1120,11 @@ SysNameInfo taosGetSysNameInfo() {
struct
utsname
uts
;
if
(
!
uname
(
&
uts
))
{
info
.
sysname
=
strdup
(
uts
.
sysname
);
info
.
nodename
=
strdup
(
uts
.
nodename
);
info
.
release
=
strdup
(
uts
.
release
);
info
.
version
=
strdup
(
uts
.
version
);
info
.
machine
=
strdup
(
uts
.
machine
);
tstrncpy
(
info
.
sysname
,
uts
.
sysname
,
sizeof
(
info
.
sysname
)
);
tstrncpy
(
info
.
nodename
,
uts
.
nodename
,
sizeof
(
info
.
nodename
)
);
tstrncpy
(
info
.
release
,
uts
.
release
,
sizeof
(
info
.
release
)
);
tstrncpy
(
info
.
version
,
uts
.
version
,
sizeof
(
info
.
version
)
);
tstrncpy
(
info
.
machine
,
uts
.
machine
,
sizeof
(
info
.
machine
)
);
}
return
info
;
...
...
src/client/src/tscAsync.c
浏览文件 @
48507aec
...
...
@@ -183,7 +183,7 @@ static void tscProcessAsyncRetrieveImpl(void *param, TAOS_RES *tres, int numOfRo
pSql
->
fp
=
fp
;
if
(
pCmd
->
command
!=
TSDB_SQL_RETRIEVE_GLOBALMERGE
&&
pCmd
->
command
<
TSDB_SQL_LOCAL
)
{
pCmd
->
command
=
(
pCmd
->
command
>
TSDB_SQL_MGMT
)
?
TSDB_SQL_RETRIEVE
:
TSDB_SQL_FETCH
;
pCmd
->
command
=
(
pCmd
->
command
>
TSDB_SQL_MGMT
)
?
TSDB_SQL_RETRIEVE
_MNODE
:
TSDB_SQL_FETCH
;
}
if
(
pCmd
->
command
==
TSDB_SQL_TABLE_JOIN_RETRIEVE
)
{
...
...
@@ -265,7 +265,7 @@ void taos_fetch_rows_a(TAOS_RES *tres, __async_cb_func_t fp, void *param) {
}
return
;
}
else
if
(
pCmd
->
command
==
TSDB_SQL_RETRIEVE
||
pCmd
->
command
==
TSDB_SQL_RETRIEVE_GLOBALMERGE
)
{
}
else
if
(
pCmd
->
command
==
TSDB_SQL_RETRIEVE
_MNODE
||
pCmd
->
command
==
TSDB_SQL_RETRIEVE_GLOBALMERGE
)
{
// in case of show command, return no data
(
*
pSql
->
fetchFp
)(
param
,
pSql
,
0
);
}
else
{
...
...
@@ -273,7 +273,7 @@ void taos_fetch_rows_a(TAOS_RES *tres, __async_cb_func_t fp, void *param) {
}
}
else
{
// current query is not completed, continue retrieve from node
if
(
pCmd
->
command
!=
TSDB_SQL_RETRIEVE_GLOBALMERGE
&&
pCmd
->
command
<
TSDB_SQL_LOCAL
)
{
pCmd
->
command
=
(
pCmd
->
command
>
TSDB_SQL_MGMT
)
?
TSDB_SQL_RETRIEVE
:
TSDB_SQL_FETCH
;
pCmd
->
command
=
(
pCmd
->
command
>
TSDB_SQL_MGMT
)
?
TSDB_SQL_RETRIEVE
_MNODE
:
TSDB_SQL_FETCH
;
}
SQueryInfo
*
pQueryInfo1
=
tscGetQueryInfo
(
&
pSql
->
cmd
);
...
...
src/client/src/tscLocal.c
浏览文件 @
48507aec
...
...
@@ -322,7 +322,7 @@ TAOS_ROW tscFetchRow(void *param) {
// current data set are exhausted, fetch more data from node
if
(
pRes
->
row
>=
pRes
->
numOfRows
&&
(
pRes
->
completed
!=
true
||
hasMoreVnodesToTry
(
pSql
)
||
hasMoreClauseToTry
(
pSql
))
&&
(
pCmd
->
command
==
TSDB_SQL_RETRIEVE
||
(
pCmd
->
command
==
TSDB_SQL_RETRIEVE
_MNODE
||
pCmd
->
command
==
TSDB_SQL_RETRIEVE_GLOBALMERGE
||
pCmd
->
command
==
TSDB_SQL_TABLE_JOIN_RETRIEVE
||
pCmd
->
command
==
TSDB_SQL_FETCH
||
...
...
src/client/src/tscServer.c
浏览文件 @
48507aec
...
...
@@ -539,7 +539,7 @@ int doBuildAndSendMsg(SSqlObj *pSql) {
if
(
pCmd
->
command
==
TSDB_SQL_SELECT
||
pCmd
->
command
==
TSDB_SQL_FETCH
||
pCmd
->
command
==
TSDB_SQL_RETRIEVE
||
pCmd
->
command
==
TSDB_SQL_RETRIEVE
_MNODE
||
pCmd
->
command
==
TSDB_SQL_INSERT
||
pCmd
->
command
==
TSDB_SQL_CONNECT
||
pCmd
->
command
==
TSDB_SQL_HB
||
...
...
@@ -2749,7 +2749,7 @@ int tscProcessRetrieveRspFromNode(SSqlObj *pSql) {
}
STableMetaInfo
*
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
0
);
if
((
pCmd
->
command
==
TSDB_SQL_RETRIEVE
)
||
if
((
pCmd
->
command
==
TSDB_SQL_RETRIEVE
_MNODE
)
||
((
UTIL_TABLE_IS_CHILD_TABLE
(
pTableMetaInfo
)
||
UTIL_TABLE_IS_NORMAL_TABLE
(
pTableMetaInfo
))
&&
!
TSDB_QUERY_HAS_TYPE
(
pQueryInfo
->
type
,
TSDB_QUERY_TYPE_SUBQUERY
))
||
(
tscNonOrderedProjectionQueryOnSTable
(
pQueryInfo
,
0
)
&&
...
...
@@ -3174,7 +3174,7 @@ void tscInitMsgsFp() {
tscBuildMsg
[
TSDB_SQL_HB
]
=
tscBuildHeartBeatMsg
;
tscBuildMsg
[
TSDB_SQL_SHOW
]
=
tscBuildShowMsg
;
tscBuildMsg
[
TSDB_SQL_RETRIEVE
]
=
tscBuildRetrieveFromMgmtMsg
;
tscBuildMsg
[
TSDB_SQL_RETRIEVE
_MNODE
]
=
tscBuildRetrieveFromMgmtMsg
;
tscBuildMsg
[
TSDB_SQL_KILL_QUERY
]
=
tscBuildKillMsg
;
tscBuildMsg
[
TSDB_SQL_KILL_STREAM
]
=
tscBuildKillMsg
;
tscBuildMsg
[
TSDB_SQL_KILL_CONNECTION
]
=
tscBuildKillMsg
;
...
...
@@ -3192,7 +3192,7 @@ void tscInitMsgsFp() {
tscProcessMsgRsp
[
TSDB_SQL_RETRIEVE_FUNC
]
=
tscProcessRetrieveFuncRsp
;
tscProcessMsgRsp
[
TSDB_SQL_SHOW
]
=
tscProcessShowRsp
;
tscProcessMsgRsp
[
TSDB_SQL_RETRIEVE
]
=
tscProcessRetrieveRspFromNode
;
// rsp handled by same function.
tscProcessMsgRsp
[
TSDB_SQL_RETRIEVE
_MNODE
]
=
tscProcessRetrieveRspFromNode
;
// rsp handled by same function.
tscProcessMsgRsp
[
TSDB_SQL_DESCRIBE_TABLE
]
=
tscProcessDescribeTableRsp
;
tscProcessMsgRsp
[
TSDB_SQL_CURRENT_DB
]
=
tscProcessLocalRetrieveRsp
;
...
...
@@ -3214,7 +3214,7 @@ void tscInitMsgsFp() {
tscProcessMsgRsp
[
TSDB_SQL_SHOW_CREATE_DATABASE
]
=
tscProcessShowCreateRsp
;
tscKeepConn
[
TSDB_SQL_SHOW
]
=
1
;
tscKeepConn
[
TSDB_SQL_RETRIEVE
]
=
1
;
tscKeepConn
[
TSDB_SQL_RETRIEVE
_MNODE
]
=
1
;
tscKeepConn
[
TSDB_SQL_SELECT
]
=
1
;
tscKeepConn
[
TSDB_SQL_FETCH
]
=
1
;
tscKeepConn
[
TSDB_SQL_HB
]
=
1
;
...
...
src/client/src/tscSql.c
浏览文件 @
48507aec
...
...
@@ -460,7 +460,7 @@ static bool needToFetchNewBlock(SSqlObj* pSql) {
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
return
(
pRes
->
completed
!=
true
||
hasMoreVnodesToTry
(
pSql
)
||
hasMoreClauseToTry
(
pSql
))
&&
(
pCmd
->
command
==
TSDB_SQL_RETRIEVE
||
(
pCmd
->
command
==
TSDB_SQL_RETRIEVE
_MNODE
||
pCmd
->
command
==
TSDB_SQL_RETRIEVE_GLOBALMERGE
||
pCmd
->
command
==
TSDB_SQL_TABLE_JOIN_RETRIEVE
||
pCmd
->
command
==
TSDB_SQL_FETCH
||
...
...
@@ -582,10 +582,10 @@ static bool tscKillQueryInDnode(SSqlObj* pSql) {
if
(
pRes
->
code
==
TSDB_CODE_SUCCESS
&&
pRes
->
completed
==
false
&&
pSql
->
pStream
==
NULL
&&
(
pTableMetaInfo
->
pTableMeta
!=
NULL
)
&&
(
cmd
==
TSDB_SQL_SELECT
||
cmd
==
TSDB_SQL_SHOW
||
cmd
==
TSDB_SQL_RETRIEVE
||
cmd
==
TSDB_SQL_RETRIEVE
_MNODE
||
cmd
==
TSDB_SQL_FETCH
))
{
pQueryInfo
->
type
=
TSDB_QUERY_TYPE_FREE_RESOURCE
;
pCmd
->
command
=
(
pCmd
->
command
>
TSDB_SQL_MGMT
)
?
TSDB_SQL_RETRIEVE
:
TSDB_SQL_FETCH
;
pCmd
->
command
=
(
pCmd
->
command
>
TSDB_SQL_MGMT
)
?
TSDB_SQL_RETRIEVE
_MNODE
:
TSDB_SQL_FETCH
;
tscDebug
(
"0x%"
PRIx64
" send msg to dnode to free qhandle ASAP before free sqlObj, command:%s"
,
pSql
->
self
,
sqlCmd
[
pCmd
->
command
]);
tscBuildAndSendRequest
(
pSql
,
NULL
);
...
...
src/client/src/tscSubquery.c
浏览文件 @
48507aec
...
...
@@ -1670,7 +1670,7 @@ void tscFetchDatablockForSubquery(SSqlObj* pSql) {
pSql1
->
fp
=
joinRetrieveFinalResCallback
;
if
(
pCmd1
->
command
<
TSDB_SQL_LOCAL
)
{
pCmd1
->
command
=
(
pCmd1
->
command
>
TSDB_SQL_MGMT
)
?
TSDB_SQL_RETRIEVE
:
TSDB_SQL_FETCH
;
pCmd1
->
command
=
(
pCmd1
->
command
>
TSDB_SQL_MGMT
)
?
TSDB_SQL_RETRIEVE
_MNODE
:
TSDB_SQL_FETCH
;
}
tscBuildAndSendRequest
(
pSql1
,
NULL
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录