Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
81e83ee4
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22017
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看板
提交
81e83ee4
编写于
12月 16, 2021
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TD-10431 change hash range
上级
f496b324
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
39 addition
and
16 deletion
+39
-16
include/common/taosmsg.h
include/common/taosmsg.h
+2
-2
source/dnode/mgmt/impl/test/db/db.cpp
source/dnode/mgmt/impl/test/db/db.cpp
+3
-3
source/dnode/mgmt/impl/test/dnode/dnode.cpp
source/dnode/mgmt/impl/test/dnode/dnode.cpp
+1
-1
source/dnode/mnode/impl/inc/mndDef.h
source/dnode/mnode/impl/inc/mndDef.h
+3
-2
source/dnode/mnode/impl/src/mndDb.c
source/dnode/mnode/impl/src/mndDb.c
+18
-0
source/dnode/mnode/impl/src/mndStb.c
source/dnode/mnode/impl/src/mndStb.c
+6
-2
source/dnode/mnode/impl/src/mndVgroup.c
source/dnode/mnode/impl/src/mndVgroup.c
+6
-6
未找到文件。
include/common/taosmsg.h
浏览文件 @
81e83ee4
...
...
@@ -807,8 +807,8 @@ typedef struct SSTableVgroupMsg {
typedef
struct
SVgroupInfo
{
int32_t
vgId
;
int32_t
hashBegin
;
int32_t
hashEnd
;
uint32_t
hashBegin
;
uint32_t
hashEnd
;
int8_t
inUse
;
int8_t
numOfEps
;
SEpAddrMsg
epAddr
[
TSDB_MAX_REPLICA
];
...
...
source/dnode/mgmt/impl/test/db/db.cpp
浏览文件 @
81e83ee4
...
...
@@ -436,7 +436,7 @@ TEST_F(DndTestDb, 03_Create_Use_Restart_Use_Db) {
pInfo
->
hashEnd
=
htonl
(
pInfo
->
hashEnd
);
EXPECT_GT
(
pInfo
->
vgId
,
0
);
EXPECT_EQ
(
pInfo
->
hashBegin
,
0
);
EXPECT_EQ
(
pInfo
->
hashEnd
,
INT32_MAX
/
2
-
1
);
EXPECT_EQ
(
pInfo
->
hashEnd
,
U
INT32_MAX
/
2
-
1
);
EXPECT_EQ
(
pInfo
->
inUse
,
0
);
EXPECT_EQ
(
pInfo
->
numOfEps
,
1
);
SEpAddrMsg
*
pAddr
=
&
pInfo
->
epAddr
[
0
];
...
...
@@ -451,8 +451,8 @@ TEST_F(DndTestDb, 03_Create_Use_Restart_Use_Db) {
pInfo
->
hashBegin
=
htonl
(
pInfo
->
hashBegin
);
pInfo
->
hashEnd
=
htonl
(
pInfo
->
hashEnd
);
EXPECT_GT
(
pInfo
->
vgId
,
0
);
EXPECT_EQ
(
pInfo
->
hashBegin
,
INT32_MAX
/
2
);
EXPECT_EQ
(
pInfo
->
hashEnd
,
INT32_MAX
);
EXPECT_EQ
(
pInfo
->
hashBegin
,
U
INT32_MAX
/
2
);
EXPECT_EQ
(
pInfo
->
hashEnd
,
U
INT32_MAX
);
EXPECT_EQ
(
pInfo
->
inUse
,
0
);
EXPECT_EQ
(
pInfo
->
numOfEps
,
1
);
SEpAddrMsg
*
pAddr
=
&
pInfo
->
epAddr
[
0
];
...
...
source/dnode/mgmt/impl/test/dnode/dnode.cpp
浏览文件 @
81e83ee4
...
...
@@ -220,7 +220,7 @@ TEST_F(DndTestDnode, 02_ConfigDnode) {
ASSERT_EQ
(
pMsg
->
code
,
0
);
}
TEST_F
(
DndTestDnode
,
03
_Create_Drop_Re
at
rt_Dnode
)
{
TEST_F
(
DndTestDnode
,
03
_Create_Drop_Re
sta
rt_Dnode
)
{
{
SCreateDnodeMsg
*
pReq
=
(
SCreateDnodeMsg
*
)
rpcMallocCont
(
sizeof
(
SCreateDnodeMsg
));
strcpy
(
pReq
->
ep
,
"localhost:9042"
);
...
...
source/dnode/mnode/impl/inc/mndDef.h
浏览文件 @
81e83ee4
...
...
@@ -224,8 +224,8 @@ typedef struct {
int64_t
createdTime
;
int64_t
updateTime
;
int32_t
version
;
int32_t
hashBegin
;
int32_t
hashEnd
;
uint32_t
hashBegin
;
uint32_t
hashEnd
;
char
dbName
[
TSDB_FULL_DB_NAME_LEN
];
int64_t
dbUid
;
int32_t
numOfTables
;
...
...
@@ -244,6 +244,7 @@ typedef struct {
int64_t
createdTime
;
int64_t
updateTime
;
uint64_t
uid
;
uint64_t
dbUid
;
int32_t
version
;
int32_t
numOfColumns
;
int32_t
numOfTags
;
...
...
source/dnode/mnode/impl/src/mndDb.c
浏览文件 @
81e83ee4
...
...
@@ -283,6 +283,14 @@ static int32_t mndSetCommitLogs(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SVg
return
0
;
}
static
int32_t
mndSetRedoActions
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SDbObj
*
pDb
,
SVgObj
*
pVgroups
)
{
return
0
;
}
static
int32_t
mndSetUndoActions
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SDbObj
*
pDb
,
SVgObj
*
pVgroups
)
{
return
0
;
}
static
int32_t
mndCreateDb
(
SMnode
*
pMnode
,
SMnodeMsg
*
pMsg
,
SCreateDbMsg
*
pCreate
,
SUserObj
*
pUser
)
{
SDbObj
dbObj
=
{
0
};
tstrncpy
(
dbObj
.
name
,
pCreate
->
db
,
TSDB_FULL_DB_NAME_LEN
);
...
...
@@ -354,6 +362,16 @@ static int32_t mndCreateDb(SMnode *pMnode, SMnodeMsg *pMsg, SCreateDbMsg *pCreat
goto
CREATE_DB_OVER
;
}
if
(
mndSetRedoActions
(
pMnode
,
pTrans
,
&
dbObj
,
pVgroups
)
!=
0
)
{
mError
(
"trans:%d, failed to set redo actions since %s"
,
pTrans
->
id
,
terrstr
());
goto
CREATE_DB_OVER
;
}
if
(
mndSetUndoActions
(
pMnode
,
pTrans
,
&
dbObj
,
pVgroups
)
!=
0
)
{
mError
(
"trans:%d, failed to set redo actions since %s"
,
pTrans
->
id
,
terrstr
());
goto
CREATE_DB_OVER
;
}
if
(
mndTransPrepare
(
pMnode
,
pTrans
)
!=
0
)
{
mError
(
"trans:%d, failed to prepare since %s"
,
pTrans
->
id
,
terrstr
());
goto
CREATE_DB_OVER
;
...
...
source/dnode/mnode/impl/src/mndStb.c
浏览文件 @
81e83ee4
...
...
@@ -74,10 +74,12 @@ static SSdbRaw *mndStbActionEncode(SStbObj *pStb) {
if
(
pRaw
==
NULL
)
return
NULL
;
int32_t
dataPos
=
0
;
SDB_SET_BINARY
(
pRaw
,
dataPos
,
pStb
->
name
,
TSDB_TABLE_NAME_LEN
)
SDB_SET_BINARY
(
pRaw
,
dataPos
,
pStb
->
name
,
TSDB_TABLE_FNAME_LEN
)
SDB_SET_BINARY
(
pRaw
,
dataPos
,
pStb
->
db
,
TSDB_FULL_DB_NAME_LEN
)
SDB_SET_INT64
(
pRaw
,
dataPos
,
pStb
->
createdTime
)
SDB_SET_INT64
(
pRaw
,
dataPos
,
pStb
->
updateTime
)
SDB_SET_INT64
(
pRaw
,
dataPos
,
pStb
->
uid
)
SDB_SET_INT64
(
pRaw
,
dataPos
,
pStb
->
dbUid
)
SDB_SET_INT64
(
pRaw
,
dataPos
,
pStb
->
version
)
SDB_SET_INT32
(
pRaw
,
dataPos
,
pStb
->
numOfColumns
)
SDB_SET_INT32
(
pRaw
,
dataPos
,
pStb
->
numOfTags
)
...
...
@@ -113,10 +115,12 @@ static SSdbRow *mndStbActionDecode(SSdbRaw *pRaw) {
if
(
pStb
==
NULL
)
return
NULL
;
int32_t
dataPos
=
0
;
SDB_GET_BINARY
(
pRaw
,
pRow
,
dataPos
,
pStb
->
name
,
TSDB_TABLE_NAME_LEN
)
SDB_GET_BINARY
(
pRaw
,
pRow
,
dataPos
,
pStb
->
name
,
TSDB_TABLE_FNAME_LEN
)
SDB_GET_BINARY
(
pRaw
,
pRow
,
dataPos
,
pStb
->
db
,
TSDB_FULL_DB_NAME_LEN
)
SDB_GET_INT64
(
pRaw
,
pRow
,
dataPos
,
&
pStb
->
createdTime
)
SDB_GET_INT64
(
pRaw
,
pRow
,
dataPos
,
&
pStb
->
updateTime
)
SDB_GET_INT64
(
pRaw
,
pRow
,
dataPos
,
&
pStb
->
uid
)
SDB_GET_INT64
(
pRaw
,
pRow
,
dataPos
,
&
pStb
->
dbUid
)
SDB_GET_INT32
(
pRaw
,
pRow
,
dataPos
,
&
pStb
->
version
)
SDB_GET_INT32
(
pRaw
,
pRow
,
dataPos
,
&
pStb
->
numOfColumns
)
SDB_GET_INT32
(
pRaw
,
pRow
,
dataPos
,
&
pStb
->
numOfTags
)
...
...
source/dnode/mnode/impl/src/mndVgroup.c
浏览文件 @
81e83ee4
...
...
@@ -213,13 +213,13 @@ int32_t mndAllocVgroup(SMnode *pMnode, SDbObj *pDb, SVgObj **ppVgroups) {
return
-
1
;
}
int32_t
alloceVgroups
=
0
;
int32_t
maxVgId
=
sdbGetMaxId
(
pMnode
->
pSdb
,
SDB_VGROUP
);
int32_t
hashMin
=
0
;
int32_t
hashMax
=
INT32_MAX
;
int32_t
hashInterval
=
(
hashMax
-
hashMin
)
/
pDb
->
numOfVgroups
;
int32_t
alloceVgroups
=
0
;
int32_t
maxVgId
=
sdbGetMaxId
(
pMnode
->
pSdb
,
SDB_VGROUP
);
u
int32_t
hashMin
=
0
;
uint32_t
hashMax
=
U
INT32_MAX
;
u
int32_t
hashInterval
=
(
hashMax
-
hashMin
)
/
pDb
->
numOfVgroups
;
for
(
int32_t
v
=
0
;
v
<
pDb
->
numOfVgroups
;
v
++
)
{
for
(
u
int32_t
v
=
0
;
v
<
pDb
->
numOfVgroups
;
v
++
)
{
SVgObj
*
pVgroup
=
&
pVgroups
[
v
];
pVgroup
->
vgId
=
maxVgId
++
;
pVgroup
->
createdTime
=
taosGetTimestampMs
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录