Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Tonvia
TDengine
提交
3f52d74a
T
TDengine
项目概览
Tonvia
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
1
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
3f52d74a
编写于
10月 15, 2020
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TD-1696
上级
bd934402
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
21 addition
and
9 deletion
+21
-9
src/inc/taoserror.h
src/inc/taoserror.h
+1
-0
src/inc/twal.h
src/inc/twal.h
+1
-0
src/vnode/src/vnodeMain.c
src/vnode/src/vnodeMain.c
+11
-5
src/wal/src/walMain.c
src/wal/src/walMain.c
+8
-4
未找到文件。
src/inc/taoserror.h
浏览文件 @
3f52d74a
...
@@ -193,6 +193,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_VND_NO_DISK_PERMISSIONS, 0, 0x0506, "No write p
...
@@ -193,6 +193,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_VND_NO_DISK_PERMISSIONS, 0, 0x0506, "No write p
TAOS_DEFINE_ERROR
(
TSDB_CODE_VND_NO_SUCH_FILE_OR_DIR
,
0
,
0x0507
,
"Missing data file"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_VND_NO_SUCH_FILE_OR_DIR
,
0
,
0x0507
,
"Missing data file"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_VND_OUT_OF_MEMORY
,
0
,
0x0508
,
"Out of memory"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_VND_OUT_OF_MEMORY
,
0
,
0x0508
,
"Out of memory"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_VND_APP_ERROR
,
0
,
0x0509
,
"Unexpected generic error in vnode"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_VND_APP_ERROR
,
0
,
0x0509
,
"Unexpected generic error in vnode"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_VND_INVALID_VRESION_FILE
,
0
,
0x050A
,
"Invalid version file"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_VND_NOT_SYNCED
,
0
,
0x0511
,
"Database suspended"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_VND_NOT_SYNCED
,
0
,
0x0511
,
"Database suspended"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_VND_NO_WRITE_AUTH
,
0
,
0x0512
,
"Write operation denied"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_VND_NO_WRITE_AUTH
,
0
,
0x0512
,
"Write operation denied"
)
...
...
src/inc/twal.h
浏览文件 @
3f52d74a
...
@@ -51,6 +51,7 @@ int walWrite(twalh, SWalHead *);
...
@@ -51,6 +51,7 @@ int walWrite(twalh, SWalHead *);
void
walFsync
(
twalh
);
void
walFsync
(
twalh
);
int
walRestore
(
twalh
,
void
*
pVnode
,
FWalWrite
writeFp
);
int
walRestore
(
twalh
,
void
*
pVnode
,
FWalWrite
writeFp
);
int
walGetWalFile
(
twalh
,
char
*
name
,
uint32_t
*
index
);
int
walGetWalFile
(
twalh
,
char
*
name
,
uint32_t
*
index
);
int64_t
walGetVersion
(
twalh
);
extern
int
wDebugFlag
;
extern
int
wDebugFlag
;
...
...
src/vnode/src/vnodeMain.c
浏览文件 @
3f52d74a
...
@@ -239,8 +239,10 @@ int32_t vnodeOpen(int32_t vnode, char *rootDir) {
...
@@ -239,8 +239,10 @@ int32_t vnodeOpen(int32_t vnode, char *rootDir) {
code
=
vnodeReadVersion
(
pVnode
);
code
=
vnodeReadVersion
(
pVnode
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
vnodeCleanUp
(
pVnode
);
vError
(
"vgId:%d, failed to read version, generate it from data file"
,
pVnode
->
vgId
);
return
code
;
// Allow vnode start even when read version fails, set version as walVersion or zero
// vnodeCleanUp(pVnode);
// return code;
}
}
pVnode
->
fversion
=
pVnode
->
version
;
pVnode
->
fversion
=
pVnode
->
version
;
...
@@ -292,6 +294,9 @@ int32_t vnodeOpen(int32_t vnode, char *rootDir) {
...
@@ -292,6 +294,9 @@ int32_t vnodeOpen(int32_t vnode, char *rootDir) {
}
}
walRestore
(
pVnode
->
wal
,
pVnode
,
vnodeWriteToQueue
);
walRestore
(
pVnode
->
wal
,
pVnode
,
vnodeWriteToQueue
);
if
(
pVnode
->
version
==
0
)
{
pVnode
->
version
=
walGetVersion
(
pVnode
->
wal
);
}
SSyncInfo
syncInfo
;
SSyncInfo
syncInfo
;
syncInfo
.
vgId
=
pVnode
->
vgId
;
syncInfo
.
vgId
=
pVnode
->
vgId
;
...
@@ -947,6 +952,7 @@ static int32_t vnodeSaveVersion(SVnodeObj *pVnode) {
...
@@ -947,6 +952,7 @@ static int32_t vnodeSaveVersion(SVnodeObj *pVnode) {
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"}
\n
"
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"}
\n
"
);
fwrite
(
content
,
1
,
len
,
fp
);
fwrite
(
content
,
1
,
len
,
fp
);
fflush
(
fp
);
fclose
(
fp
);
fclose
(
fp
);
vInfo
(
"vgId:%d, save vnode version:%"
PRId64
" succeed"
,
pVnode
->
vgId
,
pVnode
->
fversion
);
vInfo
(
"vgId:%d, save vnode version:%"
PRId64
" succeed"
,
pVnode
->
vgId
,
pVnode
->
fversion
);
...
@@ -960,7 +966,7 @@ static int32_t vnodeReadVersion(SVnodeObj *pVnode) {
...
@@ -960,7 +966,7 @@ static int32_t vnodeReadVersion(SVnodeObj *pVnode) {
cJSON
*
root
=
NULL
;
cJSON
*
root
=
NULL
;
int
maxLen
=
100
;
int
maxLen
=
100
;
terrno
=
TSDB_CODE_VND_
APP_ERROR
;
terrno
=
TSDB_CODE_VND_
INVALID_VRESION_FILE
;
sprintf
(
versionFile
,
"%s/vnode%d/version.json"
,
tsVnodeDir
,
pVnode
->
vgId
);
sprintf
(
versionFile
,
"%s/vnode%d/version.json"
,
tsVnodeDir
,
pVnode
->
vgId
);
FILE
*
fp
=
fopen
(
versionFile
,
"r"
);
FILE
*
fp
=
fopen
(
versionFile
,
"r"
);
if
(
!
fp
)
{
if
(
!
fp
)
{
...
@@ -999,6 +1005,6 @@ static int32_t vnodeReadVersion(SVnodeObj *pVnode) {
...
@@ -999,6 +1005,6 @@ static int32_t vnodeReadVersion(SVnodeObj *pVnode) {
PARSE_OVER:
PARSE_OVER:
taosTFree
(
content
);
taosTFree
(
content
);
cJSON_Delete
(
root
);
cJSON_Delete
(
root
);
if
(
fp
)
fclose
(
fp
);
if
(
fp
)
fclose
(
fp
);
return
terrno
;
return
terrno
;
}
}
src/wal/src/walMain.c
浏览文件 @
3f52d74a
...
@@ -240,10 +240,7 @@ int walWrite(void *handle, SWalHead *pHead) {
...
@@ -240,10 +240,7 @@ int walWrite(void *handle, SWalHead *pHead) {
// no wal
// no wal
if
(
pWal
->
level
==
TAOS_WAL_NOLOG
)
return
0
;
if
(
pWal
->
level
==
TAOS_WAL_NOLOG
)
return
0
;
if
(
pHead
->
version
<=
pWal
->
version
)
{
if
(
pHead
->
version
<=
pWal
->
version
)
return
0
;
wError
(
"wal:%s, failed to write ver:%"
PRIu64
", last ver:%"
PRIu64
,
pWal
->
name
,
pHead
->
version
,
pWal
->
version
);
return
0
;
}
pHead
->
signature
=
walSignature
;
pHead
->
signature
=
walSignature
;
taosCalcChecksumAppend
(
0
,
(
uint8_t
*
)
pHead
,
sizeof
(
SWalHead
));
taosCalcChecksumAppend
(
0
,
(
uint8_t
*
)
pHead
,
sizeof
(
SWalHead
));
...
@@ -560,3 +557,10 @@ static void walProcessFsyncTimer(void *param, void *tmrId) {
...
@@ -560,3 +557,10 @@ static void walProcessFsyncTimer(void *param, void *tmrId) {
pWal
->
timer
=
NULL
;
pWal
->
timer
=
NULL
;
}
}
}
}
int64_t
walGetVersion
(
twalh
param
)
{
SWal
*
pWal
=
param
;
if
(
pWal
==
0
)
return
0
;
return
pWal
->
version
;
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录