Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
b59ed557
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
b59ed557
编写于
5月 15, 2020
作者:
S
Shengliang Guan
提交者:
GitHub
5月 15, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1928 from taosdata/feature/2.0tsdb
Feature/2.0tsdb
上级
ea099d2d
d69c99d1
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
25 addition
and
23 deletion
+25
-23
src/tsdb/inc/tsdbMain.h
src/tsdb/inc/tsdbMain.h
+11
-11
src/tsdb/src/tsdbMain.c
src/tsdb/src/tsdbMain.c
+6
-5
src/tsdb/src/tsdbMeta.c
src/tsdb/src/tsdbMeta.c
+8
-7
未找到文件。
src/tsdb/inc/tsdbMain.h
浏览文件 @
b59ed557
...
@@ -29,23 +29,23 @@ extern "C" {
...
@@ -29,23 +29,23 @@ extern "C" {
extern
int
tsdbDebugFlag
;
extern
int
tsdbDebugFlag
;
#define tsdbError(...)
\
#define tsdbError(...) \
if (tsdbDebugFlag & DEBUG_ERROR) {
\
if (tsdbDebugFlag & DEBUG_ERROR) { \
taosPrintLog("ERROR T
S
DB ", tsdbDebugFlag, __VA_ARGS__); \
taosPrintLog("ERROR TDB ", tsdbDebugFlag, __VA_ARGS__); \
}
}
#define tsdbWarn(...)
\
#define tsdbWarn(...) \
if (tsdbDebugFlag & DEBUG_WARN) {
\
if (tsdbDebugFlag & DEBUG_WARN) { \
taosPrintLog("WARN T
S
DB ", tsdbDebugFlag, __VA_ARGS__); \
taosPrintLog("WARN TDB ", tsdbDebugFlag, __VA_ARGS__); \
}
}
#define tsdbTrace(...)
\
#define tsdbTrace(...) \
if (tsdbDebugFlag & DEBUG_TRACE) {
\
if (tsdbDebugFlag & DEBUG_TRACE) { \
taosPrintLog("T
S
DB ", tsdbDebugFlag, __VA_ARGS__); \
taosPrintLog("TDB ", tsdbDebugFlag, __VA_ARGS__); \
}
}
#define tsdbPrint(...) \
#define tsdbPrint(...) \
{ taosPrintLog("T
S
DB ", 255, __VA_ARGS__); }
{ taosPrintLog("TDB ", 255, __VA_ARGS__); }
// ------------------------------ TSDB META FILE INTERFACES ------------------------------
// ------------------------------ TSDB META FILE INTERFACES ------------------------------
#define TSDB_META_FILE_NAME "
META
"
#define TSDB_META_FILE_NAME "
meta
"
#define TSDB_META_HASH_FRACTION 1.1
#define TSDB_META_HASH_FRACTION 1.1
typedef
int
(
*
iterFunc
)(
void
*
,
void
*
cont
,
int
contLen
);
typedef
int
(
*
iterFunc
)(
void
*
,
void
*
cont
,
int
contLen
);
...
...
src/tsdb/src/tsdbMain.c
浏览文件 @
b59ed557
...
@@ -18,7 +18,7 @@ int tsdbDebugFlag = 135;
...
@@ -18,7 +18,7 @@ int tsdbDebugFlag = 135;
#define TSDB_MIN_ID 0
#define TSDB_MIN_ID 0
#define TSDB_MAX_ID INT_MAX
#define TSDB_MAX_ID INT_MAX
#define TSDB_CFG_FILE_NAME "
CONFIG
"
#define TSDB_CFG_FILE_NAME "
config
"
#define TSDB_DATA_DIR_NAME "data"
#define TSDB_DATA_DIR_NAME "data"
#define TSDB_DEFAULT_FILE_BLOCK_ROW_OPTION 0.7
#define TSDB_DEFAULT_FILE_BLOCK_ROW_OPTION 0.7
#define TSDB_MAX_LAST_FILE_SIZE (1024 * 1024 * 10) // 10M
#define TSDB_MAX_LAST_FILE_SIZE (1024 * 1024 * 10) // 10M
...
@@ -169,6 +169,7 @@ static int tsdbRestoreInfo(STsdbRepo *pRepo) {
...
@@ -169,6 +169,7 @@ static int tsdbRestoreInfo(STsdbRepo *pRepo) {
if
(
tsdbSetAndOpenHelperFile
(
&
rhelper
,
pFGroup
)
<
0
)
goto
_err
;
if
(
tsdbSetAndOpenHelperFile
(
&
rhelper
,
pFGroup
)
<
0
)
goto
_err
;
for
(
int
i
=
1
;
i
<
pRepo
->
config
.
maxTables
;
i
++
)
{
for
(
int
i
=
1
;
i
<
pRepo
->
config
.
maxTables
;
i
++
)
{
STable
*
pTable
=
pMeta
->
tables
[
i
];
STable
*
pTable
=
pMeta
->
tables
[
i
];
if
(
pTable
==
NULL
)
continue
;
SCompIdx
*
pIdx
=
&
rhelper
.
pCompIdx
[
i
];
SCompIdx
*
pIdx
=
&
rhelper
.
pCompIdx
[
i
];
if
(
pIdx
->
offset
>
0
&&
pTable
->
lastKey
<
pIdx
->
maxKey
)
pTable
->
lastKey
=
pIdx
->
maxKey
;
if
(
pIdx
->
offset
>
0
&&
pTable
->
lastKey
<
pIdx
->
maxKey
)
pTable
->
lastKey
=
pIdx
->
maxKey
;
...
@@ -841,8 +842,8 @@ static int32_t tdInsertRowToTable(STsdbRepo *pRepo, SDataRow row, STable *pTable
...
@@ -841,8 +842,8 @@ static int32_t tdInsertRowToTable(STsdbRepo *pRepo, SDataRow row, STable *pTable
pTable
->
mem
->
numOfPoints
=
tSkipListGetSize
(
pTable
->
mem
->
pData
);
pTable
->
mem
->
numOfPoints
=
tSkipListGetSize
(
pTable
->
mem
->
pData
);
tsdbTrace
(
"vgId:%d, tid:%d, uid:%"
PRId64
",
a row is inserted to table! key:%"
PRId64
,
tsdbTrace
(
"vgId:%d, tid:%d, uid:%"
PRId64
",
table:%s a row is inserted to table! key:%"
PRId64
,
pRepo
->
config
.
tsdbId
,
p
Repo
->
config
.
tsdbId
,
pTable
->
tableId
.
tid
,
pTable
->
tableId
.
uid
,
dataRowKey
(
row
));
p
Table
->
tableId
.
tid
,
pTable
->
tableId
.
uid
,
varDataVal
(
pTable
->
name
)
,
dataRowKey
(
row
));
return
0
;
return
0
;
}
}
...
@@ -867,9 +868,9 @@ static int32_t tsdbInsertDataToTable(TsdbRepoT *repo, SSubmitBlk *pBlock, TSKEY
...
@@ -867,9 +868,9 @@ static int32_t tsdbInsertDataToTable(TsdbRepoT *repo, SSubmitBlk *pBlock, TSKEY
tsdbInitSubmitBlkIter
(
pBlock
,
&
blkIter
);
tsdbInitSubmitBlkIter
(
pBlock
,
&
blkIter
);
while
((
row
=
tsdbGetSubmitBlkNext
(
&
blkIter
))
!=
NULL
)
{
while
((
row
=
tsdbGetSubmitBlkNext
(
&
blkIter
))
!=
NULL
)
{
if
(
dataRowKey
(
row
)
<
minKey
||
dataRowKey
(
row
)
>
maxKey
)
{
if
(
dataRowKey
(
row
)
<
minKey
||
dataRowKey
(
row
)
>
maxKey
)
{
tsdbError
(
"vgId:%d, table tid:%d, talbe uid:%ld timestamp is out of range. now:"
PRId64
", maxKey:"
PRId64
tsdbError
(
"vgId:%d, table
:%s,
tid:%d, talbe uid:%ld timestamp is out of range. now:"
PRId64
", maxKey:"
PRId64
", minKey:"
PRId64
,
", minKey:"
PRId64
,
pRepo
->
config
.
tsdbId
,
pTable
->
tableId
.
tid
,
pTable
->
tableId
.
uid
,
now
,
minKey
,
maxKey
);
pRepo
->
config
.
tsdbId
,
varDataVal
(
pTable
->
name
),
pTable
->
tableId
.
tid
,
pTable
->
tableId
.
uid
,
now
,
minKey
,
maxKey
);
return
TSDB_CODE_TIMESTAMP_OUT_OF_RANGE
;
return
TSDB_CODE_TIMESTAMP_OUT_OF_RANGE
;
}
}
...
...
src/tsdb/src/tsdbMeta.c
浏览文件 @
b59ed557
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
#include "tsdbMain.h"
#include "tsdbMain.h"
#define TSDB_SUPER_TABLE_SL_LEVEL 5 // TODO: may change here
#define TSDB_SUPER_TABLE_SL_LEVEL 5 // TODO: may change here
#define TSDB_META_FILE_NAME "META"
//
#define TSDB_META_FILE_NAME "META"
const
int32_t
DEFAULT_TAG_INDEX_COLUMN
=
0
;
// skip list built based on the first column of tags
const
int32_t
DEFAULT_TAG_INDEX_COLUMN
=
0
;
// skip list built based on the first column of tags
...
@@ -310,7 +310,7 @@ int tsdbCreateTable(TsdbRepoT *repo, STableCfg *pCfg) {
...
@@ -310,7 +310,7 @@ int tsdbCreateTable(TsdbRepoT *repo, STableCfg *pCfg) {
// todo refactor extract method
// todo refactor extract method
size_t
size
=
strnlen
(
pCfg
->
sname
,
TSDB_TABLE_NAME_LEN
);
size_t
size
=
strnlen
(
pCfg
->
sname
,
TSDB_TABLE_NAME_LEN
);
super
->
name
=
malloc
(
size
+
VARSTR_HEADER_SIZE
);
super
->
name
=
calloc
(
1
,
size
+
VARSTR_HEADER_SIZE
+
1
);
STR_WITH_SIZE_TO_VARSTR
(
super
->
name
,
pCfg
->
sname
,
size
);
STR_WITH_SIZE_TO_VARSTR
(
super
->
name
,
pCfg
->
sname
,
size
);
// index the first tag column
// index the first tag column
...
@@ -339,7 +339,7 @@ int tsdbCreateTable(TsdbRepoT *repo, STableCfg *pCfg) {
...
@@ -339,7 +339,7 @@ int tsdbCreateTable(TsdbRepoT *repo, STableCfg *pCfg) {
table
->
tableId
=
pCfg
->
tableId
;
table
->
tableId
=
pCfg
->
tableId
;
size_t
size
=
strnlen
(
pCfg
->
name
,
TSDB_TABLE_NAME_LEN
);
size_t
size
=
strnlen
(
pCfg
->
name
,
TSDB_TABLE_NAME_LEN
);
table
->
name
=
malloc
(
size
+
VARSTR_HEADER_SIZE
);
table
->
name
=
calloc
(
1
,
size
+
VARSTR_HEADER_SIZE
+
1
);
STR_WITH_SIZE_TO_VARSTR
(
table
->
name
,
pCfg
->
name
,
size
);
STR_WITH_SIZE_TO_VARSTR
(
table
->
name
,
pCfg
->
name
,
size
);
table
->
lastKey
=
0
;
table
->
lastKey
=
0
;
...
@@ -356,12 +356,12 @@ int tsdbCreateTable(TsdbRepoT *repo, STableCfg *pCfg) {
...
@@ -356,12 +356,12 @@ int tsdbCreateTable(TsdbRepoT *repo, STableCfg *pCfg) {
// Register to meta
// Register to meta
if
(
newSuper
)
{
if
(
newSuper
)
{
tsdbAddTableToMeta
(
pMeta
,
super
,
true
);
tsdbAddTableToMeta
(
pMeta
,
super
,
true
);
tsdbTrace
(
"vgId:%d, super table
is created! uid:%"
PRId64
,
pRepo
->
config
.
tsdbId
,
tsdbTrace
(
"vgId:%d, super table
%s is created! uid:%"
PRId64
,
pRepo
->
config
.
tsdbId
,
varDataVal
(
super
->
name
)
,
super
->
tableId
.
uid
);
super
->
tableId
.
uid
);
}
}
tsdbAddTableToMeta
(
pMeta
,
table
,
true
);
tsdbAddTableToMeta
(
pMeta
,
table
,
true
);
tsdbTrace
(
"vgId:%d, table
is created! tid:%d, uid:%"
PRId64
,
pRepo
->
config
.
tsdbId
,
table
->
tableId
.
tid
,
tsdbTrace
(
"vgId:%d, table
%s is created! tid:%d, uid:%"
PRId64
,
pRepo
->
config
.
tsdbId
,
varDataVal
(
table
->
name
)
,
table
->
tableId
.
uid
);
table
->
tableId
.
tid
,
table
->
tableId
.
uid
);
// Write to meta file
// Write to meta file
int
bufLen
=
0
;
int
bufLen
=
0
;
...
@@ -409,7 +409,8 @@ int tsdbDropTable(TsdbRepoT *repo, STableId tableId) {
...
@@ -409,7 +409,8 @@ int tsdbDropTable(TsdbRepoT *repo, STableId tableId) {
return
-
1
;
return
-
1
;
}
}
tsdbTrace
(
"vgId:%d, table is dropped! tid:%d, uid:%"
PRId64
,
pRepo
->
config
.
tsdbId
,
tableId
.
tid
,
tableId
.
uid
);
tsdbTrace
(
"vgId:%d, table %s is dropped! tid:%d, uid:%"
PRId64
,
pRepo
->
config
.
tsdbId
,
varDataVal
(
pTable
->
name
),
tableId
.
tid
,
tableId
.
uid
);
if
(
tsdbRemoveTableFromMeta
(
pMeta
,
pTable
)
<
0
)
return
-
1
;
if
(
tsdbRemoveTableFromMeta
(
pMeta
,
pTable
)
<
0
)
return
-
1
;
return
0
;
return
0
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录