Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
68c7fc49
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看板
提交
68c7fc49
编写于
6月 08, 2021
作者:
L
lichuang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-3963]alter db rpc return when vnode response
上级
cd549303
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
75 addition
and
24 deletion
+75
-24
src/dnode/src/dnodeVMgmt.c
src/dnode/src/dnodeVMgmt.c
+0
-1
src/mnode/inc/mnodeVgroup.h
src/mnode/inc/mnodeVgroup.h
+1
-1
src/mnode/src/mnodeDb.c
src/mnode/src/mnodeDb.c
+46
-8
src/mnode/src/mnodeVgroup.c
src/mnode/src/mnodeVgroup.c
+26
-12
tests/pytest/alter/alter_keep.py
tests/pytest/alter/alter_keep.py
+2
-2
未找到文件。
src/dnode/src/dnodeVMgmt.c
浏览文件 @
68c7fc49
...
@@ -154,7 +154,6 @@ static SCreateVnodeMsg* dnodeParseVnodeMsg(SRpcMsg *rpcMsg) {
...
@@ -154,7 +154,6 @@ static SCreateVnodeMsg* dnodeParseVnodeMsg(SRpcMsg *rpcMsg) {
static
int32_t
dnodeProcessCreateVnodeMsg
(
SRpcMsg
*
rpcMsg
)
{
static
int32_t
dnodeProcessCreateVnodeMsg
(
SRpcMsg
*
rpcMsg
)
{
SCreateVnodeMsg
*
pCreate
=
dnodeParseVnodeMsg
(
rpcMsg
);
SCreateVnodeMsg
*
pCreate
=
dnodeParseVnodeMsg
(
rpcMsg
);
void
*
pVnode
=
vnodeAcquire
(
pCreate
->
cfg
.
vgId
);
void
*
pVnode
=
vnodeAcquire
(
pCreate
->
cfg
.
vgId
);
if
(
pVnode
!=
NULL
)
{
if
(
pVnode
!=
NULL
)
{
dDebug
(
"vgId:%d, already exist, return success"
,
pCreate
->
cfg
.
vgId
);
dDebug
(
"vgId:%d, already exist, return success"
,
pCreate
->
cfg
.
vgId
);
...
...
src/mnode/inc/mnodeVgroup.h
浏览文件 @
68c7fc49
...
@@ -49,7 +49,7 @@ int32_t mnodeAddTableIntoVgroup(SVgObj *pVgroup, SCTableObj *pTable, bool needCh
...
@@ -49,7 +49,7 @@ int32_t mnodeAddTableIntoVgroup(SVgObj *pVgroup, SCTableObj *pTable, bool needCh
void
mnodeRemoveTableFromVgroup
(
SVgObj
*
pVgroup
,
SCTableObj
*
pTable
);
void
mnodeRemoveTableFromVgroup
(
SVgObj
*
pVgroup
,
SCTableObj
*
pTable
);
void
mnodeSendDropVnodeMsg
(
int32_t
vgId
,
SRpcEpSet
*
epSet
,
void
*
ahandle
);
void
mnodeSendDropVnodeMsg
(
int32_t
vgId
,
SRpcEpSet
*
epSet
,
void
*
ahandle
);
void
mnodeSendCreateVgroupMsg
(
SVgObj
*
pVgroup
,
void
*
ahandle
);
void
mnodeSendCreateVgroupMsg
(
SVgObj
*
pVgroup
,
void
*
ahandle
);
void
mnodeSendAlterVgroupMsg
(
SVgObj
*
pVgroup
);
void
mnodeSendAlterVgroupMsg
(
SVgObj
*
pVgroup
,
SMnodeMsg
*
pMsg
);
void
mnodeSendSyncVgroupMsg
(
SVgObj
*
pVgroup
);
void
mnodeSendSyncVgroupMsg
(
SVgObj
*
pVgroup
);
SRpcEpSet
mnodeGetEpSetFromVgroup
(
SVgObj
*
pVgroup
);
SRpcEpSet
mnodeGetEpSetFromVgroup
(
SVgObj
*
pVgroup
);
...
...
src/mnode/src/mnodeDb.c
浏览文件 @
68c7fc49
...
@@ -24,12 +24,14 @@
...
@@ -24,12 +24,14 @@
#include "tdataformat.h"
#include "tdataformat.h"
#include "tp.h"
#include "tp.h"
#include "mnode.h"
#include "mnode.h"
#include "dnode.h"
#include "mnodeDef.h"
#include "mnodeDef.h"
#include "mnodeInt.h"
#include "mnodeInt.h"
#include "mnodeAcct.h"
#include "mnodeAcct.h"
#include "mnodeDb.h"
#include "mnodeDb.h"
#include "mnodeDnode.h"
#include "mnodeDnode.h"
#include "mnodeMnode.h"
#include "mnodeMnode.h"
#include "mnodePeer.h"
#include "mnodeProfile.h"
#include "mnodeProfile.h"
#include "mnodeWrite.h"
#include "mnodeWrite.h"
#include "mnodeSdb.h"
#include "mnodeSdb.h"
...
@@ -43,6 +45,8 @@ int64_t tsDbRid = -1;
...
@@ -43,6 +45,8 @@ int64_t tsDbRid = -1;
void
*
tsDbSdb
=
NULL
;
void
*
tsDbSdb
=
NULL
;
static
int32_t
tsDbUpdateSize
;
static
int32_t
tsDbUpdateSize
;
#define ALTER_CDB_RETRY_TIMES 3
static
int32_t
mnodeCreateDb
(
SAcctObj
*
pAcct
,
SCreateDbMsg
*
pCreate
,
SMnodeMsg
*
pMsg
);
static
int32_t
mnodeCreateDb
(
SAcctObj
*
pAcct
,
SCreateDbMsg
*
pCreate
,
SMnodeMsg
*
pMsg
);
static
int32_t
mnodeDropDb
(
SMnodeMsg
*
newMsg
);
static
int32_t
mnodeDropDb
(
SMnodeMsg
*
newMsg
);
static
int32_t
mnodeSetDbDropping
(
SDbObj
*
pDb
);
static
int32_t
mnodeSetDbDropping
(
SDbObj
*
pDb
);
...
@@ -51,6 +55,7 @@ static int32_t mnodeRetrieveDbs(SShowObj *pShow, char *data, int32_t rows, void
...
@@ -51,6 +55,7 @@ static int32_t mnodeRetrieveDbs(SShowObj *pShow, char *data, int32_t rows, void
static
int32_t
mnodeProcessCreateDbMsg
(
SMnodeMsg
*
pMsg
);
static
int32_t
mnodeProcessCreateDbMsg
(
SMnodeMsg
*
pMsg
);
static
int32_t
mnodeProcessDropDbMsg
(
SMnodeMsg
*
pMsg
);
static
int32_t
mnodeProcessDropDbMsg
(
SMnodeMsg
*
pMsg
);
static
int32_t
mnodeProcessSyncDbMsg
(
SMnodeMsg
*
pMsg
);
static
int32_t
mnodeProcessSyncDbMsg
(
SMnodeMsg
*
pMsg
);
static
void
mnodeProcessAlterDbRsp
(
SRpcMsg
*
rpcMsg
);
int32_t
mnodeProcessAlterDbMsg
(
SMnodeMsg
*
pMsg
);
int32_t
mnodeProcessAlterDbMsg
(
SMnodeMsg
*
pMsg
);
#ifndef _TOPIC
#ifndef _TOPIC
...
@@ -198,6 +203,7 @@ int32_t mnodeInitDbs() {
...
@@ -198,6 +203,7 @@ int32_t mnodeInitDbs() {
mnodeAddWriteMsgHandle
(
TSDB_MSG_TYPE_CM_ALTER_DB
,
mnodeProcessAlterDbMsg
);
mnodeAddWriteMsgHandle
(
TSDB_MSG_TYPE_CM_ALTER_DB
,
mnodeProcessAlterDbMsg
);
mnodeAddWriteMsgHandle
(
TSDB_MSG_TYPE_CM_DROP_DB
,
mnodeProcessDropDbMsg
);
mnodeAddWriteMsgHandle
(
TSDB_MSG_TYPE_CM_DROP_DB
,
mnodeProcessDropDbMsg
);
mnodeAddWriteMsgHandle
(
TSDB_MSG_TYPE_CM_SYNC_DB
,
mnodeProcessSyncDbMsg
);
mnodeAddWriteMsgHandle
(
TSDB_MSG_TYPE_CM_SYNC_DB
,
mnodeProcessSyncDbMsg
);
mnodeAddPeerRspHandle
(
TSDB_MSG_TYPE_CM_ALTER_DB_RSP
,
mnodeProcessAlterDbRsp
);
mnodeAddShowMetaHandle
(
TSDB_MGMT_TABLE_DB
,
mnodeGetDbMeta
);
mnodeAddShowMetaHandle
(
TSDB_MGMT_TABLE_DB
,
mnodeGetDbMeta
);
mnodeAddShowRetrieveHandle
(
TSDB_MGMT_TABLE_DB
,
mnodeRetrieveDbs
);
mnodeAddShowRetrieveHandle
(
TSDB_MGMT_TABLE_DB
,
mnodeRetrieveDbs
);
mnodeAddShowFreeIterHandle
(
TSDB_MGMT_TABLE_DB
,
mnodeCancelGetNextDb
);
mnodeAddShowFreeIterHandle
(
TSDB_MGMT_TABLE_DB
,
mnodeCancelGetNextDb
);
...
@@ -1070,8 +1076,7 @@ static SDbCfg mnodeGetAlterDbOption(SDbObj *pDb, SAlterDbMsg *pAlter) {
...
@@ -1070,8 +1076,7 @@ static SDbCfg mnodeGetAlterDbOption(SDbObj *pDb, SAlterDbMsg *pAlter) {
return
newCfg
;
return
newCfg
;
}
}
static
int32_t
mnodeAlterDbCb
(
SMnodeMsg
*
pMsg
,
int32_t
code
)
{
static
int32_t
mnodeAlterDbFp
(
SMnodeMsg
*
pMsg
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
return
code
;
SDbObj
*
pDb
=
pMsg
->
pDb
;
SDbObj
*
pDb
=
pMsg
->
pDb
;
void
*
pIter
=
NULL
;
void
*
pIter
=
NULL
;
...
@@ -1080,17 +1085,21 @@ static int32_t mnodeAlterDbCb(SMnodeMsg *pMsg, int32_t code) {
...
@@ -1080,17 +1085,21 @@ static int32_t mnodeAlterDbCb(SMnodeMsg *pMsg, int32_t code) {
pIter
=
mnodeGetNextVgroup
(
pIter
,
&
pVgroup
);
pIter
=
mnodeGetNextVgroup
(
pIter
,
&
pVgroup
);
if
(
pVgroup
==
NULL
)
break
;
if
(
pVgroup
==
NULL
)
break
;
if
(
pVgroup
->
pDb
==
pDb
)
{
if
(
pVgroup
->
pDb
==
pDb
)
{
mnodeSendAlterVgroupMsg
(
pVgroup
);
mnodeSendAlterVgroupMsg
(
pVgroup
,
pMsg
);
pMsg
->
expected
+=
1
;
}
}
mnodeDecVgroupRef
(
pVgroup
);
mnodeDecVgroupRef
(
pVgroup
);
}
}
// in case there is no vnode(no db in vnode)
if
(
pMsg
->
expected
==
0
)
{
return
TSDB_CODE_SUCCESS
;
}
mDebug
(
"db:%s, all vgroups is altered"
,
pDb
->
name
);
mDebug
(
"db:%s, all vgroups is altered"
,
pDb
->
name
);
mLInfo
(
"db:%s, is alterd by %s"
,
pDb
->
name
,
mnodeGetUserFromMsg
(
pMsg
));
mLInfo
(
"db:%s, is alterd by %s"
,
pDb
->
name
,
mnodeGetUserFromMsg
(
pMsg
));
bnNotify
();
//
bnNotify();
return
TSDB_CODE_
SUCC
ESS
;
return
TSDB_CODE_
MND_ACTION_IN_PROGR
ESS
;
}
}
static
int32_t
mnodeAlterDb
(
SDbObj
*
pDb
,
SAlterDbMsg
*
pAlter
,
void
*
pMsg
)
{
static
int32_t
mnodeAlterDb
(
SDbObj
*
pDb
,
SAlterDbMsg
*
pAlter
,
void
*
pMsg
)
{
...
@@ -1114,7 +1123,7 @@ static int32_t mnodeAlterDb(SDbObj *pDb, SAlterDbMsg *pAlter, void *pMsg) {
...
@@ -1114,7 +1123,7 @@ static int32_t mnodeAlterDb(SDbObj *pDb, SAlterDbMsg *pAlter, void *pMsg) {
.
pTable
=
tsDbSdb
,
.
pTable
=
tsDbSdb
,
.
pObj
=
pDb
,
.
pObj
=
pDb
,
.
pMsg
=
pMsg
,
.
pMsg
=
pMsg
,
.
fpR
sp
=
mnodeAlterDbCb
.
fpR
eq
=
mnodeAlterDbFp
};
};
code
=
sdbUpdateRow
(
&
row
);
code
=
sdbUpdateRow
(
&
row
);
...
@@ -1279,6 +1288,35 @@ void mnodeDropAllDbs(SAcctObj *pAcct) {
...
@@ -1279,6 +1288,35 @@ void mnodeDropAllDbs(SAcctObj *pAcct) {
mInfo
(
"acct:%s, all dbs:%d is dropped from sdb"
,
pAcct
->
user
,
numOfDbs
);
mInfo
(
"acct:%s, all dbs:%d is dropped from sdb"
,
pAcct
->
user
,
numOfDbs
);
}
}
static
void
mnodeProcessAlterDbRsp
(
SRpcMsg
*
rpcMsg
)
{
if
(
rpcMsg
->
ahandle
==
NULL
)
return
;
SMnodeMsg
*
pMsg
=
rpcMsg
->
ahandle
;
pMsg
->
received
++
;
SDbObj
*
pDb
=
(
SDbObj
*
)
pMsg
->
pDb
;
assert
(
pDb
);
if
(
rpcMsg
->
code
==
TSDB_CODE_SUCCESS
)
{
mDebug
(
"msg:%p, app:%p db:%s, altered in dnode, thandle:%p result:%s"
,
pMsg
,
pMsg
->
rpcMsg
.
ahandle
,
pDb
->
name
,
pMsg
->
rpcMsg
.
handle
,
tstrerror
(
rpcMsg
->
code
));
dnodeSendRpcMWriteRsp
(
pMsg
,
TSDB_CODE_SUCCESS
);
}
else
{
if
(
pMsg
->
retry
++
<
ALTER_CDB_RETRY_TIMES
)
{
mDebug
(
"msg:%p, app:%p db:%s, alter table rsp received, need retry, times:%d result:%s thandle:%p"
,
pMsg
->
rpcMsg
.
ahandle
,
pMsg
,
pDb
->
name
,
pMsg
->
retry
,
tstrerror
(
rpcMsg
->
code
),
pMsg
->
rpcMsg
.
handle
);
dnodeDelayReprocessMWriteMsg
(
pMsg
);
}
else
{
mError
(
"msg:%p, app:%p db:%s, failed to alter in dnode, result:%s thandle:%p"
,
pMsg
,
pMsg
->
rpcMsg
.
ahandle
,
pDb
->
name
,
tstrerror
(
rpcMsg
->
code
),
pMsg
->
rpcMsg
.
handle
);
dnodeSendRpcMWriteRsp
(
pMsg
,
rpcMsg
->
code
);
}
}
}
int32_t
mnodeCompactDbs
()
{
int32_t
mnodeCompactDbs
()
{
void
*
pIter
=
NULL
;
void
*
pIter
=
NULL
;
SDbObj
*
pDb
=
NULL
;
SDbObj
*
pDb
=
NULL
;
...
...
src/mnode/src/mnodeVgroup.c
浏览文件 @
68c7fc49
...
@@ -60,7 +60,6 @@ static int32_t mnodeGetVgroupMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *p
...
@@ -60,7 +60,6 @@ static int32_t mnodeGetVgroupMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *p
static
int32_t
mnodeRetrieveVgroups
(
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
,
void
*
pConn
);
static
int32_t
mnodeRetrieveVgroups
(
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
,
void
*
pConn
);
static
void
mnodeProcessCreateVnodeRsp
(
SRpcMsg
*
rpcMsg
);
static
void
mnodeProcessCreateVnodeRsp
(
SRpcMsg
*
rpcMsg
);
static
void
mnodeProcessAlterVnodeRsp
(
SRpcMsg
*
rpcMsg
);
static
void
mnodeProcessAlterVnodeRsp
(
SRpcMsg
*
rpcMsg
);
static
void
mnodeProcessSyncVnodeRsp
(
SRpcMsg
*
rpcMsg
);
static
void
mnodeProcessDropVnodeRsp
(
SRpcMsg
*
rpcMsg
);
static
void
mnodeProcessDropVnodeRsp
(
SRpcMsg
*
rpcMsg
);
static
int32_t
mnodeProcessVnodeCfgMsg
(
SMnodeMsg
*
pMsg
)
;
static
int32_t
mnodeProcessVnodeCfgMsg
(
SMnodeMsg
*
pMsg
)
;
static
void
mnodeSendDropVgroupMsg
(
SVgObj
*
pVgroup
,
void
*
ahandle
);
static
void
mnodeSendDropVgroupMsg
(
SVgObj
*
pVgroup
,
void
*
ahandle
);
...
@@ -237,7 +236,6 @@ int32_t mnodeInitVgroups() {
...
@@ -237,7 +236,6 @@ int32_t mnodeInitVgroups() {
mnodeAddShowFreeIterHandle
(
TSDB_MGMT_TABLE_VGROUP
,
mnodeCancelGetNextVgroup
);
mnodeAddShowFreeIterHandle
(
TSDB_MGMT_TABLE_VGROUP
,
mnodeCancelGetNextVgroup
);
mnodeAddPeerRspHandle
(
TSDB_MSG_TYPE_MD_CREATE_VNODE_RSP
,
mnodeProcessCreateVnodeRsp
);
mnodeAddPeerRspHandle
(
TSDB_MSG_TYPE_MD_CREATE_VNODE_RSP
,
mnodeProcessCreateVnodeRsp
);
mnodeAddPeerRspHandle
(
TSDB_MSG_TYPE_MD_ALTER_VNODE_RSP
,
mnodeProcessAlterVnodeRsp
);
mnodeAddPeerRspHandle
(
TSDB_MSG_TYPE_MD_ALTER_VNODE_RSP
,
mnodeProcessAlterVnodeRsp
);
mnodeAddPeerRspHandle
(
TSDB_MSG_TYPE_MD_ALTER_VNODE_RSP
,
mnodeProcessSyncVnodeRsp
);
mnodeAddPeerRspHandle
(
TSDB_MSG_TYPE_MD_DROP_VNODE_RSP
,
mnodeProcessDropVnodeRsp
);
mnodeAddPeerRspHandle
(
TSDB_MSG_TYPE_MD_DROP_VNODE_RSP
,
mnodeProcessDropVnodeRsp
);
mnodeAddPeerMsgHandle
(
TSDB_MSG_TYPE_DM_CONFIG_VNODE
,
mnodeProcessVnodeCfgMsg
);
mnodeAddPeerMsgHandle
(
TSDB_MSG_TYPE_DM_CONFIG_VNODE
,
mnodeProcessVnodeCfgMsg
);
...
@@ -271,7 +269,7 @@ void mnodeUpdateVgroup(SVgObj *pVgroup) {
...
@@ -271,7 +269,7 @@ void mnodeUpdateVgroup(SVgObj *pVgroup) {
if
(
code
!=
TSDB_CODE_SUCCESS
&&
code
!=
TSDB_CODE_MND_ACTION_IN_PROGRESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
&&
code
!=
TSDB_CODE_MND_ACTION_IN_PROGRESS
)
{
mError
(
"vgId:%d, failed to update vgroup"
,
pVgroup
->
vgId
);
mError
(
"vgId:%d, failed to update vgroup"
,
pVgroup
->
vgId
);
}
}
mnodeSendAlterVgroupMsg
(
pVgroup
);
mnodeSendAlterVgroupMsg
(
pVgroup
,
NULL
);
}
}
/*
/*
...
@@ -350,7 +348,7 @@ void mnodeUpdateVgroupStatus(SVgObj *pVgroup, SDnodeObj *pDnode, SVnodeLoad *pVl
...
@@ -350,7 +348,7 @@ void mnodeUpdateVgroupStatus(SVgObj *pVgroup, SDnodeObj *pDnode, SVnodeLoad *pVl
mError
(
"dnode:%d, vgId:%d, vnode cfgVersion:%d:%d repica:%d not match with mnode cfgVersion:%d:%d replica:%d"
,
mError
(
"dnode:%d, vgId:%d, vnode cfgVersion:%d:%d repica:%d not match with mnode cfgVersion:%d:%d replica:%d"
,
pDnode
->
dnodeId
,
pVload
->
vgId
,
pVload
->
dbCfgVersion
,
pVload
->
vgCfgVersion
,
pVload
->
replica
,
pDnode
->
dnodeId
,
pVload
->
vgId
,
pVload
->
dbCfgVersion
,
pVload
->
vgCfgVersion
,
pVload
->
replica
,
pVgroup
->
pDb
->
dbCfgVersion
,
pVgroup
->
vgCfgVersion
,
pVgroup
->
numOfVnodes
);
pVgroup
->
pDb
->
dbCfgVersion
,
pVgroup
->
vgCfgVersion
,
pVgroup
->
numOfVnodes
);
mnodeSendAlterVgroupMsg
(
pVgroup
);
mnodeSendAlterVgroupMsg
(
pVgroup
,
NULL
);
}
}
}
}
...
@@ -946,10 +944,10 @@ SRpcEpSet mnodeGetEpSetFromIp(char *ep) {
...
@@ -946,10 +944,10 @@ SRpcEpSet mnodeGetEpSetFromIp(char *ep) {
return
epSet
;
return
epSet
;
}
}
static
void
mnodeSendAlterVnodeMsg
(
SVgObj
*
pVgroup
,
SRpcEpSet
*
epSet
)
{
static
void
mnodeSendAlterVnodeMsg
(
SVgObj
*
pVgroup
,
SRpcEpSet
*
epSet
,
SMnodeMsg
*
pMsg
)
{
SAlterVnodeMsg
*
pAlter
=
mnodeBuildVnodeMsg
(
pVgroup
);
SAlterVnodeMsg
*
pAlter
=
mnodeBuildVnodeMsg
(
pVgroup
);
SRpcMsg
rpcMsg
=
{
SRpcMsg
rpcMsg
=
{
.
ahandle
=
NULL
,
.
ahandle
=
pMsg
,
.
pCont
=
pAlter
,
.
pCont
=
pAlter
,
.
contLen
=
pAlter
?
sizeof
(
SAlterVnodeMsg
)
:
0
,
.
contLen
=
pAlter
?
sizeof
(
SAlterVnodeMsg
)
:
0
,
.
code
=
0
,
.
code
=
0
,
...
@@ -958,14 +956,17 @@ static void mnodeSendAlterVnodeMsg(SVgObj *pVgroup, SRpcEpSet *epSet) {
...
@@ -958,14 +956,17 @@ static void mnodeSendAlterVnodeMsg(SVgObj *pVgroup, SRpcEpSet *epSet) {
dnodeSendMsgToDnode
(
epSet
,
&
rpcMsg
);
dnodeSendMsgToDnode
(
epSet
,
&
rpcMsg
);
}
}
void
mnodeSendAlterVgroupMsg
(
SVgObj
*
pVgroup
)
{
void
mnodeSendAlterVgroupMsg
(
SVgObj
*
pVgroup
,
SMnodeMsg
*
pMsg
)
{
mDebug
(
"vgId:%d, send alter all vnodes msg, numOfVnodes:%d db:%s"
,
pVgroup
->
vgId
,
pVgroup
->
numOfVnodes
,
mDebug
(
"vgId:%d, send alter all vnodes msg, numOfVnodes:%d db:%s"
,
pVgroup
->
vgId
,
pVgroup
->
numOfVnodes
,
pVgroup
->
dbName
);
pVgroup
->
dbName
);
if
(
pMsg
)
{
pMsg
->
pVgroup
=
pVgroup
;
}
for
(
int32_t
i
=
0
;
i
<
pVgroup
->
numOfVnodes
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
pVgroup
->
numOfVnodes
;
++
i
)
{
SRpcEpSet
epSet
=
mnodeGetEpSetFromIp
(
pVgroup
->
vnodeGid
[
i
].
pDnode
->
dnodeEp
);
SRpcEpSet
epSet
=
mnodeGetEpSetFromIp
(
pVgroup
->
vnodeGid
[
i
].
pDnode
->
dnodeEp
);
mDebug
(
"vgId:%d, index:%d, send alter vnode msg to dnode %s"
,
pVgroup
->
vgId
,
i
,
mDebug
(
"vgId:%d, index:%d, send alter vnode msg to dnode %s"
,
pVgroup
->
vgId
,
i
,
pVgroup
->
vnodeGid
[
i
].
pDnode
->
dnodeEp
);
pVgroup
->
vnodeGid
[
i
].
pDnode
->
dnodeEp
);
mnodeSendAlterVnodeMsg
(
pVgroup
,
&
epSet
);
mnodeSendAlterVnodeMsg
(
pVgroup
,
&
epSet
,
pMsg
);
}
}
}
}
...
@@ -1026,11 +1027,24 @@ void mnodeSendCreateVgroupMsg(SVgObj *pVgroup, void *ahandle) {
...
@@ -1026,11 +1027,24 @@ void mnodeSendCreateVgroupMsg(SVgObj *pVgroup, void *ahandle) {
}
}
static
void
mnodeProcessAlterVnodeRsp
(
SRpcMsg
*
rpcMsg
)
{
static
void
mnodeProcessAlterVnodeRsp
(
SRpcMsg
*
rpcMsg
)
{
mDebug
(
"alter vnode rsp
received"
);
mDebug
(
"alter vnode rsp
is received, handle:%p"
,
rpcMsg
->
ahandle
);
}
if
(
rpcMsg
->
ahandle
==
NULL
)
return
;
static
void
mnodeProcessSyncVnodeRsp
(
SRpcMsg
*
rpcMsg
)
{
SMnodeMsg
*
mnodeMsg
=
rpcMsg
->
ahandle
;
mDebug
(
"sync vnode rsp received"
);
mnodeMsg
->
received
++
;
if
(
rpcMsg
->
code
==
TSDB_CODE_SUCCESS
)
{
mnodeMsg
->
code
=
rpcMsg
->
code
;
mnodeMsg
->
successed
++
;
}
SVgObj
*
pVgroup
=
mnodeMsg
->
pVgroup
;
mDebug
(
"vgId:%d, alter vnode rsp received, result:%s received:%d successed:%d expected:%d, thandle:%p ahandle:%p"
,
pVgroup
->
vgId
,
tstrerror
(
rpcMsg
->
code
),
mnodeMsg
->
received
,
mnodeMsg
->
successed
,
mnodeMsg
->
expected
,
mnodeMsg
->
rpcMsg
.
handle
,
rpcMsg
->
ahandle
);
if
(
mnodeMsg
->
received
!=
mnodeMsg
->
expected
)
return
;
dnodeReprocessMWriteMsg
(
mnodeMsg
);
}
}
static
void
mnodeProcessCreateVnodeRsp
(
SRpcMsg
*
rpcMsg
)
{
static
void
mnodeProcessCreateVnodeRsp
(
SRpcMsg
*
rpcMsg
)
{
...
...
tests/pytest/alter/alter_keep.py
浏览文件 @
68c7fc49
...
@@ -161,9 +161,9 @@ class TDTestCase:
...
@@ -161,9 +161,9 @@ class TDTestCase:
# the following line should generate an error, but the insert was a success
# the following line should generate an error, but the insert was a success
# the time now-15d is out of range of now -10d
# the time now-15d is out of range of now -10d
tdSql
.
e
xecute
(
'insert into tb values (now-15d, 10)'
)
tdSql
.
e
rror
(
'insert into tb values (now-15d, 10)'
)
tdSql
.
query
(
'select * from tb'
)
tdSql
.
query
(
'select * from tb'
)
tdSql
.
checkRows
(
rowNum
+
1
)
tdSql
.
checkRows
(
rowNum
)
# tdSql.execute('alter database db keep 20,20,20')
# tdSql.execute('alter database db keep 20,20,20')
# tdSql.query('show databases')
# tdSql.query('show databases')
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录