Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
7da3ed27
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看板
提交
7da3ed27
编写于
10月 11, 2022
作者:
C
Cary Xu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: support statistics of insert_req
上级
fe115ab0
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
34 addition
and
62 deletion
+34
-62
source/dnode/mgmt/mgmt_vnode/src/vmHandle.c
source/dnode/mgmt/mgmt_vnode/src/vmHandle.c
+4
-4
source/dnode/vnode/src/vnd/vnodeCommit.c
source/dnode/vnode/src/vnd/vnodeCommit.c
+0
-38
source/dnode/vnode/src/vnd/vnodeOpen.c
source/dnode/vnode/src/vnd/vnodeOpen.c
+0
-4
source/dnode/vnode/src/vnd/vnodeQuery.c
source/dnode/vnode/src/vnd/vnodeQuery.c
+29
-15
source/dnode/vnode/src/vnd/vnodeSvr.c
source/dnode/vnode/src/vnd/vnodeSvr.c
+1
-1
未找到文件。
source/dnode/mgmt/mgmt_vnode/src/vmHandle.c
浏览文件 @
7da3ed27
...
...
@@ -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
-
pMgmt
->
state
.
numOfInsertReqs
;
pInfo
->
vstat
.
numOfInsertSuccessReqs
=
numOfInsertSuccessReqs
-
pMgmt
->
state
.
numOfInsertSuccessReqs
;
pInfo
->
vstat
.
numOfBatchInsertReqs
=
numOfBatchInsertReqs
-
pMgmt
->
state
.
numOfBatchInsertReqs
;
pInfo
->
vstat
.
numOfBatchInsertSuccessReqs
=
numOfBatchInsertSuccessReqs
-
pMgmt
->
state
.
numOfBatchInsertSuccessReqs
;
pInfo
->
vstat
.
numOfInsertReqs
=
numOfInsertReqs
;
pInfo
->
vstat
.
numOfInsertSuccessReqs
=
numOfInsertSuccessReqs
;
pInfo
->
vstat
.
numOfBatchInsertReqs
=
numOfBatchInsertReqs
;
pInfo
->
vstat
.
numOfBatchInsertSuccessReqs
=
numOfBatchInsertSuccessReqs
;
pMgmt
->
state
.
totalVnodes
=
totalVnodes
;
pMgmt
->
state
.
masterNum
=
masterNum
;
pMgmt
->
state
.
numOfSelectReqs
=
numOfSelectReqs
;
...
...
source/dnode/vnode/src/vnd/vnodeCommit.c
浏览文件 @
7da3ed27
...
...
@@ -227,10 +227,6 @@ int vnodeCommit(SVnode *pVnode) {
info
.
state
.
committed
=
pVnode
->
state
.
applied
;
info
.
state
.
commitTerm
=
pVnode
->
state
.
applyTerm
;
info
.
state
.
commitID
=
pVnode
->
state
.
commitID
;
info
.
statis
.
nInsert
=
pVnode
->
statis
.
nInsert
;
info
.
statis
.
nInsertSuccess
=
pVnode
->
statis
.
nInsertSuccess
;
info
.
statis
.
nBatchInsert
=
pVnode
->
statis
.
nBatchInsert
;
info
.
statis
.
nBatchInsertSuccess
=
pVnode
->
statis
.
nBatchInsertSuccess
;
snprintf
(
dir
,
TSDB_FILENAME_LEN
,
"%s%s%s"
,
tfsGetPrimaryPath
(
pVnode
->
pTfs
),
TD_DIRSEP
,
pVnode
->
path
);
if
(
vnodeSaveInfo
(
dir
,
&
info
)
<
0
)
{
...
...
@@ -357,32 +353,6 @@ static int vnodeDecodeState(const SJson *pJson, void *pObj) {
return
0
;
}
static
int
vnodeEncodeStatis
(
const
void
*
pObj
,
SJson
*
pJson
)
{
const
SVStatis
*
pStatis
=
(
SVStatis
*
)
pObj
;
if
(
tjsonAddIntegerToObject
(
pJson
,
"insert"
,
pStatis
->
nInsert
)
<
0
)
return
-
1
;
if
(
tjsonAddIntegerToObject
(
pJson
,
"insert success"
,
pStatis
->
nInsertSuccess
)
<
0
)
return
-
1
;
if
(
tjsonAddIntegerToObject
(
pJson
,
"batch insert"
,
pStatis
->
nBatchInsert
)
<
0
)
return
-
1
;
if
(
tjsonAddIntegerToObject
(
pJson
,
"batch insert success"
,
pStatis
->
nBatchInsertSuccess
)
<
0
)
return
-
1
;
return
0
;
}
static
int
vnodeDecodeStatis
(
const
SJson
*
pJson
,
void
*
pObj
)
{
SVStatis
*
pStatis
=
(
SVStatis
*
)
pObj
;
int32_t
code
;
tjsonGetNumberValue
(
pJson
,
"insert"
,
pStatis
->
nInsert
,
code
);
if
(
code
<
0
)
return
-
1
;
tjsonGetNumberValue
(
pJson
,
"insert success"
,
pStatis
->
nInsertSuccess
,
code
);
if
(
code
<
0
)
return
-
1
;
tjsonGetNumberValue
(
pJson
,
"batch insert"
,
pStatis
->
nBatchInsert
,
code
);
if
(
code
<
0
)
return
-
1
;
tjsonGetNumberValue
(
pJson
,
"batch insert success"
,
pStatis
->
nBatchInsertSuccess
,
code
);
if
(
code
<
0
)
return
-
1
;
return
0
;
}
static
int
vnodeEncodeInfo
(
const
SVnodeInfo
*
pInfo
,
char
**
ppData
)
{
SJson
*
pJson
;
char
*
pData
;
...
...
@@ -402,10 +372,6 @@ static int vnodeEncodeInfo(const SVnodeInfo *pInfo, char **ppData) {
goto
_err
;
}
if
(
tjsonAddObject
(
pJson
,
"statis"
,
vnodeEncodeStatis
,
(
void
*
)
&
pInfo
->
statis
)
<
0
)
{
goto
_err
;
}
pData
=
tjsonToString
(
pJson
);
if
(
pData
==
NULL
)
{
goto
_err
;
...
...
@@ -437,10 +403,6 @@ static int vnodeDecodeInfo(uint8_t *pData, SVnodeInfo *pInfo) {
goto
_err
;
}
if
(
tjsonToObject
(
pJson
,
"statis"
,
vnodeDecodeStatis
,
(
void
*
)
&
pInfo
->
statis
)
<
0
)
{
goto
_err
;
}
tjsonDelete
(
pJson
);
return
0
;
...
...
source/dnode/vnode/src/vnd/vnodeOpen.c
浏览文件 @
7da3ed27
...
...
@@ -85,10 +85,6 @@ SVnode *vnodeOpen(const char *path, STfs *pTfs, SMsgCb msgCb) {
pVnode
->
state
.
applied
=
info
.
state
.
committed
;
pVnode
->
state
.
commitID
=
info
.
state
.
commitID
;
pVnode
->
state
.
commitTerm
=
info
.
state
.
commitTerm
;
pVnode
->
statis
.
nInsert
=
info
.
statis
.
nInsert
;
pVnode
->
statis
.
nInsertSuccess
=
info
.
statis
.
nInsertSuccess
;
pVnode
->
statis
.
nBatchInsert
=
info
.
statis
.
nBatchInsert
;
pVnode
->
statis
.
nBatchInsertSuccess
=
info
.
statis
.
nBatchInsertSuccess
;
pVnode
->
pTfs
=
pTfs
;
pVnode
->
msgCb
=
msgCb
;
taosThreadMutexInit
(
&
pVnode
->
lock
,
NULL
);
...
...
source/dnode/vnode/src/vnd/vnodeQuery.c
浏览文件 @
7da3ed27
...
...
@@ -365,22 +365,36 @@ _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
);
return
0
;
}
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
);
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
;
}
void
vnodeGetInfo
(
SVnode
*
pVnode
,
const
char
**
dbname
,
int32_t
*
vgId
)
{
if
(
dbname
)
{
...
...
source/dnode/vnode/src/vnd/vnodeSvr.c
浏览文件 @
7da3ed27
...
...
@@ -951,8 +951,8 @@ _exit:
// 1/level 2.
// TODO: refactor
if
((
terrno
==
TSDB_CODE_SUCCESS
)
&&
(
pRsp
->
code
==
TSDB_CODE_SUCCESS
))
{
tdProcessRSmaSubmit
(
pVnode
->
pSma
,
pReq
,
STREAM_INPUT__DATA_SUBMIT
);
atomic_fetch_add_64
(
&
pVnode
->
statis
.
nBatchInsertSuccess
,
1
);
tdProcessRSmaSubmit
(
pVnode
->
pSma
,
pReq
,
STREAM_INPUT__DATA_SUBMIT
);
}
vDebug
(
"vgId:%d, submit success, index:%"
PRId64
,
pVnode
->
config
.
vgId
,
version
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录