Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
CSDN产品汪
TDengine
提交
b0186d1c
T
TDengine
项目概览
CSDN产品汪
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
5
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
b0186d1c
编写于
8月 06, 2020
作者:
B
Bomin Zhang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
td-1033: add more infomation to report
上级
b2cd9823
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
80 addition
and
19 deletion
+80
-19
src/dnode/src/dnodeTelemetry.c
src/dnode/src/dnodeTelemetry.c
+27
-19
src/mnode/inc/mnodeAcct.h
src/mnode/inc/mnodeAcct.h
+1
-0
src/mnode/inc/mnodeDb.h
src/mnode/inc/mnodeDb.h
+1
-0
src/mnode/inc/mnodeTable.h
src/mnode/inc/mnodeTable.h
+2
-0
src/mnode/inc/mnodeVgroup.h
src/mnode/inc/mnodeVgroup.h
+1
-0
src/mnode/src/mnodeAcct.c
src/mnode/src/mnodeAcct.c
+32
-0
src/mnode/src/mnodeDb.c
src/mnode/src/mnodeDb.c
+4
-0
src/mnode/src/mnodeTable.c
src/mnode/src/mnodeTable.c
+8
-0
src/mnode/src/mnodeVgroup.c
src/mnode/src/mnodeVgroup.c
+4
-0
未找到文件。
src/dnode/src/dnodeTelemetry.c
浏览文件 @
b0186d1c
...
...
@@ -22,8 +22,16 @@
#include "tsocket.h"
#include "tbuffer.h"
#include "mnode.h"
#include "mnodeDef.h"
#include "mnodeDb.h"
#include "mnodeDnode.h"
#include "mnodeCluster.h"
#include "mnodeDnode.h"
#include "mnodeVgroup.h"
#include "mnodeMnode.h"
#include "mnodeTable.h"
#include "mnodeSdb.h"
#include "mnodeAcct.h"
#include "dnode.h"
#include "dnodeInt.h"
#include "dnodeTelemetry.h"
...
...
@@ -170,18 +178,23 @@ static void addVersionInfo(SBufferWriter* bw) {
addStringField
(
bw
,
"version"
,
version
);
addStringField
(
bw
,
"buildInfo"
,
buildinfo
);
addStringField
(
bw
,
"gitInfo"
,
gitinfo
);
//addStringField(&bw, "installAt", "2020-08-01T00:00:00Z");
}
static
void
addRuntimeInfo
(
SBufferWriter
*
bw
)
{
// addIntField(&bw, "numOfDnode", 1);
// addIntField(&bw, "numOfVnode", 1);
// addIntField(&bw, "numOfStable", 1);
// addIntField(&bw, "numOfTable", 1);
// addIntField(&bw, "numOfRows", 1);
// addStringField(&bw, "startAt", "2020-08-01T00:00:00Z");
// addStringField(&bw, "memoryUsage", "10240 kB");
// addStringField(&bw, "diskUsage", "10240 MB");
addIntField
(
bw
,
"numOfDnode"
,
mnodeGetDnodesNum
());
addIntField
(
bw
,
"numOfMnode"
,
mnodeGetMnodesNum
());
addIntField
(
bw
,
"numOfVgroup"
,
mnodeGetVgroupNum
());
addIntField
(
bw
,
"numOfDatabase"
,
mnodeGetDbNum
());
addIntField
(
bw
,
"numOfSuperTable"
,
mnodeGetSuperTableNum
());
addIntField
(
bw
,
"numOfChildTable"
,
mnodeGetChildTableNum
());
SAcctInfo
info
;
mnodeGetStatOfAllAcct
(
&
info
);
addIntField
(
bw
,
"numOfColumn"
,
info
.
numOfTimeSeries
);
addIntField
(
bw
,
"numOfPoint"
,
info
.
totalPoints
);
addIntField
(
bw
,
"totalStorage"
,
info
.
totalStorage
);
addIntField
(
bw
,
"compStorage"
,
info
.
compStorage
);
// addStringField(bw, "installTime", "2020-08-01T00:00:00Z");
}
static
void
sendTelemetryReport
()
{
...
...
@@ -230,18 +243,13 @@ static void sendTelemetryReport() {
static
void
*
telemetryThread
(
void
*
param
)
{
struct
timespec
end
=
{
0
};
clock_gettime
(
CLOCK_REALTIME
,
&
end
);
end
.
tv_sec
+=
300
;
// wait 5 minutes
to
send first report
end
.
tv_sec
+=
300
;
// wait 5 minutes
before
send first report
while
(
1
)
{
while
(
1
)
{
if
(
sem_timedwait
(
&
tsExitSem
,
&
end
)
==
0
)
{
return
NULL
;
}
struct
timespec
now
=
{
0
};
clock_gettime
(
CLOCK_REALTIME
,
&
now
);
if
(
now
.
tv_sec
>
end
.
tv_sec
||
(
now
.
tv_sec
==
end
.
tv_sec
&&
now
.
tv_nsec
>=
end
.
tv_nsec
))
{
break
;
}
if
(
sem_timedwait
(
&
tsExitSem
,
&
end
)
==
0
)
{
break
;
}
else
if
(
errno
!=
ETIMEDOUT
)
{
continue
;
}
if
(
sdbIsMaster
())
{
...
...
src/mnode/inc/mnodeAcct.h
浏览文件 @
b0186d1c
...
...
@@ -24,6 +24,7 @@ extern "C" {
int32_t
mnodeInitAccts
();
void
mnodeCleanupAccts
();
void
mnodeGetStatOfAllAcct
(
SAcctInfo
*
pAcctInfo
);
void
*
mnodeGetAcct
(
char
*
acctName
);
void
*
mnodeGetNextAcct
(
void
*
pIter
,
SAcctObj
**
pAcct
);
void
mnodeIncAcctRef
(
SAcctObj
*
pAcct
);
...
...
src/mnode/inc/mnodeDb.h
浏览文件 @
b0186d1c
...
...
@@ -30,6 +30,7 @@ enum _TSDB_DB_STATUS {
// api
int32_t
mnodeInitDbs
();
void
mnodeCleanupDbs
();
int64_t
mnodeGetDbNum
();
SDbObj
*
mnodeGetDb
(
char
*
db
);
SDbObj
*
mnodeGetDbByTableId
(
char
*
db
);
void
*
mnodeGetNextDb
(
void
*
pIter
,
SDbObj
**
pDb
);
...
...
src/mnode/inc/mnodeTable.h
浏览文件 @
b0186d1c
...
...
@@ -24,6 +24,8 @@ extern "C" {
int32_t
mnodeInitTables
();
void
mnodeCleanupTables
();
int64_t
mnodeGetSuperTableNum
();
int64_t
mnodeGetChildTableNum
();
void
*
mnodeGetTable
(
char
*
tableId
);
void
mnodeIncTableRef
(
void
*
pTable
);
void
mnodeDecTableRef
(
void
*
pTable
);
...
...
src/mnode/inc/mnodeVgroup.h
浏览文件 @
b0186d1c
...
...
@@ -24,6 +24,7 @@ struct SMnodeMsg;
int32_t
mnodeInitVgroups
();
void
mnodeCleanupVgroups
();
int64_t
mnodeGetVgroupNum
();
SVgObj
*
mnodeGetVgroup
(
int32_t
vgId
);
void
mnodeIncVgroupRef
(
SVgObj
*
pVgroup
);
void
mnodeDecVgroupRef
(
SVgObj
*
pVgroup
);
...
...
src/mnode/src/mnodeAcct.c
浏览文件 @
b0186d1c
...
...
@@ -23,6 +23,7 @@
#include "mnodeDb.h"
#include "mnodeSdb.h"
#include "mnodeUser.h"
#include "mnodeVgroup.h"
#include "tglobal.h"
...
...
@@ -130,6 +131,37 @@ void mnodeCleanupAccts() {
tsAcctSdb
=
NULL
;
}
void
mnodeGetStatOfAllAcct
(
SAcctInfo
*
pAcctInfo
)
{
memset
(
pAcctInfo
,
0
,
sizeof
(
*
pAcctInfo
));
void
*
pIter
=
NULL
;
SAcctObj
*
pAcct
=
NULL
;
while
(
1
)
{
pIter
=
mnodeGetNextAcct
(
pIter
,
&
pAcct
);
if
(
pAcct
==
NULL
)
{
break
;
}
pAcctInfo
->
numOfDbs
+=
pAcct
->
acctInfo
.
numOfDbs
;
pAcctInfo
->
numOfTimeSeries
+=
pAcct
->
acctInfo
.
numOfTimeSeries
;
mnodeDecAcctRef
(
pAcct
);
}
sdbFreeIter
(
pIter
);
SVgObj
*
pVgroup
=
NULL
;
pIter
=
NULL
;
while
(
1
)
{
pIter
=
mnodeGetNextVgroup
(
pIter
,
&
pVgroup
);
if
(
pVgroup
==
NULL
)
{
break
;
}
pAcctInfo
->
totalStorage
+=
pVgroup
->
totalStorage
;
pAcctInfo
->
compStorage
+=
pVgroup
->
compStorage
;
pAcctInfo
->
totalPoints
+=
pVgroup
->
pointsWritten
;
mnodeDecVgroupRef
(
pVgroup
);
}
sdbFreeIter
(
pIter
);
}
void
*
mnodeGetAcct
(
char
*
name
)
{
return
sdbGetRow
(
tsAcctSdb
,
name
);
}
...
...
src/mnode/src/mnodeDb.c
浏览文件 @
b0186d1c
...
...
@@ -61,6 +61,10 @@ static int32_t mnodeDbActionDestroy(SSdbOper *pOper) {
return
TSDB_CODE_SUCCESS
;
}
int64_t
mnodeGetDbNum
()
{
return
sdbGetNumOfRows
(
tsDbSdb
);
}
static
int32_t
mnodeDbActionInsert
(
SSdbOper
*
pOper
)
{
SDbObj
*
pDb
=
pOper
->
pObj
;
SAcctObj
*
pAcct
=
mnodeGetAcct
(
pDb
->
acct
);
...
...
src/mnode/src/mnodeTable.c
浏览文件 @
b0186d1c
...
...
@@ -375,6 +375,14 @@ static void mnodeCleanupChildTables() {
tsChildTableSdb
=
NULL
;
}
int64_t
mnodeGetSuperTableNum
()
{
return
sdbGetNumOfRows
(
tsSuperTableSdb
);
}
int64_t
mnodeGetChildTableNum
()
{
return
sdbGetNumOfRows
(
tsChildTableSdb
);
}
static
void
mnodeAddTableIntoStable
(
SSuperTableObj
*
pStable
,
SChildTableObj
*
pCtable
)
{
atomic_add_fetch_32
(
&
pStable
->
numOfTables
,
1
);
...
...
src/mnode/src/mnodeVgroup.c
浏览文件 @
b0186d1c
...
...
@@ -605,6 +605,10 @@ void mnodeCleanupVgroups() {
tsVgroupSdb
=
NULL
;
}
int64_t
mnodeGetVgroupNum
()
{
return
sdbGetNumOfRows
(
tsVgroupSdb
);
}
static
int32_t
mnodeGetVgroupMeta
(
STableMetaMsg
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
)
{
SDbObj
*
pDb
=
mnodeGetDb
(
pShow
->
db
);
if
(
pDb
==
NULL
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录