Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
02979f08
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看板
提交
02979f08
编写于
10月 11, 2022
作者:
C
Cary Xu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: support statistics of insert_req
上级
7da3ed27
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
42 addition
and
49 deletion
+42
-49
source/dnode/mgmt/mgmt_vnode/src/vmHandle.c
source/dnode/mgmt/mgmt_vnode/src/vmHandle.c
+8
-17
source/dnode/mgmt/node_mgmt/inc/dmNodes.h
source/dnode/mgmt/node_mgmt/inc/dmNodes.h
+1
-1
source/dnode/mgmt/node_mgmt/src/dmMonitor.c
source/dnode/mgmt/node_mgmt/src/dmMonitor.c
+1
-1
source/dnode/vnode/inc/vnode.h
source/dnode/vnode/inc/vnode.h
+1
-1
source/dnode/vnode/src/inc/vnodeInt.h
source/dnode/vnode/src/inc/vnodeInt.h
+4
-4
source/dnode/vnode/src/vnd/vnodeQuery.c
source/dnode/vnode/src/vnd/vnodeQuery.c
+27
-25
未找到文件。
source/dnode/mgmt/mgmt_vnode/src/vmHandle.c
浏览文件 @
02979f08
...
...
@@ -16,7 +16,7 @@
#define _DEFAULT_SOURCE
#include "vmInt.h"
void
vmGetVnodeLoads
(
SVnodeMgmt
*
pMgmt
,
SMonVloadInfo
*
pInfo
)
{
void
vmGetVnodeLoads
(
SVnodeMgmt
*
pMgmt
,
SMonVloadInfo
*
pInfo
,
bool
isReset
)
{
pInfo
->
pVloads
=
taosArrayInit
(
pMgmt
->
state
.
totalVnodes
,
sizeof
(
SVnodeLoad
));
if
(
pInfo
->
pVloads
==
NULL
)
return
;
...
...
@@ -29,7 +29,7 @@ void vmGetVnodeLoads(SVnodeMgmt *pMgmt, SMonVloadInfo *pInfo) {
SVnodeObj
*
pVnode
=
*
ppVnode
;
SVnodeLoad
vload
=
{
0
};
vnodeGetLoad
(
pVnode
->
pImpl
,
&
vload
);
vnodeGetLoad
(
pVnode
->
pImpl
,
&
vload
,
isReset
);
taosArrayPush
(
pInfo
->
pVloads
,
&
vload
);
pIter
=
taosHashIterate
(
pMgmt
->
hash
,
pIter
);
}
...
...
@@ -39,7 +39,7 @@ void vmGetVnodeLoads(SVnodeMgmt *pMgmt, SMonVloadInfo *pInfo) {
void
vmGetMonitorInfo
(
SVnodeMgmt
*
pMgmt
,
SMonVmInfo
*
pInfo
)
{
SMonVloadInfo
vloads
=
{
0
};
vmGetVnodeLoads
(
pMgmt
,
&
vloads
);
vmGetVnodeLoads
(
pMgmt
,
&
vloads
,
true
);
SArray
*
pVloads
=
vloads
.
pVloads
;
if
(
pVloads
==
NULL
)
return
;
...
...
@@ -66,10 +66,10 @@ void vmGetMonitorInfo(SVnodeMgmt *pMgmt, SMonVmInfo *pInfo) {
pInfo
->
vstat
.
totalVnodes
=
totalVnodes
;
pInfo
->
vstat
.
masterNum
=
masterNum
;
pInfo
->
vstat
.
numOfSelectReqs
=
numOfSelectReqs
-
pMgmt
->
state
.
numOfSelectReqs
;
pInfo
->
vstat
.
numOfInsertReqs
=
numOfInsertReqs
;
pInfo
->
vstat
.
numOfInsertSuccessReqs
=
numOfInsertSuccessReqs
;
pInfo
->
vstat
.
numOfBatchInsertReqs
=
numOfBatchInsertReqs
;
pInfo
->
vstat
.
numOfBatchInsertSuccessReqs
=
numOfBatchInsertSuccessReqs
;
pInfo
->
vstat
.
numOfInsertReqs
=
numOfInsertReqs
;
// delta
pInfo
->
vstat
.
numOfInsertSuccessReqs
=
numOfInsertSuccessReqs
;
// delta
pInfo
->
vstat
.
numOfBatchInsertReqs
=
numOfBatchInsertReqs
;
// delta
pInfo
->
vstat
.
numOfBatchInsertSuccessReqs
=
numOfBatchInsertSuccessReqs
;
// delta
pMgmt
->
state
.
totalVnodes
=
totalVnodes
;
pMgmt
->
state
.
masterNum
=
masterNum
;
pMgmt
->
state
.
numOfSelectReqs
=
numOfSelectReqs
;
...
...
@@ -78,15 +78,6 @@ void vmGetMonitorInfo(SVnodeMgmt *pMgmt, SMonVmInfo *pInfo) {
pMgmt
->
state
.
numOfBatchInsertReqs
=
numOfBatchInsertReqs
;
pMgmt
->
state
.
numOfBatchInsertSuccessReqs
=
numOfBatchInsertSuccessReqs
;
printf
(
"%s:%d: Info: nInsert:%"
PRIi64
", nInsertSuccess:%"
PRIi64
", nBatch:%"
PRIi64
", nBatchSuccess:%"
PRIi64
"
\n
"
,
__func__
,
__LINE__
,
pInfo
->
vstat
.
numOfInsertReqs
,
pInfo
->
vstat
.
numOfInsertSuccessReqs
,
pInfo
->
vstat
.
numOfBatchInsertReqs
,
pInfo
->
vstat
.
numOfBatchInsertSuccessReqs
);
printf
(
"%s:%d: Mgmt: nInsert:%"
PRIi64
", nInsertSuccess:%"
PRIi64
", nBatch:%"
PRIi64
", nBatchSuccess:%"
PRIi64
"
\n
"
,
__func__
,
__LINE__
,
pMgmt
->
state
.
numOfInsertReqs
,
pMgmt
->
state
.
numOfInsertSuccessReqs
,
pMgmt
->
state
.
numOfBatchInsertReqs
,
pMgmt
->
state
.
numOfBatchInsertSuccessReqs
);
tfsGetMonitorInfo
(
pMgmt
->
pTfs
,
&
pInfo
->
tfs
);
taosArrayDestroy
(
pVloads
);
}
...
...
@@ -118,7 +109,7 @@ int32_t vmProcessGetMonitorInfoReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
int32_t
vmProcessGetLoadsReq
(
SVnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
)
{
SMonVloadInfo
vloads
=
{
0
};
vmGetVnodeLoads
(
pMgmt
,
&
vloads
);
vmGetVnodeLoads
(
pMgmt
,
&
vloads
,
false
);
int32_t
rspLen
=
tSerializeSMonVloadInfo
(
NULL
,
0
,
&
vloads
);
if
(
rspLen
<
0
)
{
...
...
source/dnode/mgmt/node_mgmt/inc/dmNodes.h
浏览文件 @
02979f08
...
...
@@ -35,7 +35,7 @@ void qmGetMonitorInfo(void *pMgmt, SMonQmInfo *pInfo);
void
smGetMonitorInfo
(
void
*
pMgmt
,
SMonSmInfo
*
pInfo
);
void
bmGetMonitorInfo
(
void
*
pMgmt
,
SMonBmInfo
*
pInfo
);
void
vmGetVnodeLoads
(
void
*
pMgmt
,
SMonVloadInfo
*
pInfo
);
void
vmGetVnodeLoads
(
void
*
pMgmt
,
SMonVloadInfo
*
pInfo
,
bool
isReset
);
void
mmGetMnodeLoads
(
void
*
pMgmt
,
SMonMloadInfo
*
pInfo
);
void
qmGetQnodeLoads
(
void
*
pMgmt
,
SQnodeLoad
*
pInfo
);
...
...
source/dnode/mgmt/node_mgmt/src/dmMonitor.c
浏览文件 @
02979f08
...
...
@@ -152,7 +152,7 @@ void dmGetVnodeLoads(SMonVloadInfo *pInfo) {
if
(
tsMultiProcess
)
{
dmSendLocalRecv
(
pDnode
,
TDMT_MON_VM_LOAD
,
tDeserializeSMonVloadInfo
,
pInfo
);
}
else
if
(
pWrapper
->
pMgmt
!=
NULL
)
{
vmGetVnodeLoads
(
pWrapper
->
pMgmt
,
pInfo
);
vmGetVnodeLoads
(
pWrapper
->
pMgmt
,
pInfo
,
false
);
}
dmReleaseWrapper
(
pWrapper
);
}
...
...
source/dnode/vnode/inc/vnode.h
浏览文件 @
02979f08
...
...
@@ -73,7 +73,7 @@ int32_t vnodeGetCtbNum(SVnode *pVnode, int64_t suid, int64_t *num);
int32_t
vnodeGetTimeSeriesNum
(
SVnode
*
pVnode
,
int64_t
*
num
);
int32_t
vnodeGetAllCtbNum
(
SVnode
*
pVnode
,
int64_t
*
num
);
int32_t
vnodeGetLoad
(
SVnode
*
pVnode
,
SVnodeLoad
*
pLoad
);
int32_t
vnodeGetLoad
(
SVnode
*
pVnode
,
SVnodeLoad
*
pLoad
,
bool
isReset
);
int32_t
vnodeValidateTableHash
(
SVnode
*
pVnode
,
char
*
tableFName
);
int32_t
vnodePreProcessWriteMsg
(
SVnode
*
pVnode
,
SRpcMsg
*
pMsg
);
...
...
source/dnode/vnode/src/inc/vnodeInt.h
浏览文件 @
02979f08
...
...
@@ -286,10 +286,10 @@ struct SVState {
};
struct
SVStatis
{
int64_t
nInsert
;
int64_t
nInsertSuccess
;
int64_t
nBatchInsert
;
int64_t
nBatchInsertSuccess
;
int64_t
nInsert
;
// delta
int64_t
nInsertSuccess
;
// delta
int64_t
nBatchInsert
;
// delta
int64_t
nBatchInsertSuccess
;
// delta
};
struct
SVnodeInfo
{
...
...
source/dnode/vnode/src/vnd/vnodeQuery.c
浏览文件 @
02979f08
...
...
@@ -15,6 +15,14 @@
#include "vnd.h"
#define VNODE_GET_LOAD_RESET_VALS(pVar, oVal, vType) \
do { \
if ((oVal) != atomic_val_compare_exchange_##vType(&(pVar), (oVal), 0)) { \
int##vType##_t newVal = atomic_sub_fetch_##vType(&(pVar), (oVal)); \
ASSERT(newVal >= 0); \
} \
} while (0)
int
vnodeQueryOpen
(
SVnode
*
pVnode
)
{
return
qWorkerInit
(
NODE_TYPE_VNODE
,
TD_VID
(
pVnode
),
(
void
**
)
&
pVnode
->
pQuery
,
&
pVnode
->
msgCb
);
}
...
...
@@ -365,37 +373,31 @@ _exit:
return
code
;
}
#define VNODE_GET_LOAD_RESET_VALS(pVar, oVal, type) \
do { \
if (oVal != atomic_val_compare_exchange_##type(&pVar, oVal, 0)) { \
int##type##_t tmpVal = atomic_sub_fetch_##type(&pVar, oVal); \
ASSERT(tmpVal >= 0); \
} \
} while (0)
int32_t
vnodeGetLoad
(
SVnode
*
pVnode
,
SVnodeLoad
*
pLoad
)
{
pLoad
->
vgId
=
TD_VID
(
pVnode
);
pLoad
->
syncState
=
syncGetMyRole
(
pVnode
->
sync
);
pLoad
->
cacheUsage
=
tsdbCacheGetUsage
(
pVnode
);
pLoad
->
numOfTables
=
metaGetTbNum
(
pVnode
->
pMeta
);
pLoad
->
numOfTimeSeries
=
metaGetTimeSeriesNum
(
pVnode
->
pMeta
);
pLoad
->
totalStorage
=
(
int64_t
)
3
*
1073741824
;
pLoad
->
compStorage
=
(
int64_t
)
2
*
1073741824
;
pLoad
->
pointsWritten
=
100
;
pLoad
->
numOfSelectReqs
=
1
;
pLoad
->
numOfInsertReqs
=
atomic_load_64
(
&
pVnode
->
statis
.
nInsert
);
pLoad
->
numOfInsertSuccessReqs
=
atomic_load_64
(
&
pVnode
->
statis
.
nInsertSuccess
);
pLoad
->
numOfBatchInsertReqs
=
atomic_load_64
(
&
pVnode
->
statis
.
nBatchInsert
);
pLoad
->
numOfBatchInsertSuccessReqs
=
atomic_load_64
(
&
pVnode
->
statis
.
nBatchInsertSuccess
);
int32_t
vnodeGetLoad
(
SVnode
*
pVnode
,
SVnodeLoad
*
pLoad
,
bool
isReset
)
{
pLoad
->
vgId
=
TD_VID
(
pVnode
);
pLoad
->
syncState
=
syncGetMyRole
(
pVnode
->
sync
);
pLoad
->
cacheUsage
=
tsdbCacheGetUsage
(
pVnode
);
pLoad
->
numOfTables
=
metaGetTbNum
(
pVnode
->
pMeta
);
pLoad
->
numOfTimeSeries
=
metaGetTimeSeriesNum
(
pVnode
->
pMeta
);
pLoad
->
totalStorage
=
(
int64_t
)
3
*
1073741824
;
pLoad
->
compStorage
=
(
int64_t
)
2
*
1073741824
;
pLoad
->
pointsWritten
=
100
;
pLoad
->
numOfSelectReqs
=
1
;
pLoad
->
numOfInsertReqs
=
atomic_load_64
(
&
pVnode
->
statis
.
nInsert
);
pLoad
->
numOfInsertSuccessReqs
=
atomic_load_64
(
&
pVnode
->
statis
.
nInsertSuccess
);
pLoad
->
numOfBatchInsertReqs
=
atomic_load_64
(
&
pVnode
->
statis
.
nBatchInsert
);
pLoad
->
numOfBatchInsertSuccessReqs
=
atomic_load_64
(
&
pVnode
->
statis
.
nBatchInsertSuccess
);
if
(
isReset
)
{
VNODE_GET_LOAD_RESET_VALS
(
pVnode
->
statis
.
nInsert
,
pLoad
->
numOfInsertReqs
,
64
);
VNODE_GET_LOAD_RESET_VALS
(
pVnode
->
statis
.
nInsertSuccess
,
pLoad
->
numOfInsertSuccessReqs
,
64
);
VNODE_GET_LOAD_RESET_VALS
(
pVnode
->
statis
.
nBatchInsert
,
pLoad
->
numOfBatchInsertReqs
,
64
);
VNODE_GET_LOAD_RESET_VALS
(
pVnode
->
statis
.
nBatchInsertSuccess
,
pLoad
->
numOfBatchInsertSuccessReqs
,
64
);
return
0
;
}
return
0
;
}
void
vnodeGetInfo
(
SVnode
*
pVnode
,
const
char
**
dbname
,
int32_t
*
vgId
)
{
if
(
dbname
)
{
*
dbname
=
pVnode
->
config
.
dbname
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录