Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
fc7579cd
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看板
未验证
提交
fc7579cd
编写于
4月 09, 2021
作者:
S
Shengliang Guan
提交者:
GitHub
4月 09, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #5737 from taosdata/hotfix/TD-3682
[TD-3682]<fix>: Insufficient disk space may cause oom
上级
be4671d5
b7579334
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
31 addition
and
7 deletion
+31
-7
src/common/src/tglobal.c
src/common/src/tglobal.c
+1
-1
src/sync/src/syncMain.c
src/sync/src/syncMain.c
+9
-2
src/vnode/inc/vnodeInt.h
src/vnode/inc/vnodeInt.h
+1
-0
src/vnode/src/vnodeWrite.c
src/vnode/src/vnodeWrite.c
+20
-4
未找到文件。
src/common/src/tglobal.c
浏览文件 @
fc7579cd
...
...
@@ -212,7 +212,7 @@ float tsAvailTmpDirectorySpace = 0;
float
tsAvailDataDirGB
=
0
;
float
tsUsedDataDirGB
=
0
;
float
tsReservedTmpDirectorySpace
=
1
.
0
f
;
float
tsMinimalDataDirGB
=
1
.
0
f
;
float
tsMinimalDataDirGB
=
2
.
0
f
;
int32_t
tsTotalMemoryMB
=
0
;
uint32_t
tsVersion
=
0
;
...
...
src/sync/src/syncMain.c
浏览文件 @
fc7579cd
...
...
@@ -997,17 +997,24 @@ static void syncProcessForwardFromPeer(char *cont, SSyncPeer *pPeer) {
sTrace
(
"%s, forward is received, hver:%"
PRIu64
", len:%d"
,
pPeer
->
id
,
pHead
->
version
,
pHead
->
len
);
int32_t
code
=
0
;
if
(
nodeRole
==
TAOS_SYNC_ROLE_SLAVE
)
{
// nodeVersion = pHead->version;
(
*
pNode
->
writeToCacheFp
)(
pNode
->
vgId
,
pHead
,
TAOS_QTYPE_FWD
,
NULL
);
code
=
(
*
pNode
->
writeToCacheFp
)(
pNode
->
vgId
,
pHead
,
TAOS_QTYPE_FWD
,
NULL
);
}
else
{
if
(
nodeSStatus
!=
TAOS_SYNC_STATUS_INIT
)
{
syncSaveIntoBuffer
(
pPeer
,
pHead
);
code
=
syncSaveIntoBuffer
(
pPeer
,
pHead
);
}
else
{
sError
(
"%s, forward discarded since sstatus:%s, hver:%"
PRIu64
,
pPeer
->
id
,
syncStatus
[
nodeSStatus
],
pHead
->
version
);
code
=
-
1
;
}
}
if
(
code
!=
0
)
{
sError
(
"%s, failed to process fwd msg, hver:%"
PRIu64
", len:%d"
,
pPeer
->
id
,
pHead
->
version
,
pHead
->
len
);
syncRestartConnection
(
pPeer
);
}
}
static
void
syncProcessPeersStatusMsg
(
SPeersStatus
*
pPeersStatus
,
SSyncPeer
*
pPeer
)
{
...
...
src/vnode/inc/vnodeInt.h
浏览文件 @
fc7579cd
...
...
@@ -37,6 +37,7 @@ extern int32_t vDebugFlag;
typedef
struct
{
int32_t
vgId
;
// global vnode group ID
int32_t
refCount
;
// reference count
int64_t
queuedWMsgSize
;
int32_t
queuedWMsg
;
int32_t
queuedRMsg
;
int32_t
flowctrlLevel
;
...
...
src/vnode/src/vnodeWrite.c
浏览文件 @
fc7579cd
...
...
@@ -25,6 +25,7 @@
#include "vnodeStatus.h"
#define MAX_QUEUED_MSG_NUM 100000
#define MAX_QUEUED_MSG_SIZE 1024*1024*1024 //1GB
extern
void
*
tsDnodeTmr
;
static
int32_t
(
*
vnodeProcessWriteMsgFp
[
TSDB_MSG_TYPE_MAX
])(
SVnodeObj
*
,
void
*
pCont
,
SRspRet
*
);
...
...
@@ -269,6 +270,13 @@ static int32_t vnodeWriteToWQueueImp(SVWriteMsg *pWrite) {
}
}
if
(
tsAvailDataDirGB
<=
tsMinimalDataDirGB
)
{
vError
(
"vgId:%d, failed to write into vwqueue since no diskspace, avail:%fGB"
,
pVnode
->
vgId
,
tsAvailDataDirGB
);
taosFreeQitem
(
pWrite
);
vnodeRelease
(
pVnode
);
return
TSDB_CODE_VND_NO_DISKSPACE
;
}
if
(
!
vnodeInReadyOrUpdatingStatus
(
pVnode
))
{
vError
(
"vgId:%d, failed to write into vwqueue, vstatus is %s, refCount:%d pVnode:%p"
,
pVnode
->
vgId
,
vnodeStatus
[
pVnode
->
status
],
pVnode
->
refCount
,
pVnode
);
...
...
@@ -278,14 +286,17 @@ static int32_t vnodeWriteToWQueueImp(SVWriteMsg *pWrite) {
}
int32_t
queued
=
atomic_add_fetch_32
(
&
pVnode
->
queuedWMsg
,
1
);
if
(
queued
>
MAX_QUEUED_MSG_NUM
)
{
int64_t
queuedSize
=
atomic_add_fetch_64
(
&
pVnode
->
queuedWMsgSize
,
pWrite
->
pHead
.
len
);
if
(
queued
>
MAX_QUEUED_MSG_NUM
||
queuedSize
>
MAX_QUEUED_MSG_SIZE
)
{
int32_t
ms
=
(
queued
/
MAX_QUEUED_MSG_NUM
)
*
10
+
3
;
if
(
ms
>
100
)
ms
=
100
;
vDebug
(
"vgId:%d, too many msg:%d in vwqueue, flow control %dms"
,
pVnode
->
vgId
,
queued
,
ms
);
taosMsleep
(
ms
);
}
vTrace
(
"vgId:%d, write into vwqueue, refCount:%d queued:%d"
,
pVnode
->
vgId
,
pVnode
->
refCount
,
pVnode
->
queuedWMsg
);
vTrace
(
"vgId:%d, write into vwqueue, refCount:%d queued:%d size:%"
PRId64
,
pVnode
->
vgId
,
pVnode
->
refCount
,
pVnode
->
queuedWMsg
,
pVnode
->
queuedWMsgSize
);
taosWriteQitem
(
pVnode
->
wqueue
,
pWrite
->
qtype
,
pWrite
);
return
TSDB_CODE_SUCCESS
;
...
...
@@ -308,7 +319,10 @@ void vnodeFreeFromWQueue(void *vparam, SVWriteMsg *pWrite) {
SVnodeObj
*
pVnode
=
vparam
;
int32_t
queued
=
atomic_sub_fetch_32
(
&
pVnode
->
queuedWMsg
,
1
);
vTrace
(
"vgId:%d, msg:%p, app:%p, free from vwqueue, queued:%d"
,
pVnode
->
vgId
,
pWrite
,
pWrite
->
rpcMsg
.
ahandle
,
queued
);
int64_t
queuedSize
=
atomic_sub_fetch_64
(
&
pVnode
->
queuedWMsgSize
,
pWrite
->
pHead
.
len
);
vTrace
(
"vgId:%d, msg:%p, app:%p, free from vwqueue, queued:%d size:%"
PRId64
,
pVnode
->
vgId
,
pWrite
,
pWrite
->
rpcMsg
.
ahandle
,
queued
,
queuedSize
);
taosFreeQitem
(
pWrite
);
vnodeRelease
(
pVnode
);
...
...
@@ -344,7 +358,9 @@ static void vnodeFlowCtrlMsgToWQueue(void *param, void *tmrId) {
static
int32_t
vnodePerformFlowCtrl
(
SVWriteMsg
*
pWrite
)
{
SVnodeObj
*
pVnode
=
pWrite
->
pVnode
;
if
(
pWrite
->
qtype
!=
TAOS_QTYPE_RPC
)
return
0
;
if
(
pVnode
->
queuedWMsg
<
MAX_QUEUED_MSG_NUM
&&
pVnode
->
flowctrlLevel
<=
0
)
return
0
;
if
(
pVnode
->
queuedWMsg
<
MAX_QUEUED_MSG_NUM
&&
pVnode
->
queuedWMsgSize
<
MAX_QUEUED_MSG_SIZE
&&
pVnode
->
flowctrlLevel
<=
0
)
return
0
;
if
(
tsEnableFlowCtrl
==
0
)
{
int32_t
ms
=
(
int32_t
)
pow
(
2
,
pVnode
->
flowctrlLevel
+
2
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录