Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
bbf58d2d
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
bbf58d2d
编写于
7月 12, 2023
作者:
B
Benguang Zhao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
enh: unify handling of vnode primary dir in vnodeCreate and metaOpen
上级
bd758760
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
29 addition
and
39 deletion
+29
-39
source/dnode/vnode/src/inc/vnd.h
source/dnode/vnode/src/inc/vnd.h
+3
-0
source/dnode/vnode/src/meta/metaOpen.c
source/dnode/vnode/src/meta/metaOpen.c
+12
-14
source/dnode/vnode/src/vnd/vnodeOpen.c
source/dnode/vnode/src/vnd/vnodeOpen.c
+14
-25
未找到文件。
source/dnode/vnode/src/inc/vnd.h
浏览文件 @
bbf58d2d
...
...
@@ -86,6 +86,9 @@ void vnodeBufPoolReset(SVBufPool* pPool);
void
vnodeBufPoolAddToFreeList
(
SVBufPool
*
pPool
);
int32_t
vnodeBufPoolRecycle
(
SVBufPool
*
pPool
);
// vnodeOpen.c
int32_t
vnodeGetAbsDir
(
const
char
*
relPath
,
STfs
*
pTfs
,
char
*
buf
,
size_t
bufLen
);
// vnodeQuery.c
int32_t
vnodeQueryOpen
(
SVnode
*
pVnode
);
void
vnodeQueryPreClose
(
SVnode
*
pVnode
);
...
...
source/dnode/vnode/src/meta/metaOpen.c
浏览文件 @
bbf58d2d
...
...
@@ -14,6 +14,7 @@
*/
#include "meta.h"
#include "vnd.h"
static
int
tbDbKeyCmpr
(
const
void
*
pKey1
,
int
kLen1
,
const
void
*
pKey2
,
int
kLen2
);
static
int
skmDbKeyCmpr
(
const
void
*
pKey1
,
int
kLen1
,
const
void
*
pKey2
,
int
kLen2
);
...
...
@@ -34,30 +35,27 @@ static void metaCleanup(SMeta **ppMeta);
int
metaOpen
(
SVnode
*
pVnode
,
SMeta
**
ppMeta
,
int8_t
rollback
)
{
SMeta
*
pMeta
=
NULL
;
int
ret
;
int
slen
;
int
offset
;
char
path
[
TSDB_FILENAME_LEN
]
=
{
0
};
*
ppMeta
=
NULL
;
// create handle
if
(
pVnode
->
pTfs
)
{
slen
=
strlen
(
tfsGetPrimaryPath
(
pVnode
->
pTfs
))
+
strlen
(
pVnode
->
path
)
+
strlen
(
VNODE_META_DIR
)
+
3
;
}
else
{
slen
=
strlen
(
pVnode
->
path
)
+
strlen
(
VNODE_META_DIR
)
+
2
;
}
if
((
pMeta
=
taosMemoryCalloc
(
1
,
sizeof
(
*
pMeta
)
+
slen
))
==
NULL
)
{
vnodeGetAbsDir
(
pVnode
->
path
,
pVnode
->
pTfs
,
path
,
TSDB_FILENAME_LEN
);
offset
=
strlen
(
path
);
snprintf
(
path
+
offset
,
TSDB_FILENAME_LEN
-
offset
-
1
,
"%s%s"
,
TD_DIRSEP
,
VNODE_META_DIR
);
if
((
pMeta
=
taosMemoryCalloc
(
1
,
sizeof
(
*
pMeta
)
+
strlen
(
path
)
+
1
))
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
metaInitLock
(
pMeta
);
pMeta
->
path
=
(
char
*
)
&
pMeta
[
1
];
if
(
pVnode
->
pTfs
)
{
sprintf
(
pMeta
->
path
,
"%s%s%s%s%s"
,
tfsGetPrimaryPath
(
pVnode
->
pTfs
),
TD_DIRSEP
,
pVnode
->
path
,
TD_DIRSEP
,
VNODE_META_DIR
);
}
else
{
sprintf
(
pMeta
->
path
,
"%s%s%s"
,
pVnode
->
path
,
TD_DIRSEP
,
VNODE_META_DIR
);
}
taosRealPath
(
pMeta
->
path
,
NULL
,
slen
);
strcpy
(
pMeta
->
path
,
path
);
taosRealPath
(
pMeta
->
path
,
NULL
,
strlen
(
path
)
+
1
);
pMeta
->
pVnode
=
pVnode
;
// create path if not created yet
...
...
source/dnode/vnode/src/vnd/vnodeOpen.c
浏览文件 @
bbf58d2d
...
...
@@ -15,6 +15,16 @@
#include "vnd.h"
int32_t
vnodeGetAbsDir
(
const
char
*
relPath
,
STfs
*
pTfs
,
char
*
buf
,
size_t
bufLen
)
{
if
(
pTfs
)
{
snprintf
(
buf
,
bufLen
-
1
,
"%s%s%s"
,
tfsGetPrimaryPath
(
pTfs
),
TD_DIRSEP
,
relPath
);
}
else
{
snprintf
(
buf
,
bufLen
-
1
,
"%s"
,
relPath
);
}
buf
[
bufLen
-
1
]
=
'\0'
;
return
0
;
}
int32_t
vnodeCreate
(
const
char
*
path
,
SVnodeCfg
*
pCfg
,
STfs
*
pTfs
)
{
SVnodeInfo
info
=
{
0
};
char
dir
[
TSDB_FILENAME_LEN
]
=
{
0
};
...
...
@@ -26,17 +36,9 @@ int32_t vnodeCreate(const char *path, SVnodeCfg *pCfg, STfs *pTfs) {
}
// create vnode env
if
(
pTfs
)
{
if
(
tfsMkdirAt
(
pTfs
,
path
,
(
SDiskID
){
0
})
<
0
)
{
vError
(
"vgId:%d, failed to create vnode since:%s"
,
pCfg
->
vgId
,
tstrerror
(
terrno
));
return
-
1
;
}
snprintf
(
dir
,
TSDB_FILENAME_LEN
,
"%s%s%s"
,
tfsGetPrimaryPath
(
pTfs
),
TD_DIRSEP
,
path
);
}
else
{
if
(
taosMkDir
(
path
))
{
return
TAOS_SYSTEM_ERROR
(
errno
);
}
snprintf
(
dir
,
TSDB_FILENAME_LEN
,
"%s"
,
path
);
vnodeGetAbsDir
(
path
,
pTfs
,
dir
,
TSDB_FILENAME_LEN
);
if
(
taosMkDir
(
dir
))
{
return
TAOS_SYSTEM_ERROR
(
errno
);
}
if
(
pCfg
)
{
...
...
@@ -63,11 +65,7 @@ int32_t vnodeAlterReplica(const char *path, SAlterVnodeReplicaReq *pReq, STfs *p
char
dir
[
TSDB_FILENAME_LEN
]
=
{
0
};
int32_t
ret
=
0
;
if
(
pTfs
)
{
snprintf
(
dir
,
TSDB_FILENAME_LEN
,
"%s%s%s"
,
tfsGetPrimaryPath
(
pTfs
),
TD_DIRSEP
,
path
);
}
else
{
snprintf
(
dir
,
TSDB_FILENAME_LEN
,
"%s"
,
path
);
}
vnodeGetAbsDir
(
path
,
pTfs
,
dir
,
TSDB_FILENAME_LEN
);
ret
=
vnodeLoadInfo
(
dir
,
&
info
);
if
(
ret
<
0
)
{
...
...
@@ -185,15 +183,6 @@ int32_t vnodeRenameVgroupId(const char *srcPath, const char *dstPath, int32_t sr
return
ret
;
}
int32_t
vnodeGetAbsDir
(
const
char
*
relPath
,
STfs
*
pTfs
,
char
*
buf
,
size_t
bufLen
)
{
if
(
pTfs
)
{
snprintf
(
buf
,
bufLen
,
"%s%s%s"
,
tfsGetPrimaryPath
(
pTfs
),
TD_DIRSEP
,
relPath
);
}
else
{
snprintf
(
buf
,
bufLen
,
"%s"
,
relPath
);
}
return
0
;
}
int32_t
vnodeAlterHashRange
(
const
char
*
srcPath
,
const
char
*
dstPath
,
SAlterVnodeHashRangeReq
*
pReq
,
STfs
*
pTfs
)
{
SVnodeInfo
info
=
{
0
};
char
dir
[
TSDB_FILENAME_LEN
]
=
{
0
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录