Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
112ebfa1
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
112ebfa1
编写于
12月 12, 2020
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-2433]<fix>: fix the bug that server_status() not working.
上级
af023836
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
59 addition
and
22 deletion
+59
-22
src/client/inc/tsclient.h
src/client/inc/tsclient.h
+2
-2
src/client/src/tscLocal.c
src/client/src/tscLocal.c
+23
-15
src/client/src/tscServer.c
src/client/src/tscServer.c
+34
-5
未找到文件。
src/client/inc/tsclient.h
浏览文件 @
112ebfa1
...
...
@@ -285,8 +285,8 @@ typedef struct {
char
**
buffer
;
// Buffer used to put multibytes encoded using unicode (wchar_t)
SColumnIndex
*
pColumnIndex
;
SArithmeticSupport
*
pArithSup
;
// support the arithmetic expression calculation on agg functions
struct
SLocalReducer
*
pLocalReducer
;
SArithmeticSupport
*
pArithSup
;
// support the arithmetic expression calculation on agg functions
struct
SLocalReducer
*
pLocalReducer
;
}
SSqlRes
;
typedef
struct
STscObj
{
...
...
src/client/src/tscLocal.c
浏览文件 @
112ebfa1
...
...
@@ -46,7 +46,8 @@ typedef struct SCreateBuilder {
SSqlObj
*
pInterSql
;
int32_t
(
*
fp
)(
void
*
para
,
char
*
result
);
Stage
callStage
;
}
SCreateBuilder
;
}
SCreateBuilder
;
static
void
tscSetLocalQueryResult
(
SSqlObj
*
pSql
,
const
char
*
val
,
const
char
*
columnName
,
int16_t
type
,
size_t
valueLength
);
static
int32_t
tscSetValueToResObj
(
SSqlObj
*
pSql
,
int32_t
rowLen
)
{
...
...
@@ -207,10 +208,7 @@ static int32_t tscProcessDescribeTable(SSqlObj *pSql) {
const
int32_t
TYPE_COLUMN_LENGTH
=
16
;
const
int32_t
NOTE_COLUMN_MIN_LENGTH
=
8
;
int32_t
noteFieldLen
=
NOTE_COLUMN_MIN_LENGTH
;
//tscMaxLengthOfTagsFields(pSql);
// if (noteFieldLen == 0) {
// noteFieldLen = NOTE_COLUMN_MIN_LENGTH;
// }
int32_t
noteFieldLen
=
NOTE_COLUMN_MIN_LENGTH
;
int32_t
rowLen
=
tscBuildTableSchemaResultFields
(
pSql
,
NUM_OF_DESC_TABLE_COLUMNS
,
TYPE_COLUMN_LENGTH
,
noteFieldLen
);
tscFieldInfoUpdateOffset
(
pQueryInfo
);
...
...
@@ -822,26 +820,36 @@ static int32_t tscProcessClientVer(SSqlObj *pSql) {
}
// TODO add test cases.
static
int32_t
checkForOnlineNode
(
SSqlObj
*
pSql
)
{
int32_t
*
data
=
pSql
->
res
.
length
;
int32_t
total
=
data
[
0
];
int32_t
online
=
data
[
1
];
return
(
online
<
total
)
?
TSDB_CODE_RPC_NETWORK_UNAVAIL
:
TSDB_CODE_SUCCESS
;
}
static
int32_t
tscProcessServStatus
(
SSqlObj
*
pSql
)
{
STscObj
*
pObj
=
pSql
->
pTscObj
;
SSqlObj
*
pHb
=
(
SSqlObj
*
)
taosAcquireRef
(
tscObjRef
,
pObj
->
hbrid
);
if
(
pHb
!=
NULL
)
{
int32_t
code
=
pHb
->
res
.
code
;
pSql
->
res
.
code
=
pHb
->
res
.
code
;
taosReleaseRef
(
tscObjRef
,
pObj
->
hbrid
);
if
(
code
==
TSDB_CODE_RPC_NETWORK_UNAVAIL
)
{
pSql
->
res
.
code
=
TSDB_CODE_RPC_NETWORK_UNAVAIL
;
return
pSql
->
res
.
code
;
}
}
else
{
if
(
pSql
->
res
.
code
==
TSDB_CODE_RPC_NETWORK_UNAVAIL
)
{
return
pSql
->
res
.
code
;
}
}
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
&
pSql
->
cmd
,
0
);
if
(
pSql
->
res
.
code
==
TSDB_CODE_RPC_NETWORK_UNAVAIL
)
{
return
pSql
->
res
.
code
;
}
pSql
->
res
.
code
=
checkForOnlineNode
(
pHb
);
if
(
pSql
->
res
.
code
==
TSDB_CODE_RPC_NETWORK_UNAVAIL
)
{
return
pSql
->
res
.
code
;
}
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
&
pSql
->
cmd
,
0
);
SSqlExpr
*
pExpr
=
taosArrayGetP
(
pQueryInfo
->
exprList
,
0
);
int32_t
val
=
1
;
tscSetLocalQueryResult
(
pSql
,
(
char
*
)
&
val
,
pExpr
->
aliasName
,
TSDB_DATA_TYPE_INT
,
sizeof
(
int32_t
));
return
TSDB_CODE_SUCCESS
;
...
...
src/client/src/tscServer.c
浏览文件 @
112ebfa1
...
...
@@ -147,15 +147,15 @@ void tscProcessHeartBeatRsp(void *param, TAOS_RES *tres, int code) {
SSqlObj
*
pSql
=
tres
;
SSqlRes
*
pRes
=
&
pSql
->
res
;
if
(
code
==
0
)
{
if
(
code
==
TSDB_CODE_SUCCESS
)
{
SHeartBeatRsp
*
pRsp
=
(
SHeartBeatRsp
*
)
pRes
->
pRsp
;
SRpcEpSet
*
epSet
=
&
pRsp
->
epSet
;
SRpcEpSet
*
epSet
=
&
pRsp
->
epSet
;
if
(
epSet
->
numOfEps
>
0
)
{
tscEpSetHtons
(
epSet
);
if
(
!
tscEpSetIsEqual
(
&
pSql
->
pTscObj
->
tscCorMgmtEpSet
->
epSet
,
epSet
))
{
tscTrace
(
"%p updating epset: numOfEps: %d, inUse: %d"
,
pSql
,
epSet
->
numOfEps
,
epSet
->
inUse
);
for
(
int8_t
i
=
0
;
i
<
epSet
->
numOfEps
;
i
++
)
{
tscTrace
(
"endpoint %d: fqdn
=
%s, port=%d"
,
i
,
epSet
->
fqdn
[
i
],
epSet
->
port
[
i
]);
tscTrace
(
"endpoint %d: fqdn
=
%s, port=%d"
,
i
,
epSet
->
fqdn
[
i
],
epSet
->
port
[
i
]);
}
tscUpdateMgmtEpSet
(
pSql
,
epSet
);
}
...
...
@@ -167,11 +167,40 @@ void tscProcessHeartBeatRsp(void *param, TAOS_RES *tres, int code) {
tscKillConnection
(
pObj
);
return
;
}
else
{
if
(
pRsp
->
queryId
)
tscKillQuery
(
pObj
,
htonl
(
pRsp
->
queryId
));
if
(
pRsp
->
streamId
)
tscKillStream
(
pObj
,
htonl
(
pRsp
->
streamId
));
if
(
pRsp
->
queryId
)
{
tscKillQuery
(
pObj
,
htonl
(
pRsp
->
queryId
));
}
if
(
pRsp
->
streamId
)
{
tscKillStream
(
pObj
,
htonl
(
pRsp
->
streamId
));
}
}
int32_t
total
=
htonl
(
pRsp
->
totalDnodes
);
int32_t
online
=
htonl
(
pRsp
->
onlineDnodes
);
assert
(
online
<=
total
);
if
(
online
<
total
)
{
tscError
(
"HB:%p, total dnode:%d, online dnode:%d"
,
pSql
,
total
,
online
);
pSql
->
res
.
code
=
TSDB_CODE_RPC_NETWORK_UNAVAIL
;
}
if
(
pRes
->
buffer
==
NULL
)
{
pRes
->
length
=
calloc
(
2
,
sizeof
(
int32_t
));
}
pRes
->
length
[
0
]
=
total
;
pRes
->
length
[
1
]
=
online
;
}
else
{
tscDebug
(
"%"
PRId64
" heartbeat failed, code:%s"
,
pObj
->
hbrid
,
tstrerror
(
code
));
if
(
pRes
->
buffer
==
NULL
)
{
pRes
->
length
=
calloc
(
2
,
sizeof
(
int32_t
));
}
pRes
->
length
[
1
]
=
0
;
if
(
pRes
->
length
[
0
]
==
0
)
{
pRes
->
length
[
0
]
=
1
;
// make sure that the value of the total node is greater than the online node
}
}
if
(
pObj
->
hbrid
!=
0
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录