Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
84d49718
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
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看板
提交
84d49718
编写于
5月 21, 2020
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-374] update code while alter database maxTables
上级
d79aff09
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
42 addition
and
14 deletion
+42
-14
src/mnode/inc/mgmtVgroup.h
src/mnode/inc/mgmtVgroup.h
+1
-0
src/mnode/src/mgmtDb.c
src/mnode/src/mgmtDb.c
+1
-0
src/mnode/src/mgmtVgroup.c
src/mnode/src/mgmtVgroup.c
+37
-11
tests/script/general/db/alter_tables_v1.sim
tests/script/general/db/alter_tables_v1.sim
+3
-3
未找到文件。
src/mnode/inc/mgmtVgroup.h
浏览文件 @
84d49718
...
...
@@ -29,6 +29,7 @@ void mgmtIncVgroupRef(SVgObj *pVgroup);
void
mgmtDecVgroupRef
(
SVgObj
*
pVgroup
);
void
mgmtDropAllDbVgroups
(
SDbObj
*
pDropDb
,
bool
sendMsg
);
void
mgmtDropAllDnodeVgroups
(
SDnodeObj
*
pDropDnode
);
void
mgmtUpdateAllDbVgroups
(
SDbObj
*
pAlterDb
);
void
*
mgmtGetNextVgroup
(
void
*
pIter
,
SVgObj
**
pVgroup
);
void
mgmtUpdateVgroup
(
SVgObj
*
pVgroup
);
...
...
src/mnode/src/mgmtDb.c
浏览文件 @
84d49718
...
...
@@ -96,6 +96,7 @@ static int32_t mgmtDbActionUpdate(SSdbOper *pOper) {
memcpy
(
pSaved
,
pDb
,
pOper
->
rowSize
);
free
(
pDb
);
}
mgmtUpdateAllDbVgroups
(
pSaved
);
mgmtDecDbRef
(
pSaved
);
return
TSDB_CODE_SUCCESS
;
}
...
...
src/mnode/src/mgmtVgroup.c
浏览文件 @
84d49718
...
...
@@ -121,6 +121,19 @@ static int32_t mgmtVgroupActionDelete(SSdbOper *pOper) {
return
TSDB_CODE_SUCCESS
;
}
static
void
mgmtVgroupUpdateIdPool
(
SVgObj
*
pVgroup
)
{
int32_t
oldTables
=
taosIdPoolMaxSize
(
pVgroup
->
idPool
);
SDbObj
*
pDb
=
pVgroup
->
pDb
;
if
(
pDb
!=
NULL
)
{
if
(
pDb
->
cfg
.
maxTables
!=
oldTables
)
{
mPrint
(
"vgId:%d tables change from %d to %d"
,
pVgroup
->
vgId
,
oldTables
,
pDb
->
cfg
.
maxTables
);
taosUpdateIdPool
(
pVgroup
->
idPool
,
pDb
->
cfg
.
maxTables
);
int32_t
size
=
sizeof
(
SChildTableObj
*
)
*
pDb
->
cfg
.
maxTables
;
pVgroup
->
tableList
=
(
SChildTableObj
**
)
realloc
(
pVgroup
->
tableList
,
size
);
}
}
}
static
int32_t
mgmtVgroupActionUpdate
(
SSdbOper
*
pOper
)
{
SVgObj
*
pNew
=
pOper
->
pObj
;
SVgObj
*
pVgroup
=
mgmtGetVgroup
(
pNew
->
vgId
);
...
...
@@ -146,20 +159,11 @@ static int32_t mgmtVgroupActionUpdate(SSdbOper *pOper) {
}
}
int32_t
oldTables
=
taosIdPoolMaxSize
(
pVgroup
->
idPool
);
SDbObj
*
pDb
=
pVgroup
->
pDb
;
if
(
pDb
!=
NULL
)
{
if
(
pDb
->
cfg
.
maxTables
!=
oldTables
)
{
mPrint
(
"vgId:%d tables change from %d to %d"
,
pVgroup
->
vgId
,
oldTables
,
pDb
->
cfg
.
maxTables
);
taosUpdateIdPool
(
pVgroup
->
idPool
,
pDb
->
cfg
.
maxTables
);
int32_t
size
=
sizeof
(
SChildTableObj
*
)
*
pDb
->
cfg
.
maxTables
;
pVgroup
->
tableList
=
(
SChildTableObj
**
)
realloc
(
pVgroup
->
tableList
,
size
);
}
}
mgmtVgroupUpdateIdPool
(
pVgroup
);
mgmtDecVgroupRef
(
pVgroup
);
mTrace
(
"vgId:%d, is updated, numOfVnode:%d
tables:%d"
,
pVgroup
->
vgId
,
pVgroup
->
numOfVnodes
,
pDb
==
NULL
?
0
:
pDb
->
cfg
.
maxTabl
es
);
mTrace
(
"vgId:%d, is updated, numOfVnode:%d
"
,
pVgroup
->
vgId
,
pVgroup
->
numOfVnod
es
);
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -762,6 +766,28 @@ void mgmtDropAllDnodeVgroups(SDnodeObj *pDropDnode) {
sdbFreeIter
(
pIter
);
}
void
mgmtUpdateAllDbVgroups
(
SDbObj
*
pAlterDb
)
{
void
*
pIter
=
NULL
;
SVgObj
*
pVgroup
=
NULL
;
mPrint
(
"db:%s, all vgroups will be update in sdb"
,
pAlterDb
->
name
);
while
(
1
)
{
pIter
=
mgmtGetNextVgroup
(
pIter
,
&
pVgroup
);
if
(
pVgroup
==
NULL
)
break
;
if
(
pVgroup
->
pDb
==
pAlterDb
)
{
mgmtVgroupUpdateIdPool
(
pVgroup
);
}
mgmtDecVgroupRef
(
pVgroup
);
}
sdbFreeIter
(
pIter
);
mPrint
(
"db:%s, all vgroups is updated in sdb"
,
pAlterDb
->
name
);
}
void
mgmtDropAllDbVgroups
(
SDbObj
*
pDropDb
,
bool
sendMsg
)
{
void
*
pIter
=
NULL
;
int32_t
numOfVgroups
=
0
;
...
...
tests/script/general/db/alter_tables.sim
→
tests/script/general/db/alter_tables
_v1
.sim
浏览文件 @
84d49718
...
...
@@ -49,7 +49,7 @@ endi
print ============================ step3
sql
create
database db maxTables 20
sql
alter
database db maxTables 20
sleep 1000
sql create table db.t10 using db.st tags(0)
...
...
@@ -87,7 +87,7 @@ endi
print ============================ step5
sql
create
database db maxTables 30
sql
alter
database db maxTables 30
sleep 1000
sql create table db.t20 using db.st tags(0)
...
...
@@ -185,7 +185,7 @@ endi
print ============================ step9
sql
create
database db maxTables 40
sql
alter
database db maxTables 40
sleep 1000
sql create table db.t30 using db.st tags(0)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录