Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
dce1f579
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看板
未验证
提交
dce1f579
编写于
7月 24, 2023
作者:
D
dapan1121
提交者:
GitHub
7月 24, 2023
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #22143 from taosdata/enh/TD-24987-3.0
enh: expire time optimize
上级
6fbf2519
7946ce49
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
52 addition
and
9 deletion
+52
-9
include/common/tglobal.h
include/common/tglobal.h
+6
-0
include/os/os.h
include/os/os.h
+1
-0
include/os/osSysinfo.h
include/os/osSysinfo.h
+1
-0
source/common/src/tglobal.c
source/common/src/tglobal.c
+8
-0
source/dnode/mgmt/exe/dmMain.c
source/dnode/mgmt/exe/dmMain.c
+2
-0
source/dnode/mgmt/mgmt_dnode/src/dmWorker.c
source/dnode/mgmt/mgmt_dnode/src/dmWorker.c
+12
-2
source/dnode/mgmt/node_mgmt/src/dmTransport.c
source/dnode/mgmt/node_mgmt/src/dmTransport.c
+1
-0
source/dnode/mnode/impl/inc/mndCluster.h
source/dnode/mnode/impl/inc/mndCluster.h
+1
-1
source/dnode/mnode/impl/src/mndCluster.c
source/dnode/mnode/impl/src/mndCluster.c
+2
-2
source/dnode/mnode/impl/src/mndDnode.c
source/dnode/mnode/impl/src/mndDnode.c
+5
-3
source/dnode/mnode/impl/src/mndMain.c
source/dnode/mnode/impl/src/mndMain.c
+1
-1
source/os/src/osSysinfo.c
source/os/src/osSysinfo.c
+12
-0
未找到文件。
include/common/tglobal.h
浏览文件 @
dce1f579
...
...
@@ -85,8 +85,14 @@ extern int64_t tsVndCommitMaxIntervalMs;
extern
int64_t
tsMndSdbWriteDelta
;
extern
int64_t
tsMndLogRetention
;
extern
int8_t
tsGrant
;
extern
int32_t
tsMndGrantMode
;
extern
bool
tsMndSkipGrant
;
// dnode
extern
int64_t
tsDndStart
;
extern
int64_t
tsDndStartOsUptime
;
extern
int64_t
tsDndUpTime
;
// monitor
extern
bool
tsEnableMonitor
;
extern
int32_t
tsMonitorInterval
;
...
...
include/os/os.h
浏览文件 @
dce1f579
...
...
@@ -53,6 +53,7 @@ extern "C" {
#else
#include <argp.h>
#include <sys/prctl.h>
#include <sys/sysinfo.h>
#if defined(_TD_X86_)
#include <cpuid.h>
#endif
...
...
include/os/osSysinfo.h
浏览文件 @
dce1f579
...
...
@@ -35,6 +35,7 @@ typedef struct {
bool
taosCheckSystemIsLittleEnd
();
void
taosGetSystemInfo
();
int64_t
taosGetOsUptime
();
int32_t
taosGetEmail
(
char
*
email
,
int32_t
maxLen
);
int32_t
taosGetOsReleaseName
(
char
*
releaseName
,
char
*
sName
,
char
*
ver
,
int32_t
maxLen
);
int32_t
taosGetCpuInfo
(
char
*
cpuModel
,
int32_t
maxLen
,
float
*
numOfCores
);
...
...
source/common/src/tglobal.c
浏览文件 @
dce1f579
...
...
@@ -77,8 +77,14 @@ int64_t tsVndCommitMaxIntervalMs = 600 * 1000;
int64_t
tsMndSdbWriteDelta
=
200
;
int64_t
tsMndLogRetention
=
2000
;
int8_t
tsGrant
=
1
;
int32_t
tsMndGrantMode
=
0
;
bool
tsMndSkipGrant
=
false
;
// dnode
int64_t
tsDndStart
=
0
;
int64_t
tsDndStartOsUptime
=
0
;
int64_t
tsDndUpTime
=
0
;
// monitor
bool
tsEnableMonitor
=
true
;
int32_t
tsMonitorInterval
=
30
;
...
...
@@ -506,6 +512,7 @@ static int32_t taosAddServerCfg(SConfig *pCfg) {
if
(
cfgAddInt64
(
pCfg
,
"mndSdbWriteDelta"
,
tsMndSdbWriteDelta
,
20
,
10000
,
CFG_SCOPE_SERVER
)
!=
0
)
return
-
1
;
if
(
cfgAddInt64
(
pCfg
,
"mndLogRetention"
,
tsMndLogRetention
,
500
,
10000
,
CFG_SCOPE_SERVER
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"grantMode"
,
tsMndGrantMode
,
0
,
10000
,
CFG_SCOPE_SERVER
)
!=
0
)
return
-
1
;
if
(
cfgAddBool
(
pCfg
,
"skipGrant"
,
tsMndSkipGrant
,
CFG_SCOPE_SERVER
)
!=
0
)
return
-
1
;
if
(
cfgAddBool
(
pCfg
,
"monitor"
,
tsEnableMonitor
,
CFG_SCOPE_SERVER
)
!=
0
)
return
-
1
;
...
...
@@ -915,6 +922,7 @@ static int32_t taosSetServerCfg(SConfig *pCfg) {
tsMndSdbWriteDelta
=
cfgGetItem
(
pCfg
,
"mndSdbWriteDelta"
)
->
i64
;
tsMndLogRetention
=
cfgGetItem
(
pCfg
,
"mndLogRetention"
)
->
i64
;
tsMndSkipGrant
=
cfgGetItem
(
pCfg
,
"skipGrant"
)
->
bval
;
tsMndGrantMode
=
cfgGetItem
(
pCfg
,
"grantMode"
)
->
i32
;
tsStartUdfd
=
cfgGetItem
(
pCfg
,
"udf"
)
->
bval
;
tstrncpy
(
tsUdfdResFuncs
,
cfgGetItem
(
pCfg
,
"udfdResFuncs"
)
->
str
,
sizeof
(
tsUdfdResFuncs
));
...
...
source/dnode/mgmt/exe/dmMain.c
浏览文件 @
dce1f579
...
...
@@ -373,6 +373,8 @@ int mainWindows(int argc, char **argv) {
dInfo
(
"start to init service"
);
dmSetSignalHandle
();
tsDndStart
=
taosGetTimestampMs
();
tsDndStartOsUptime
=
taosGetOsUptime
();
int32_t
code
=
dmRun
();
dInfo
(
"shutting down the service"
);
...
...
source/dnode/mgmt/mgmt_dnode/src/dmWorker.c
浏览文件 @
dce1f579
...
...
@@ -24,12 +24,16 @@ static void *dmStatusThreadFp(void *param) {
const
static
int16_t
TRIM_FREQ
=
30
;
int32_t
trimCount
=
0
;
int32_t
upTimeCount
=
0
;
int64_t
upTime
=
0
;
while
(
1
)
{
taosMsleep
(
200
);
if
(
pMgmt
->
pData
->
dropped
||
pMgmt
->
pData
->
stopped
)
break
;
int64_t
curTime
=
taosGetTimestampMs
();
float
interval
=
(
curTime
-
lastTime
)
/
1000
.
0
f
;
if
(
curTime
<
lastTime
)
lastTime
=
curTime
;
float
interval
=
(
curTime
-
lastTime
)
/
1000
.
0
f
;
if
(
interval
>=
tsStatusInterval
)
{
dmSendStatusReq
(
pMgmt
);
lastTime
=
curTime
;
...
...
@@ -38,6 +42,11 @@ static void *dmStatusThreadFp(void *param) {
if
(
trimCount
==
0
)
{
taosMemoryTrim
(
0
);
}
if
((
upTimeCount
=
((
upTimeCount
+
1
)
&
63
))
==
0
)
{
upTime
=
taosGetOsUptime
()
-
tsDndStartOsUptime
;
tsDndUpTime
=
TMAX
(
tsDndUpTime
,
upTime
);
}
}
}
...
...
@@ -54,7 +63,8 @@ static void *dmMonitorThreadFp(void *param) {
if
(
pMgmt
->
pData
->
dropped
||
pMgmt
->
pData
->
stopped
)
break
;
int64_t
curTime
=
taosGetTimestampMs
();
float
interval
=
(
curTime
-
lastTime
)
/
1000
.
0
f
;
if
(
curTime
<
lastTime
)
lastTime
=
curTime
;
float
interval
=
(
curTime
-
lastTime
)
/
1000
.
0
f
;
if
(
interval
>=
tsMonitorInterval
)
{
(
*
pMgmt
->
sendMonitorReportFp
)();
lastTime
=
curTime
;
...
...
source/dnode/mgmt/node_mgmt/src/dmTransport.c
浏览文件 @
dce1f579
...
...
@@ -290,6 +290,7 @@ int32_t dmInitClient(SDnode *pDnode) {
rpcInit
.
cfp
=
(
RpcCfp
)
dmProcessRpcMsg
;
rpcInit
.
sessions
=
1024
;
rpcInit
.
connType
=
TAOS_CONN_CLIENT
;
rpcInit
.
user
=
TSDB_DEFAULT_USER
;
rpcInit
.
idleTime
=
tsShellActivityTimer
*
1000
;
rpcInit
.
parent
=
pDnode
;
rpcInit
.
rfp
=
rpcRfp
;
...
...
source/dnode/mnode/impl/inc/mndCluster.h
浏览文件 @
dce1f579
...
...
@@ -27,7 +27,7 @@ void mndCleanupCluster(SMnode *pMnode);
int32_t
mndGetClusterName
(
SMnode
*
pMnode
,
char
*
clusterName
,
int32_t
len
);
int64_t
mndGetClusterId
(
SMnode
*
pMnode
);
int64_t
mndGetClusterCreateTime
(
SMnode
*
pMnode
);
float
mndGetClusterUpTime
(
SMnode
*
pMnode
);
int64_t
mndGetClusterUpTime
(
SMnode
*
pMnode
);
#ifdef __cplusplus
}
...
...
source/dnode/mnode/impl/src/mndCluster.c
浏览文件 @
dce1f579
...
...
@@ -123,7 +123,7 @@ static int32_t mndGetClusterUpTimeImp(SClusterObj *pCluster) {
#endif
}
floa
t
mndGetClusterUpTime
(
SMnode
*
pMnode
)
{
int64_
t
mndGetClusterUpTime
(
SMnode
*
pMnode
)
{
int64_t
upTime
=
0
;
void
*
pIter
=
NULL
;
SClusterObj
*
pCluster
=
mndAcquireCluster
(
pMnode
,
&
pIter
);
...
...
@@ -132,7 +132,7 @@ float mndGetClusterUpTime(SMnode *pMnode) {
mndReleaseCluster
(
pMnode
,
pCluster
,
pIter
);
}
return
upTime
/
86400
.
0
f
;
return
upTime
;
}
static
SSdbRaw
*
mndClusterActionEncode
(
SClusterObj
*
pCluster
)
{
...
...
source/dnode/mnode/impl/src/mndDnode.c
浏览文件 @
dce1f579
...
...
@@ -655,6 +655,7 @@ static int32_t mndConfigDnode(SMnode *pMnode, SRpcMsg *pReq, SMCfgDnodeReq *pCfg
STrans
*
pTrans
=
NULL
;
SDnodeObj
*
pDnode
=
NULL
;
bool
cfgAll
=
pCfgReq
->
dnodeId
==
-
1
;
int32_t
iter
=
0
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
void
*
pIter
=
NULL
;
...
...
@@ -662,7 +663,8 @@ static int32_t mndConfigDnode(SMnode *pMnode, SRpcMsg *pReq, SMCfgDnodeReq *pCfg
if
(
cfgAll
)
{
pIter
=
sdbFetch
(
pSdb
,
SDB_DNODE
,
pIter
,
(
void
**
)
&
pDnode
);
if
(
pIter
==
NULL
)
break
;
}
else
if
(
!
(
pDnode
=
mndAcquireDnode
(
pMnode
,
pCfgReq
->
dnodeId
)))
{
++
iter
;
}
else
if
(
!
(
pDnode
=
mndAcquireDnode
(
pMnode
,
pCfgReq
->
dnodeId
)))
{
goto
_OVER
;
}
...
...
@@ -699,7 +701,7 @@ static int32_t mndConfigDnode(SMnode *pMnode, SRpcMsg *pReq, SMCfgDnodeReq *pCfg
}
if
(
pTrans
&&
mndTransPrepare
(
pMnode
,
pTrans
)
!=
0
)
goto
_OVER
;
tsGrantHBInterval
=
TMIN
(
TMAX
(
5
,
iter
/
2
),
30
);
terrno
=
0
;
_OVER:
...
...
@@ -863,7 +865,7 @@ static int32_t mndProcessCreateDnodeReq(SRpcMsg *pReq) {
code
=
mndCreateDnode
(
pMnode
,
pReq
,
&
createReq
);
if
(
code
==
0
)
code
=
TSDB_CODE_ACTION_IN_PROGRESS
;
tsGrantHBInterval
=
5
;
_OVER:
if
(
code
!=
0
&&
code
!=
TSDB_CODE_ACTION_IN_PROGRESS
)
{
mError
(
"dnode:%s:%d, failed to create since %s"
,
createReq
.
fqdn
,
createReq
.
port
,
terrstr
());
...
...
source/dnode/mnode/impl/src/mndMain.c
浏览文件 @
dce1f579
...
...
@@ -804,7 +804,7 @@ int32_t mndGetMonitorInfo(SMnode *pMnode, SMonClusterInfo *pClusterInfo, SMonVgr
if
(
pObj
->
id
==
pMnode
->
selfDnodeId
)
{
pClusterInfo
->
first_ep_dnode_id
=
pObj
->
id
;
tstrncpy
(
pClusterInfo
->
first_ep
,
pObj
->
pDnode
->
ep
,
sizeof
(
pClusterInfo
->
first_ep
));
pClusterInfo
->
master_uptime
=
mndGetClusterUpTime
(
pMnode
)
;
pClusterInfo
->
master_uptime
=
(
float
)
mndGetClusterUpTime
(
pMnode
)
/
86400
.
0
f
;
// pClusterInfo->master_uptime = (ms - pObj->stateStartTime) / (86400000.0f);
tstrncpy
(
desc
.
role
,
syncStr
(
TAOS_SYNC_STATE_LEADER
),
sizeof
(
desc
.
role
));
}
else
{
...
...
source/os/src/osSysinfo.c
浏览文件 @
dce1f579
...
...
@@ -961,6 +961,18 @@ char *taosGetCmdlineByPID(int pid) {
#endif
}
int64_t
taosGetOsUptime
()
{
#ifdef WINDOWS
#elif defined(_TD_DARWIN_64)
#else
struct
sysinfo
info
;
if
(
0
==
sysinfo
(
&
info
))
{
return
(
int64_t
)
info
.
uptime
*
1000
;
}
#endif
return
0
;
}
void
taosSetCoreDump
(
bool
enable
)
{
if
(
!
enable
)
return
;
#ifdef WINDOWS
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录