Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
哥们要飞
TDengine
提交
c31c27a8
T
TDengine
项目概览
哥们要飞
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
1
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
c31c27a8
编写于
4月 18, 2020
作者:
H
hzcheng
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'develop' into feature/2.0tsdb
上级
a1a706e6
57f473e2
变更
8
显示空白变更内容
内联
并排
Showing
8 changed file
with
70 addition
and
3 deletion
+70
-3
src/inc/tsdb.h
src/inc/tsdb.h
+4
-0
src/mnode/src/mgmtDnode.c
src/mnode/src/mgmtDnode.c
+3
-1
src/tsdb/inc/tsdbMain.h
src/tsdb/inc/tsdbMain.h
+1
-0
src/tsdb/src/tsdbMain.c
src/tsdb/src/tsdbMain.c
+25
-0
src/tsdb/src/tsdbMeta.c
src/tsdb/src/tsdbMeta.c
+16
-1
src/vnode/src/vnodeWrite.c
src/vnode/src/vnodeWrite.c
+2
-0
src/wal/src/walMain.c
src/wal/src/walMain.c
+4
-1
tests/script/unique/mnode/basic1.sim
tests/script/unique/mnode/basic1.sim
+15
-0
未找到文件。
src/inc/tsdb.h
浏览文件 @
c31c27a8
...
...
@@ -78,8 +78,10 @@ typedef struct {
// --------- TSDB TABLE configuration
typedef
struct
{
ETableType
type
;
char
*
name
;
STableId
tableId
;
int32_t
sversion
;
char
*
sname
;
// super table name
int64_t
superUid
;
STSchema
*
schema
;
STSchema
*
tagSchema
;
...
...
@@ -91,6 +93,8 @@ int tsdbTableSetSuperUid(STableCfg *config, int64_t uid);
int
tsdbTableSetSchema
(
STableCfg
*
config
,
STSchema
*
pSchema
,
bool
dup
);
int
tsdbTableSetTagSchema
(
STableCfg
*
config
,
STSchema
*
pSchema
,
bool
dup
);
int
tsdbTableSetTagValue
(
STableCfg
*
config
,
SDataRow
row
,
bool
dup
);
int
tsdbTableSetName
(
STableCfg
*
config
,
char
*
name
,
bool
dup
);
int
tsdbTableSetSName
(
STableCfg
*
config
,
char
*
sname
,
bool
dup
);
void
tsdbClearTableCfg
(
STableCfg
*
config
);
int32_t
tsdbGetTableTagVal
(
tsdb_repo_t
*
repo
,
STableId
id
,
int32_t
col
,
int16_t
*
type
,
int16_t
*
bytes
,
char
**
val
);
...
...
src/mnode/src/mgmtDnode.c
浏览文件 @
c31c27a8
...
...
@@ -402,8 +402,10 @@ static int32_t mgmtCreateDnode(uint32_t ip) {
int32_t
code
=
sdbInsertRow
(
&
oper
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
int
dnodeId
=
pDnode
->
dnodeId
;
tfree
(
pDnode
);
code
=
TSDB_CODE_SDB_ERROR
;
mError
(
"failed to create dnode:%d, result:%s"
,
dnodeId
,
tstrerror
(
code
));
return
TSDB_CODE_SDB_ERROR
;
}
mPrint
(
"dnode:%d is created, result:%s"
,
pDnode
->
dnodeId
,
tstrerror
(
code
));
...
...
src/tsdb/inc/tsdbMain.h
浏览文件 @
c31c27a8
...
...
@@ -62,6 +62,7 @@ typedef struct {
// ---------- TSDB TABLE DEFINITION
typedef
struct
STable
{
int8_t
type
;
char
*
name
;
STableId
tableId
;
int64_t
superUid
;
// Super table UID
int32_t
sversion
;
...
...
src/tsdb/src/tsdbMain.c
浏览文件 @
c31c27a8
...
...
@@ -462,10 +462,35 @@ int tsdbTableSetTagValue(STableCfg *config, SDataRow row, bool dup) {
return
0
;
}
int
tsdbTableSetName
(
STableCfg
*
config
,
char
*
name
,
bool
dup
)
{
if
(
dup
)
{
config
->
name
=
strdup
(
name
);
if
(
config
->
name
==
NULL
)
return
-
1
;
}
else
{
config
->
name
=
name
;
}
return
0
;
}
int
tsdbTableSetSName
(
STableCfg
*
config
,
char
*
sname
,
bool
dup
)
{
if
(
config
->
type
!=
TSDB_CHILD_TABLE
)
return
-
1
;
if
(
dup
)
{
config
->
sname
=
strdup
(
sname
);
if
(
config
->
sname
==
NULL
)
return
-
1
;
}
else
{
config
->
sname
=
sname
;
}
return
0
;
}
void
tsdbClearTableCfg
(
STableCfg
*
config
)
{
if
(
config
->
schema
)
tdFreeSchema
(
config
->
schema
);
if
(
config
->
tagSchema
)
tdFreeSchema
(
config
->
tagSchema
);
if
(
config
->
tagValues
)
tdFreeDataRow
(
config
->
tagValues
);
tfree
(
config
->
name
);
tfree
(
config
->
sname
);
}
int
tsdbInitSubmitBlkIter
(
SSubmitBlk
*
pBlock
,
SSubmitBlkIter
*
pIter
)
{
...
...
src/tsdb/src/tsdbMeta.c
浏览文件 @
c31c27a8
...
...
@@ -39,6 +39,11 @@ void *tsdbEncodeTable(STable *pTable, int *contLen) {
void
*
ptr
=
ret
;
T_APPEND_MEMBER
(
ptr
,
pTable
,
STable
,
type
);
// Encode name
*
(
int
*
)
ptr
=
strlen
(
pTable
->
name
);
ptr
=
(
char
*
)
ptr
+
sizeof
(
int
);
memcpy
(
ptr
,
pTable
->
name
,
strlen
(
pTable
->
name
));
ptr
=
(
char
*
)
ptr
+
strlen
(
pTable
->
name
);
T_APPEND_MEMBER
(
ptr
,
&
(
pTable
->
tableId
),
STableId
,
uid
);
T_APPEND_MEMBER
(
ptr
,
&
(
pTable
->
tableId
),
STableId
,
tid
);
T_APPEND_MEMBER
(
ptr
,
pTable
,
STable
,
superUid
);
...
...
@@ -72,6 +77,12 @@ STable *tsdbDecodeTable(void *cont, int contLen) {
void
*
ptr
=
cont
;
T_READ_MEMBER
(
ptr
,
int8_t
,
pTable
->
type
);
int
len
=
*
(
int
*
)
ptr
;
ptr
=
(
char
*
)
ptr
+
sizeof
(
int
);
pTable
->
name
=
calloc
(
1
,
len
+
1
);
if
(
pTable
->
name
==
NULL
)
return
NULL
;
memcpy
(
pTable
->
name
,
ptr
,
len
);
ptr
=
(
char
*
)
ptr
+
len
;
T_READ_MEMBER
(
ptr
,
int64_t
,
pTable
->
tableId
.
uid
);
T_READ_MEMBER
(
ptr
,
int32_t
,
pTable
->
tableId
.
tid
);
T_READ_MEMBER
(
ptr
,
int64_t
,
pTable
->
superUid
);
...
...
@@ -252,6 +263,7 @@ int32_t tsdbCreateTableImpl(STsdbMeta *pMeta, STableCfg *pCfg) {
super
->
schema
=
tdDupSchema
(
pCfg
->
schema
);
super
->
tagSchema
=
tdDupSchema
(
pCfg
->
tagSchema
);
super
->
tagVal
=
tdDataRowDup
(
pCfg
->
tagValues
);
super
->
name
=
strdup
(
pCfg
->
sname
);
// index the first tag column
STColumn
*
pColSchema
=
schemaColAt
(
super
->
tagSchema
,
0
);
...
...
@@ -277,6 +289,7 @@ int32_t tsdbCreateTableImpl(STsdbMeta *pMeta, STableCfg *pCfg) {
}
table
->
tableId
=
pCfg
->
tableId
;
table
->
name
=
strdup
(
pCfg
->
name
);
if
(
IS_CREATE_STABLE
(
pCfg
))
{
// TSDB_CHILD_TABLE
table
->
type
=
TSDB_CHILD_TABLE
;
table
->
superUid
=
pCfg
->
superUid
;
...
...
@@ -374,6 +387,7 @@ static int tsdbFreeTable(STable *pTable) {
tsdbFreeMemTable
(
pTable
->
mem
);
tsdbFreeMemTable
(
pTable
->
imem
);
tfree
(
pTable
->
name
);
free
(
pTable
);
return
0
;
}
...
...
@@ -468,6 +482,7 @@ static int tsdbRemoveTableFromIndex(STsdbMeta *pMeta, STable *pTable) {
static
int
tsdbEstimateTableEncodeSize
(
STable
*
pTable
)
{
int
size
=
0
;
size
+=
T_MEMBER_SIZE
(
STable
,
type
);
size
+=
sizeof
(
int
)
+
strlen
(
pTable
->
name
);
size
+=
T_MEMBER_SIZE
(
STable
,
tableId
);
size
+=
T_MEMBER_SIZE
(
STable
,
superUid
);
size
+=
T_MEMBER_SIZE
(
STable
,
sversion
);
...
...
src/vnode/src/vnodeWrite.c
浏览文件 @
c31c27a8
...
...
@@ -126,6 +126,7 @@ static int32_t vnodeProcessCreateTableMsg(SVnodeObj *pVnode, void *pCont, SRspRe
tdSchemaAppendCol
(
pDestSchema
,
pSchema
[
i
].
type
,
htons
(
pSchema
[
i
].
colId
),
htons
(
pSchema
[
i
].
bytes
));
}
tsdbTableSetSchema
(
&
tCfg
,
pDestSchema
,
false
);
tsdbTableSetName
(
&
tCfg
,
pTable
->
tableId
,
false
);
if
(
numOfTags
!=
0
)
{
STSchema
*
pDestTagSchema
=
tdNewSchema
(
numOfTags
);
...
...
@@ -133,6 +134,7 @@ static int32_t vnodeProcessCreateTableMsg(SVnodeObj *pVnode, void *pCont, SRspRe
tdSchemaAppendCol
(
pDestTagSchema
,
pSchema
[
i
].
type
,
htons
(
pSchema
[
i
].
colId
),
htons
(
pSchema
[
i
].
bytes
));
}
tsdbTableSetTagSchema
(
&
tCfg
,
pDestTagSchema
,
false
);
tsdbTableSetSName
(
&
tCfg
,
pTable
->
superTableId
,
false
);
char
*
pTagData
=
pTable
->
data
+
totalCols
*
sizeof
(
SSchema
);
int
accumBytes
=
0
;
...
...
src/wal/src/walMain.c
浏览文件 @
c31c27a8
...
...
@@ -208,7 +208,10 @@ int walRestore(void *handle, void *pVnode, int (*writeFp)(void *, void *, int))
}
}
if
(
count
==
0
)
return
0
;
if
(
count
==
0
)
{
if
(
pWal
->
keep
)
code
=
walRenew
(
pWal
);
return
code
;
}
if
(
count
!=
(
maxId
-
minId
+
1
)
)
{
wError
(
"wal:%s, messed up, count:%d max:%d min:%d"
,
opath
,
count
,
maxId
,
minId
);
...
...
tests/script/unique/mnode/basic1.sim
0 → 100644
浏览文件 @
c31c27a8
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -m 192.168.0.1 -i 192.168.0.1
system sh/deploy.sh -n dnode2 -m 192.168.0.1 -i 192.168.0.2
system sh/deploy.sh -n dnode3 -m 192.168.0.1 -i 192.168.0.3
system sh/cfg.sh -n dnode1 -c numOfMPeers -v 3
system sh/cfg.sh -n dnode2 -c numOfMPeers -v 3
system sh/cfg.sh -n dnode3 -c numOfMPeers -v 3
system sh/exec_up.sh -n dnode1 -s start
system sh/exec_up.sh -n dnode2 -s start
sql connect
sleep 2000
sql create dnode 192.168.0.2
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录