Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
993f5fe9
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
993f5fe9
编写于
7月 18, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: let certain type of write messages to be executed sequentially
上级
4e048f36
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
39 addition
and
32 deletion
+39
-32
source/dnode/mgmt/mgmt_vnode/src/vmWorker.c
source/dnode/mgmt/mgmt_vnode/src/vmWorker.c
+10
-0
source/dnode/vnode/src/vnd/vnodeSvr.c
source/dnode/vnode/src/vnd/vnodeSvr.c
+2
-1
source/dnode/vnode/src/vnd/vnodeSync.c
source/dnode/vnode/src/vnd/vnodeSync.c
+18
-31
tests/script/tsim/db/alter_replica_31.sim
tests/script/tsim/db/alter_replica_31.sim
+9
-0
未找到文件。
source/dnode/mgmt/mgmt_vnode/src/vmWorker.c
浏览文件 @
993f5fe9
...
@@ -179,6 +179,16 @@ static int32_t vmPutMsgToQueue(SVnodeMgmt *pMgmt, SRpcMsg *pMsg, EQueueType qtyp
...
@@ -179,6 +179,16 @@ static int32_t vmPutMsgToQueue(SVnodeMgmt *pMgmt, SRpcMsg *pMsg, EQueueType qtyp
}
else
{
}
else
{
dGTrace
(
"vgId:%d, msg:%p put into vnode-write queue"
,
pVnode
->
vgId
,
pMsg
);
dGTrace
(
"vgId:%d, msg:%p put into vnode-write queue"
,
pVnode
->
vgId
,
pMsg
);
taosWriteQitem
(
pVnode
->
pWriteQ
,
pMsg
);
taosWriteQitem
(
pVnode
->
pWriteQ
,
pMsg
);
#if 0 // tests for batch writes
if (pMsg->msgType == TDMT_VND_CREATE_TABLE) {
SRpcMsg *pDup = taosAllocateQitem(sizeof(SRpcMsg), RPC_QITEM);
memcpy(pDup, pMsg, sizeof(SRpcMsg));
pDup->pCont = rpcMallocCont(pMsg->contLen);
memcpy(pDup->pCont, pMsg->pCont, pMsg->contLen);
pDup->info.handle = NULL;
taosWriteQitem(pVnode->pWriteQ, pDup);
}
#endif
}
}
break
;
break
;
case
SYNC_QUEUE
:
case
SYNC_QUEUE
:
...
...
source/dnode/vnode/src/vnd/vnodeSvr.c
浏览文件 @
993f5fe9
...
@@ -53,6 +53,7 @@ int32_t vnodePreProcessWriteMsg(SVnode *pVnode, SRpcMsg *pMsg) {
...
@@ -53,6 +53,7 @@ int32_t vnodePreProcessWriteMsg(SVnode *pVnode, SRpcMsg *pMsg) {
*
(
int64_t
*
)(
dc
.
data
+
dc
.
pos
)
=
uid
;
*
(
int64_t
*
)(
dc
.
data
+
dc
.
pos
)
=
uid
;
*
(
int64_t
*
)(
dc
.
data
+
dc
.
pos
+
8
)
=
ctime
;
*
(
int64_t
*
)(
dc
.
data
+
dc
.
pos
+
8
)
=
ctime
;
vTrace
(
"vgId:%d, table:%s uid:%"
PRId64
" is generated"
,
pVnode
->
config
.
vgId
,
name
,
uid
);
tEndDecode
(
&
dc
);
tEndDecode
(
&
dc
);
}
}
...
@@ -381,7 +382,7 @@ static int32_t vnodeProcessDropTtlTbReq(SVnode *pVnode, int64_t version, void *p
...
@@ -381,7 +382,7 @@ static int32_t vnodeProcessDropTtlTbReq(SVnode *pVnode, int64_t version, void *p
goto
end
;
goto
end
;
}
}
v
Info
(
"vgId:%d, drop ttl table req will be processed, time:%d"
,
pVnode
->
config
.
vgId
,
ttlReq
.
timestamp
);
v
Debug
(
"vgId:%d, drop ttl table req will be processed, time:%d"
,
pVnode
->
config
.
vgId
,
ttlReq
.
timestamp
);
int32_t
ret
=
metaTtlDropTable
(
pVnode
->
pMeta
,
ttlReq
.
timestamp
,
tbUids
);
int32_t
ret
=
metaTtlDropTable
(
pVnode
->
pMeta
,
ttlReq
.
timestamp
,
tbUids
);
if
(
ret
!=
0
)
{
if
(
ret
!=
0
)
{
goto
end
;
goto
end
;
...
...
source/dnode/vnode/src/vnd/vnodeSync.c
浏览文件 @
993f5fe9
...
@@ -17,35 +17,22 @@
...
@@ -17,35 +17,22 @@
#include "vnd.h"
#include "vnd.h"
static
inline
bool
vnodeIsMsgBlock
(
tmsg_t
type
)
{
static
inline
bool
vnodeIsMsgBlock
(
tmsg_t
type
)
{
return
(
type
==
TDMT_VND_CREATE_TABLE
)
||
(
type
==
TDMT_VND_ALTER_CONFIRM
)
||
(
type
==
TDMT_VND_ALTER_REPLICA
);
return
(
type
==
TDMT_VND_CREATE_TABLE
)
||
(
type
==
TDMT_VND_CREATE_TABLE
)
||
(
type
==
TDMT_VND_CREATE_TABLE
)
||
(
type
==
TDMT_VND_ALTER_TABLE
)
||
(
type
==
TDMT_VND_DROP_TABLE
)
||
(
type
==
TDMT_VND_UPDATE_TAG_VAL
);
}
}
static
inline
bool
vnodeIsMsgWeak
(
tmsg_t
type
)
{
return
false
;
}
static
inline
bool
vnodeIsMsgWeak
(
tmsg_t
type
)
{
return
false
;
}
static
inline
void
vnodeAccumBlockMsg
(
SVnode
*
pVnode
,
tmsg_t
type
)
{
static
inline
void
vnodeWaitBlockMsg
(
SVnode
*
pVnode
,
const
SRpcMsg
*
pMsg
)
{
if
(
!
vnodeIsMsgBlock
(
type
))
return
;
if
(
vnodeIsMsgBlock
(
pMsg
->
msgType
))
{
vTrace
(
"vgId:%d, msg:%p wait block, type:%s"
,
pVnode
->
config
.
vgId
,
pMsg
,
TMSG_INFO
(
pMsg
->
msgType
));
int32_t
count
=
atomic_add_fetch_32
(
&
pVnode
->
blockCount
,
1
);
tsem_wait
(
&
pVnode
->
syncSem
);
vTrace
(
"vgId:%d, accum block, count:%d type:%s"
,
pVnode
->
config
.
vgId
,
count
,
TMSG_INFO
(
type
));
}
}
static
inline
void
vnodeWaitBlockMsg
(
SVnode
*
pVnode
)
{
int32_t
count
=
atomic_load_32
(
&
pVnode
->
blockCount
);
if
(
count
<=
0
)
return
;
vTrace
(
"vgId:%d, wait block finish, count:%d"
,
pVnode
->
config
.
vgId
,
count
);
tsem_wait
(
&
pVnode
->
syncSem
);
}
}
static
inline
void
vnodePostBlockMsg
(
SVnode
*
pVnode
,
tmsg_t
type
)
{
static
inline
void
vnodePostBlockMsg
(
SVnode
*
pVnode
,
const
SRpcMsg
*
pMsg
)
{
if
(
!
vnodeIsMsgBlock
(
type
))
return
;
if
(
vnodeIsMsgBlock
(
pMsg
->
msgType
))
{
vTrace
(
"vgId:%d, msg:%p post block, type:%s"
,
pVnode
->
config
.
vgId
,
pMsg
,
TMSG_INFO
(
pMsg
->
msgType
));
int32_t
count
=
atomic_load_32
(
&
pVnode
->
blockCount
);
if
(
count
<=
0
)
return
;
count
=
atomic_sub_fetch_32
(
&
pVnode
->
blockCount
,
1
);
vTrace
(
"vgId:%d, post block, count:%d type:%s"
,
pVnode
->
config
.
vgId
,
count
,
TMSG_INFO
(
type
));
if
(
count
<=
0
)
{
tsem_post
(
&
pVnode
->
syncSem
);
tsem_post
(
&
pVnode
->
syncSem
);
}
}
}
}
...
@@ -143,6 +130,8 @@ void vnodeProposeWriteMsg(SQueueInfo *pInfo, STaosQall *qall, int32_t numOfMsgs)
...
@@ -143,6 +130,8 @@ void vnodeProposeWriteMsg(SQueueInfo *pInfo, STaosQall *qall, int32_t numOfMsgs)
int32_t
code
=
0
;
int32_t
code
=
0
;
SRpcMsg
*
pMsg
=
NULL
;
SRpcMsg
*
pMsg
=
NULL
;
vTrace
(
"vgId:%d, get %d msgs from vnode-write queue"
,
vgId
,
numOfMsgs
);
for
(
int32_t
m
=
0
;
m
<
numOfMsgs
;
m
++
)
{
for
(
int32_t
m
=
0
;
m
<
numOfMsgs
;
m
++
)
{
if
(
taosGetQitem
(
qall
,
(
void
**
)
&
pMsg
)
==
0
)
continue
;
if
(
taosGetQitem
(
qall
,
(
void
**
)
&
pMsg
)
==
0
)
continue
;
const
STraceId
*
trace
=
&
pMsg
->
info
.
traceId
;
const
STraceId
*
trace
=
&
pMsg
->
info
.
traceId
;
...
@@ -165,13 +154,14 @@ void vnodeProposeWriteMsg(SQueueInfo *pInfo, STaosQall *qall, int32_t numOfMsgs)
...
@@ -165,13 +154,14 @@ void vnodeProposeWriteMsg(SQueueInfo *pInfo, STaosQall *qall, int32_t numOfMsgs)
if
(
rsp
.
info
.
handle
!=
NULL
)
{
if
(
rsp
.
info
.
handle
!=
NULL
)
{
tmsgSendRsp
(
&
rsp
);
tmsgSendRsp
(
&
rsp
);
}
}
}
else
if
(
code
==
0
)
{
vnodeWaitBlockMsg
(
pVnode
,
pMsg
);
}
else
{
}
}
}
}
}
}
if
(
code
==
0
)
{
if
(
code
<
0
)
{
vnodeAccumBlockMsg
(
pVnode
,
pMsg
->
msgType
);
}
else
if
(
code
<
0
)
{
if
(
terrno
==
TSDB_CODE_SYN_NOT_LEADER
)
{
if
(
terrno
==
TSDB_CODE_SYN_NOT_LEADER
)
{
vnodeRedirectRpcMsg
(
pVnode
,
pMsg
);
vnodeRedirectRpcMsg
(
pVnode
,
pMsg
);
}
else
{
}
else
{
...
@@ -182,15 +172,12 @@ void vnodeProposeWriteMsg(SQueueInfo *pInfo, STaosQall *qall, int32_t numOfMsgs)
...
@@ -182,15 +172,12 @@ void vnodeProposeWriteMsg(SQueueInfo *pInfo, STaosQall *qall, int32_t numOfMsgs)
tmsgSendRsp
(
&
rsp
);
tmsgSendRsp
(
&
rsp
);
}
}
}
}
}
else
{
}
}
vGTrace
(
"vgId:%d, msg:%p is freed, code:0x%x"
,
vgId
,
pMsg
,
code
);
vGTrace
(
"vgId:%d, msg:%p is freed, code:0x%x"
,
vgId
,
pMsg
,
code
);
rpcFreeCont
(
pMsg
->
pCont
);
rpcFreeCont
(
pMsg
->
pCont
);
taosFreeQitem
(
pMsg
);
taosFreeQitem
(
pMsg
);
}
}
vnodeWaitBlockMsg
(
pVnode
);
}
}
void
vnodeApplyWriteMsg
(
SQueueInfo
*
pInfo
,
STaosQall
*
qall
,
int32_t
numOfMsgs
)
{
void
vnodeApplyWriteMsg
(
SQueueInfo
*
pInfo
,
STaosQall
*
qall
,
int32_t
numOfMsgs
)
{
...
@@ -213,7 +200,7 @@ void vnodeApplyWriteMsg(SQueueInfo *pInfo, STaosQall *qall, int32_t numOfMsgs) {
...
@@ -213,7 +200,7 @@ void vnodeApplyWriteMsg(SQueueInfo *pInfo, STaosQall *qall, int32_t numOfMsgs) {
}
}
}
}
vnodePostBlockMsg
(
pVnode
,
pMsg
->
msgType
);
vnodePostBlockMsg
(
pVnode
,
pMsg
);
if
(
rsp
.
info
.
handle
!=
NULL
)
{
if
(
rsp
.
info
.
handle
!=
NULL
)
{
tmsgSendRsp
(
&
rsp
);
tmsgSendRsp
(
&
rsp
);
}
}
...
@@ -418,7 +405,7 @@ static void vnodeSyncReconfig(struct SSyncFSM *pFsm, const SRpcMsg *pMsg, SReCon
...
@@ -418,7 +405,7 @@ static void vnodeSyncReconfig(struct SSyncFSM *pFsm, const SRpcMsg *pMsg, SReCon
tmsgSendRsp
(
&
rpcMsg
);
tmsgSendRsp
(
&
rpcMsg
);
}
}
vnodePostBlockMsg
(
pVnode
,
TDMT_VND_ALTER_REPLICA
);
vnodePostBlockMsg
(
pVnode
,
pMsg
);
}
}
static
void
vnodeSyncCommitMsg
(
SSyncFSM
*
pFsm
,
const
SRpcMsg
*
pMsg
,
SFsmCbMeta
cbMeta
)
{
static
void
vnodeSyncCommitMsg
(
SSyncFSM
*
pFsm
,
const
SRpcMsg
*
pMsg
,
SFsmCbMeta
cbMeta
)
{
...
...
tests/script/tsim/db/alter_replica_31.sim
浏览文件 @
993f5fe9
...
@@ -111,6 +111,15 @@ if $hasleader != 1 then
...
@@ -111,6 +111,15 @@ if $hasleader != 1 then
goto step2
goto step2
endi
endi
# sql use db;
# sql create table stb (ts timestamp, c int) tags (t int);
# sql create table t0 using stb tags (0);
# sql insert into t0 values(now, 1);
# sql show db.stables;
# sql show db.tables;
# sql show db.vgroups;
return
sql create table db.stb (ts timestamp, c1 int, c2 binary(4)) tags(t1 int, t2 binary(16)) comment "abd"
sql create table db.stb (ts timestamp, c1 int, c2 binary(4)) tags(t1 int, t2 binary(16)) comment "abd"
sql create table db.ctb using db.stb tags(101, "102")
sql create table db.ctb using db.stb tags(101, "102")
sql insert into db.ctb values(now, 1, "2")
sql insert into db.ctb values(now, 1, "2")
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录