Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
c867eff2
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看板
提交
c867eff2
编写于
11月 27, 2020
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix sync bug
上级
0ab1a0ff
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
13 addition
and
12 deletion
+13
-12
src/tsdb/src/tsdbFile.c
src/tsdb/src/tsdbFile.c
+1
-1
src/tsdb/src/tsdbMain.c
src/tsdb/src/tsdbMain.c
+12
-11
未找到文件。
src/tsdb/src/tsdbFile.c
浏览文件 @
c867eff2
...
@@ -423,7 +423,7 @@ void tsdbGetFileInfoImpl(char *fname, uint32_t *magic, int64_t *size) { // TODO
...
@@ -423,7 +423,7 @@ void tsdbGetFileInfoImpl(char *fname, uint32_t *magic, int64_t *size) { // TODO
SFile
file
;
SFile
file
;
SFile
*
pFile
=
&
file
;
SFile
*
pFile
=
&
file
;
strncpy
(
TSDB_FILE_NAME
(
pFile
),
fname
,
TSDB_FILENAME_LEN
-
1
);
tfsInitFile
(
&
(
pFile
->
file
),
TFS_PRIMARY_LEVEL
,
TFS_PRIMARY_ID
,
fname
);
pFile
->
fd
=
-
1
;
pFile
->
fd
=
-
1
;
if
(
tsdbOpenFile
(
pFile
,
O_RDONLY
)
<
0
)
goto
_err
;
if
(
tsdbOpenFile
(
pFile
,
O_RDONLY
)
<
0
)
goto
_err
;
...
...
src/tsdb/src/tsdbMain.c
浏览文件 @
c867eff2
...
@@ -176,12 +176,7 @@ uint32_t tsdbGetFileInfo(TSDB_REPO_T *repo, char *name, uint32_t *index, uint32_
...
@@ -176,12 +176,7 @@ uint32_t tsdbGetFileInfo(TSDB_REPO_T *repo, char *name, uint32_t *index, uint32_
tsdbDebug
(
"vgId:%d name:%s index:%d eindex:%d"
,
pRepo
->
config
.
tsdbId
,
name
,
*
index
,
eindex
);
tsdbDebug
(
"vgId:%d name:%s index:%d eindex:%d"
,
pRepo
->
config
.
tsdbId
,
name
,
*
index
,
eindex
);
ASSERT
(
*
index
<=
eindex
);
ASSERT
(
*
index
<=
eindex
);
char
*
sdup
=
strdup
(
pRepo
->
rootDir
);
char
*
prefix
=
dirname
(
sdup
);
int
prefixLen
=
(
int
)
strlen
(
prefix
);
if
(
name
[
0
]
==
0
)
{
// get the file from index or after, but not larger than eindex
if
(
name
[
0
]
==
0
)
{
// get the file from index or after, but not larger than eindex
tfree
(
sdup
);
int
fid
=
(
*
index
)
/
TSDB_FILE_TYPE_MAX
;
int
fid
=
(
*
index
)
/
TSDB_FILE_TYPE_MAX
;
if
(
pFileH
->
nFGroups
==
0
||
fid
>
pFileH
->
pFGroup
[
pFileH
->
nFGroups
-
1
].
fileId
)
{
if
(
pFileH
->
nFGroups
==
0
||
fid
>
pFileH
->
pFGroup
[
pFileH
->
nFGroups
-
1
].
fileId
)
{
...
@@ -189,6 +184,7 @@ uint32_t tsdbGetFileInfo(TSDB_REPO_T *repo, char *name, uint32_t *index, uint32_
...
@@ -189,6 +184,7 @@ uint32_t tsdbGetFileInfo(TSDB_REPO_T *repo, char *name, uint32_t *index, uint32_
fname
=
tsdbGetMetaFileName
(
pRepo
->
rootDir
);
fname
=
tsdbGetMetaFileName
(
pRepo
->
rootDir
);
*
index
=
TSDB_META_FILE_INDEX
;
*
index
=
TSDB_META_FILE_INDEX
;
magic
=
TSDB_META_FILE_MAGIC
(
pRepo
->
tsdbMeta
);
magic
=
TSDB_META_FILE_MAGIC
(
pRepo
->
tsdbMeta
);
sprintf
(
name
,
"tsdb/%s"
,
TSDB_META_FILE_NAME
);
}
else
{
}
else
{
return
0
;
return
0
;
}
}
...
@@ -199,33 +195,38 @@ uint32_t tsdbGetFileInfo(TSDB_REPO_T *repo, char *name, uint32_t *index, uint32_
...
@@ -199,33 +195,38 @@ uint32_t tsdbGetFileInfo(TSDB_REPO_T *repo, char *name, uint32_t *index, uint32_
SFile
*
pFile
=
&
pFGroup
->
files
[(
*
index
)
%
TSDB_FILE_TYPE_MAX
];
SFile
*
pFile
=
&
pFGroup
->
files
[(
*
index
)
%
TSDB_FILE_TYPE_MAX
];
fname
=
strdup
(
TSDB_FILE_NAME
(
pFile
));
fname
=
strdup
(
TSDB_FILE_NAME
(
pFile
));
magic
=
pFile
->
info
.
magic
;
magic
=
pFile
->
info
.
magic
;
char
*
tfname
=
strdup
(
fname
);
sprintf
(
name
,
"tsdb/%s/%s"
,
TSDB_DATA_DIR_NAME
,
basename
(
tfname
));
tfree
(
tfname
);
}
else
{
}
else
{
if
((
pFGroup
->
fileId
+
1
)
*
TSDB_FILE_TYPE_MAX
-
1
<
(
int
)
eindex
)
{
if
((
pFGroup
->
fileId
+
1
)
*
TSDB_FILE_TYPE_MAX
-
1
<
(
int
)
eindex
)
{
SFile
*
pFile
=
&
pFGroup
->
files
[
0
];
SFile
*
pFile
=
&
pFGroup
->
files
[
0
];
fname
=
strdup
(
TSDB_FILE_NAME
(
pFile
));
fname
=
strdup
(
TSDB_FILE_NAME
(
pFile
));
*
index
=
pFGroup
->
fileId
*
TSDB_FILE_TYPE_MAX
;
*
index
=
pFGroup
->
fileId
*
TSDB_FILE_TYPE_MAX
;
magic
=
pFile
->
info
.
magic
;
magic
=
pFile
->
info
.
magic
;
char
*
tfname
=
strdup
(
fname
);
sprintf
(
name
,
"tsdb/%s/%s"
,
TSDB_DATA_DIR_NAME
,
basename
(
tfname
));
tfree
(
tfname
)
}
else
{
}
else
{
return
0
;
return
0
;
}
}
}
}
}
}
strcpy
(
name
,
fname
+
prefixLen
);
}
else
{
// get the named file at the specified index. If not there, return 0
}
else
{
// get the named file at the specified index. If not there, return 0
fname
=
malloc
(
prefixLen
+
strlen
(
name
)
+
2
);
fname
=
malloc
(
256
);
sprintf
(
fname
,
"%s/
%s"
,
prefix
,
name
);
sprintf
(
fname
,
"%s/
vnode/vnode%d/%s"
,
TFS_PRIMARY_PATH
(),
REPO_ID
(
pRepo
)
,
name
);
if
(
access
(
fname
,
F_OK
)
!=
0
)
{
if
(
access
(
fname
,
F_OK
)
!=
0
)
{
tfree
(
fname
);
tfree
(
fname
);
tfree
(
sdup
);
return
0
;
return
0
;
}
}
if
(
*
index
==
TSDB_META_FILE_INDEX
)
{
// get meta file
if
(
*
index
==
TSDB_META_FILE_INDEX
)
{
// get meta file
tsdbGetStoreInfo
(
fname
,
&
magic
,
size
);
tsdbGetStoreInfo
(
fname
,
&
magic
,
size
);
}
else
{
}
else
{
tsdbGetFileInfoImpl
(
fname
,
&
magic
,
size
);
char
tfname
[
TSDB_FILENAME_LEN
]
=
"
\0
"
;
sprintf
(
tfname
,
"vnode/vnode%d/tsdb/%s/%s"
,
REPO_ID
(
pRepo
),
TSDB_DATA_DIR_NAME
,
basename
(
name
));
tsdbGetFileInfoImpl
(
tfname
,
&
magic
,
size
);
}
}
tfree
(
fname
);
tfree
(
fname
);
tfree
(
sdup
);
return
magic
;
return
magic
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录