Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
a15f7c6f
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
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看板
未验证
提交
a15f7c6f
编写于
11月 09, 2020
作者:
S
Shengliang Guan
提交者:
GitHub
11月 09, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #4166 from taosdata/feature/wal
add log for wal
上级
bf7f7055
98e380be
变更
10
显示空白变更内容
内联
并排
Showing
10 changed file
with
31 addition
and
20 deletion
+31
-20
src/common/src/tglobal.c
src/common/src/tglobal.c
+2
-0
src/dnode/src/dnodeVWrite.c
src/dnode/src/dnodeVWrite.c
+2
-2
src/inc/taosdef.h
src/inc/taosdef.h
+2
-0
src/sync/src/syncMain.c
src/sync/src/syncMain.c
+2
-2
src/sync/src/syncRestore.c
src/sync/src/syncRestore.c
+1
-1
src/sync/src/syncRetrieve.c
src/sync/src/syncRetrieve.c
+2
-2
src/vnode/src/vnodeMain.c
src/vnode/src/vnodeMain.c
+4
-1
src/vnode/src/vnodeVersion.c
src/vnode/src/vnodeVersion.c
+2
-2
src/vnode/src/vnodeWrite.c
src/vnode/src/vnodeWrite.c
+9
-5
src/wal/src/walWrite.c
src/wal/src/walWrite.c
+5
-5
未找到文件。
src/common/src/tglobal.c
浏览文件 @
a15f7c6f
...
...
@@ -218,6 +218,8 @@ int32_t (*monitorStartSystemFp)() = NULL;
void
(
*
monitorStopSystemFp
)()
=
NULL
;
void
(
*
monitorExecuteSQLFp
)(
char
*
sql
)
=
NULL
;
char
*
qtypeStr
[]
=
{
"rpc"
,
"fwd"
,
"wal"
,
"cq"
,
"query"
};
static
pthread_once_t
tsInitGlobalCfgOnce
=
PTHREAD_ONCE_INIT
;
void
taosSetAllDebugFlag
()
{
...
...
src/dnode/src/dnodeVWrite.c
浏览文件 @
a15f7c6f
...
...
@@ -207,8 +207,8 @@ static void *dnodeProcessVWriteQueue(void *param) {
bool
forceFsync
=
false
;
for
(
int32_t
i
=
0
;
i
<
numOfMsgs
;
++
i
)
{
taosGetQitem
(
pWorker
->
qall
,
&
qtype
,
(
void
**
)
&
pWrite
);
dTrace
(
"%p, msg:%p:%s will be processed in vwrite queue, qtype:%
d version
:%"
PRIu64
,
pWrite
->
rpcAhandle
,
pWrite
,
taosMsg
[
pWrite
->
pHead
->
msgType
],
qtype
,
pWrite
->
pHead
->
version
);
dTrace
(
"%p, msg:%p:%s will be processed in vwrite queue, qtype:%
s hver
:%"
PRIu64
,
pWrite
->
rpcAhandle
,
pWrite
,
taosMsg
[
pWrite
->
pHead
->
msgType
],
qtype
Str
[
qtype
]
,
pWrite
->
pHead
->
version
);
pWrite
->
code
=
vnodeProcessWrite
(
pVnode
,
pWrite
->
pHead
,
qtype
,
&
pWrite
->
rspRet
);
if
(
pWrite
->
code
<=
0
)
pWrite
->
processedCount
=
1
;
...
...
src/inc/taosdef.h
浏览文件 @
a15f7c6f
...
...
@@ -467,6 +467,8 @@ typedef enum {
TSDB_CHECK_ITEM_MAX
}
ECheckItemType
;
extern
char
*
qtypeStr
[];
#ifdef __cplusplus
}
#endif
...
...
src/sync/src/syncMain.c
浏览文件 @
a15f7c6f
...
...
@@ -1221,8 +1221,8 @@ static int32_t syncForwardToPeerImpl(SSyncNode *pNode, void *data, void *mhandle
// always update version
nodeVersion
=
pWalHead
->
version
;
sDebug
(
"vgId:%d,
replica:%d nodeRole:%s qtype:%d ver:%"
PRIu64
,
pNode
->
vgId
,
pNode
->
replica
,
syncRole
[
nodeRole
]
,
qtype
,
pWalHead
->
version
);
sDebug
(
"vgId:%d,
forward to peer, replica:%d role:%s qtype:%s hver:%"
PRIu64
,
pNode
->
vgId
,
pNode
->
replica
,
syncRole
[
nodeRole
],
qtypeStr
[
qtype
]
,
pWalHead
->
version
);
if
(
pNode
->
replica
==
1
||
nodeRole
!=
TAOS_SYNC_ROLE_MASTER
)
return
0
;
...
...
src/sync/src/syncRestore.c
浏览文件 @
a15f7c6f
...
...
@@ -153,7 +153,7 @@ static int syncRestoreWal(SSyncPeer *pPeer) {
ret
=
taosReadMsg
(
pPeer
->
syncFd
,
pHead
->
cont
,
pHead
->
len
);
if
(
ret
<
0
)
break
;
sDebug
(
"%s, restore a record, ver:%"
PRIu64
,
pPeer
->
id
,
pHead
->
version
);
sDebug
(
"%s, restore a record,
qtype:wal h
ver:%"
PRIu64
,
pPeer
->
id
,
pHead
->
version
);
(
*
pNode
->
writeToCache
)(
pNode
->
ahandle
,
pHead
,
TAOS_QTYPE_WAL
,
NULL
);
}
...
...
src/sync/src/syncRetrieve.c
浏览文件 @
a15f7c6f
...
...
@@ -256,7 +256,7 @@ static int syncRetrieveLastWal(SSyncPeer *pPeer, char *name, uint64_t fversion,
}
(
void
)
lseek
(
sfd
,
offset
,
SEEK_SET
);
sDebug
(
"%s, retrieve last wal, offset:%"
PRId64
" fver
sion
:%"
PRIu64
,
pPeer
->
id
,
offset
,
fversion
);
sDebug
(
"%s, retrieve last wal, offset:%"
PRId64
" fver:%"
PRIu64
,
pPeer
->
id
,
offset
,
fversion
);
while
(
1
)
{
int
wsize
=
syncReadOneWalRecord
(
sfd
,
pHead
,
pEvent
);
...
...
@@ -325,7 +325,7 @@ static int syncProcessLastWal(SSyncPeer *pPeer, char *wname, int64_t index) {
// if all data up to fversion is read out, it is over
if
(
pPeer
->
sversion
>=
fversion
&&
fversion
>
0
)
{
code
=
0
;
sDebug
(
"%s, data up to fver
sion:%"
PRId
64
" has been read out, bytes:%d"
,
pPeer
->
id
,
fversion
,
bytes
);
sDebug
(
"%s, data up to fver
:%"
PRIu
64
" has been read out, bytes:%d"
,
pPeer
->
id
,
fversion
,
bytes
);
break
;
}
...
...
src/vnode/src/vnodeMain.c
浏览文件 @
a15f7c6f
...
...
@@ -577,10 +577,12 @@ static int vnodeProcessTsdbStatus(void *arg, int status) {
if
(
status
==
TSDB_STATUS_COMMIT_START
)
{
pVnode
->
fversion
=
pVnode
->
version
;
vDebug
(
"vgId:%d, start commit, fver:%"
PRIu64
" vver:%"
PRIu64
,
pVnode
->
vgId
,
pVnode
->
fversion
,
pVnode
->
version
);
return
walRenew
(
pVnode
->
wal
);
}
if
(
status
==
TSDB_STATUS_COMMIT_OVER
)
{
vDebug
(
"vgId:%d, commit over, fver:%"
PRIu64
" vver:%"
PRIu64
,
pVnode
->
vgId
,
pVnode
->
fversion
,
pVnode
->
version
);
return
vnodeSaveVersion
(
pVnode
);
}
...
...
@@ -656,11 +658,12 @@ static int vnodeResetTsdb(SVnodeObj *pVnode) {
static
int
vnodeNotifyFileSynced
(
void
*
ahandle
,
uint64_t
fversion
)
{
SVnodeObj
*
pVnode
=
ahandle
;
vDebug
(
"vgId:%d, data file is synced, fversion:%"
PRId64
,
pVnode
->
vgId
,
fversion
);
pVnode
->
fversion
=
fversion
;
pVnode
->
version
=
fversion
;
vnodeSaveVersion
(
pVnode
);
vDebug
(
"vgId:%d, data file is synced, fver:%"
PRIu64
" vver:%"
PRIu64
,
pVnode
->
vgId
,
pVnode
->
fversion
,
pVnode
->
version
);
return
vnodeResetTsdb
(
pVnode
);
}
src/vnode/src/vnodeVersion.c
浏览文件 @
a15f7c6f
...
...
@@ -64,7 +64,7 @@ int32_t vnodeReadVersion(SVnodeObj *pVnode) {
pVnode
->
version
=
(
uint64_t
)
ver
->
valueint
;
terrno
=
TSDB_CODE_SUCCESS
;
vInfo
(
"vgId:%d, read %s successfully,
version
:%"
PRIu64
,
pVnode
->
vgId
,
file
,
pVnode
->
version
);
vInfo
(
"vgId:%d, read %s successfully,
fver
:%"
PRIu64
,
pVnode
->
vgId
,
file
,
pVnode
->
version
);
PARSE_VER_ERROR:
if
(
content
!=
NULL
)
free
(
content
);
...
...
@@ -98,6 +98,6 @@ int32_t vnodeSaveVersion(SVnodeObj *pVnode) {
free
(
content
);
terrno
=
0
;
vInfo
(
"vgId:%d, successed to write %s,
version
:%"
PRIu64
,
pVnode
->
vgId
,
file
,
pVnode
->
fversion
);
vInfo
(
"vgId:%d, successed to write %s,
fver
:%"
PRIu64
,
pVnode
->
vgId
,
file
,
pVnode
->
fversion
);
return
TSDB_CODE_SUCCESS
;
}
\ No newline at end of file
src/vnode/src/vnodeWrite.c
浏览文件 @
a15f7c6f
...
...
@@ -52,20 +52,24 @@ int32_t vnodeProcessWrite(void *vparam, void *wparam, int32_t qtype, void *rpara
SRspRet
*
pRspRet
=
rparam
;
if
(
vnodeProcessWriteMsgFp
[
pHead
->
msgType
]
==
NULL
)
{
vDebug
(
"vgId:%d, msgType:%s not processed, no handle"
,
pVnode
->
vgId
,
taosMsg
[
pHead
->
msgType
]);
vError
(
"vgId:%d, msg:%s not processed since no handle, qtype:%s hver:%"
PRIu64
,
pVnode
->
vgId
,
taosMsg
[
pHead
->
msgType
],
qtypeStr
[
qtype
],
pHead
->
version
);
return
TSDB_CODE_VND_MSG_NOT_PROCESSED
;
}
vTrace
(
"vgId:%d, msg:%s will be processed in vnode, qtype:%s hver:%"
PRIu64
" vver:%"
PRIu64
,
pVnode
->
vgId
,
taosMsg
[
pHead
->
msgType
],
qtypeStr
[
qtype
],
pHead
->
version
,
pVnode
->
version
);
if
(
pHead
->
version
==
0
)
{
// from client or CQ
if
(
pVnode
->
status
!=
TAOS_VN_STATUS_READY
)
{
vDebug
(
"vgId:%d, msg
Type:%s not processed, vnode status is %d"
,
pVnode
->
vgId
,
taosMsg
[
pHead
->
msgType
]
,
pVnode
->
status
);
vDebug
(
"vgId:%d, msg
:%s not processed since vstatus:%d, qtype:%s hver:%"
PRIu64
,
pVnode
->
vgId
,
taosMsg
[
pHead
->
msgType
],
pVnode
->
status
,
qtypeStr
[
qtype
],
pHead
->
version
);
return
TSDB_CODE_APP_NOT_READY
;
// it may be in deleting or closing state
}
if
(
pVnode
->
role
!=
TAOS_SYNC_ROLE_MASTER
)
{
vDebug
(
"vgId:%d, msg
Type:%s not processed, replica:%d role:%s"
,
pVnode
->
vgId
,
taosMsg
[
pHead
->
msgType
]
,
pVnode
->
syncCfg
.
replica
,
syncRole
[
pVnode
->
role
]
);
vDebug
(
"vgId:%d, msg
:%s not processed since replica:%d role:%s, qtype:%s hver:%"
PRIu64
,
pVnode
->
vgId
,
taosMsg
[
pHead
->
msgType
],
pVnode
->
syncCfg
.
replica
,
syncRole
[
pVnode
->
role
],
qtypeStr
[
qtype
],
pHead
->
version
);
return
TSDB_CODE_APP_NOT_READY
;
}
...
...
src/wal/src/walWrite.c
浏览文件 @
a15f7c6f
...
...
@@ -99,8 +99,8 @@ int32_t walWrite(void *handle, SWalHead *pHead) {
code
=
TAOS_SYSTEM_ERROR
(
errno
);
wError
(
"vgId:%d, file:%s, failed to write since %s"
,
pWal
->
vgId
,
pWal
->
name
,
strerror
(
errno
));
}
else
{
wTrace
(
"vgId:%d,
fileId:%"
PRId64
" fd:%d, write wal ver:%"
PRId64
", head ver:%"
PRIu64
", len:%d
"
,
pWal
->
vgId
,
pWal
->
fileId
,
pWal
->
fd
,
p
Wal
->
version
,
pHead
->
version
,
pHead
->
len
);
wTrace
(
"vgId:%d,
write wal, fileId:%"
PRId64
" fd:%d hver:%"
PRId64
" wver:%"
PRIu64
" len:%d
"
,
pWal
->
vgId
,
pWal
->
fileId
,
pWal
->
fd
,
p
Head
->
version
,
pWal
->
version
,
pHead
->
len
);
pWal
->
version
=
pHead
->
version
;
}
...
...
@@ -261,7 +261,7 @@ static int32_t walRestoreWalFile(SWal *pWal, void *pVnode, FWalWrite writeFp, ch
}
if
(
!
taosCheckChecksumWhole
((
uint8_t
*
)
pHead
,
sizeof
(
SWalHead
)))
{
wError
(
"vgId:%d, file:%s, wal head cksum is messed up, ver:%"
PRIu64
" len:%d offset:%"
PRId64
,
pWal
->
vgId
,
name
,
wError
(
"vgId:%d, file:%s, wal head cksum is messed up,
h
ver:%"
PRIu64
" len:%d offset:%"
PRId64
,
pWal
->
vgId
,
name
,
pHead
->
version
,
pHead
->
len
,
offset
);
code
=
walSkipCorruptedRecord
(
pWal
,
pHead
,
fd
,
&
offset
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
...
...
@@ -297,8 +297,8 @@ static int32_t walRestoreWalFile(SWal *pWal, void *pVnode, FWalWrite writeFp, ch
offset
=
offset
+
sizeof
(
SWalHead
)
+
pHead
->
len
;
wTrace
(
"vgId:%d,
fileId:%"
PRId64
", restore wal ver:%"
PRIu64
", head ver:%"
PRIu64
" len:%d"
,
pWal
->
vgId
,
file
Id
,
pWal
->
version
,
pHead
->
version
,
pHead
->
len
);
wTrace
(
"vgId:%d,
restore wal, fileId:%"
PRId64
" hver:%"
PRIu64
" wver:%"
PRIu64
" len:%d"
,
pWal
->
vg
Id
,
fileId
,
pHead
->
version
,
pWal
->
version
,
pHead
->
len
);
pWal
->
version
=
pHead
->
version
;
(
*
writeFp
)(
pVnode
,
pHead
,
TAOS_QTYPE_WAL
,
NULL
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录