Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
4480dc44
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1185
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看板
提交
4480dc44
编写于
5月 12, 2020
作者:
H
hzcheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add log in tsdb
上级
d5d67853
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
41 addition
and
18 deletion
+41
-18
src/tsdb/inc/tsdbMain.h
src/tsdb/inc/tsdbMain.h
+0
-2
src/tsdb/src/tsdbMain.c
src/tsdb/src/tsdbMain.c
+17
-12
src/tsdb/src/tsdbMeta.c
src/tsdb/src/tsdbMeta.c
+24
-4
未找到文件。
src/tsdb/inc/tsdbMain.h
浏览文件 @
4480dc44
...
...
@@ -151,8 +151,6 @@ STSchema * tsdbGetTableTagSchema(STsdbMeta *pMeta, STable *pTable);
STsdbMeta
*
tsdbGetMeta
(
TsdbRepoT
*
pRepo
);
int32_t
tsdbCreateTableImpl
(
STsdbMeta
*
pMeta
,
STableCfg
*
pCfg
);
int32_t
tsdbDropTableImpl
(
STsdbMeta
*
pMeta
,
STableId
tableId
);
STable
*
tsdbIsValidTableToInsert
(
STsdbMeta
*
pMeta
,
STableId
tableId
);
// int32_t tsdbInsertRowToTableImpl(SSkipListNode *pNode, STable *pTable);
STable
*
tsdbGetTableByUid
(
STsdbMeta
*
pMeta
,
int64_t
uid
);
...
...
src/tsdb/src/tsdbMain.c
浏览文件 @
4480dc44
...
...
@@ -134,6 +134,7 @@ int32_t tsdbCreateRepo(char *rootDir, STsdbCfg *pCfg, void *limiter /* TODO */)
*/
int32_t
tsdbDropRepo
(
TsdbRepoT
*
repo
)
{
STsdbRepo
*
pRepo
=
(
STsdbRepo
*
)
repo
;
int
id
=
pRepo
->
config
.
tsdbId
;
pRepo
->
state
=
TSDB_REPO_STATE_CLOSED
;
...
...
@@ -149,6 +150,8 @@ int32_t tsdbDropRepo(TsdbRepoT *repo) {
free
(
pRepo
->
rootDir
);
free
(
pRepo
);
tsdbTrace
(
"vgId %d: tsdb repository is dropped!"
,
id
);
return
0
;
}
...
...
@@ -239,6 +242,7 @@ TsdbRepoT *tsdbOpenRepo(char *tsdbDir, STsdbAppH *pAppH) {
pRepo
->
state
=
TSDB_REPO_STATE_ACTIVE
;
tsdbTrace
(
"vgId %d: open tsdb repository successfully!"
,
pRepo
->
config
.
tsdbId
);
return
(
TsdbRepoT
*
)
pRepo
;
}
...
...
@@ -257,6 +261,7 @@ TsdbRepoT *tsdbOpenRepo(char *tsdbDir, STsdbAppH *pAppH) {
int32_t
tsdbCloseRepo
(
TsdbRepoT
*
repo
)
{
STsdbRepo
*
pRepo
=
(
STsdbRepo
*
)
repo
;
if
(
pRepo
==
NULL
)
return
0
;
int
id
=
pRepo
->
config
.
tsdbId
;
pRepo
->
state
=
TSDB_REPO_STATE_CLOSED
;
tsdbLockRepo
(
repo
);
...
...
@@ -290,6 +295,8 @@ int32_t tsdbCloseRepo(TsdbRepoT *repo) {
tfree
(
pRepo
->
rootDir
);
tfree
(
pRepo
);
tsdbTrace
(
"vgId %d: repository is closed!"
,
id
);
return
0
;
}
...
...
@@ -350,6 +357,7 @@ int32_t tsdbTriggerCommit(TsdbRepoT *repo) {
pthread_attr_init
(
&
thattr
);
pthread_attr_setdetachstate
(
&
thattr
,
PTHREAD_CREATE_DETACHED
);
pthread_create
(
&
(
pRepo
->
commitThread
),
&
thattr
,
tsdbCommitData
,
(
void
*
)
repo
);
tsdbTrace
(
"vgId %d: start to commit!"
,
pRepo
->
config
.
tsdbId
);
return
0
;
}
...
...
@@ -377,11 +385,6 @@ STsdbRepoInfo *tsdbGetStatus(TsdbRepoT *pRepo) {
return
NULL
;
}
int
tsdbCreateTable
(
TsdbRepoT
*
repo
,
STableCfg
*
pCfg
)
{
STsdbRepo
*
pRepo
=
(
STsdbRepo
*
)
repo
;
return
tsdbCreateTableImpl
(
pRepo
->
tsdbMeta
,
pCfg
);
}
int
tsdbAlterTable
(
TsdbRepoT
*
pRepo
,
STableCfg
*
pCfg
)
{
// TODO
return
0
;
...
...
@@ -396,13 +399,6 @@ TSKEY tsdbGetTableLastKey(TsdbRepoT *repo, int64_t uid) {
return
TSDB_GET_TABLE_LAST_KEY
(
pTable
);
}
int
tsdbDropTable
(
TsdbRepoT
*
repo
,
STableId
tableId
)
{
if
(
repo
==
NULL
)
return
-
1
;
STsdbRepo
*
pRepo
=
(
STsdbRepo
*
)
repo
;
return
tsdbDropTableImpl
(
pRepo
->
tsdbMeta
,
tableId
);
}
STableInfo
*
tsdbGetTableInfo
(
TsdbRepoT
*
pRepo
,
STableId
tableId
)
{
// TODO
return
NULL
;
...
...
@@ -843,6 +839,9 @@ static int32_t tdInsertRowToTable(STsdbRepo *pRepo, SDataRow row, STable *pTable
pTable
->
mem
->
numOfPoints
=
tSkipListGetSize
(
pTable
->
mem
->
pData
);
tsdbTrace
(
"vgId %d, tid %d, uid "
PRId64
"a row is inserted to table! key"
PRId64
,
pRepo
->
config
.
tsdbId
,
pTable
->
tableId
.
tid
,
pTable
->
tableId
.
uid
,
dataRowKey
(
row
));
return
0
;
}
...
...
@@ -1105,11 +1104,14 @@ static int tsdbHasDataToCommit(SSkipListIterator **iters, int nIters, TSKEY minK
}
static
void
tsdbAlterCompression
(
STsdbRepo
*
pRepo
,
int8_t
compression
)
{
int8_t
oldCompRession
=
pRepo
->
config
.
compression
;
pRepo
->
config
.
compression
=
compression
;
tsdbTrace
(
"vgId %d: tsdb compression is changed from %d to %d"
,
oldCompRession
,
compression
);
}
static
void
tsdbAlterKeep
(
STsdbRepo
*
pRepo
,
int32_t
keep
)
{
STsdbCfg
*
pCfg
=
&
pRepo
->
config
;
int
oldKeep
=
pCfg
->
keep
;
int
maxFiles
=
keep
/
pCfg
->
maxTables
+
3
;
if
(
pRepo
->
config
.
keep
>
keep
)
{
...
...
@@ -1121,10 +1123,13 @@ static void tsdbAlterKeep(STsdbRepo *pRepo, int32_t keep) {
}
pRepo
->
tsdbFileH
->
maxFGroups
=
maxFiles
;
}
tsdbTrace
(
"id %d: keep is changed from %d to %d"
,
pRepo
->
config
.
tsdbId
,
oldKeep
,
keep
);
}
static
void
tsdbAlterMaxTables
(
STsdbRepo
*
pRepo
,
int32_t
maxTables
)
{
// TODO
int
oldMaxTables
=
pRepo
->
config
.
maxTables
;
tsdbTrace
(
"vgId %d: tsdb maxTables is changed from %d to %d!"
,
pRepo
->
config
.
tsdbId
,
oldMaxTables
,
maxTables
);
}
uint32_t
tsdbGetFileInfo
(
TsdbRepoT
*
repo
,
char
*
name
,
uint32_t
*
index
,
int32_t
*
size
)
{
...
...
src/tsdb/src/tsdbMeta.c
浏览文件 @
4480dc44
...
...
@@ -283,7 +283,10 @@ char* tsdbGetTableName(TsdbRepoT *repo, const STableId* id, int16_t* bytes) {
}
}
int32_t
tsdbCreateTableImpl
(
STsdbMeta
*
pMeta
,
STableCfg
*
pCfg
)
{
int
tsdbCreateTable
(
TsdbRepoT
*
repo
,
STableCfg
*
pCfg
)
{
STsdbRepo
*
pRepo
=
(
STsdbRepo
*
)
repo
;
STsdbMeta
*
pMeta
=
pRepo
->
tsdbMeta
;
if
(
tsdbCheckTableCfg
(
pCfg
)
<
0
)
return
-
1
;
STable
*
super
=
NULL
;
...
...
@@ -351,8 +354,14 @@ int32_t tsdbCreateTableImpl(STsdbMeta *pMeta, STableCfg *pCfg) {
}
// Register to meta
if
(
newSuper
)
tsdbAddTableToMeta
(
pMeta
,
super
,
true
);
if
(
newSuper
)
{
tsdbAddTableToMeta
(
pMeta
,
super
,
true
);
tsdbTrace
(
"vgId %d: super table is created! uid "
PRId64
,
pRepo
->
config
.
tsdbId
,
super
->
tableId
.
uid
);
}
tsdbAddTableToMeta
(
pMeta
,
table
,
true
);
tsdbTrace
(
"vgId %d: table is created! tid %d, uid "
PRId64
,
pRepo
->
config
.
tsdbId
,
super
->
tableId
.
tid
,
super
->
tableId
.
uid
);
// Write to meta file
int
bufLen
=
0
;
...
...
@@ -385,13 +394,24 @@ STable *tsdbIsValidTableToInsert(STsdbMeta *pMeta, STableId tableId) {
return
pTable
;
}
int32_t
tsdbDropTableImpl
(
STsdbMeta
*
pMeta
,
STableId
tableId
)
{
// int32_t tsdbDropTableImpl(STsdbMeta *pMeta, STableId tableId) {
int
tsdbDropTable
(
TsdbRepoT
*
repo
,
STableId
tableId
)
{
STsdbRepo
*
pRepo
=
(
STsdbRepo
*
)
repo
;
if
(
pRepo
==
NULL
)
return
-
1
;
STsdbMeta
*
pMeta
=
pRepo
->
tsdbMeta
;
if
(
pMeta
==
NULL
)
return
-
1
;
STable
*
pTable
=
tsdbGetTableByUid
(
pMeta
,
tableId
.
uid
);
if
(
pTable
==
NULL
)
return
-
1
;
if
(
pTable
==
NULL
)
{
tsdbError
(
"vgId %d: failed to drop table since table not exists! tid %d, uid "
PRId64
,
pRepo
->
config
.
tsdbId
,
tableId
.
tid
,
tableId
.
uid
);
return
-
1
;
}
tsdbTrace
(
"vgId %d: table is dropped! tid %s, uid "
PRId64
,
pRepo
->
config
.
tsdbId
,
tableId
.
tid
,
tableId
.
uid
);
if
(
tsdbRemoveTableFromMeta
(
pMeta
,
pTable
)
<
0
)
return
-
1
;
return
0
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录