Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
66cfe3a3
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看板
提交
66cfe3a3
编写于
6月 22, 2022
作者:
D
dapan1121
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: show dnode variables
上级
4a8c9db8
变更
25
隐藏空白更改
内联
并排
Showing
25 changed file
with
461 addition
and
29 deletion
+461
-29
include/common/tmsg.h
include/common/tmsg.h
+8
-0
include/common/tmsgdef.h
include/common/tmsgdef.h
+2
-1
include/libs/nodes/cmdnodes.h
include/libs/nodes/cmdnodes.h
+4
-0
include/util/tconfig.h
include/util/tconfig.h
+2
-0
include/util/tdef.h
include/util/tdef.h
+2
-2
source/common/src/systable.c
source/common/src/systable.c
+8
-1
source/common/src/tmsg.c
source/common/src/tmsg.c
+26
-0
source/dnode/mgmt/mgmt_dnode/inc/dmInt.h
source/dnode/mgmt/mgmt_dnode/inc/dmInt.h
+1
-0
source/dnode/mgmt/mgmt_dnode/src/dmHandle.c
source/dnode/mgmt/mgmt_dnode/src/dmHandle.c
+129
-0
source/dnode/mgmt/mgmt_dnode/src/dmWorker.c
source/dnode/mgmt/mgmt_dnode/src/dmWorker.c
+3
-0
source/dnode/mgmt/node_mgmt/src/dmTransport.c
source/dnode/mgmt/node_mgmt/src/dmTransport.c
+1
-0
source/dnode/mnode/impl/src/mndDnode.c
source/dnode/mnode/impl/src/mndDnode.c
+8
-7
source/dnode/mnode/impl/src/mndMain.c
source/dnode/mnode/impl/src/mndMain.c
+1
-1
source/libs/catalog/inc/catalogInt.h
source/libs/catalog/inc/catalogInt.h
+2
-0
source/libs/catalog/src/ctgAsync.c
source/libs/catalog/src/ctgAsync.c
+58
-0
source/libs/catalog/src/ctgRemote.c
source/libs/catalog/src/ctgRemote.c
+16
-5
source/libs/catalog/src/ctgUtil.c
source/libs/catalog/src/ctgUtil.c
+12
-0
source/libs/command/src/command.c
source/libs/command/src/command.c
+81
-2
source/libs/executor/src/scanoperator.c
source/libs/executor/src/scanoperator.c
+6
-1
source/libs/parser/src/parAstParser.c
source/libs/parser/src/parAstParser.c
+3
-0
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+22
-1
source/libs/parser/src/parUtil.c
source/libs/parser/src/parUtil.c
+6
-1
source/libs/qcom/src/querymsg.c
source/libs/qcom/src/querymsg.c
+10
-4
source/util/src/tconfig.c
source/util/src/tconfig.c
+33
-1
tests/script/tsim/show/basic.sim
tests/script/tsim/show/basic.sim
+17
-2
未找到文件。
include/common/tmsg.h
浏览文件 @
66cfe3a3
...
...
@@ -834,6 +834,14 @@ typedef struct {
int32_t
tSerializeSQnodeListReq
(
void
*
buf
,
int32_t
bufLen
,
SQnodeListReq
*
pReq
);
int32_t
tDeserializeSQnodeListReq
(
void
*
buf
,
int32_t
bufLen
,
SQnodeListReq
*
pReq
);
typedef
struct
{
int32_t
rowNum
;
}
SDnodeListReq
;
int32_t
tSerializeSDnodeListReq
(
void
*
buf
,
int32_t
bufLen
,
SDnodeListReq
*
pReq
);
int32_t
tDeserializeSDnodeListReq
(
void
*
buf
,
int32_t
bufLen
,
SDnodeListReq
*
pReq
);
typedef
struct
SQueryNodeAddr
{
int32_t
nodeId
;
// vgId or qnodeId
SEpSet
epSet
;
...
...
include/common/tmsgdef.h
浏览文件 @
66cfe3a3
...
...
@@ -81,6 +81,7 @@ enum {
TD_DEF_MSG_TYPE
(
TDMT_DND_SERVER_STATUS
,
"server-status"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_DND_NET_TEST
,
"net-test"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_DND_CONFIG_DNODE
,
"config-dnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_DND_SYSTABLE_RETRIEVE
,
"dnode-retrieve"
,
NULL
,
NULL
)
TD_NEW_MSG_SEG
(
TDMT_MND_MSG
)
TD_DEF_MSG_TYPE
(
TDMT_MND_CONNECT
,
"connect"
,
NULL
,
NULL
)
...
...
@@ -152,7 +153,7 @@ enum {
TD_DEF_MSG_TYPE
(
TDMT_MND_HEARTBEAT
,
"heartbeat"
,
SClientHbBatchReq
,
SClientHbBatchRsp
)
TD_DEF_MSG_TYPE
(
TDMT_MND_STATUS
,
"status"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_SHOW
,
"show"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_SYSTABLE_RETRIEVE
,
"retrieve"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_SYSTABLE_RETRIEVE
,
"
mnd-
retrieve"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_GRANT
,
"grant"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_AUTH
,
"auth"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_APPLY_MSG
,
"mnode-apply"
,
NULL
,
NULL
)
...
...
include/libs/nodes/cmdnodes.h
浏览文件 @
66cfe3a3
...
...
@@ -36,6 +36,10 @@ extern "C" {
#define SHOW_CREATE_TB_RESULT_FIELD1_LEN (TSDB_TABLE_NAME_LEN + VARSTR_HEADER_SIZE)
#define SHOW_CREATE_TB_RESULT_FIELD2_LEN (TSDB_MAX_BINARY_LEN + VARSTR_HEADER_SIZE)
#define SHOW_LOCAL_VARIABLES_RESULT_COLS 2
#define SHOW_LOCAL_VARIABLES_RESULT_FIELD1_LEN (TSDB_CONFIG_OPTION_LEN + VARSTR_HEADER_SIZE)
#define SHOW_LOCAL_VARIABLES_RESULT_FIELD2_LEN (TSDB_CONFIG_VALUE_LEN + VARSTR_HEADER_SIZE)
#define PRIVILEGE_TYPE_MASK(n) (1 << n)
...
...
include/util/tconfig.h
浏览文件 @
66cfe3a3
...
...
@@ -104,6 +104,8 @@ int32_t cfgAddTimezone(SConfig *pCfg, const char *name, const char *defaultVal);
const
char
*
cfgStypeStr
(
ECfgSrcType
type
);
const
char
*
cfgDtypeStr
(
ECfgDataType
type
);
void
cfgDumpItemValue
(
SConfigItem
*
pItem
,
char
*
buf
,
int32_t
bufSize
,
int32_t
*
pLen
);
void
cfgDumpCfg
(
SConfig
*
pCfg
,
bool
tsc
,
bool
dump
);
int32_t
cfgGetApollUrl
(
const
char
**
envCmd
,
const
char
*
envFile
,
char
*
apolloUrl
);
...
...
include/util/tdef.h
浏览文件 @
66cfe3a3
...
...
@@ -443,8 +443,8 @@ enum {
#define VNODE_HANDLE -3
#define BNODE_HANDLE -4
#define TSDB_CONFIG_OPTION_LEN
16
#define TSDB_CON
IIG_VALUE_LEN 48
#define TSDB_CONFIG_OPTION_LEN
32
#define TSDB_CON
FIG_VALUE_LEN 64
#define TSDB_CONFIG_NUMBER 8
#define QUERY_ID_SIZE 20
...
...
source/common/src/systable.c
浏览文件 @
66cfe3a3
...
...
@@ -231,7 +231,13 @@ static const SSysDbTableSchema transSchema[] = {
static
const
SSysDbTableSchema
configSchema
[]
=
{
{.
name
=
"name"
,
.
bytes
=
TSDB_CONFIG_OPTION_LEN
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"value"
,
.
bytes
=
TSDB_CONIIG_VALUE_LEN
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"value"
,
.
bytes
=
TSDB_CONFIG_VALUE_LEN
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
};
static
const
SSysDbTableSchema
variablesSchema
[]
=
{
{.
name
=
"dnode_id"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
},
{.
name
=
"name"
,
.
bytes
=
TSDB_CONFIG_OPTION_LEN
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"value"
,
.
bytes
=
TSDB_CONFIG_VALUE_LEN
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
};
static
const
SSysTableMeta
infosMeta
[]
=
{
...
...
@@ -253,6 +259,7 @@ static const SSysTableMeta infosMeta[] = {
{
TSDB_INS_TABLE_LICENCES
,
grantsSchema
,
tListLen
(
grantsSchema
)},
{
TSDB_INS_TABLE_VGROUPS
,
vgroupsSchema
,
tListLen
(
vgroupsSchema
)},
{
TSDB_INS_TABLE_CONFIGS
,
configSchema
,
tListLen
(
configSchema
)},
{
TSDB_INS_TABLE_DNODE_VARIABLES
,
variablesSchema
,
tListLen
(
variablesSchema
)},
};
static
const
SSysDbTableSchema
connectionsSchema
[]
=
{
...
...
source/common/src/tmsg.c
浏览文件 @
66cfe3a3
...
...
@@ -2194,6 +2194,32 @@ int32_t tDeserializeSQnodeListReq(void *buf, int32_t bufLen, SQnodeListReq *pReq
return
0
;
}
int32_t
tSerializeSDnodeListReq
(
void
*
buf
,
int32_t
bufLen
,
SDnodeListReq
*
pReq
)
{
SEncoder
encoder
=
{
0
};
tEncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
rowNum
)
<
0
)
return
-
1
;
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
tEncoderClear
(
&
encoder
);
return
tlen
;
}
int32_t
tDeserializeSDnodeListReq
(
void
*
buf
,
int32_t
bufLen
,
SDnodeListReq
*
pReq
)
{
SDecoder
decoder
=
{
0
};
tDecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
rowNum
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tDecoderClear
(
&
decoder
);
return
0
;
}
int32_t
tSerializeSQnodeListRsp
(
void
*
buf
,
int32_t
bufLen
,
SQnodeListRsp
*
pRsp
)
{
SEncoder
encoder
=
{
0
};
tEncoderInit
(
&
encoder
,
buf
,
bufLen
);
...
...
source/dnode/mgmt/mgmt_dnode/inc/dmInt.h
浏览文件 @
66cfe3a3
...
...
@@ -45,6 +45,7 @@ int32_t dmProcessConfigReq(SDnodeMgmt *pMgmt, SRpcMsg *pMsg);
int32_t
dmProcessAuthRsp
(
SDnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
);
int32_t
dmProcessGrantRsp
(
SDnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
);
int32_t
dmProcessServerRunStatus
(
SDnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
);
int32_t
dmProcessRetrieve
(
SDnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
);
// dmWorker.c
int32_t
dmPutNodeMsgToMgmtQueue
(
SDnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
);
...
...
source/dnode/mgmt/mgmt_dnode/src/dmHandle.c
浏览文件 @
66cfe3a3
...
...
@@ -15,6 +15,10 @@
#define _DEFAULT_SOURCE
#include "dmInt.h"
#include "systable.h"
extern
SConfig
*
tsCfg
;
static
void
dmUpdateDnodeCfg
(
SDnodeMgmt
*
pMgmt
,
SDnodeCfg
*
pCfg
)
{
if
(
pMgmt
->
pData
->
dnodeId
==
0
||
pMgmt
->
pData
->
clusterId
==
0
)
{
...
...
@@ -175,6 +179,130 @@ int32_t dmProcessServerRunStatus(SDnodeMgmt *pMgmt, SRpcMsg *pMsg) {
return
0
;
}
SSDataBlock
*
dmBuildVariablesBlock
(
void
)
{
SSDataBlock
*
pBlock
=
taosMemoryCalloc
(
1
,
sizeof
(
SSDataBlock
));
size_t
size
=
0
;
const
SSysTableMeta
*
pMeta
=
NULL
;
getInfosDbMeta
(
&
pMeta
,
&
size
);
int32_t
index
=
0
;
for
(
int32_t
i
=
0
;
i
<
size
;
++
i
)
{
if
(
strcmp
(
pMeta
[
i
].
name
,
TSDB_INS_TABLE_DNODE_VARIABLES
)
==
0
)
{
index
=
i
;
break
;
}
}
pBlock
->
pDataBlock
=
taosArrayInit
(
pMeta
[
index
].
colNum
,
sizeof
(
SColumnInfoData
));
for
(
int32_t
i
=
0
;
i
<
pMeta
[
index
].
colNum
;
++
i
)
{
SColumnInfoData
colInfoData
=
{
0
};
colInfoData
.
info
.
colId
=
i
+
1
;
colInfoData
.
info
.
type
=
pMeta
[
index
].
schema
[
i
].
type
;
colInfoData
.
info
.
bytes
=
pMeta
[
index
].
schema
[
i
].
bytes
;
taosArrayPush
(
pBlock
->
pDataBlock
,
&
colInfoData
);
}
pBlock
->
info
.
numOfCols
=
pMeta
[
index
].
colNum
;
pBlock
->
info
.
hasVarCol
=
true
;
return
pBlock
;
}
int32_t
dmAppendVariablesToBlock
(
SSDataBlock
*
pBlock
,
int32_t
dnodeId
)
{
int32_t
numOfCfg
=
taosArrayGetSize
(
tsCfg
->
array
);
int32_t
numOfRows
=
0
;
blockDataEnsureCapacity
(
pBlock
,
numOfCfg
);
for
(
int32_t
i
=
0
,
c
=
0
;
i
<
numOfCfg
;
++
i
,
c
=
0
)
{
SConfigItem
*
pItem
=
taosArrayGet
(
tsCfg
->
array
,
i
);
SColumnInfoData
*
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
c
++
);
colDataAppend
(
pColInfo
,
i
,
(
const
char
*
)
&
dnodeId
,
false
);
char
name
[
TSDB_CONFIG_OPTION_LEN
+
VARSTR_HEADER_SIZE
]
=
{
0
};
STR_WITH_MAXSIZE_TO_VARSTR
(
name
,
pItem
->
name
,
TSDB_CONFIG_OPTION_LEN
+
VARSTR_HEADER_SIZE
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
c
++
);
colDataAppend
(
pColInfo
,
i
,
name
,
false
);
char
value
[
TSDB_CONFIG_VALUE_LEN
+
VARSTR_HEADER_SIZE
]
=
{
0
};
int32_t
valueLen
=
0
;
cfgDumpItemValue
(
pItem
,
&
value
[
VARSTR_HEADER_SIZE
],
TSDB_CONFIG_VALUE_LEN
,
&
valueLen
);
varDataSetLen
(
value
,
valueLen
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
c
++
);
colDataAppend
(
pColInfo
,
i
,
value
,
false
);
numOfRows
++
;
}
pBlock
->
info
.
rows
=
numOfRows
;
return
TSDB_CODE_SUCCESS
;
}
int32_t
dmProcessRetrieve
(
SDnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
)
{
int32_t
size
=
0
;
int32_t
rowsRead
=
0
;
SRetrieveTableReq
retrieveReq
=
{
0
};
if
(
tDeserializeSRetrieveTableReq
(
pMsg
->
pCont
,
pMsg
->
contLen
,
&
retrieveReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
return
-
1
;
}
if
(
strcasecmp
(
retrieveReq
.
tb
,
TSDB_INS_TABLE_DNODE_VARIABLES
))
{
terrno
=
TSDB_CODE_INVALID_MSG
;
return
-
1
;
}
SSDataBlock
*
pBlock
=
dmBuildVariablesBlock
();
dmAppendVariablesToBlock
(
pBlock
,
pMgmt
->
pData
->
dnodeId
);
size
=
sizeof
(
SRetrieveMetaTableRsp
)
+
sizeof
(
int32_t
)
+
sizeof
(
SSysTableSchema
)
*
pBlock
->
info
.
numOfCols
+
blockDataGetSize
(
pBlock
)
+
blockDataGetSerialMetaSize
(
pBlock
->
info
.
numOfCols
);
SRetrieveMetaTableRsp
*
pRsp
=
rpcMallocCont
(
size
);
if
(
pRsp
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
dError
(
"failed to retrieve data since %s"
,
terrstr
());
blockDataDestroy
(
pBlock
);
return
-
1
;
}
char
*
pStart
=
pRsp
->
data
;
*
(
int32_t
*
)
pStart
=
htonl
(
pBlock
->
info
.
numOfCols
);
pStart
+=
sizeof
(
int32_t
);
// number of columns
for
(
int32_t
i
=
0
;
i
<
pBlock
->
info
.
numOfCols
;
++
i
)
{
SSysTableSchema
*
pSchema
=
(
SSysTableSchema
*
)
pStart
;
SColumnInfoData
*
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
i
);
pSchema
->
bytes
=
htonl
(
pColInfo
->
info
.
bytes
);
pSchema
->
colId
=
htons
(
pColInfo
->
info
.
colId
);
pSchema
->
type
=
pColInfo
->
info
.
type
;
pStart
+=
sizeof
(
SSysTableSchema
);
}
int32_t
len
=
0
;
blockCompressEncode
(
pBlock
,
pStart
,
&
len
,
pBlock
->
info
.
numOfCols
,
false
);
pRsp
->
numOfRows
=
htonl
(
pBlock
->
info
.
rows
);
pRsp
->
precision
=
TSDB_TIME_PRECISION_MILLI
;
// millisecond time precision
pRsp
->
completed
=
1
;
pMsg
->
info
.
rsp
=
pRsp
;
pMsg
->
info
.
rspLen
=
size
;
dDebug
(
"dnode variables retrieve completed"
);
blockDataDestroy
(
pBlock
);
return
TSDB_CODE_SUCCESS
;
}
SArray
*
dmGetMsgHandles
()
{
int32_t
code
=
-
1
;
SArray
*
pArray
=
taosArrayInit
(
16
,
sizeof
(
SMgmtHandle
));
...
...
@@ -191,6 +319,7 @@ SArray *dmGetMsgHandles() {
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_DND_DROP_BNODE
,
dmPutNodeMsgToMgmtQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_DND_CONFIG_DNODE
,
dmPutNodeMsgToMgmtQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_DND_SERVER_STATUS
,
dmPutNodeMsgToMgmtQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_DND_SYSTABLE_RETRIEVE
,
dmPutNodeMsgToMgmtQueue
,
0
)
==
NULL
)
goto
_OVER
;
// Requests handled by MNODE
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_GRANT_RSP
,
dmPutNodeMsgToMgmtQueue
,
0
)
==
NULL
)
goto
_OVER
;
...
...
source/dnode/mgmt/mgmt_dnode/src/dmWorker.c
浏览文件 @
66cfe3a3
...
...
@@ -141,6 +141,9 @@ static void dmProcessMgmtQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) {
case
TDMT_DND_SERVER_STATUS
:
code
=
dmProcessServerRunStatus
(
pMgmt
,
pMsg
);
break
;
case
TDMT_DND_SYSTABLE_RETRIEVE
:
code
=
dmProcessRetrieve
(
pMgmt
,
pMsg
);
break
;
default:
terrno
=
TSDB_CODE_MSG_NOT_PROCESSED
;
break
;
...
...
source/dnode/mgmt/node_mgmt/src/dmTransport.c
浏览文件 @
66cfe3a3
...
...
@@ -85,6 +85,7 @@ static void dmProcessRpcMsg(SDnode *pDnode, SRpcMsg *pRpc, SEpSet *pEpSet) {
dmProcessNetTestReq
(
pDnode
,
pRpc
);
return
;
case
TDMT_MND_SYSTABLE_RETRIEVE_RSP
:
case
TDMT_DND_SYSTABLE_RETRIEVE_RSP
:
case
TDMT_VND_FETCH_RSP
:
qWorkerProcessFetchRsp
(
NULL
,
NULL
,
pRpc
,
0
);
return
;
...
...
source/dnode/mnode/impl/src/mndDnode.c
浏览文件 @
66cfe3a3
...
...
@@ -46,6 +46,7 @@ static SSdbRow *mndDnodeActionDecode(SSdbRaw *pRaw);
static
int32_t
mndDnodeActionInsert
(
SSdb
*
pSdb
,
SDnodeObj
*
pDnode
);
static
int32_t
mndDnodeActionDelete
(
SSdb
*
pSdb
,
SDnodeObj
*
pDnode
);
static
int32_t
mndDnodeActionUpdate
(
SSdb
*
pSdb
,
SDnodeObj
*
pOld
,
SDnodeObj
*
pNew
);
static
int32_t
mndProcessDnodeListReq
(
SRpcMsg
*
pReq
);
static
int32_t
mndProcessCreateDnodeReq
(
SRpcMsg
*
pReq
);
static
int32_t
mndProcessDropDnodeReq
(
SRpcMsg
*
pReq
);
...
...
@@ -734,28 +735,28 @@ static int32_t mndRetrieveConfigs(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *p
int32_t
totalRows
=
0
;
int32_t
numOfRows
=
0
;
char
*
cfgOpts
[
TSDB_CONFIG_NUMBER
]
=
{
0
};
char
cfgVals
[
TSDB_CONFIG_NUMBER
][
TSDB_CON
I
IG_VALUE_LEN
+
1
]
=
{
0
};
char
cfgVals
[
TSDB_CONFIG_NUMBER
][
TSDB_CON
F
IG_VALUE_LEN
+
1
]
=
{
0
};
char
*
pWrite
=
NULL
;
int32_t
cols
=
0
;
cfgOpts
[
totalRows
]
=
"statusInterval"
;
snprintf
(
cfgVals
[
totalRows
],
TSDB_CON
I
IG_VALUE_LEN
,
"%d"
,
tsStatusInterval
);
snprintf
(
cfgVals
[
totalRows
],
TSDB_CON
F
IG_VALUE_LEN
,
"%d"
,
tsStatusInterval
);
totalRows
++
;
cfgOpts
[
totalRows
]
=
"timezone"
;
snprintf
(
cfgVals
[
totalRows
],
TSDB_CON
I
IG_VALUE_LEN
,
"%s"
,
tsTimezoneStr
);
snprintf
(
cfgVals
[
totalRows
],
TSDB_CON
F
IG_VALUE_LEN
,
"%s"
,
tsTimezoneStr
);
totalRows
++
;
cfgOpts
[
totalRows
]
=
"locale"
;
snprintf
(
cfgVals
[
totalRows
],
TSDB_CON
I
IG_VALUE_LEN
,
"%s"
,
tsLocale
);
snprintf
(
cfgVals
[
totalRows
],
TSDB_CON
F
IG_VALUE_LEN
,
"%s"
,
tsLocale
);
totalRows
++
;
cfgOpts
[
totalRows
]
=
"charset"
;
snprintf
(
cfgVals
[
totalRows
],
TSDB_CON
I
IG_VALUE_LEN
,
"%s"
,
tsCharset
);
snprintf
(
cfgVals
[
totalRows
],
TSDB_CON
F
IG_VALUE_LEN
,
"%s"
,
tsCharset
);
totalRows
++
;
char
buf
[
TSDB_CONFIG_OPTION_LEN
+
VARSTR_HEADER_SIZE
]
=
{
0
};
char
bufVal
[
TSDB_CON
I
IG_VALUE_LEN
+
VARSTR_HEADER_SIZE
]
=
{
0
};
char
bufVal
[
TSDB_CON
F
IG_VALUE_LEN
+
VARSTR_HEADER_SIZE
]
=
{
0
};
for
(
int32_t
i
=
0
;
i
<
totalRows
;
i
++
)
{
cols
=
0
;
...
...
@@ -764,7 +765,7 @@ static int32_t mndRetrieveConfigs(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *p
SColumnInfoData
*
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
buf
,
false
);
STR_WITH_MAXSIZE_TO_VARSTR
(
bufVal
,
cfgVals
[
i
],
TSDB_CON
I
IG_VALUE_LEN
);
STR_WITH_MAXSIZE_TO_VARSTR
(
bufVal
,
cfgVals
[
i
],
TSDB_CON
F
IG_VALUE_LEN
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
bufVal
,
false
);
...
...
source/dnode/mnode/impl/src/mndMain.c
浏览文件 @
66cfe3a3
...
...
@@ -583,7 +583,7 @@ static int32_t mndCheckMnodeState(SRpcMsg *pMsg) {
static
int32_t
mndCheckMsgContent
(
SRpcMsg
*
pMsg
)
{
if
(
!
IsReq
(
pMsg
))
return
0
;
if
(
pMsg
->
contLen
!=
0
&&
pMsg
->
pCont
!=
NULL
)
return
0
;
const
STraceId
*
trace
=
&
pMsg
->
info
.
traceId
;
mGError
(
"msg:%p, failed to check msg, cont:%p contLen:%d, app:%p type:%s"
,
pMsg
,
pMsg
->
pCont
,
pMsg
->
contLen
,
pMsg
->
info
.
ahandle
,
TMSG_INFO
(
pMsg
->
msgType
));
...
...
source/libs/catalog/inc/catalogInt.h
浏览文件 @
66cfe3a3
...
...
@@ -65,6 +65,7 @@ enum {
typedef
enum
{
CTG_TASK_GET_QNODE
=
0
,
CTG_TASK_GET_DNODE
,
CTG_TASK_GET_DB_VGROUP
,
CTG_TASK_GET_DB_CFG
,
CTG_TASK_GET_DB_INFO
,
...
...
@@ -566,6 +567,7 @@ int32_t ctgGetTbHashVgroupFromCache(SCatalog *pCtg, const SName *pTableName, SVg
int32_t
ctgProcessRspMsg
(
void
*
out
,
int32_t
reqType
,
char
*
msg
,
int32_t
msgSize
,
int32_t
rspCode
,
char
*
target
);
int32_t
ctgGetDBVgInfoFromMnode
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
SBuildUseDBInput
*
input
,
SUseDbOutput
*
out
,
SCtgTask
*
pTask
);
int32_t
ctgGetQnodeListFromMnode
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
SArray
*
out
,
SCtgTask
*
pTask
);
int32_t
ctgGetDnodeListFromMnode
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
SArray
**
out
,
SCtgTask
*
pTask
);
int32_t
ctgGetDBCfgFromMnode
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
const
char
*
dbFName
,
SDbCfgInfo
*
out
,
SCtgTask
*
pTask
);
int32_t
ctgGetIndexInfoFromMnode
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
const
char
*
indexName
,
SIndexInfo
*
out
,
SCtgTask
*
pTask
);
int32_t
ctgGetTbIndexFromMnode
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
SName
*
name
,
STableIndex
*
out
,
SCtgTask
*
pTask
);
...
...
source/libs/catalog/src/ctgAsync.c
浏览文件 @
66cfe3a3
...
...
@@ -168,6 +168,21 @@ int32_t ctgInitGetQnodeTask(SCtgJob *pJob, int32_t taskIdx, void* param) {
return
TSDB_CODE_SUCCESS
;
}
int32_t
ctgInitGetDnodeTask
(
SCtgJob
*
pJob
,
int32_t
taskIdx
,
void
*
param
)
{
SCtgTask
task
=
{
0
};
task
.
type
=
CTG_TASK_GET_DNODE
;
task
.
taskId
=
taskIdx
;
task
.
pJob
=
pJob
;
task
.
taskCtx
=
NULL
;
taosArrayPush
(
pJob
->
pTasks
,
&
task
);
qDebug
(
"QID:0x%"
PRIx64
" the %d task type %s initialized"
,
pJob
->
queryId
,
taskIdx
,
ctgTaskTypeStr
(
task
.
type
));
return
TSDB_CODE_SUCCESS
;
}
int32_t
ctgInitGetIndexTask
(
SCtgJob
*
pJob
,
int32_t
taskIdx
,
void
*
param
)
{
char
*
name
=
(
char
*
)
param
;
SCtgTask
task
=
{
0
};
...
...
@@ -511,6 +526,10 @@ int32_t ctgInitJob(SCatalog* pCtg, SRequestConnInfo *pConn, SCtgJob** job, uint6
CTG_ERR_JRET
(
ctgInitTask
(
pJob
,
CTG_TASK_GET_QNODE
,
NULL
,
NULL
));
}
if
(
dnodeNum
)
{
CTG_ERR_JRET
(
ctgInitTask
(
pJob
,
CTG_TASK_GET_DNODE
,
NULL
,
NULL
));
}
pJob
->
refId
=
taosAddRef
(
gCtgMgmt
.
jobPool
,
pJob
);
if
(
pJob
->
refId
<
0
)
{
ctgError
(
"add job to ref failed, error: %s"
,
tstrerror
(
terrno
));
...
...
@@ -633,6 +652,22 @@ int32_t ctgDumpQnodeRes(SCtgTask* pTask) {
return
TSDB_CODE_SUCCESS
;
}
int32_t
ctgDumpDnodeRes
(
SCtgTask
*
pTask
)
{
SCtgJob
*
pJob
=
pTask
->
pJob
;
if
(
NULL
==
pJob
->
jobRes
.
pDnodeList
)
{
pJob
->
jobRes
.
pDnodeList
=
taosArrayInit
(
1
,
sizeof
(
SMetaRes
));
if
(
NULL
==
pJob
->
jobRes
.
pDnodeList
)
{
CTG_ERR_RET
(
TSDB_CODE_OUT_OF_MEMORY
);
}
}
SMetaRes
res
=
{.
code
=
pTask
->
code
,
.
pRes
=
pTask
->
res
};
taosArrayPush
(
pJob
->
jobRes
.
pDnodeList
,
&
res
);
return
TSDB_CODE_SUCCESS
;
}
int32_t
ctgDumpDbCfgRes
(
SCtgTask
*
pTask
)
{
SCtgJob
*
pJob
=
pTask
->
pJob
;
if
(
NULL
==
pJob
->
jobRes
.
pDbCfg
)
{
...
...
@@ -1038,6 +1073,19 @@ _return:
CTG_RET
(
code
);
}
int32_t
ctgHandleGetDnodeRsp
(
SCtgTask
*
pTask
,
int32_t
reqType
,
const
SDataBuf
*
pMsg
,
int32_t
rspCode
)
{
int32_t
code
=
0
;
CTG_ERR_JRET
(
ctgProcessRspMsg
(
&
pTask
->
msgCtx
.
out
,
reqType
,
pMsg
->
pData
,
pMsg
->
len
,
rspCode
,
pTask
->
msgCtx
.
target
));
TSWAP
(
pTask
->
res
,
pTask
->
msgCtx
.
out
);
_return:
ctgHandleTaskEnd
(
pTask
,
code
);
CTG_RET
(
code
);
}
int32_t
ctgHandleGetIndexRsp
(
SCtgTask
*
pTask
,
int32_t
reqType
,
const
SDataBuf
*
pMsg
,
int32_t
rspCode
)
{
int32_t
code
=
0
;
CTG_ERR_JRET
(
ctgProcessRspMsg
(
pTask
->
msgCtx
.
out
,
reqType
,
pMsg
->
pData
,
pMsg
->
len
,
rspCode
,
pTask
->
msgCtx
.
target
));
...
...
@@ -1313,6 +1361,15 @@ int32_t ctgLaunchGetQnodeTask(SCtgTask *pTask) {
return
TSDB_CODE_SUCCESS
;
}
int32_t
ctgLaunchGetDnodeTask
(
SCtgTask
*
pTask
)
{
SCatalog
*
pCtg
=
pTask
->
pJob
->
pCtg
;
SRequestConnInfo
*
pConn
=
&
pTask
->
pJob
->
conn
;
CTG_ERR_RET
(
ctgGetDnodeListFromMnode
(
pCtg
,
pConn
,
NULL
,
pTask
));
return
TSDB_CODE_SUCCESS
;
}
int32_t
ctgLaunchGetDbCfgTask
(
SCtgTask
*
pTask
)
{
SCatalog
*
pCtg
=
pTask
->
pJob
->
pCtg
;
SRequestConnInfo
*
pConn
=
&
pTask
->
pJob
->
conn
;
...
...
@@ -1464,6 +1521,7 @@ int32_t ctgCloneDbVg(SCtgTask* pTask, void** pRes) {
SCtgAsyncFps
gCtgAsyncFps
[]
=
{
{
ctgInitGetQnodeTask
,
ctgLaunchGetQnodeTask
,
ctgHandleGetQnodeRsp
,
ctgDumpQnodeRes
,
NULL
,
NULL
},
{
ctgInitGetDnodeTask
,
ctgLaunchGetDnodeTask
,
ctgHandleGetDnodeRsp
,
ctgDumpDnodeRes
,
NULL
,
NULL
},
{
ctgInitGetDbVgTask
,
ctgLaunchGetDbVgTask
,
ctgHandleGetDbVgRsp
,
ctgDumpDbVgRes
,
ctgCompDbVgTasks
,
ctgCloneDbVg
},
{
ctgInitGetDbCfgTask
,
ctgLaunchGetDbCfgTask
,
ctgHandleGetDbCfgRsp
,
ctgDumpDbCfgRes
,
NULL
,
NULL
},
{
ctgInitGetDbInfoTask
,
ctgLaunchGetDbInfoTask
,
ctgHandleGetDbInfoRsp
,
ctgDumpDbInfoRes
,
NULL
,
NULL
},
...
...
source/libs/catalog/src/ctgRemote.c
浏览文件 @
66cfe3a3
...
...
@@ -40,6 +40,21 @@ int32_t ctgProcessRspMsg(void* out, int32_t reqType, char* msg, int32_t msgSize,
qDebug
(
"Got qnode list from mnode, listNum:%d"
,
(
int32_t
)
taosArrayGetSize
(
out
));
break
;
}
case
TDMT_MND_DNODE_LIST
:
{
if
(
TSDB_CODE_SUCCESS
!=
rspCode
)
{
qError
(
"error rsp for dnode list, error:%s"
,
tstrerror
(
rspCode
));
CTG_ERR_RET
(
rspCode
);
}
code
=
queryProcessMsgRsp
[
TMSG_INDEX
(
reqType
)](
out
,
msg
,
msgSize
);
if
(
code
)
{
qError
(
"Process dnode list rsp failed, error:%s"
,
tstrerror
(
rspCode
));
CTG_ERR_RET
(
code
);
}
qDebug
(
"Got dnode list from mnode, listNum:%d"
,
(
int32_t
)
taosArrayGetSize
(
*
(
SArray
**
)
out
));
break
;
}
case
TDMT_MND_USE_DB
:
{
if
(
TSDB_CODE_SUCCESS
!=
rspCode
)
{
qError
(
"error rsp for use db, error:%s, dbFName:%s"
,
tstrerror
(
rspCode
),
target
);
...
...
@@ -361,11 +376,7 @@ int32_t ctgGetDnodeListFromMnode(SCatalog* pCtg, SRequestConnInfo *pConn, SArray
}
if
(
pTask
)
{
void
*
pOut
=
taosArrayInit
(
4
,
sizeof
(
SQueryNodeLoad
));
if
(
NULL
==
pOut
)
{
CTG_ERR_RET
(
TSDB_CODE_OUT_OF_MEMORY
);
}
CTG_ERR_RET
(
ctgUpdateMsgCtx
(
&
pTask
->
msgCtx
,
reqType
,
pOut
,
NULL
));
CTG_ERR_RET
(
ctgUpdateMsgCtx
(
&
pTask
->
msgCtx
,
reqType
,
NULL
,
NULL
));
CTG_RET
(
ctgAsyncSendMsg
(
pCtg
,
pConn
,
pTask
,
reqType
,
msg
,
msgLen
));
}
...
...
source/libs/catalog/src/ctgUtil.c
浏览文件 @
66cfe3a3
...
...
@@ -23,6 +23,8 @@ char *ctgTaskTypeStr(CTG_TASK_TYPE type) {
switch
(
type
)
{
case
CTG_TASK_GET_QNODE
:
return
"[get qnode list]"
;
case
CTG_TASK_GET_DNODE
:
return
"[get dnode list]"
;
case
CTG_TASK_GET_DB_VGROUP
:
return
"[get db vgroup]"
;
case
CTG_TASK_GET_DB_CFG
:
...
...
@@ -349,6 +351,11 @@ void ctgFreeTaskRes(CTG_TASK_TYPE type, void **pRes) {
*
pRes
=
NULL
;
break
;
}
case
CTG_TASK_GET_DNODE
:
{
taosArrayDestroy
((
SArray
*
)
*
pRes
);
*
pRes
=
NULL
;
break
;
}
case
CTG_TASK_GET_TB_META
:
{
taosMemoryFreeClear
(
*
pRes
);
break
;
...
...
@@ -413,6 +420,11 @@ void ctgFreeSubTaskRes(CTG_TASK_TYPE type, void **pRes) {
*
pRes
=
NULL
;
break
;
}
case
CTG_TASK_GET_DNODE
:
{
taosArrayDestroy
((
SArray
*
)
*
pRes
);
*
pRes
=
NULL
;
break
;
}
case
CTG_TASK_GET_TB_META
:
{
taosMemoryFreeClear
(
*
pRes
);
break
;
...
...
source/libs/command/src/command.c
浏览文件 @
66cfe3a3
...
...
@@ -18,6 +18,7 @@
#include "tdatablock.h"
#include "tglobal.h"
extern
SConfig
*
tsCfg
;
static
int32_t
getSchemaBytes
(
const
SSchema
*
pSchema
)
{
switch
(
pSchema
->
type
)
{
case
TSDB_DATA_TYPE_BINARY
:
...
...
@@ -551,7 +552,85 @@ static int32_t execShowCreateSTable(SShowCreateTableStmt* pStmt, SRetrieveTableR
static
int32_t
execAlterLocal
(
SAlterLocalStmt
*
pStmt
)
{
return
TSDB_CODE_FAILED
;
}
static
int32_t
execShowLocalVariables
()
{
return
TSDB_CODE_FAILED
;
}
static
SSDataBlock
*
buildLocalVariablesResultDataBlock
()
{
SSDataBlock
*
pBlock
=
taosMemoryCalloc
(
1
,
sizeof
(
SSDataBlock
));
pBlock
->
info
.
numOfCols
=
SHOW_LOCAL_VARIABLES_RESULT_COLS
;
pBlock
->
info
.
hasVarCol
=
true
;
pBlock
->
pDataBlock
=
taosArrayInit
(
pBlock
->
info
.
numOfCols
,
sizeof
(
SColumnInfoData
));
SColumnInfoData
infoData
=
{
0
};
infoData
.
info
.
type
=
TSDB_DATA_TYPE_VARCHAR
;
infoData
.
info
.
bytes
=
SHOW_LOCAL_VARIABLES_RESULT_FIELD1_LEN
;
taosArrayPush
(
pBlock
->
pDataBlock
,
&
infoData
);
infoData
.
info
.
type
=
TSDB_DATA_TYPE_VARCHAR
;
infoData
.
info
.
bytes
=
SHOW_LOCAL_VARIABLES_RESULT_FIELD2_LEN
;
taosArrayPush
(
pBlock
->
pDataBlock
,
&
infoData
);
return
pBlock
;
}
int32_t
setLocalVariablesResultIntoDataBlock
(
SSDataBlock
*
pBlock
)
{
int32_t
numOfCfg
=
taosArrayGetSize
(
tsCfg
->
array
);
int32_t
numOfRows
=
0
;
blockDataEnsureCapacity
(
pBlock
,
numOfCfg
);
for
(
int32_t
i
=
0
,
c
=
0
;
i
<
numOfCfg
;
++
i
,
c
=
0
)
{
SConfigItem
*
pItem
=
taosArrayGet
(
tsCfg
->
array
,
i
);
char
name
[
TSDB_CONFIG_OPTION_LEN
+
VARSTR_HEADER_SIZE
]
=
{
0
};
STR_WITH_MAXSIZE_TO_VARSTR
(
name
,
pItem
->
name
,
TSDB_CONFIG_OPTION_LEN
+
VARSTR_HEADER_SIZE
);
SColumnInfoData
*
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
c
++
);
colDataAppend
(
pColInfo
,
i
,
name
,
false
);
char
value
[
TSDB_CONFIG_VALUE_LEN
+
VARSTR_HEADER_SIZE
]
=
{
0
};
int32_t
valueLen
=
0
;
cfgDumpItemValue
(
pItem
,
&
value
[
VARSTR_HEADER_SIZE
],
TSDB_CONFIG_VALUE_LEN
,
&
valueLen
);
varDataSetLen
(
value
,
valueLen
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
c
++
);
colDataAppend
(
pColInfo
,
i
,
value
,
false
);
numOfRows
++
;
}
pBlock
->
info
.
rows
=
numOfRows
;
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
execShowLocalVariables
(
SRetrieveTableRsp
**
pRsp
)
{
SSDataBlock
*
pBlock
=
buildLocalVariablesResultDataBlock
();
int32_t
code
=
setLocalVariablesResultIntoDataBlock
(
pBlock
);
if
(
code
)
{
return
code
;
}
size_t
rspSize
=
sizeof
(
SRetrieveTableRsp
)
+
blockGetEncodeSize
(
pBlock
);
*
pRsp
=
taosMemoryCalloc
(
1
,
rspSize
);
if
(
NULL
==
*
pRsp
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
(
*
pRsp
)
->
useconds
=
0
;
(
*
pRsp
)
->
completed
=
1
;
(
*
pRsp
)
->
precision
=
0
;
(
*
pRsp
)
->
compressed
=
0
;
(
*
pRsp
)
->
compLen
=
0
;
(
*
pRsp
)
->
numOfRows
=
htonl
(
pBlock
->
info
.
rows
);
(
*
pRsp
)
->
numOfCols
=
htonl
(
SHOW_LOCAL_VARIABLES_RESULT_COLS
);
int32_t
len
=
0
;
blockCompressEncode
(
pBlock
,
(
*
pRsp
)
->
data
,
&
len
,
SHOW_LOCAL_VARIABLES_RESULT_COLS
,
false
);
ASSERT
(
len
==
rspSize
-
sizeof
(
SRetrieveTableRsp
));
blockDataDestroy
(
pBlock
);
return
TSDB_CODE_SUCCESS
;
}
int32_t
qExecCommand
(
SNode
*
pStmt
,
SRetrieveTableRsp
**
pRsp
)
{
switch
(
nodeType
(
pStmt
))
{
...
...
@@ -568,7 +647,7 @@ int32_t qExecCommand(SNode* pStmt, SRetrieveTableRsp** pRsp) {
case
QUERY_NODE_ALTER_LOCAL_STMT
:
return
execAlterLocal
((
SAlterLocalStmt
*
)
pStmt
);
case
QUERY_NODE_SHOW_LOCAL_VARIABLES_STMT
:
return
execShowLocalVariables
();
return
execShowLocalVariables
(
pRsp
);
default:
break
;
}
...
...
source/libs/executor/src/scanoperator.c
浏览文件 @
66cfe3a3
...
...
@@ -1541,11 +1541,14 @@ static SSDataBlock* doSysTableScan(SOperatorInfo* pOperator) {
return
NULL
;
}
int32_t
msgType
=
(
strcasecmp
(
name
,
TSDB_INS_TABLE_DNODE_VARIABLES
)
==
0
)
?
TDMT_DND_SYSTABLE_RETRIEVE
:
TDMT_MND_SYSTABLE_RETRIEVE
;
pMsgSendInfo
->
param
=
pOperator
;
pMsgSendInfo
->
msgInfo
.
pData
=
buf1
;
pMsgSendInfo
->
msgInfo
.
len
=
contLen
;
pMsgSendInfo
->
msgType
=
TDMT_MND_SYSTABLE_RETRIEVE
;
pMsgSendInfo
->
msgType
=
msgType
;
pMsgSendInfo
->
fp
=
loadSysTableCallback
;
pMsgSendInfo
->
requestId
=
pTaskInfo
->
id
.
queryId
;
int64_t
transporterId
=
0
;
int32_t
code
=
...
...
@@ -1580,6 +1583,8 @@ static SSDataBlock* doSysTableScan(SOperatorInfo* pOperator) {
taosMemoryFree
(
pRsp
);
if
(
pInfo
->
pRes
->
info
.
rows
>
0
)
{
return
pInfo
->
pRes
;
}
else
if
(
pOperator
->
status
==
OP_EXEC_DONE
)
{
return
NULL
;
}
}
}
...
...
source/libs/parser/src/parAstParser.c
浏览文件 @
66cfe3a3
...
...
@@ -137,6 +137,9 @@ static int32_t collectMetaKeyFromRealTableImpl(SCollectMetaKeyCxt* pCxt, SRealTa
code
=
reserveTableIndexInCache
(
pCxt
->
pParseCxt
->
acctId
,
pRealTable
->
table
.
dbName
,
pRealTable
->
table
.
tableName
,
pCxt
->
pMetaCache
);
}
if
(
TSDB_CODE_SUCCESS
==
code
&&
(
0
==
strcmp
(
pRealTable
->
table
.
tableName
,
TSDB_INS_TABLE_DNODE_VARIABLES
)))
{
code
=
reserveDnodeRequiredInCache
(
pCxt
->
pMetaCache
);
}
return
code
;
}
...
...
source/libs/parser/src/parTranslater.c
浏览文件 @
66cfe3a3
...
...
@@ -4592,6 +4592,25 @@ static int32_t extractShowCreateTableResultSchema(int32_t* numOfCols, SSchema**
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
extractShowLocalVariablesResultSchema
(
int32_t
*
numOfCols
,
SSchema
**
pSchema
)
{
*
numOfCols
=
2
;
*
pSchema
=
taosMemoryCalloc
((
*
numOfCols
),
sizeof
(
SSchema
));
if
(
NULL
==
(
*
pSchema
))
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
(
*
pSchema
)[
0
].
type
=
TSDB_DATA_TYPE_BINARY
;
(
*
pSchema
)[
0
].
bytes
=
TSDB_CONFIG_OPTION_LEN
;
strcpy
((
*
pSchema
)[
0
].
name
,
"name"
);
(
*
pSchema
)[
1
].
type
=
TSDB_DATA_TYPE_BINARY
;
(
*
pSchema
)[
1
].
bytes
=
TSDB_CONFIG_VALUE_LEN
;
strcpy
((
*
pSchema
)[
1
].
name
,
"value"
);
return
TSDB_CODE_SUCCESS
;
}
int32_t
extractResultSchema
(
const
SNode
*
pRoot
,
int32_t
*
numOfCols
,
SSchema
**
pSchema
)
{
if
(
NULL
==
pRoot
)
{
return
TSDB_CODE_SUCCESS
;
...
...
@@ -4610,6 +4629,8 @@ int32_t extractResultSchema(const SNode* pRoot, int32_t* numOfCols, SSchema** pS
case
QUERY_NODE_SHOW_CREATE_TABLE_STMT
:
case
QUERY_NODE_SHOW_CREATE_STABLE_STMT
:
return
extractShowCreateTableResultSchema
(
numOfCols
,
pSchema
);
case
QUERY_NODE_SHOW_LOCAL_VARIABLES_STMT
:
return
extractShowLocalVariablesResultSchema
(
numOfCols
,
pSchema
);
default:
break
;
}
...
...
@@ -5926,12 +5947,12 @@ static int32_t setQuery(STranslateContext* pCxt, SQuery* pQuery) {
case
QUERY_NODE_SHOW_CREATE_DATABASE_STMT
:
case
QUERY_NODE_SHOW_CREATE_TABLE_STMT
:
case
QUERY_NODE_SHOW_CREATE_STABLE_STMT
:
case
QUERY_NODE_SHOW_LOCAL_VARIABLES_STMT
:
pQuery
->
execMode
=
QUERY_EXEC_MODE_LOCAL
;
pQuery
->
haveResultSet
=
true
;
break
;
case
QUERY_NODE_RESET_QUERY_CACHE_STMT
:
case
QUERY_NODE_ALTER_LOCAL_STMT
:
case
QUERY_NODE_SHOW_LOCAL_VARIABLES_STMT
:
pQuery
->
execMode
=
QUERY_EXEC_MODE_LOCAL
;
break
;
default:
...
...
source/libs/parser/src/parUtil.c
浏览文件 @
66cfe3a3
...
...
@@ -928,7 +928,12 @@ int32_t reserveDnodeRequiredInCache(SParseMetaCache* pMetaCache) {
}
int32_t
getDnodeListFromCache
(
SParseMetaCache
*
pMetaCache
,
SArray
**
pDnodes
)
{
*
pDnodes
=
taosArrayDup
(
pMetaCache
->
pDnodes
);
SMetaRes
*
pRes
=
taosArrayGet
(
pMetaCache
->
pDnodes
,
0
);
if
(
pRes
->
code
)
{
return
pRes
->
code
;
}
*
pDnodes
=
taosArrayDup
((
SArray
*
)
pRes
->
pRes
);
if
(
NULL
==
*
pDnodes
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
...
...
source/libs/qcom/src/querymsg.c
浏览文件 @
66cfe3a3
...
...
@@ -131,8 +131,15 @@ int32_t queryBuildDnodeListMsg(void *input, char **msg, int32_t msgSize, int32_t
return
TSDB_CODE_TSC_INVALID_INPUT
;
}
*
msg
=
NULL
;
*
msgLen
=
0
;
SDnodeListReq
dnodeListReq
=
{
0
};
dnodeListReq
.
rowNum
=
-
1
;
int32_t
bufLen
=
tSerializeSDnodeListReq
(
NULL
,
0
,
&
dnodeListReq
);
void
*
pBuf
=
(
*
mallcFp
)(
bufLen
);
tSerializeSDnodeListReq
(
pBuf
,
bufLen
,
&
dnodeListReq
);
*
msg
=
pBuf
;
*
msgLen
=
bufLen
;
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -440,7 +447,7 @@ int32_t queryProcessQnodeListRsp(void *output, char *msg, int32_t msgSize) {
return
code
;
}
int32_t
queryProcess
Q
nodeListRsp
(
void
*
output
,
char
*
msg
,
int32_t
msgSize
)
{
int32_t
queryProcess
D
nodeListRsp
(
void
*
output
,
char
*
msg
,
int32_t
msgSize
)
{
SDnodeListRsp
out
=
{
0
};
int32_t
code
=
0
;
...
...
@@ -449,7 +456,6 @@ int32_t queryProcessQnodeListRsp(void *output, char *msg, int32_t msgSize) {
return
code
;
}
out
.
dnodeList
=
(
SArray
*
)
output
;
if
(
tDeserializeSDnodeListRsp
(
msg
,
msgSize
,
&
out
)
!=
0
)
{
qError
(
"invalid dnode list rsp msg, msgSize:%d"
,
msgSize
);
code
=
TSDB_CODE_INVALID_MSG
;
...
...
source/util/src/tconfig.c
浏览文件 @
66cfe3a3
...
...
@@ -503,6 +503,38 @@ const char *cfgDtypeStr(ECfgDataType type) {
}
}
void
cfgDumpItemValue
(
SConfigItem
*
pItem
,
char
*
buf
,
int32_t
bufSize
,
int32_t
*
pLen
)
{
int32_t
len
=
0
;
switch
(
pItem
->
dtype
)
{
case
CFG_DTYPE_BOOL
:
len
=
snprintf
(
buf
,
bufSize
,
"%u"
,
pItem
->
bval
);
break
;
case
CFG_DTYPE_INT32
:
len
=
snprintf
(
buf
,
bufSize
,
"%d"
,
pItem
->
i32
);
break
;
case
CFG_DTYPE_INT64
:
len
=
snprintf
(
buf
,
bufSize
,
"%"
PRId64
,
pItem
->
i64
);
break
;
case
CFG_DTYPE_FLOAT
:
len
=
snprintf
(
buf
,
bufSize
,
"%f"
,
pItem
->
fval
);
break
;
case
CFG_DTYPE_STRING
:
case
CFG_DTYPE_DIR
:
case
CFG_DTYPE_LOCALE
:
case
CFG_DTYPE_CHARSET
:
case
CFG_DTYPE_TIMEZONE
:
case
CFG_DTYPE_NONE
:
len
=
snprintf
(
buf
,
bufSize
,
"%s"
,
pItem
->
str
);
break
;
}
if
(
len
>
bufSize
)
{
len
=
bufSize
;
}
*
pLen
=
len
;
}
void
cfgDumpCfg
(
SConfig
*
pCfg
,
bool
tsc
,
bool
dump
)
{
if
(
dump
)
{
printf
(
" global config"
);
...
...
@@ -996,4 +1028,4 @@ int32_t cfgGetApollUrl(const char **envCmd, const char *envFile, char* apolloUrl
uInfo
(
"fail get apollo url from cmd env file"
);
return
-
1
;
}
\ No newline at end of file
}
tests/script/tsim/show/basic.sim
浏览文件 @
66cfe3a3
...
...
@@ -99,7 +99,7 @@ if $rows != 1 then
endi
#sql select * from information_schema.`streams`
sql select * from information_schema.user_tables
if $rows != 3
0
then
if $rows != 3
1
then
return -1
endi
#sql select * from information_schema.user_table_distributed
...
...
@@ -197,7 +197,7 @@ if $rows != 1 then
endi
#sql select * from performance_schema.`streams`
sql select * from information_schema.user_tables
if $rows != 3
0
then
if $rows != 3
1
then
return -1
endi
#sql select * from information_schema.user_table_distributed
...
...
@@ -227,5 +227,20 @@ endi
sql_error show create stable t0;
sql show variables;
if $rows != 4 then
return -1
endi
sql show dnode 1 variables;
if $rows != 114 then
return -1
endi
sql show local variables;
if $rows != 50 then
return -1
endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT
system sh/exec.sh -n dnode2 -s stop -x SIGINT
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录