Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
43c954b6
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
43c954b6
编写于
9月 27, 2022
作者:
C
Cary Xu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
chore: data migration support specify max speed
上级
6c682daf
变更
11
显示空白变更内容
内联
并排
Showing
11 changed file
with
65 addition
and
42 deletion
+65
-42
include/common/tmsg.h
include/common/tmsg.h
+1
-1
source/common/src/tmsg.c
source/common/src/tmsg.c
+2
-2
source/dnode/mnode/impl/src/mndDb.c
source/dnode/mnode/impl/src/mndDb.c
+13
-4
source/dnode/vnode/src/inc/tsdb.h
source/dnode/vnode/src/inc/tsdb.h
+3
-3
source/dnode/vnode/src/inc/vnodeInt.h
source/dnode/vnode/src/inc/vnodeInt.h
+2
-2
source/dnode/vnode/src/sma/smaRollup.c
source/dnode/vnode/src/sma/smaRollup.c
+1
-1
source/dnode/vnode/src/tsdb/tsdbCommit.c
source/dnode/vnode/src/tsdb/tsdbCommit.c
+3
-2
source/dnode/vnode/src/tsdb/tsdbOpen.c
source/dnode/vnode/src/tsdb/tsdbOpen.c
+1
-1
source/dnode/vnode/src/tsdb/tsdbReaderWriter.c
source/dnode/vnode/src/tsdb/tsdbReaderWriter.c
+24
-18
source/dnode/vnode/src/tsdb/tsdbRetention2.c
source/dnode/vnode/src/tsdb/tsdbRetention2.c
+9
-3
source/dnode/vnode/src/vnd/vnodeSvr.c
source/dnode/vnode/src/vnd/vnodeSvr.c
+6
-5
未找到文件。
include/common/tmsg.h
浏览文件 @
43c954b6
...
...
@@ -875,7 +875,7 @@ int32_t tDeserializeSTrimDbReq(void* buf, int32_t bufLen, STrimDbReq* pReq);
typedef
struct
{
int64_t
timestamp
;
// unit: millisecond
int
32_t
maxSpeed
;
// 0 no limit, unit: bit
/s
int
64_t
maxSpeed
;
// 0 no limit, unit: Byte
/s
}
SVTrimDbReq
;
int32_t
tSerializeSVTrimDbReq
(
void
*
buf
,
int32_t
bufLen
,
SVTrimDbReq
*
pReq
);
...
...
source/common/src/tmsg.c
浏览文件 @
43c954b6
...
...
@@ -2709,7 +2709,7 @@ int32_t tSerializeSVTrimDbReq(void *buf, int32_t bufLen, SVTrimDbReq *pReq) {
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
pReq
->
timestamp
)
<
0
)
return
-
1
;
if
(
tEncodeI
32
(
&
encoder
,
pReq
->
maxSpeed
)
<
0
)
return
-
1
;
if
(
tEncodeI
64
(
&
encoder
,
pReq
->
maxSpeed
)
<
0
)
return
-
1
;
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
...
...
@@ -2723,7 +2723,7 @@ int32_t tDeserializeSVTrimDbReq(void *buf, int32_t bufLen, SVTrimDbReq *pReq) {
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
pReq
->
timestamp
)
<
0
)
return
-
1
;
if
(
tDecodeI
32
(
&
decoder
,
&
pReq
->
maxSpeed
)
<
0
)
return
-
1
;
if
(
tDecodeI
64
(
&
decoder
,
&
pReq
->
maxSpeed
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tDecoderClear
(
&
decoder
);
...
...
source/dnode/mnode/impl/src/mndDb.c
浏览文件 @
43c954b6
...
...
@@ -1385,11 +1385,19 @@ _OVER:
return
code
;
}
static
int32_t
mndTrimDb
(
SMnode
*
pMnode
,
SDbObj
*
pDb
)
{
/**
* @brief trim database
*
* @param pMnode
* @param pDb
* @param maxSpeed MB/s
* @return int32_t
*/
static
int32_t
mndTrimDb
(
SMnode
*
pMnode
,
SDbObj
*
pDb
,
int32_t
maxSpeed
)
{
SSdb
*
pSdb
=
pMnode
->
pSdb
;
SVgObj
*
pVgroup
=
NULL
;
void
*
pIter
=
NULL
;
SVTrimDbReq
trimReq
=
{.
timestamp
=
taosGetTimestampMs
(),
.
maxSpeed
=
1048576
<<
2
};
// TODO: use specified maxSpeed
SVTrimDbReq
trimReq
=
{.
timestamp
=
taosGetTimestampMs
(),
.
maxSpeed
=
maxSpeed
<<
20
};
int32_t
reqLen
=
tSerializeSVTrimDbReq
(
NULL
,
0
,
&
trimReq
);
int32_t
contLen
=
reqLen
+
sizeof
(
SMsgHead
);
...
...
@@ -1413,7 +1421,8 @@ static int32_t mndTrimDb(SMnode *pMnode, SDbObj *pDb) {
if
(
code
!=
0
)
{
mError
(
"vgId:%d, failed to send vnode-trim request to vnode since 0x%x"
,
pVgroup
->
vgId
,
code
);
}
else
{
mInfo
(
"vgId:%d, send vnode-trim request to vnode, time:%"
PRIi64
,
pVgroup
->
vgId
,
trimReq
.
timestamp
);
mInfo
(
"vgId:%d, send vnode-trim request to vnode, time:%"
PRIi64
", max speed:%"
PRIi64
,
pVgroup
->
vgId
,
trimReq
.
timestamp
,
trimReq
.
maxSpeed
);
}
sdbRelease
(
pSdb
,
pVgroup
);
}
...
...
@@ -1443,7 +1452,7 @@ static int32_t mndProcessTrimDbReq(SRpcMsg *pReq) {
goto
_OVER
;
}
code
=
mndTrimDb
(
pMnode
,
pDb
);
code
=
mndTrimDb
(
pMnode
,
pDb
,
trimReq
.
maxSpeed
);
_OVER:
if
(
code
!=
0
)
{
...
...
source/dnode/vnode/src/inc/tsdb.h
浏览文件 @
43c954b6
...
...
@@ -264,7 +264,7 @@ int32_t tsdbWriteSttBlk(SDataFWriter *pWriter, SArray *aSttBlk);
int32_t
tsdbWriteBlockData
(
SDataFWriter
*
pWriter
,
SBlockData
*
pBlockData
,
SBlockInfo
*
pBlkInfo
,
SSmaInfo
*
pSmaInfo
,
int8_t
cmprAlg
,
int8_t
toLast
);
int32_t
tsdbDFileSetCopy
(
STsdb
*
pTsdb
,
SDFileSet
*
pSetFrom
,
SDFileSet
*
pSetTo
,
int
32
_t
maxSpeed
);
int32_t
tsdbDFileSetCopy
(
STsdb
*
pTsdb
,
SDFileSet
*
pSetFrom
,
SDFileSet
*
pSetTo
,
int
64
_t
maxSpeed
);
// SDataFReader
int32_t
tsdbDataFReaderOpen
(
SDataFReader
**
ppReader
,
STsdb
*
pTsdb
,
SDFileSet
*
pSet
);
int32_t
tsdbDataFReaderClose
(
SDataFReader
**
ppReader
);
...
...
@@ -321,7 +321,7 @@ struct STsdbFS {
struct
STsdbTrimHdl
{
volatile
int8_t
state
;
// 0 idle 1 in use
volatile
int8_t
limitSpeed
;
// 0 no limit, 1 with lim
it
volatile
int8_t
commitInWait
;
// 0 not in wait, 1 in wa
it
volatile
int32_t
maxRetentFid
;
volatile
int32_t
minCommitFid
;
};
...
...
source/dnode/vnode/src/inc/vnodeInt.h
浏览文件 @
43c954b6
...
...
@@ -145,7 +145,7 @@ int tsdbOpen(SVnode* pVnode, STsdb** ppTsdb, const char* dir, STsdbKeepC
int
tsdbClose
(
STsdb
**
pTsdb
);
int32_t
tsdbBegin
(
STsdb
*
pTsdb
);
int32_t
tsdbCommit
(
STsdb
*
pTsdb
);
int32_t
tsdbDoRetention
(
STsdb
*
pTsdb
,
int64_t
now
,
int
32
_t
maxSpeed
);
int32_t
tsdbDoRetention
(
STsdb
*
pTsdb
,
int64_t
now
,
int
64
_t
maxSpeed
);
int
tsdbScanAndConvertSubmitMsg
(
STsdb
*
pTsdb
,
SSubmitReq
*
pMsg
);
int
tsdbInsertData
(
STsdb
*
pTsdb
,
int64_t
version
,
SSubmitReq
*
pMsg
,
SSubmitRsp
*
pRsp
);
int32_t
tsdbInsertTableData
(
STsdb
*
pTsdb
,
int64_t
version
,
SSubmitMsgIter
*
pMsgIter
,
SSubmitBlk
*
pBlock
,
...
...
@@ -200,7 +200,7 @@ int32_t smaSyncPostCommit(SSma* pSma);
int32_t
smaAsyncPreCommit
(
SSma
*
pSma
);
int32_t
smaAsyncCommit
(
SSma
*
pSma
);
int32_t
smaAsyncPostCommit
(
SSma
*
pSma
);
int32_t
smaDoRetention
(
SSma
*
pSma
,
int64_t
now
,
int
32
_t
maxSpeed
);
int32_t
smaDoRetention
(
SSma
*
pSma
,
int64_t
now
,
int
64
_t
maxSpeed
);
int32_t
tdProcessTSmaCreate
(
SSma
*
pSma
,
int64_t
version
,
const
char
*
msg
);
int32_t
tdProcessTSmaInsert
(
SSma
*
pSma
,
int64_t
indexUid
,
const
char
*
msg
);
...
...
source/dnode/vnode/src/sma/smaRollup.c
浏览文件 @
43c954b6
...
...
@@ -664,7 +664,7 @@ static int32_t tdFetchSubmitReqSuids(SSubmitReq *pMsg, STbUidStore *pStore) {
* @param maxSpeed
* @return int32_t
*/
int32_t
smaDoRetention
(
SSma
*
pSma
,
int64_t
now
,
int
32
_t
maxSpeed
)
{
int32_t
smaDoRetention
(
SSma
*
pSma
,
int64_t
now
,
int
64
_t
maxSpeed
)
{
int32_t
code
=
TSDB_CODE_SUCCESS
;
if
(
!
VND_IS_RSMA
(
pSma
->
pVnode
))
{
return
code
;
...
...
source/dnode/vnode/src/tsdb/tsdbCommit.c
浏览文件 @
43c954b6
...
...
@@ -763,10 +763,11 @@ static int32_t tsdbStartCommit(STsdb *pTsdb, SCommitter *pCommitter) {
_wait_retention_end:
while
(
atomic_load_32
(
&
pTsdb
->
trimHdl
.
maxRetentFid
)
>=
minCommitFid
)
{
atomic_val_compare_exchange_8
(
&
pTsdb
->
trimHdl
.
limitSpeed
,
1
,
0
);
atomic_val_compare_exchange_8
(
&
pTsdb
->
trimHdl
.
commitInWait
,
0
,
1
);
if
(
++
nLoops
>
1000
)
{
nLoops
=
0
;
sched_yield
();
printf
(
"%s:%d wait retention to finish
\n
"
,
__func__
,
__LINE__
);
}
}
if
(
atomic_val_compare_exchange_8
(
&
pTsdb
->
trimHdl
.
state
,
0
,
1
)
==
0
)
{
...
...
@@ -779,7 +780,7 @@ static int32_t tsdbStartCommit(STsdb *pTsdb, SCommitter *pCommitter) {
}
else
{
goto
_wait_retention_end
;
}
atomic_store_8
(
&
pTsdb
->
trimHdl
.
limitSpeed
,
1
);
atomic_store_8
(
&
pTsdb
->
trimHdl
.
commitInWait
,
0
);
}
code
=
tsdbFSCopy
(
pTsdb
,
&
pCommitter
->
fs
);
...
...
source/dnode/vnode/src/tsdb/tsdbOpen.c
浏览文件 @
43c954b6
...
...
@@ -73,7 +73,7 @@ int tsdbOpen(SVnode *pVnode, STsdb **ppTsdb, const char *dir, STsdbKeepCfg *pKee
pTsdb
->
trimHdl
.
maxRetentFid
=
INT32_MIN
;
pTsdb
->
trimHdl
.
minCommitFid
=
INT32_MAX
;
pTsdb
->
trimHdl
.
limitSpeed
=
1
;
pTsdb
->
trimHdl
.
commitInWait
=
0
;
tsdbDebug
(
"vgId:%d, tsdb is opened at %s, days:%d, keep:%d,%d,%d"
,
TD_VID
(
pVnode
),
pTsdb
->
path
,
pTsdb
->
keepCfg
.
days
,
pTsdb
->
keepCfg
.
keep0
,
pTsdb
->
keepCfg
.
keep1
,
pTsdb
->
keepCfg
.
keep2
);
...
...
source/dnode/vnode/src/tsdb/tsdbReaderWriter.c
浏览文件 @
43c954b6
...
...
@@ -610,13 +610,14 @@ _err:
/**
* @brief send file with limited speed(rough control)
*
* @param pTsdb
* @param pFileOut
* @param pFileIn
* @param size
* @param speed 0 no limit, unit: B/s
* @return int64_t
*/
static
int64_t
tsdbFSendFile
(
TdFilePtr
pOutFD
,
TdFilePtr
pInFD
,
int64_t
size
,
int32
_t
speed
)
{
static
int64_t
tsdbFSendFile
(
STsdb
*
pTsdb
,
TdFilePtr
pOutFD
,
TdFilePtr
pInFD
,
int64_t
size
,
int64
_t
speed
)
{
if
(
speed
<=
0
)
{
return
taosFSendFile
(
pOutFD
,
pInFD
,
0
,
size
);
}
...
...
@@ -626,9 +627,15 @@ static int64_t tsdbFSendFile(TdFilePtr pOutFD, TdFilePtr pInFD, int64_t size, in
int64_t
nBytes
=
0
;
int64_t
startMs
=
0
;
int64_t
cost
=
0
;
while
((
offset
+
speed
)
<
size
)
{
while
((
offset
+
nBytes
)
<
size
)
{
if
(
atomic_load_8
(
&
pTsdb
->
trimHdl
.
commitInWait
)
==
1
)
{
tsdbInfo
(
"vgId:%d sendFile without limit since conflicts, fSize:%"
PRIi64
", maxSpeed:%"
PRIi64
,
TD_VID
(
pTsdb
->
pVnode
),
size
,
speed
);
goto
_send_remain
;
}
startMs
=
taosGetTimestampMs
();
if
((
nBytes
=
taosFSendFile
(
pOutFD
,
pInFD
,
&
offset
,
speed
))
<
0
)
{
if
((
nBytes
=
taosFSendFile
(
pOutFD
,
pInFD
,
&
offset
,
speed
/
10
))
<
0
)
{
return
nBytes
;
}
cost
=
taosGetTimestampMs
()
-
startMs
;
...
...
@@ -642,20 +649,24 @@ static int64_t tsdbFSendFile(TdFilePtr pOutFD, TdFilePtr pInFD, int64_t size, in
}
if
(
nSleep
>
0
)
{
taosMsleep
(
nSleep
);
tsdb
Debug
(
"sendFile from %p to %p, fSize:%"
PRIi64
", maxSpeed:%d, msleep:%"
PRIi64
,
pOutFD
,
pInFD
,
size
,
speed
,
nSleep
);
tsdb
Info
(
"vgId:%d sendFile and msleep:%"
PRIi64
", fSize:%"
PRIi64
", tBytes:%"
PRIi64
" maxSpeed:%"
PRIi64
,
TD_VID
(
pTsdb
->
pVnode
),
nSleep
,
size
,
tBytes
,
speed
);
}
}
_send_remain:
if
(
offset
<
size
)
{
if
((
nBytes
=
taosFSendFile
(
pOutFD
,
pInFD
,
&
offset
,
size
-
offset
))
<
0
)
{
return
nBytes
;
}
tBytes
+=
nBytes
;
tsdbInfo
(
"vgId:%d sendFile remain, fSize:%"
PRIi64
", tBytes:%"
PRIi64
" maxSpeed:%"
PRIi64
,
TD_VID
(
pTsdb
->
pVnode
),
size
,
tBytes
,
speed
);
}
return
tBytes
;
}
int32_t
tsdbDFileSetCopy
(
STsdb
*
pTsdb
,
SDFileSet
*
pSetFrom
,
SDFileSet
*
pSetTo
,
int
32
_t
maxSpeed
)
{
int32_t
tsdbDFileSetCopy
(
STsdb
*
pTsdb
,
SDFileSet
*
pSetFrom
,
SDFileSet
*
pSetTo
,
int
64
_t
maxSpeed
)
{
int32_t
code
=
0
;
int64_t
n
;
int64_t
size
;
...
...
@@ -664,13 +675,8 @@ int32_t tsdbDFileSetCopy(STsdb *pTsdb, SDFileSet *pSetFrom, SDFileSet *pSetTo, i
int32_t
szPage
=
pTsdb
->
pVnode
->
config
.
szPage
;
char
fNameFrom
[
TSDB_FILENAME_LEN
];
char
fNameTo
[
TSDB_FILENAME_LEN
];
int32_t
speed
=
0
;
int64_t
fStatSize
=
0
;
if
(
atomic_load_8
(
&
pTsdb
->
trimHdl
.
limitSpeed
))
{
speed
=
maxSpeed
;
}
// head
tsdbHeadFileName
(
pTsdb
,
pSetFrom
->
diskId
,
pSetFrom
->
fid
,
pSetFrom
->
pHeadF
,
fNameFrom
);
tsdbHeadFileName
(
pTsdb
,
pSetTo
->
diskId
,
pSetTo
->
fid
,
pSetTo
->
pHeadF
,
fNameTo
);
...
...
@@ -687,7 +693,7 @@ int32_t tsdbDFileSetCopy(STsdb *pTsdb, SDFileSet *pSetFrom, SDFileSet *pSetTo, i
fStatSize
=
0
;
taosStatFile
(
fNameFrom
,
&
fStatSize
,
0
);
ASSERT
(
fStatSize
==
tsdbLogicToFileSize
(
pSetFrom
->
pHeadF
->
size
,
szPage
));
n
=
tsdbFSendFile
(
p
OutFD
,
PInFD
,
tsdbLogicToFileSize
(
pSetFrom
->
pHeadF
->
size
,
szPage
),
s
peed
);
n
=
tsdbFSendFile
(
p
Tsdb
,
pOutFD
,
PInFD
,
tsdbLogicToFileSize
(
pSetFrom
->
pHeadF
->
size
,
szPage
),
maxS
peed
);
if
(
n
<
0
)
{
code
=
TAOS_SYSTEM_ERROR
(
errno
);
goto
_err
;
...
...
@@ -711,7 +717,7 @@ int32_t tsdbDFileSetCopy(STsdb *pTsdb, SDFileSet *pSetFrom, SDFileSet *pSetTo, i
fStatSize
=
0
;
taosStatFile
(
fNameFrom
,
&
fStatSize
,
0
);
ASSERT
(
fStatSize
==
tsdbLogicToFileSize
(
pSetFrom
->
pDataF
->
size
,
szPage
));
n
=
tsdbFSendFile
(
p
OutFD
,
PInFD
,
tsdbLogicToFileSize
(
pSetFrom
->
pDataF
->
size
,
szPage
),
s
peed
);
n
=
tsdbFSendFile
(
p
Tsdb
,
pOutFD
,
PInFD
,
tsdbLogicToFileSize
(
pSetFrom
->
pDataF
->
size
,
szPage
),
maxS
peed
);
if
(
n
<
0
)
{
code
=
TAOS_SYSTEM_ERROR
(
errno
);
goto
_err
;
...
...
@@ -735,7 +741,7 @@ int32_t tsdbDFileSetCopy(STsdb *pTsdb, SDFileSet *pSetFrom, SDFileSet *pSetTo, i
fStatSize
=
0
;
taosStatFile
(
fNameFrom
,
&
fStatSize
,
0
);
ASSERT
(
fStatSize
==
tsdbLogicToFileSize
(
pSetFrom
->
pSmaF
->
size
,
szPage
));
n
=
tsdbFSendFile
(
p
OutFD
,
PInFD
,
tsdbLogicToFileSize
(
pSetFrom
->
pSmaF
->
size
,
szPage
),
s
peed
);
n
=
tsdbFSendFile
(
p
Tsdb
,
pOutFD
,
PInFD
,
tsdbLogicToFileSize
(
pSetFrom
->
pSmaF
->
size
,
szPage
),
maxS
peed
);
if
(
n
<
0
)
{
code
=
TAOS_SYSTEM_ERROR
(
errno
);
goto
_err
;
...
...
@@ -760,7 +766,7 @@ int32_t tsdbDFileSetCopy(STsdb *pTsdb, SDFileSet *pSetFrom, SDFileSet *pSetTo, i
fStatSize
=
0
;
taosStatFile
(
fNameFrom
,
&
fStatSize
,
0
);
ASSERT
(
fStatSize
==
tsdbLogicToFileSize
(
pSetFrom
->
aSttF
[
iStt
]
->
size
,
szPage
));
n
=
tsdbFSendFile
(
p
OutFD
,
PInFD
,
tsdbLogicToFileSize
(
pSetFrom
->
aSttF
[
iStt
]
->
size
,
szPage
),
s
peed
);
n
=
tsdbFSendFile
(
p
Tsdb
,
pOutFD
,
PInFD
,
tsdbLogicToFileSize
(
pSetFrom
->
aSttF
[
iStt
]
->
size
,
szPage
),
maxS
peed
);
if
(
n
<
0
)
{
code
=
TAOS_SYSTEM_ERROR
(
errno
);
goto
_err
;
...
...
source/dnode/vnode/src/tsdb/tsdbRetention2.c
浏览文件 @
43c954b6
...
...
@@ -30,7 +30,7 @@ enum { RETENTION_NO = 0, RETENTION_EXPIRED = 1, RETENTION_MIGRATE = 2 };
static
bool
tsdbShouldDoMigrate
(
STsdb
*
pTsdb
);
static
int32_t
tsdbShouldDoRetention
(
STsdb
*
pTsdb
,
int64_t
now
);
static
int32_t
tsdbProcessExpire
(
STsdb
*
pTsdb
,
int64_t
now
,
int32_t
retention
);
static
int32_t
tsdbProcessMigrate
(
STsdb
*
pTsdb
,
int64_t
now
,
int
32
_t
maxSpeed
,
int32_t
retention
);
static
int32_t
tsdbProcessMigrate
(
STsdb
*
pTsdb
,
int64_t
now
,
int
64
_t
maxSpeed
,
int32_t
retention
);
static
bool
tsdbShouldDoMigrate
(
STsdb
*
pTsdb
)
{
if
(
tfsGetLevel
(
pTsdb
->
pVnode
->
pTfs
)
<
2
)
{
...
...
@@ -109,6 +109,7 @@ _wait_commit_end:
if
(
++
nLoops
>
1000
)
{
nLoops
=
0
;
sched_yield
();
printf
(
"%s:%d wait commit finished
\n
"
,
__func__
,
__LINE__
);
}
}
if
(
atomic_val_compare_exchange_8
(
&
pTsdb
->
trimHdl
.
state
,
0
,
1
)
==
0
)
{
...
...
@@ -163,7 +164,7 @@ _exit:
* @param retention
* @return int32_t
*/
static
int32_t
tsdbProcessMigrate
(
STsdb
*
pTsdb
,
int64_t
now
,
int
32
_t
maxSpeed
,
int32_t
retention
)
{
static
int32_t
tsdbProcessMigrate
(
STsdb
*
pTsdb
,
int64_t
now
,
int
64
_t
maxSpeed
,
int32_t
retention
)
{
int32_t
code
=
0
;
int32_t
nBatch
=
0
;
int32_t
nLoops
=
0
;
...
...
@@ -183,6 +184,11 @@ _migrate_loop:
tsdbFSDestroy
(
&
fs
);
tsdbFSDestroy
(
&
fsLatest
);
if
(
atomic_load_8
(
&
pTsdb
->
trimHdl
.
commitInWait
)
==
1
)
{
atomic_store_32
(
&
pTsdb
->
trimHdl
.
maxRetentFid
,
INT32_MIN
);
taosMsleep
(
10
);
}
code
=
tsdbFSCopy
(
pTsdb
,
&
fs
);
if
(
code
)
goto
_exit
;
...
...
@@ -315,7 +321,7 @@ _exit:
* @param maxSpeed
* @return int32_t
*/
int32_t
tsdbDoRetention
(
STsdb
*
pTsdb
,
int64_t
now
,
int
32
_t
maxSpeed
)
{
int32_t
tsdbDoRetention
(
STsdb
*
pTsdb
,
int64_t
now
,
int
64
_t
maxSpeed
)
{
int32_t
code
=
0
;
int32_t
retention
=
RETENTION_NO
;
...
...
source/dnode/vnode/src/vnd/vnodeSvr.c
浏览文件 @
43c954b6
...
...
@@ -455,13 +455,14 @@ static int32_t vnodeProcessTrimReq(SVnode *pVnode, int64_t version, void *pReq,
}
if
(
atomic_val_compare_exchange_8
(
&
pHandle
->
state
,
0
,
1
)
!=
0
)
{
vInfo
(
"vgId:%d, trim vnode request
will not be processed since duplicated req, time:%"
PRIi64
,
TD_VID
(
pVnode
)
,
pVndTrimReq
->
trimReq
.
timestamp
);
vInfo
(
"vgId:%d, trim vnode request
ignored since duplicated req, time:%"
PRIi64
", max speed:%"
PRIi64
,
TD_VID
(
pVnode
),
pVndTrimReq
->
trimReq
.
timestamp
,
pVndTrimReq
->
trimReq
.
maxSpeed
);
taosMemoryFree
(
pVndTrimReq
);
goto
_exit
;
}
vInfo
(
"vgId:%d, trim vnode request will be processed, time:%"
PRIi64
,
TD_VID
(
pVnode
),
pVndTrimReq
->
trimReq
.
timestamp
);
vInfo
(
"vgId:%d, trim vnode request will be processed, time:%"
PRIi64
", max speed:%"
PRIi64
,
TD_VID
(
pVnode
),
pVndTrimReq
->
trimReq
.
timestamp
,
pVndTrimReq
->
trimReq
.
maxSpeed
);
TdThreadAttr
thAttr
=
{
0
};
taosThreadAttrInit
(
&
thAttr
);
...
...
@@ -474,10 +475,10 @@ static int32_t vnodeProcessTrimReq(SVnode *pVnode, int64_t version, void *pReq,
taosThreadAttrDestroy
(
&
thAttr
);
int8_t
oldVal
=
atomic_val_compare_exchange_8
(
&
pHandle
->
state
,
1
,
0
);
ASSERT
(
oldVal
==
1
);
vError
(
"vgId:%d, failed to create pthread
for
trim vnode since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
code
));
vError
(
"vgId:%d, failed to create pthread
to
trim vnode since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
code
));
goto
_exit
;
}
vDebug
(
"vgId:%d, success to create pthread
for
trim vnode"
,
TD_VID
(
pVnode
));
vDebug
(
"vgId:%d, success to create pthread
to
trim vnode"
,
TD_VID
(
pVnode
));
taosThreadAttrDestroy
(
&
thAttr
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录