Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
c8ed7d15
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看板
提交
c8ed7d15
编写于
3月 13, 2020
作者:
H
hzcheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
resolve interface change conflict
上级
8855a6ac
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
13 addition
and
13 deletion
+13
-13
src/vnode/tsdb/src/tsdbMeta.c
src/vnode/tsdb/src/tsdbMeta.c
+3
-3
src/vnode/tsdb/src/tsdbMetaFile.c
src/vnode/tsdb/src/tsdbMetaFile.c
+10
-10
未找到文件。
src/vnode/tsdb/src/tsdbMeta.c
浏览文件 @
c8ed7d15
...
...
@@ -86,7 +86,7 @@ STsdbMeta *tsdbInitMeta(const char *rootDir, int32_t maxTables) {
return
NULL
;
}
pMeta
->
map
=
taos
InitHashTable
(
maxTables
*
TSDB_META_HASH_FRACTION
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BIGINT
),
false
);
pMeta
->
map
=
taos
HashInit
(
maxTables
*
TSDB_META_HASH_FRACTION
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BIGINT
),
false
);
if
(
pMeta
->
map
==
NULL
)
{
free
(
pMeta
->
tables
);
free
(
pMeta
);
...
...
@@ -95,7 +95,7 @@ STsdbMeta *tsdbInitMeta(const char *rootDir, int32_t maxTables) {
pMeta
->
mfh
=
tsdbInitMetaFile
(
rootDir
,
maxTables
);
if
(
pMeta
->
mfh
==
NULL
)
{
taos
CleanUpHashTable
(
pMeta
->
map
);
taos
HashCleanup
(
pMeta
->
map
);
free
(
pMeta
->
tables
);
free
(
pMeta
);
return
NULL
;
...
...
@@ -260,7 +260,7 @@ static int32_t tsdbCheckTableCfg(STableCfg *pCfg) {
}
STable
*
tsdbGetTableByUid
(
STsdbMeta
*
pMeta
,
int64_t
uid
)
{
void
*
ptr
=
taosHashGet
(
pMeta
->
tableM
ap
,
(
char
*
)(
&
uid
),
sizeof
(
uid
));
void
*
ptr
=
taosHashGet
(
pMeta
->
m
ap
,
(
char
*
)(
&
uid
),
sizeof
(
uid
));
if
(
ptr
==
NULL
)
return
NULL
;
...
...
src/vnode/tsdb/src/tsdbMetaFile.c
浏览文件 @
c8ed7d15
...
...
@@ -42,7 +42,7 @@ SMetaFile *tsdbInitMetaFile(char *rootDir, int32_t maxTables) {
// OPEN MAP
mfh
->
map
=
taos
InitHashTable
(
maxTables
*
TSDB_META_HASH_FRACTION
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BIGINT
),
false
);
taos
HashInit
(
maxTables
*
TSDB_META_HASH_FRACTION
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BIGINT
),
false
);
if
(
mfh
->
map
==
NULL
)
{
free
(
mfh
);
return
NULL
;
...
...
@@ -52,13 +52,13 @@ SMetaFile *tsdbInitMetaFile(char *rootDir, int32_t maxTables) {
if
(
access
(
fname
,
F_OK
)
<
0
)
{
// file not exists
mfh
->
fd
=
tsdbCreateMetaFile
(
fname
);
if
(
mfh
->
fd
<
0
)
{
taos
CleanUpHashTable
(
mfh
->
map
);
taos
HashCleanup
(
mfh
->
map
);
free
(
mfh
);
return
NULL
;
}
}
else
{
// file exists, recover from file
if
(
tsdbRestoreFromMetaFile
(
fname
,
mfh
)
<
0
)
{
taos
CleanUpHashTable
(
mfh
->
map
);
taos
HashCleanup
(
mfh
->
map
);
free
(
mfh
);
return
NULL
;
}
...
...
@@ -68,7 +68,7 @@ SMetaFile *tsdbInitMetaFile(char *rootDir, int32_t maxTables) {
}
int32_t
tsdbInsertMetaRecord
(
SMetaFile
*
mfh
,
int64_t
uid
,
void
*
cont
,
int32_t
contLen
)
{
if
(
taos
GetDataFromHashTable
(
mfh
->
map
,
(
char
*
)(
&
uid
),
sizeof
(
uid
))
!=
NULL
)
{
if
(
taos
HashGet
(
mfh
->
map
,
(
char
*
)(
&
uid
),
sizeof
(
uid
))
!=
NULL
)
{
return
-
1
;
}
...
...
@@ -78,7 +78,7 @@ int32_t tsdbInsertMetaRecord(SMetaFile *mfh, int64_t uid, void *cont, int32_t co
mfh
->
size
+=
(
contLen
+
sizeof
(
SRecordInfo
));
if
(
taos
AddToHashTable
(
mfh
->
map
,
(
char
*
)(
&
uid
),
sizeof
(
uid
),
(
void
*
)(
&
info
),
sizeof
(
SRecordInfo
))
<
0
)
{
if
(
taos
HashPut
(
mfh
->
map
,
(
char
*
)(
&
uid
),
sizeof
(
uid
),
(
void
*
)(
&
info
),
sizeof
(
SRecordInfo
))
<
0
)
{
return
-
1
;
}
...
...
@@ -103,13 +103,13 @@ int32_t tsdbInsertMetaRecord(SMetaFile *mfh, int64_t uid, void *cont, int32_t co
}
int32_t
tsdbDeleteMetaRecord
(
SMetaFile
*
mfh
,
int64_t
uid
)
{
char
*
ptr
=
taos
GetDataFromHashTable
(
mfh
->
map
,
(
char
*
)(
&
uid
),
sizeof
(
uid
));
char
*
ptr
=
taos
HashGet
(
mfh
->
map
,
(
char
*
)(
&
uid
),
sizeof
(
uid
));
if
(
ptr
==
NULL
)
return
-
1
;
SRecordInfo
info
=
*
(
SRecordInfo
*
)
ptr
;
// Remove record from hash table
taos
DeleteFromHashTabl
e
(
mfh
->
map
,
(
char
*
)(
&
uid
),
sizeof
(
uid
));
taos
HashRemov
e
(
mfh
->
map
,
(
char
*
)(
&
uid
),
sizeof
(
uid
));
// Remove record from file
...
...
@@ -130,12 +130,12 @@ int32_t tsdbDeleteMetaRecord(SMetaFile *mfh, int64_t uid) {
}
int32_t
tsdbUpdateMetaRecord
(
SMetaFile
*
mfh
,
int64_t
uid
,
void
*
cont
,
int32_t
contLen
)
{
char
*
ptr
=
taos
GetDataFromHashTable
(
mfh
->
map
,
(
char
*
)(
&
uid
),
sizeof
(
uid
));
char
*
ptr
=
taos
HashGet
(
mfh
->
map
,
(
char
*
)(
&
uid
),
sizeof
(
uid
));
if
(
ptr
==
NULL
)
return
-
1
;
SRecordInfo
info
=
*
(
SRecordInfo
*
)
ptr
;
// Update the hash table
if
(
taos
AddToHashTable
(
mfh
->
map
,
(
char
*
)(
&
uid
),
sizeof
(
uid
),
(
void
*
)(
&
info
),
sizeof
(
SRecordInfo
))
<
0
)
{
if
(
taos
HashPut
(
mfh
->
map
,
(
char
*
)(
&
uid
),
sizeof
(
uid
),
(
void
*
)(
&
info
),
sizeof
(
SRecordInfo
))
<
0
)
{
return
-
1
;
}
...
...
@@ -166,7 +166,7 @@ void tsdbCloseMetaFile(SMetaFile *mfh) {
if
(
mfh
==
NULL
)
return
;
close
(
mfh
);
taos
CleanUpHashTable
(
mfh
->
map
);
taos
HashCleanup
(
mfh
->
map
);
}
static
int32_t
tsdbGetMetaFileName
(
char
*
rootDir
,
char
*
fname
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录