Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lzh_me
TDengine
提交
11c94027
TDengine
项目概览
lzh_me
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
11c94027
编写于
10月 28, 2020
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TD-1780
上级
f403fc0c
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
152 addition
and
6 deletion
+152
-6
src/mnode/src/mnodeVgroup.c
src/mnode/src/mnodeVgroup.c
+2
-2
src/sync/src/syncRestore.c
src/sync/src/syncRestore.c
+3
-1
src/tsdb/src/tsdbFile.c
src/tsdb/src/tsdbFile.c
+3
-0
src/vnode/src/vnodeMain.c
src/vnode/src/vnodeMain.c
+7
-3
tests/script/unique/dnode/data1.sim
tests/script/unique/dnode/data1.sim
+137
-0
未找到文件。
src/mnode/src/mnodeVgroup.c
浏览文件 @
11c94027
...
...
@@ -663,13 +663,13 @@ static int32_t mnodeGetVgroupMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *p
for
(
int32_t
i
=
0
;
i
<
pShow
->
maxReplica
;
++
i
)
{
pShow
->
bytes
[
cols
]
=
2
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_SMALLINT
;
snprintf
(
pSchema
[
cols
].
name
,
TSDB_COL_NAME_LEN
,
"
dnode%d
"
,
i
+
1
);
snprintf
(
pSchema
[
cols
].
name
,
TSDB_COL_NAME_LEN
,
"
v%dDnode
"
,
i
+
1
);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
9
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
snprintf
(
pSchema
[
cols
].
name
,
TSDB_COL_NAME_LEN
,
"v%d
s
tatus"
,
i
+
1
);
snprintf
(
pSchema
[
cols
].
name
,
TSDB_COL_NAME_LEN
,
"v%d
S
tatus"
,
i
+
1
);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
cols
++
;
}
...
...
src/sync/src/syncRestore.c
浏览文件 @
11c94027
...
...
@@ -56,6 +56,7 @@ static int syncRestoreFile(SSyncPeer *pPeer, uint64_t *fversion) {
int
code
=
-
1
;
char
name
[
TSDB_FILENAME_LEN
*
2
]
=
{
0
};
uint32_t
pindex
=
0
;
// index in last restore
bool
fileChanged
=
false
;
*
fversion
=
0
;
sinfo
.
index
=
0
;
...
...
@@ -114,10 +115,11 @@ static int syncRestoreFile(SSyncPeer *pPeer, uint64_t *fversion) {
close
(
dfd
);
if
(
ret
<
0
)
break
;
fileChanged
=
true
;
sDebug
(
"%s, %s is received, size:%"
PRId64
,
pPeer
->
id
,
minfo
.
name
,
minfo
.
size
);
}
if
(
code
==
0
&&
(
minfo
.
fversion
!=
sinfo
.
fversion
)
)
{
if
(
code
==
0
&&
fileChanged
)
{
// data file is changed, code shall be set to 1
*
fversion
=
minfo
.
fversion
;
code
=
1
;
...
...
src/tsdb/src/tsdbFile.c
浏览文件 @
11c94027
...
...
@@ -96,6 +96,9 @@ int tsdbOpenFileH(STsdbRepo *pRepo) {
dir
=
opendir
(
tDataDir
);
if
(
dir
==
NULL
)
{
if
(
errno
==
ENOENT
)
{
tsdbError
(
"vgId:%d directory %s not exist"
,
REPO_ID
(
pRepo
),
tDataDir
);
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
if
(
taosMkDir
(
tDataDir
,
0755
)
<
0
)
{
tsdbError
(
"vgId:%d failed to create directory %s since %s"
,
REPO_ID
(
pRepo
),
tDataDir
,
strerror
(
errno
));
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
...
...
src/vnode/src/vnodeMain.c
浏览文件 @
11c94027
...
...
@@ -291,11 +291,15 @@ int32_t vnodeOpen(int32_t vnode, char *rootDir) {
if
(
pVnode
->
tsdb
==
NULL
)
{
vnodeCleanUp
(
pVnode
);
return
terrno
;
}
else
if
(
terrno
!=
TSDB_CODE_SUCCESS
&&
pVnode
->
syncCfg
.
replica
<=
1
)
{
}
else
if
(
terrno
!=
TSDB_CODE_SUCCESS
)
{
vError
(
"vgId:%d, failed to open tsdb, replica:%d reason:%s"
,
pVnode
->
vgId
,
pVnode
->
syncCfg
.
replica
,
tstrerror
(
terrno
));
vnodeCleanUp
(
pVnode
);
return
terrno
;
if
(
pVnode
->
syncCfg
.
replica
<=
1
)
{
vnodeCleanUp
(
pVnode
);
return
terrno
;
}
else
{
pVnode
->
version
=
0
;
}
}
sprintf
(
temp
,
"%s/wal"
,
rootDir
);
...
...
tests/script/unique/dnode/data1.sim
0 → 100644
浏览文件 @
11c94027
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/deploy.sh -n dnode2 -i 2
system sh/deploy.sh -n dnode3 -i 3
system sh/deploy.sh -n dnode4 -i 4
system sh/cfg.sh -n dnode1 -c balanceInterval -v 10
system sh/cfg.sh -n dnode2 -c balanceInterval -v 10
system sh/cfg.sh -n dnode3 -c balanceInterval -v 10
system sh/cfg.sh -n dnode4 -c balanceInterval -v 10
system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4
system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 4
system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 4
system sh/cfg.sh -n dnode4 -c mnodeEqualVnodeNum -v 4
system sh/cfg.sh -n dnode1 -c wallevel -v 2
system sh/cfg.sh -n dnode2 -c wallevel -v 2
system sh/cfg.sh -n dnode3 -c wallevel -v 2
system sh/cfg.sh -n dnode4 -c wallevel -v 2
print ========== step1
system sh/exec.sh -n dnode1 -s start
sql connect
sleep 3000
print ========== step2
sql create dnode $hostname2
system sh/exec.sh -n dnode2 -s start
sql create dnode $hostname3
system sh/exec.sh -n dnode3 -s start
sql create dnode $hostname4
system sh/exec.sh -n dnode4 -s start
$x = 0
show2:
$x = $x + 1
sleep 3000
if $x == 10 then
return -1
endi
sql show dnodes
print dnode1 openVnodes $data2_1
print dnode2 openVnodes $data2_2
print dnode3 openVnodes $data2_3
print dnode4 openVnodes $data2_4
if $data2_1 != 0 then
goto show2
endi
if $data2_2 != 0 then
goto show2
endi
if $data2_3 != 0 then
goto show2
endi
if $data2_4 != 0 then
goto show2
endi
print ========== step3
sql create database d1 replica 3
sql create table d1.t1 (t timestamp, i int)
sql insert into d1.t1 values(now+1s, 35)
sql insert into d1.t1 values(now+2s, 34)
sql insert into d1.t1 values(now+3s, 33)
sql insert into d1.t1 values(now+4s, 32)
sql insert into d1.t1 values(now+5s, 31)
$x = 0
show3:
$x = $x + 1
sleep 3000
if $x == 10 then
return -1
endi
sql show dnodes
print dnode1 openVnodes $data2_1
print dnode2 openVnodes $data2_2
print dnode3 openVnodes $data2_3
print dnode4 openVnodes $data2_4
if $data2_1 != 0 then
goto show3
endi
if $data2_2 != 1 then
goto show3
endi
if $data2_3 != 1 then
goto show3
endi
if $data2_4 != 1 then
goto show3
endi
print ========== step4
system sh/exec.sh -n dnode2 -s stop -x SIGINT
system sh/exec.sh -n dnode3 -s stop -x SIGINT
system sh/exec.sh -n dnode4 -s stop -x SIGINT
print ========== step5
system_content rm -rf ../../../sim/dnode4/data/vnode/vnode2/tsdb/data
print ========== step6
system sh/exec.sh -n dnode2 -s start
system sh/exec.sh -n dnode3 -s start
system sh/exec.sh -n dnode4 -s start
sleep 10000
print ========== step7
sql select * from d1.t1 order by t desc
print $data01 $data11 $data21 $data31 $data41
if $data01 != 31 then
return -1
endi
if $data11 != 32 then
return -1
endi
if $data21 != 33 then
return -1
endi
if $data31 != 34 then
return -1
endi
if $data41 != 35 then
return -1
endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT
system sh/exec.sh -n dnode2 -s stop -x SIGINT
system sh/exec.sh -n dnode3 -s stop -x SIGINT
system sh/exec.sh -n dnode4 -s stop -x SIGINT
system sh/exec.sh -n dnode5 -s stop -x SIGINT
system sh/exec.sh -n dnode6 -s stop -x SIGINT
system sh/exec.sh -n dnode7 -s stop -x SIGINT
system sh/exec.sh -n dnode8 -s stop -x SIGINT
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录