Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
冷面1992
TDengine
提交
566b749c
TDengine
项目概览
冷面1992
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
566b749c
编写于
11月 20, 2020
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TD-2046
上级
976d8653
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
125 addition
and
178 deletion
+125
-178
src/mnode/inc/mnodeSdb.h
src/mnode/inc/mnodeSdb.h
+4
-1
src/mnode/src/mnodeSdb.c
src/mnode/src/mnodeSdb.c
+100
-156
src/mnode/src/mnodeTable.c
src/mnode/src/mnodeTable.c
+1
-1
src/mnode/src/mnodeVgroup.c
src/mnode/src/mnodeVgroup.c
+1
-1
src/sync/src/syncRestore.c
src/sync/src/syncRestore.c
+1
-1
tests/script/sh/deploy.sh
tests/script/sh/deploy.sh
+18
-18
未找到文件。
src/mnode/inc/mnodeSdb.h
浏览文件 @
566b749c
...
...
@@ -21,6 +21,7 @@ extern "C" {
#endif
#include "mnode.h"
#include "twal.h"
struct
SSdbTable
;
...
...
@@ -60,6 +61,8 @@ typedef struct SSWriteMsg {
void
*
pRow
;
SMnodeMsg
*
pMsg
;
struct
SSdbTable
*
pTable
;
char
reserveForSync
[
16
];
SWalHead
pHead
[];
}
SSWriteMsg
;
typedef
struct
{
...
...
@@ -89,7 +92,7 @@ void sdbUpdateMnodeRoles();
int32_t
sdbInsertRow
(
SSWriteMsg
*
pWrite
);
int32_t
sdbDeleteRow
(
SSWriteMsg
*
pWrite
);
int32_t
sdbUpdateRow
(
SSWriteMsg
*
pWrite
);
int32_t
sdbInsertRow
Imp
(
SSWriteMsg
*
pWrite
);
int32_t
sdbInsertRow
ToQueue
(
SSWriteMsg
*
pWrite
);
void
*
sdbGetRow
(
void
*
pTable
,
void
*
key
);
void
*
sdbFetchRow
(
void
*
pTable
,
void
*
pIter
,
void
**
ppRow
);
...
...
src/mnode/src/mnodeSdb.c
浏览文件 @
566b749c
...
...
@@ -34,7 +34,7 @@
#include "mnodeSdb.h"
#define SDB_TABLE_LEN 12
#define
SDB_SYNC_HACK 16
#define
MAX_QUEUED_MSG_NUM 10000
typedef
enum
{
SDB_ACTION_INSERT
=
0
,
...
...
@@ -82,6 +82,7 @@ typedef struct {
int64_t
sync
;
void
*
wal
;
SSyncCfg
cfg
;
int32_t
queuedMsg
;
int32_t
numOfTables
;
SSdbTable
*
tableList
[
SDB_TABLE_MAX
];
pthread_mutex_t
mutex
;
...
...
@@ -105,16 +106,14 @@ static taos_qall tsSdbWQall;
static
taos_queue
tsSdbWQueue
;
static
SSdbWorkerPool
tsSdbPool
;
static
int32_t
sdbWrite
(
void
*
pWrite
,
void
*
pHead
,
int32_t
qtype
,
void
*
unused
);
static
int32_t
sdbWriteToQueue
(
void
*
pWrite
,
void
*
pHead
,
int32_t
qtype
,
void
*
unused
);
static
int32_t
sdbProcessWrite
(
void
*
pWrite
,
void
*
pHead
,
int32_t
qtype
,
void
*
unused
);
static
int32_t
sdbWriteWalToQueue
(
void
*
vparam
,
void
*
pHead
,
int32_t
qtype
,
void
*
rparam
);
static
int32_t
sdbWriteRowToQueue
(
SSWriteMsg
*
pInputWrite
,
int32_t
action
);
static
void
*
sdbWorkerFp
(
void
*
pWorker
);
static
int32_t
sdbInitWorker
();
static
void
sdbCleanupWorker
();
static
int32_t
sdbAllocQueue
();
static
void
sdbFreeQueue
();
extern
int32_t
sdbInsertRowImp
(
SSWriteMsg
*
pWrite
);
static
int32_t
sdbUpdateRowImp
(
SSWriteMsg
*
pWrite
);
static
int32_t
sdbDeleteRowImp
(
SSWriteMsg
*
pWrite
);
static
int32_t
sdbInsertHash
(
SSdbTable
*
pTable
,
SSWriteMsg
*
pWrite
);
static
int32_t
sdbUpdateHash
(
SSdbTable
*
pTable
,
SSWriteMsg
*
pWrite
);
static
int32_t
sdbDeleteHash
(
SSdbTable
*
pTable
,
SSWriteMsg
*
pWrite
);
...
...
@@ -181,7 +180,7 @@ static int32_t sdbInitWal() {
}
sdbInfo
(
"vgId:1, open wal for restore"
);
int
code
=
walRestore
(
tsSdbMgmt
.
wal
,
NULL
,
sdb
Write
);
int
32_t
code
=
walRestore
(
tsSdbMgmt
.
wal
,
NULL
,
sdbProcess
Write
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
sdbError
(
"vgId:1, failed to open wal for restore since %s"
,
tstrerror
(
code
));
return
-
1
;
...
...
@@ -250,7 +249,7 @@ static void sdbNotifyRole(void *ahandle, int8_t role) {
// failed to forward, need revert insert
static
void
sdbHandleFailedConfirm
(
SSWriteMsg
*
pWrite
)
{
SWalHead
*
pHead
=
(
SWalHead
*
)((
char
*
)
pWrite
+
sizeof
(
SSWriteMsg
)
+
SDB_SYNC_HACK
)
;
SWalHead
*
pHead
=
pWrite
->
pHead
;
int32_t
action
=
pHead
->
msgType
%
10
;
sdbError
(
"vgId:1, row:%p:%s hver:%"
PRIu64
" action:%s, failed to foward since %s"
,
pWrite
->
pRow
,
...
...
@@ -285,13 +284,6 @@ static void sdbConfirmForward(void *ahandle, void *wparam, int32_t code) {
}
dnodeSendRpcMWriteRsp
(
pMsg
,
pWrite
->
code
);
// if ahandle, means this func is called by sdb write
if
(
ahandle
==
NULL
)
{
sdbDecRef
(
pWrite
->
pTable
,
pWrite
->
pRow
);
}
taosFreeQitem
(
pWrite
);
}
static
void
sdbUpdateSyncTmrFp
(
void
*
param
,
void
*
tmrId
)
{
sdbUpdateSync
(
NULL
);
}
...
...
@@ -379,7 +371,7 @@ void sdbUpdateSync(void *pMnodes) {
syncInfo
.
ahandle
=
NULL
;
syncInfo
.
getWalInfo
=
sdbGetWalInfo
;
syncInfo
.
getFileInfo
=
sdbGetFileInfo
;
syncInfo
.
writeToCache
=
sdbWriteToQueue
;
syncInfo
.
writeToCache
=
sdbWrite
Wal
ToQueue
;
syncInfo
.
confirmForward
=
sdbConfirmForward
;
syncInfo
.
notifyRole
=
sdbNotifyRole
;
tsSdbMgmt
.
cfg
=
syncCfg
;
...
...
@@ -389,6 +381,7 @@ void sdbUpdateSync(void *pMnodes) {
}
else
{
tsSdbMgmt
.
sync
=
syncStart
(
&
syncInfo
);
}
sdbUpdateMnodeRoles
();
}
...
...
@@ -565,7 +558,7 @@ static int32_t sdbUpdateHash(SSdbTable *pTable, SSWriteMsg *pWrite) {
return
TSDB_CODE_SUCCESS
;
}
static
int
sdbWrite
(
void
*
wparam
,
void
*
hparam
,
int32_t
qtype
,
void
*
unused
)
{
static
int
sdb
Process
Write
(
void
*
wparam
,
void
*
hparam
,
int32_t
qtype
,
void
*
unused
)
{
SSWriteMsg
*
pWrite
=
wparam
;
SWalHead
*
pHead
=
hparam
;
int32_t
tableId
=
pHead
->
msgType
/
10
;
...
...
@@ -665,8 +658,7 @@ int32_t sdbInsertRow(SSWriteMsg *pWrite) {
if
(
pTable
==
NULL
)
return
TSDB_CODE_MND_SDB_INVALID_TABLE_TYPE
;
if
(
sdbGetRowFromObj
(
pTable
,
pWrite
->
pRow
))
{
sdbError
(
"vgId:1, sdb:%s, failed to insert key:%s since it already exist"
,
pTable
->
name
,
sdbGetRowStr
(
pTable
,
pWrite
->
pRow
));
sdbError
(
"vgId:1, sdb:%s, failed to insert:%s since it exist"
,
pTable
->
name
,
sdbGetRowStr
(
pTable
,
pWrite
->
pRow
));
sdbDecRef
(
pTable
,
pWrite
->
pRow
);
return
TSDB_CODE_MND_SDB_OBJ_ALREADY_THERE
;
}
...
...
@@ -675,14 +667,14 @@ int32_t sdbInsertRow(SSWriteMsg *pWrite) {
*
((
uint32_t
*
)
pWrite
->
pRow
)
=
atomic_add_fetch_32
(
&
pTable
->
autoIndex
,
1
);
// let vgId increase from 2
if
(
pTable
->
autoIndex
==
1
&&
strcmp
(
pTable
->
name
,
"vgroups"
)
==
0
)
{
if
(
pTable
->
autoIndex
==
1
&&
pTable
->
id
==
SDB_TABLE_VGROUP
)
{
*
((
uint32_t
*
)
pWrite
->
pRow
)
=
atomic_add_fetch_32
(
&
pTable
->
autoIndex
,
1
);
}
}
int32_t
code
=
sdbInsertHash
(
pTable
,
pWrite
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
sdbError
(
"vgId:1, sdb:%s, failed to insert
into hash"
,
pTable
->
name
);
sdbError
(
"vgId:1, sdb:%s, failed to insert
:%s into hash"
,
pTable
->
name
,
sdbGetRowStr
(
pTable
,
pWrite
->
pRow
)
);
return
code
;
}
...
...
@@ -694,37 +686,8 @@ int32_t sdbInsertRow(SSWriteMsg *pWrite) {
if
(
pWrite
->
fpReq
)
{
return
(
*
pWrite
->
fpReq
)(
pWrite
->
pMsg
);
}
else
{
return
sdbInsertRowImp
(
pWrite
);
}
}
int32_t
sdbInsertRowImp
(
SSWriteMsg
*
pWrite
)
{
SSdbTable
*
pTable
=
pWrite
->
pTable
;
if
(
pTable
==
NULL
)
return
TSDB_CODE_MND_SDB_INVALID_TABLE_TYPE
;
int32_t
size
=
sizeof
(
SSWriteMsg
)
+
sizeof
(
SWalHead
)
+
pTable
->
maxRowSize
+
SDB_SYNC_HACK
;
SSWriteMsg
*
pNewWrite
=
taosAllocateQitem
(
size
);
SWalHead
*
pHead
=
(
SWalHead
*
)((
char
*
)
pNewWrite
+
sizeof
(
SSWriteMsg
)
+
SDB_SYNC_HACK
);
pHead
->
version
=
0
;
pHead
->
len
=
pWrite
->
rowSize
;
pHead
->
msgType
=
pTable
->
id
*
10
+
SDB_ACTION_INSERT
;
pWrite
->
rowData
=
pHead
->
cont
;
(
*
pTable
->
fpEncode
)(
pWrite
);
pHead
->
len
=
pWrite
->
rowSize
;
memcpy
(
pNewWrite
,
pWrite
,
sizeof
(
SSWriteMsg
));
if
(
pNewWrite
->
pMsg
!=
NULL
)
{
sdbDebug
(
"vgId:1, ahandle:%p msg:%p, sdb:%s row:%p:%s, insert action is add to sdb queue"
,
pNewWrite
->
pMsg
->
rpcMsg
.
ahandle
,
pNewWrite
->
pMsg
,
pTable
->
name
,
pWrite
->
pRow
,
sdbGetRowStr
(
pTable
,
pWrite
->
pRow
));
return
sdbWriteRowToQueue
(
pWrite
,
SDB_ACTION_INSERT
);
}
sdbIncRef
(
pNewWrite
->
pTable
,
pNewWrite
->
pRow
);
taosWriteQitem
(
tsSdbWQueue
,
TAOS_QTYPE_RPC
,
pNewWrite
);
return
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
}
bool
sdbCheckRowDeleted
(
void
*
tparam
,
void
*
pRow
)
{
...
...
@@ -745,55 +708,24 @@ int32_t sdbDeleteRow(SSWriteMsg *pWrite) {
return
TSDB_CODE_MND_SDB_OBJ_NOT_THERE
;
}
sdbIncRef
(
pTable
,
pWrite
->
pRow
);
int32_t
code
=
sdbDeleteHash
(
pTable
,
pWrite
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
sdbError
(
"vgId:1, sdb:%s, failed to delete from hash"
,
pTable
->
name
);
sdbDecRef
(
pTable
,
pWrite
->
pRow
);
return
code
;
}
// just delete data from memory
if
(
pWrite
->
type
!=
SDB_OPER_GLOBAL
)
{
sdbDecRef
(
pTable
,
pWrite
->
pRow
);
return
TSDB_CODE_SUCCESS
;
}
if
(
pWrite
->
fpReq
)
{
return
(
*
pWrite
->
fpReq
)(
pWrite
->
pMsg
);
}
else
{
return
sdb
DeleteRowImp
(
pWrite
);
return
sdb
WriteRowToQueue
(
pWrite
,
SDB_ACTION_DELETE
);
}
}
int32_t
sdbDeleteRowImp
(
SSWriteMsg
*
pWrite
)
{
SSdbTable
*
pTable
=
pWrite
->
pTable
;
if
(
pTable
==
NULL
)
return
TSDB_CODE_MND_SDB_INVALID_TABLE_TYPE
;
int32_t
size
=
sizeof
(
SSWriteMsg
)
+
sizeof
(
SWalHead
)
+
pTable
->
maxRowSize
+
SDB_SYNC_HACK
;
SSWriteMsg
*
pNewWrite
=
taosAllocateQitem
(
size
);
SWalHead
*
pHead
=
(
SWalHead
*
)((
void
*
)
pNewWrite
+
sizeof
(
SSWriteMsg
)
+
SDB_SYNC_HACK
);
pHead
->
version
=
0
;
pHead
->
msgType
=
pTable
->
id
*
10
+
SDB_ACTION_DELETE
;
pWrite
->
rowData
=
pHead
->
cont
;
(
*
pTable
->
fpEncode
)(
pWrite
);
pHead
->
len
=
pWrite
->
rowSize
;
memcpy
(
pNewWrite
,
pWrite
,
sizeof
(
SSWriteMsg
));
if
(
pNewWrite
->
pMsg
!=
NULL
)
{
sdbDebug
(
"vgId:1, ahandle:%p msg:%p, sdb:%s row:%p:%s, delete action is add to sdb queue"
,
pNewWrite
->
pMsg
->
rpcMsg
.
ahandle
,
pNewWrite
->
pMsg
,
pTable
->
name
,
pWrite
->
pRow
,
sdbGetRowStr
(
pTable
,
pWrite
->
pRow
));
}
taosWriteQitem
(
tsSdbWQueue
,
TAOS_QTYPE_RPC
,
pNewWrite
);
return
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
}
int32_t
sdbUpdateRow
(
SSWriteMsg
*
pWrite
)
{
SSdbTable
*
pTable
=
pWrite
->
pTable
;
if
(
pTable
==
NULL
)
return
TSDB_CODE_MND_SDB_INVALID_TABLE_TYPE
;
...
...
@@ -818,38 +750,10 @@ int32_t sdbUpdateRow(SSWriteMsg *pWrite) {
if
(
pWrite
->
fpReq
)
{
return
(
*
pWrite
->
fpReq
)(
pWrite
->
pMsg
);
}
else
{
return
sdb
UpdateRowImp
(
pWrite
);
return
sdb
WriteRowToQueue
(
pWrite
,
SDB_ACTION_UPDATE
);
}
}
int32_t
sdbUpdateRowImp
(
SSWriteMsg
*
pWrite
)
{
SSdbTable
*
pTable
=
pWrite
->
pTable
;
if
(
pTable
==
NULL
)
return
TSDB_CODE_MND_SDB_INVALID_TABLE_TYPE
;
int32_t
size
=
sizeof
(
SSWriteMsg
)
+
sizeof
(
SWalHead
)
+
pTable
->
maxRowSize
+
SDB_SYNC_HACK
;
SSWriteMsg
*
pNewWrite
=
taosAllocateQitem
(
size
);
SWalHead
*
pHead
=
(
SWalHead
*
)((
void
*
)
pNewWrite
+
sizeof
(
SSWriteMsg
)
+
SDB_SYNC_HACK
);
pHead
->
version
=
0
;
pHead
->
msgType
=
pTable
->
id
*
10
+
SDB_ACTION_UPDATE
;
pWrite
->
rowData
=
pHead
->
cont
;
(
*
pTable
->
fpEncode
)(
pWrite
);
pHead
->
len
=
pWrite
->
rowSize
;
memcpy
(
pNewWrite
,
pWrite
,
sizeof
(
SSWriteMsg
));
if
(
pNewWrite
->
pMsg
!=
NULL
)
{
sdbDebug
(
"vgId:1, ahandle:%p msg:%p, sdb:%s row:%p:%s, update action is add to sdb queue"
,
pNewWrite
->
pMsg
->
rpcMsg
.
ahandle
,
pNewWrite
->
pMsg
,
pTable
->
name
,
pWrite
->
pRow
,
sdbGetRowStr
(
pTable
,
pWrite
->
pRow
));
}
sdbIncRef
(
pNewWrite
->
pTable
,
pNewWrite
->
pRow
);
taosWriteQitem
(
tsSdbWQueue
,
TAOS_QTYPE_RPC
,
pNewWrite
);
return
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
}
void
*
sdbFetchRow
(
void
*
tparam
,
void
*
pNode
,
void
**
ppRow
)
{
SSdbTable
*
pTable
=
tparam
;
*
ppRow
=
NULL
;
...
...
@@ -942,7 +846,7 @@ void sdbCloseTable(void *handle) {
free
(
pTable
);
}
int32_t
sdbInitWorker
()
{
static
int32_t
sdbInitWorker
()
{
tsSdbPool
.
num
=
1
;
tsSdbPool
.
worker
=
calloc
(
sizeof
(
SSdbWorker
),
tsSdbPool
.
num
);
...
...
@@ -958,7 +862,7 @@ int32_t sdbInitWorker() {
return
0
;
}
void
sdbCleanupWorker
()
{
static
void
sdbCleanupWorker
()
{
for
(
int32_t
i
=
0
;
i
<
tsSdbPool
.
num
;
++
i
)
{
SSdbWorker
*
pWorker
=
tsSdbPool
.
worker
+
i
;
if
(
pWorker
->
thread
)
{
...
...
@@ -979,7 +883,7 @@ void sdbCleanupWorker() {
mInfo
(
"vgId:1, sdb write is closed"
);
}
int32_t
sdbAllocQueue
()
{
static
int32_t
sdbAllocQueue
()
{
tsSdbWQueue
=
taosOpenQueue
();
if
(
tsSdbWQueue
==
NULL
)
return
TSDB_CODE_MND_OUT_OF_MEMORY
;
...
...
@@ -1021,7 +925,7 @@ int32_t sdbAllocQueue() {
return
TSDB_CODE_SUCCESS
;
}
void
sdbFreeQueue
()
{
static
void
sdbFreeQueue
()
{
taosCloseQueue
(
tsSdbWQueue
);
taosFreeQall
(
tsSdbWQall
);
taosCloseQset
(
tsSdbWQset
);
...
...
@@ -1030,54 +934,96 @@ void sdbFreeQueue() {
tsSdbWQueue
=
NULL
;
}
int32_t
sdbWriteToQueue
(
void
*
wparam
,
void
*
hparam
,
int32_t
qtype
,
void
*
unsed
)
{
SWalHead
*
pHead
=
hparam
;
int32_t
size
=
sizeof
(
SWalHead
)
+
pHead
->
len
;
SWalHead
*
pWal
=
taosAllocateQitem
(
size
);
memcpy
(
pWal
,
pHead
,
size
);
static
int32_t
sdbWriteToQueue
(
SSWriteMsg
*
pWrite
,
int32_t
qtype
)
{
SWalHead
*
pHead
=
pWrite
->
pHead
;
taosWriteQitem
(
tsSdbWQueue
,
qtype
,
pWal
);
return
0
;
if
(
pHead
->
len
>
TSDB_MAX_WAL_SIZE
)
{
sdbError
(
"vgId:1, wal len:%d exceeds limit, hver:%"
PRIu64
,
pHead
->
len
,
pHead
->
version
);
taosFreeQitem
(
pWrite
);
return
TSDB_CODE_WAL_SIZE_LIMIT
;
}
int32_t
queued
=
atomic_add_fetch_32
(
&
tsSdbMgmt
.
queuedMsg
,
1
);
if
(
queued
>
MAX_QUEUED_MSG_NUM
)
{
sdbDebug
(
"vgId:1, too many msg:%d in sdb queue, flow control"
,
queued
);
taosMsleep
(
1
);
}
sdbIncRef
(
pWrite
->
pTable
,
pWrite
->
pRow
);
sdbTrace
(
"vgId:1, msg:%p write into to sdb queue"
,
pWrite
->
pMsg
);
taosWriteQitem
(
tsSdbWQueue
,
qtype
,
pWrite
);
return
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
}
static
void
sdbFreeFromQueue
(
SSWriteMsg
*
pWrite
)
{
int32_t
queued
=
atomic_sub_fetch_32
(
&
tsSdbMgmt
.
queuedMsg
,
1
);
sdbTrace
(
"vgId:1, msg:%p free from sdb queue, queued:%d"
,
pWrite
->
pMsg
,
queued
);
sdbDecRef
(
pWrite
->
pTable
,
pWrite
->
pRow
);
taosFreeQitem
(
pWrite
);
}
static
int32_t
sdbWriteWalToQueue
(
void
*
vparam
,
void
*
wparam
,
int32_t
qtype
,
void
*
rparam
)
{
SWalHead
*
pHead
=
wparam
;
int32_t
size
=
sizeof
(
SSWriteMsg
)
+
sizeof
(
SWalHead
)
+
pHead
->
len
;
SSWriteMsg
*
pWrite
=
taosAllocateQitem
(
size
);
if
(
pWrite
==
NULL
)
{
return
TSDB_CODE_VND_OUT_OF_MEMORY
;
}
return
sdbWriteToQueue
(
pWrite
,
qtype
);
}
static
int32_t
sdbWriteRowToQueue
(
SSWriteMsg
*
pInputWrite
,
int32_t
action
)
{
SSdbTable
*
pTable
=
pInputWrite
->
pTable
;
if
(
pTable
==
NULL
)
return
TSDB_CODE_MND_SDB_INVALID_TABLE_TYPE
;
int32_t
size
=
sizeof
(
SSWriteMsg
)
+
sizeof
(
SWalHead
)
+
pTable
->
maxRowSize
;
SSWriteMsg
*
pWrite
=
taosAllocateQitem
(
size
);
if
(
pWrite
==
NULL
)
{
return
TSDB_CODE_VND_OUT_OF_MEMORY
;
}
memcpy
(
pWrite
,
pInputWrite
,
sizeof
(
SSWriteMsg
));
pWrite
->
processedCount
=
1
;
SWalHead
*
pHead
=
pWrite
->
pHead
;
pWrite
->
rowData
=
pHead
->
cont
;
(
*
pTable
->
fpEncode
)(
pWrite
);
pHead
->
len
=
pWrite
->
rowSize
;
pHead
->
version
=
0
;
pHead
->
msgType
=
pTable
->
id
*
10
+
action
;
return
sdbWriteToQueue
(
pWrite
,
TAOS_QTYPE_RPC
);
}
int32_t
sdbInsertRowToQueue
(
SSWriteMsg
*
pWrite
)
{
return
sdbWriteRowToQueue
(
pWrite
,
SDB_ACTION_INSERT
);
}
static
void
*
sdbWorkerFp
(
void
*
pWorker
)
{
SWalHead
*
pHead
;
SSWriteMsg
*
pWrite
;
int32_t
qtype
;
int32_t
numOfMsgs
;
void
*
item
;
void
*
unUsed
;
int32_t
qtype
;
void
*
unUsed
;
while
(
1
)
{
numOfMsgs
=
taosReadAllQitemsFromQset
(
tsSdbWQset
,
tsSdbWQall
,
&
unUsed
);
int32_t
numOfMsgs
=
taosReadAllQitemsFromQset
(
tsSdbWQset
,
tsSdbWQall
,
&
unUsed
);
if
(
numOfMsgs
==
0
)
{
sdbDebug
(
"qset:%p, sdb got no message from qset, exiting"
,
tsSdbWQset
);
break
;
}
for
(
int32_t
i
=
0
;
i
<
numOfMsgs
;
++
i
)
{
taosGetQitem
(
tsSdbWQall
,
&
qtype
,
&
item
);
if
(
qtype
==
TAOS_QTYPE_RPC
)
{
pWrite
=
(
SSWriteMsg
*
)
item
;
pWrite
->
processedCount
=
1
;
pHead
=
(
void
*
)
pWrite
+
sizeof
(
SSWriteMsg
)
+
SDB_SYNC_HACK
;
if
(
pWrite
->
pMsg
!=
NULL
)
{
sdbDebug
(
"vgId:1, ahandle:%p msg:%p, sdb:%s row:%p:%s hver:%"
PRIu64
", will be processed in sdb queue"
,
pWrite
->
pMsg
->
rpcMsg
.
ahandle
,
pWrite
->
pMsg
,
pWrite
->
pTable
->
name
,
pWrite
->
pRow
,
sdbGetKeyStr
(
pWrite
->
pTable
,
pHead
->
cont
),
pHead
->
version
);
}
}
else
{
pHead
=
(
SWalHead
*
)
item
;
pWrite
=
NULL
;
}
taosGetQitem
(
tsSdbWQall
,
&
qtype
,
(
void
**
)
&
pWrite
);
sdbTrace
(
"vgId:1, msg:%p, row:%p hver:%"
PRIu64
", will be processed in sdb queue"
,
pWrite
->
pMsg
,
pWrite
->
pRow
,
pWrite
->
pHead
->
version
);
int32_t
code
=
sdbWrite
(
pWrite
,
pHead
,
qtype
,
NULL
);
if
(
code
>
0
)
code
=
0
;
if
(
pWrite
)
{
pWrite
->
code
=
code
;
}
else
{
pHead
->
len
=
code
;
// hackway
}
pWrite
->
code
=
sdbProcessWrite
((
qtype
==
TAOS_QTYPE_RPC
)
?
pWrite
:
NULL
,
pWrite
->
pHead
,
qtype
,
NULL
);
if
(
pWrite
->
code
>
0
)
pWrite
->
code
=
0
;
sdbTrace
(
"vgId:1, msg:%p is processed in sdb queue, code:%x"
,
pWrite
->
pMsg
,
pWrite
->
code
);
}
walFsync
(
tsSdbMgmt
.
wal
,
true
);
...
...
@@ -1085,18 +1031,16 @@ static void *sdbWorkerFp(void *pWorker) {
// browse all items, and process them one by one
taosResetQitems
(
tsSdbWQall
);
for
(
int32_t
i
=
0
;
i
<
numOfMsgs
;
++
i
)
{
taosGetQitem
(
tsSdbWQall
,
&
qtype
,
&
item
);
taosGetQitem
(
tsSdbWQall
,
&
qtype
,
(
void
**
)
&
pWrite
);
if
(
qtype
==
TAOS_QTYPE_RPC
)
{
pWrite
=
(
SSWriteMsg
*
)
item
;
sdbConfirmForward
(
NULL
,
pWrite
,
pWrite
->
code
);
}
else
if
(
qtype
==
TAOS_QTYPE_FWD
)
{
pHead
=
(
SWalHead
*
)
item
;
syncConfirmForward
(
tsSdbMgmt
.
sync
,
pHead
->
version
,
pHead
->
len
);
taosFreeQitem
(
item
);
syncConfirmForward
(
tsSdbMgmt
.
sync
,
pWrite
->
pHead
->
version
,
pWrite
->
code
);
}
else
{
taosFreeQitem
(
item
);
}
sdbFreeFromQueue
(
pWrite
);
}
}
...
...
src/mnode/src/mnodeTable.c
浏览文件 @
566b749c
...
...
@@ -2418,7 +2418,7 @@ static void mnodeProcessCreateChildTableRsp(SRpcMsg *rpcMsg) {
.
fpRsp
=
mnodeDoCreateChildTableCb
};
int32_t
code
=
sdbInsertRow
Imp
(
&
desc
);
int32_t
code
=
sdbInsertRow
ToQueue
(
&
desc
);
if
(
code
!=
TSDB_CODE_SUCCESS
&&
code
!=
TSDB_CODE_MND_ACTION_IN_PROGRESS
)
{
mnodeMsg
->
pTable
=
NULL
;
mnodeDestroyChildTable
(
pTable
);
...
...
src/mnode/src/mnodeVgroup.c
浏览文件 @
566b749c
...
...
@@ -966,7 +966,7 @@ static void mnodeProcessCreateVnodeRsp(SRpcMsg *rpcMsg) {
.
fpRsp
=
mnodeCreateVgroupCb
};
int32_t
code
=
sdbInsertRow
Imp
(
&
wmsg
);
int32_t
code
=
sdbInsertRow
ToQueue
(
&
wmsg
);
if
(
code
!=
TSDB_CODE_SUCCESS
&&
code
!=
TSDB_CODE_MND_ACTION_IN_PROGRESS
)
{
mnodeMsg
->
pVgroup
=
NULL
;
mnodeDestroyVgroup
(
pVgroup
);
...
...
src/sync/src/syncRestore.c
浏览文件 @
566b749c
...
...
@@ -156,7 +156,7 @@ static int32_t syncRestoreWal(SSyncPeer *pPeer) {
sDebug
(
"%s, restore a record, qtype:wal len:%d hver:%"
PRIu64
,
pPeer
->
id
,
pHead
->
len
,
pHead
->
version
);
if
(
lastVer
!=
0
&&
lastVer
==
pHead
->
version
)
{
if
(
lastVer
==
pHead
->
version
)
{
sError
(
"%s, failed to restore record, same hver:%"
PRIu64
", wal sync failed"
PRIu64
,
pPeer
->
id
,
lastVer
);
break
;
}
...
...
tests/script/sh/deploy.sh
浏览文件 @
566b749c
...
...
@@ -111,24 +111,24 @@ echo "serverPort ${NODE}" >> $TAOS_CFG
echo
"dataDir
$DATA_DIR
"
>>
$TAOS_CFG
echo
"logDir
$LOG_DIR
"
>>
$TAOS_CFG
echo
"debugFlag 0"
>>
$TAOS_CFG
echo
"mDebugFlag 1
43
"
>>
$TAOS_CFG
echo
"sdbDebugFlag 1
43
"
>>
$TAOS_CFG
echo
"dDebugFlag 13
1
"
>>
$TAOS_CFG
echo
"vDebugFlag 13
1
"
>>
$TAOS_CFG
echo
"tsdbDebugFlag 13
1
"
>>
$TAOS_CFG
echo
"cDebugFlag 13
1
"
>>
$TAOS_CFG
echo
"jnidebugFlag 13
1
"
>>
$TAOS_CFG
echo
"odbcdebugFlag 13
1
"
>>
$TAOS_CFG
echo
"httpDebugFlag 13
1
"
>>
$TAOS_CFG
echo
"monitorDebugFlag 13
1
"
>>
$TAOS_CFG
echo
"mqttDebugFlag 13
1
"
>>
$TAOS_CFG
echo
"qdebugFlag 13
1
"
>>
$TAOS_CFG
echo
"rpcDebugFlag 13
1
"
>>
$TAOS_CFG
echo
"mDebugFlag 1
35
"
>>
$TAOS_CFG
echo
"sdbDebugFlag 1
35
"
>>
$TAOS_CFG
echo
"dDebugFlag 13
5
"
>>
$TAOS_CFG
echo
"vDebugFlag 13
5
"
>>
$TAOS_CFG
echo
"tsdbDebugFlag 13
5
"
>>
$TAOS_CFG
echo
"cDebugFlag 13
5
"
>>
$TAOS_CFG
echo
"jnidebugFlag 13
5
"
>>
$TAOS_CFG
echo
"odbcdebugFlag 13
5
"
>>
$TAOS_CFG
echo
"httpDebugFlag 13
5
"
>>
$TAOS_CFG
echo
"monitorDebugFlag 13
5
"
>>
$TAOS_CFG
echo
"mqttDebugFlag 13
5
"
>>
$TAOS_CFG
echo
"qdebugFlag 13
5
"
>>
$TAOS_CFG
echo
"rpcDebugFlag 13
5
"
>>
$TAOS_CFG
echo
"tmrDebugFlag 131"
>>
$TAOS_CFG
echo
"udebugFlag 13
1
"
>>
$TAOS_CFG
echo
"sdebugFlag 1
43
"
>>
$TAOS_CFG
echo
"wdebugFlag 1
43
"
>>
$TAOS_CFG
echo
"cqdebugFlag 13
1
"
>>
$TAOS_CFG
echo
"udebugFlag 13
5
"
>>
$TAOS_CFG
echo
"sdebugFlag 1
35
"
>>
$TAOS_CFG
echo
"wdebugFlag 1
35
"
>>
$TAOS_CFG
echo
"cqdebugFlag 13
5
"
>>
$TAOS_CFG
echo
"monitor 0"
>>
$TAOS_CFG
echo
"monitorInterval 1"
>>
$TAOS_CFG
echo
"http 0"
>>
$TAOS_CFG
...
...
@@ -140,7 +140,7 @@ echo "clog 2" >> $TAOS_CFG
#echo "cache 1" >> $TAOS_CFG
echo
"days 10"
>>
$TAOS_CFG
echo
"statusInterval 1"
>>
$TAOS_CFG
echo
"maxVgroupsPerDb
10
"
>>
$TAOS_CFG
echo
"maxVgroupsPerDb
4
"
>>
$TAOS_CFG
echo
"minTablesPerVnode 4"
>>
$TAOS_CFG
echo
"maxTablesPerVnode 1000"
>>
$TAOS_CFG
echo
"tableIncStepPerVnode 10000"
>>
$TAOS_CFG
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录