Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
df6eb27b
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看板
提交
df6eb27b
编写于
12月 04, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
差异文件
Merge branch '3.0' of
https://github.com/taosdata/TDengine
into feat/async_commit
上级
f78efdac
af3bd5bc
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
80 addition
and
46 deletion
+80
-46
include/common/tglobal.h
include/common/tglobal.h
+9
-4
include/libs/sync/sync.h
include/libs/sync/sync.h
+1
-1
source/common/src/tglobal.c
source/common/src/tglobal.c
+20
-5
source/dnode/vnode/src/tsdb/tsdbRead.c
source/dnode/vnode/src/tsdb/tsdbRead.c
+43
-31
source/dnode/vnode/src/tsdb/tsdbReaderWriter.c
source/dnode/vnode/src/tsdb/tsdbReaderWriter.c
+1
-2
source/libs/sync/src/syncMain.c
source/libs/sync/src/syncMain.c
+6
-3
未找到文件。
include/common/tglobal.h
浏览文件 @
df6eb27b
...
...
@@ -64,6 +64,11 @@ extern int32_t tsNumOfSnodeStreamThreads;
extern
int32_t
tsNumOfSnodeWriteThreads
;
extern
int64_t
tsRpcQueueMemoryAllowed
;
// sync raft
extern
int32_t
tsElectInterval
;
extern
int32_t
tsHeartbeatInterval
;
extern
int32_t
tsHeartbeatTimeout
;
// monitor
extern
bool
tsEnableMonitor
;
extern
int32_t
tsMonitorInterval
;
...
...
@@ -146,7 +151,7 @@ extern int32_t tsUptimeInterval;
extern
int32_t
tsRpcRetryLimit
;
extern
int32_t
tsRpcRetryInterval
;
//#define NEEDTO_COMPRESSS_MSG(size) (tsCompressMsgSize != -1 && (size) > tsCompressMsgSize)
//
#define NEEDTO_COMPRESSS_MSG(size) (tsCompressMsgSize != -1 && (size) > tsCompressMsgSize)
int32_t
taosCreateLog
(
const
char
*
logname
,
int32_t
logFileNum
,
const
char
*
cfgDir
,
const
char
**
envCmd
,
const
char
*
envFile
,
char
*
apolloUrl
,
SArray
*
pArgs
,
bool
tsc
);
...
...
include/libs/sync/sync.h
浏览文件 @
df6eb27b
...
...
@@ -43,7 +43,7 @@ extern "C" {
#define SYNC_MAX_RETRY_BACKOFF 5
#define SYNC_LOG_REPL_RETRY_WAIT_MS 100
#define SYNC_APPEND_ENTRIES_TIMEOUT_MS 10000
#define SYNC_HEART_TIMEOUT_MS 1000 *
8
#define SYNC_HEART_TIMEOUT_MS 1000 *
15
#define SYNC_HEARTBEAT_SLOW_MS 1500
#define SYNC_HEARTBEAT_REPLY_SLOW_MS 1500
...
...
source/common/src/tglobal.c
浏览文件 @
df6eb27b
...
...
@@ -55,6 +55,11 @@ int32_t tsNumOfQnodeFetchThreads = 1;
int32_t
tsNumOfSnodeStreamThreads
=
4
;
int32_t
tsNumOfSnodeWriteThreads
=
1
;
// sync raft
int32_t
tsElectInterval
=
25
*
1000
;
int32_t
tsHeartbeatInterval
=
1000
;
int32_t
tsHeartbeatTimeout
=
20
*
1000
;
// monitor
bool
tsEnableMonitor
=
true
;
int32_t
tsMonitorInterval
=
30
;
...
...
@@ -198,9 +203,7 @@ int32_t taosSetTfsCfg(SConfig *pCfg) {
int32_t
taosSetTfsCfg
(
SConfig
*
pCfg
);
#endif
struct
SConfig
*
taosGetCfg
()
{
return
tsCfg
;
}
struct
SConfig
*
taosGetCfg
()
{
return
tsCfg
;
}
static
int32_t
taosLoadCfg
(
SConfig
*
pCfg
,
const
char
**
envCmd
,
const
char
*
inputCfgDir
,
const
char
*
envFile
,
char
*
apolloUrl
)
{
...
...
@@ -423,6 +426,10 @@ static int32_t taosAddServerCfg(SConfig *pCfg) {
if
(
cfgAddInt64
(
pCfg
,
"rpcQueueMemoryAllowed"
,
tsRpcQueueMemoryAllowed
,
TSDB_MAX_MSG_SIZE
*
10L
,
INT64_MAX
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"syncElectInterval"
,
tsElectInterval
,
10
,
1000
*
60
*
24
*
2
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"syncHeartbeatInterval"
,
tsHeartbeatInterval
,
10
,
1000
*
60
*
24
*
2
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"syncHeartbeatTimeout"
,
tsHeartbeatTimeout
,
10
,
1000
*
60
*
24
*
2
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddBool
(
pCfg
,
"monitor"
,
tsEnableMonitor
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"monitorInterval"
,
tsMonitorInterval
,
1
,
200000
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddString
(
pCfg
,
"monitorFqdn"
,
tsMonitorFqdn
,
0
)
!=
0
)
return
-
1
;
...
...
@@ -728,6 +735,10 @@ static int32_t taosSetServerCfg(SConfig *pCfg) {
tstrncpy
(
tsTelemServer
,
cfgGetItem
(
pCfg
,
"telemetryServer"
)
->
str
,
TSDB_FQDN_LEN
);
tsTelemPort
=
(
uint16_t
)
cfgGetItem
(
pCfg
,
"telemetryPort"
)
->
i32
;
tsElectInterval
=
cfgGetItem
(
pCfg
,
"syncElectInterval"
)
->
i32
;
tsHeartbeatInterval
=
cfgGetItem
(
pCfg
,
"syncHeartbeatInterval"
)
->
i32
;
tsHeartbeatTimeout
=
cfgGetItem
(
pCfg
,
"syncHeartbeatTimeout"
)
->
i32
;
tsTransPullupInterval
=
cfgGetItem
(
pCfg
,
"transPullupInterval"
)
->
i32
;
tsMqRebalanceInterval
=
cfgGetItem
(
pCfg
,
"mqRebalanceInterval"
)
->
i32
;
tsTtlUnit
=
cfgGetItem
(
pCfg
,
"ttlUnit"
)
->
i32
;
...
...
@@ -737,6 +748,10 @@ static int32_t taosSetServerCfg(SConfig *pCfg) {
tsWalFsyncDataSizeLimit
=
cfgGetItem
(
pCfg
,
"walFsyncDataSizeLimit"
)
->
i64
;
tsElectInterval
=
cfgGetItem
(
pCfg
,
"syncElectInterval"
)
->
i32
;
tsHeartbeatInterval
=
cfgGetItem
(
pCfg
,
"syncHeartbeatInterval"
)
->
i32
;
tsHeartbeatTimeout
=
cfgGetItem
(
pCfg
,
"syncHeartbeatTimeout"
)
->
i32
;
tsStartUdfd
=
cfgGetItem
(
pCfg
,
"udf"
)
->
bval
;
tstrncpy
(
tsUdfdResFuncs
,
cfgGetItem
(
pCfg
,
"udfdResFuncs"
)
->
str
,
sizeof
(
tsUdfdResFuncs
));
tstrncpy
(
tsUdfdLdLibPath
,
cfgGetItem
(
pCfg
,
"udfdLdLibPath"
)
->
str
,
sizeof
(
tsUdfdLdLibPath
));
...
...
source/dnode/vnode/src/tsdb/tsdbRead.c
浏览文件 @
df6eb27b
...
...
@@ -170,7 +170,9 @@ struct STsdbReader {
SIOCostSummary
cost
;
STSchema
*
pSchema
;
// the newest version schema
STSchema
*
pMemSchema
;
// the previous schema for in-memory data, to avoid load schema too many times
SDataFReader
*
pFileReader
;
SDataFReader
*
pFileReader
;
// the file reader
SDelFReader
*
pDelFReader
;
// the del file reader
SArray
*
pDelIdx
;
// del file block index;
SVersionRange
verRange
;
SBlockInfoBuf
blockInfoBuf
;
int32_t
step
;
...
...
@@ -2531,42 +2533,18 @@ int32_t initDelSkylineIterator(STableBlockScanInfo* pBlockScanInfo, STsdbReader*
}
int32_t
code
=
0
;
STsdb
*
pTsdb
=
pReader
->
pTsdb
;
SArray
*
pDelData
=
taosArrayInit
(
4
,
sizeof
(
SDelData
));
ASSERT
(
pReader
->
pReadSnap
!=
NULL
);
SDelFile
*
pDelFile
=
pReader
->
pReadSnap
->
fs
.
pDelFile
;
if
(
pDelFile
)
{
SDelFReader
*
pDelFReader
=
NULL
;
code
=
tsdbDelFReaderOpen
(
&
pDelFReader
,
pDelFile
,
pTsdb
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_err
;
}
SArray
*
aDelIdx
=
taosArrayInit
(
4
,
sizeof
(
SDelIdx
));
if
(
aDelIdx
==
NULL
)
{
tsdbDelFReaderClose
(
&
pDelFReader
);
goto
_err
;
}
// TODO: opt the perf of read del index
code
=
tsdbReadDelIdx
(
pDelFReader
,
aDelIdx
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
taosArrayDestroy
(
aDelIdx
);
tsdbDelFReaderClose
(
&
pDelFReader
);
goto
_err
;
}
if
(
pDelFile
&&
taosArrayGetSize
(
pReader
->
pDelIdx
)
>
0
)
{
SDelIdx
idx
=
{.
suid
=
pReader
->
suid
,
.
uid
=
pBlockScanInfo
->
uid
};
SDelIdx
*
pIdx
=
taosArraySearch
(
a
DelIdx
,
&
idx
,
tCmprDelIdx
,
TD_EQ
);
SDelIdx
*
pIdx
=
taosArraySearch
(
pReader
->
p
DelIdx
,
&
idx
,
tCmprDelIdx
,
TD_EQ
);
if
(
pIdx
!=
NULL
)
{
code
=
tsdbReadDelData
(
pDelFReader
,
pIdx
,
pDelData
);
code
=
tsdbReadDelData
(
p
Reader
->
p
DelFReader
,
pIdx
,
pDelData
);
}
taosArrayDestroy
(
aDelIdx
);
tsdbDelFReaderClose
(
&
pDelFReader
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_err
;
}
...
...
@@ -2662,6 +2640,30 @@ static int32_t moveToNextFile(STsdbReader* pReader, SBlockNumber* pBlockNum) {
}
taosArrayDestroy
(
pIndexList
);
if
(
pReader
->
pReadSnap
!=
NULL
)
{
SDelFile
*
pDelFile
=
pReader
->
pReadSnap
->
fs
.
pDelFile
;
if
(
pReader
->
pDelFReader
==
NULL
&&
pDelFile
!=
NULL
)
{
int32_t
code
=
tsdbDelFReaderOpen
(
&
pReader
->
pDelFReader
,
pDelFile
,
pReader
->
pTsdb
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
pReader
->
pDelIdx
=
taosArrayInit
(
4
,
sizeof
(
SDelIdx
));
if
(
pReader
->
pDelIdx
==
NULL
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
return
code
;
}
code
=
tsdbReadDelIdx
(
pReader
->
pDelFReader
,
pReader
->
pDelIdx
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
taosArrayDestroy
(
pReader
->
pDelIdx
);
return
code
;
}
}
}
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -3912,6 +3914,15 @@ void tsdbReaderClose(STsdbReader* pReader) {
tsdbDataFReaderClose
(
&
pReader
->
pFileReader
);
}
if
(
pReader
->
pDelFReader
!=
NULL
)
{
tsdbDelFReaderClose
(
&
pReader
->
pDelFReader
);
}
if
(
pReader
->
pDelIdx
!=
NULL
)
{
taosArrayDestroy
(
pReader
->
pDelIdx
);
pReader
->
pDelIdx
=
NULL
;
}
tsdbUntakeReadSnap
(
pReader
->
pTsdb
,
pReader
->
pReadSnap
,
pReader
->
idStr
);
taosMemoryFree
(
pReader
->
status
.
uidCheckInfo
.
tableUidList
);
...
...
@@ -3953,6 +3964,9 @@ static bool doTsdbNextDataBlock(STsdbReader* pReader) {
blockDataCleanup
(
pBlock
);
SReaderStatus
*
pStatus
=
&
pReader
->
status
;
if
(
taosHashGetSize
(
pStatus
->
pTableMap
)
==
0
){
return
false
;
}
if
(
pStatus
->
loadFromFile
)
{
int32_t
code
=
buildBlockFromFiles
(
pReader
);
...
...
@@ -3970,8 +3984,6 @@ static bool doTsdbNextDataBlock(STsdbReader* pReader) {
buildBlockFromBufferSequentially
(
pReader
);
return
pBlock
->
info
.
rows
>
0
;
}
return
false
;
}
bool
tsdbNextDataBlock
(
STsdbReader
*
pReader
)
{
...
...
source/dnode/vnode/src/tsdb/tsdbReaderWriter.c
浏览文件 @
df6eb27b
...
...
@@ -1477,9 +1477,8 @@ int32_t tsdbDelFReaderClose(SDelFReader **ppReader) {
}
taosMemoryFree
(
pReader
);
}
*
ppReader
=
NULL
;
_exit:
*
ppReader
=
NULL
;
return
code
;
}
...
...
source/libs/sync/src/syncMain.c
浏览文件 @
df6eb27b
...
...
@@ -22,8 +22,8 @@
#include "syncEnv.h"
#include "syncIndexMgr.h"
#include "syncInt.h"
#include "syncPipeline.h"
#include "syncMessage.h"
#include "syncPipeline.h"
#include "syncRaftCfg.h"
#include "syncRaftLog.h"
#include "syncRaftStore.h"
...
...
@@ -35,6 +35,7 @@
#include "syncTimeout.h"
#include "syncUtil.h"
#include "syncVoteMgr.h"
#include "tglobal.h"
#include "tref.h"
static
void
syncNodeEqPingTimer
(
void
*
param
,
void
*
tmrId
);
...
...
@@ -1115,7 +1116,9 @@ SSyncNode* syncNodeOpen(SSyncInfo* pSyncInfo) {
pSyncNode
->
hbrSlowNum
=
0
;
pSyncNode
->
tmrRoutineNum
=
0
;
sNTrace
(
pSyncNode
,
"sync open, node:%p"
,
pSyncNode
);
sNInfo
(
pSyncNode
,
"sync open, node:%p"
,
pSyncNode
);
sTrace
(
"vgId:%d, tsElectInterval:%d, tsHeartbeatInterval:%d, tsHeartbeatTimeout:%d"
,
pSyncNode
->
vgId
,
tsElectInterval
,
tsHeartbeatInterval
,
tsHeartbeatTimeout
);
return
pSyncNode
;
...
...
@@ -1229,7 +1232,7 @@ void syncHbTimerDataFree(SSyncHbTimerData* pData) { taosMemoryFree(pData); }
void
syncNodeClose
(
SSyncNode
*
pSyncNode
)
{
if
(
pSyncNode
==
NULL
)
return
;
sN
Trace
(
pSyncNode
,
"sync close, data
:%p"
,
pSyncNode
);
sN
Info
(
pSyncNode
,
"sync close, node
:%p"
,
pSyncNode
);
int32_t
ret
=
raftStoreClose
(
pSyncNode
->
pRaftStore
);
ASSERT
(
ret
==
0
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录