Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
3810b5d4
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
3810b5d4
编写于
9月 23, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: add more info log for mnode
上级
fae0ad1b
变更
21
隐藏空白更改
内联
并排
Showing
21 changed file
with
172 addition
and
171 deletion
+172
-171
include/util/tutil.h
include/util/tutil.h
+1
-0
source/dnode/mnode/impl/src/mndAcct.c
source/dnode/mnode/impl/src/mndAcct.c
+2
-2
source/dnode/mnode/impl/src/mndBnode.c
source/dnode/mnode/impl/src/mndBnode.c
+4
-4
source/dnode/mnode/impl/src/mndCluster.c
source/dnode/mnode/impl/src/mndCluster.c
+2
-2
source/dnode/mnode/impl/src/mndDb.c
source/dnode/mnode/impl/src/mndDb.c
+13
-13
source/dnode/mnode/impl/src/mndDnode.c
source/dnode/mnode/impl/src/mndDnode.c
+4
-4
source/dnode/mnode/impl/src/mndFunc.c
source/dnode/mnode/impl/src/mndFunc.c
+6
-6
source/dnode/mnode/impl/src/mndMain.c
source/dnode/mnode/impl/src/mndMain.c
+13
-13
source/dnode/mnode/impl/src/mndQnode.c
source/dnode/mnode/impl/src/mndQnode.c
+4
-4
source/dnode/mnode/impl/src/mndSma.c
source/dnode/mnode/impl/src/mndSma.c
+8
-8
source/dnode/mnode/impl/src/mndSnode.c
source/dnode/mnode/impl/src/mndSnode.c
+4
-4
source/dnode/mnode/impl/src/mndStb.c
source/dnode/mnode/impl/src/mndStb.c
+33
-33
source/dnode/mnode/impl/src/mndStream.c
source/dnode/mnode/impl/src/mndStream.c
+10
-10
source/dnode/mnode/impl/src/mndSubscribe.c
source/dnode/mnode/impl/src/mndSubscribe.c
+2
-2
source/dnode/mnode/impl/src/mndSync.c
source/dnode/mnode/impl/src/mndSync.c
+7
-7
source/dnode/mnode/impl/src/mndTopic.c
source/dnode/mnode/impl/src/mndTopic.c
+6
-6
source/dnode/mnode/impl/src/mndTrans.c
source/dnode/mnode/impl/src/mndTrans.c
+4
-4
source/dnode/mnode/impl/src/mndUser.c
source/dnode/mnode/impl/src/mndUser.c
+8
-8
source/dnode/mnode/impl/src/mndVgroup.c
source/dnode/mnode/impl/src/mndVgroup.c
+16
-16
source/dnode/mnode/sdb/src/sdb.c
source/dnode/mnode/sdb/src/sdb.c
+5
-5
source/dnode/mnode/sdb/src/sdbFile.c
source/dnode/mnode/sdb/src/sdbFile.c
+20
-20
未找到文件。
include/util/tutil.h
浏览文件 @
3810b5d4
...
...
@@ -62,6 +62,7 @@ static FORCE_INLINE void taosEncryptPass_c(uint8_t *inBuf, size_t len, char *tar
tMD5Final
(
&
context
);
char
buf
[
TSDB_PASSWORD_LEN
+
1
];
buf
[
TSDB_PASSWORD_LEN
]
=
0
;
sprintf
(
buf
,
"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x"
,
context
.
digest
[
0
],
context
.
digest
[
1
],
context
.
digest
[
2
],
context
.
digest
[
3
],
context
.
digest
[
4
],
context
.
digest
[
5
],
context
.
digest
[
6
],
context
.
digest
[
7
],
context
.
digest
[
8
],
context
.
digest
[
9
],
context
.
digest
[
10
],
context
.
digest
[
11
],
...
...
source/dnode/mnode/impl/src/mndAcct.c
浏览文件 @
3810b5d4
...
...
@@ -79,14 +79,14 @@ static int32_t mndCreateDefaultAcct(SMnode *pMnode) {
if
(
pRaw
==
NULL
)
return
-
1
;
sdbSetRawStatus
(
pRaw
,
SDB_STATUS_READY
);
m
Debug
(
"acct:%s, will be created when deploying, raw:%p"
,
acctObj
.
acct
,
pRaw
);
m
Info
(
"acct:%s, will be created when deploying, raw:%p"
,
acctObj
.
acct
,
pRaw
);
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_CONFLICT_NOTHING
,
NULL
,
"create-acct"
);
if
(
pTrans
==
NULL
)
{
mError
(
"acct:%s, failed to create since %s"
,
acctObj
.
acct
,
terrstr
());
return
-
1
;
}
m
Debug
(
"trans:%d, used to create acct:%s"
,
pTrans
->
id
,
acctObj
.
acct
);
m
Info
(
"trans:%d, used to create acct:%s"
,
pTrans
->
id
,
acctObj
.
acct
);
if
(
mndTransAppendCommitlog
(
pTrans
,
pRaw
)
!=
0
)
{
mError
(
"trans:%d, failed to commit redo log since %s"
,
pTrans
->
id
,
terrstr
());
...
...
source/dnode/mnode/impl/src/mndBnode.c
浏览文件 @
3810b5d4
...
...
@@ -249,7 +249,7 @@ static int32_t mndCreateBnode(SMnode *pMnode, SRpcMsg *pReq, SDnodeObj *pDnode,
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_CONFLICT_NOTHING
,
pReq
,
"create-bnode"
);
if
(
pTrans
==
NULL
)
goto
_OVER
;
m
Debug
(
"trans:%d, used to create bnode:%d"
,
pTrans
->
id
,
pCreate
->
dnodeId
);
m
Info
(
"trans:%d, used to create bnode:%d"
,
pTrans
->
id
,
pCreate
->
dnodeId
);
if
(
mndSetCreateBnodeRedoLogs
(
pTrans
,
&
bnodeObj
)
!=
0
)
goto
_OVER
;
if
(
mndSetCreateBnodeUndoLogs
(
pTrans
,
&
bnodeObj
)
!=
0
)
goto
_OVER
;
if
(
mndSetCreateBnodeCommitLogs
(
pTrans
,
&
bnodeObj
)
!=
0
)
goto
_OVER
;
...
...
@@ -276,7 +276,7 @@ static int32_t mndProcessCreateBnodeReq(SRpcMsg *pReq) {
goto
_OVER
;
}
m
Debug
(
"bnode:%d, start to create"
,
createReq
.
dnodeId
);
m
Info
(
"bnode:%d, start to create"
,
createReq
.
dnodeId
);
if
(
mndCheckOperPrivilege
(
pMnode
,
pReq
->
info
.
conn
.
user
,
MND_OPER_CREATE_BNODE
)
!=
0
)
{
goto
_OVER
;
}
...
...
@@ -357,7 +357,7 @@ static int32_t mndDropBnode(SMnode *pMnode, SRpcMsg *pReq, SBnodeObj *pObj) {
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_CONFLICT_NOTHING
,
pReq
,
"drop-bnode"
);
if
(
pTrans
==
NULL
)
goto
_OVER
;
m
Debug
(
"trans:%d, used to drop bnode:%d"
,
pTrans
->
id
,
pObj
->
id
);
m
Info
(
"trans:%d, used to drop bnode:%d"
,
pTrans
->
id
,
pObj
->
id
);
if
(
mndSetDropBnodeRedoLogs
(
pTrans
,
pObj
)
!=
0
)
goto
_OVER
;
if
(
mndSetDropBnodeCommitLogs
(
pTrans
,
pObj
)
!=
0
)
goto
_OVER
;
if
(
mndSetDropBnodeRedoActions
(
pTrans
,
pObj
->
pDnode
,
pObj
)
!=
0
)
goto
_OVER
;
...
...
@@ -381,7 +381,7 @@ static int32_t mndProcessDropBnodeReq(SRpcMsg *pReq) {
goto
_OVER
;
}
m
Debug
(
"bnode:%d, start to drop"
,
dropReq
.
dnodeId
);
m
Info
(
"bnode:%d, start to drop"
,
dropReq
.
dnodeId
);
if
(
mndCheckOperPrivilege
(
pMnode
,
pReq
->
info
.
conn
.
user
,
MND_OPER_DROP_BNODE
)
!=
0
)
{
goto
_OVER
;
}
...
...
source/dnode/mnode/impl/src/mndCluster.c
浏览文件 @
3810b5d4
...
...
@@ -233,14 +233,14 @@ static int32_t mndCreateDefaultCluster(SMnode *pMnode) {
if
(
pRaw
==
NULL
)
return
-
1
;
sdbSetRawStatus
(
pRaw
,
SDB_STATUS_READY
);
m
Debug
(
"cluster:%"
PRId64
", will be created when deploying, raw:%p"
,
clusterObj
.
id
,
pRaw
);
m
Info
(
"cluster:%"
PRId64
", will be created when deploying, raw:%p"
,
clusterObj
.
id
,
pRaw
);
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_CONFLICT_NOTHING
,
NULL
,
"create-cluster"
);
if
(
pTrans
==
NULL
)
{
mError
(
"cluster:%"
PRId64
", failed to create since %s"
,
clusterObj
.
id
,
terrstr
());
return
-
1
;
}
m
Debug
(
"trans:%d, used to create cluster:%"
PRId64
,
pTrans
->
id
,
clusterObj
.
id
);
m
Info
(
"trans:%d, used to create cluster:%"
PRId64
,
pTrans
->
id
,
clusterObj
.
id
);
if
(
mndTransAppendCommitlog
(
pTrans
,
pRaw
)
!=
0
)
{
mError
(
"trans:%d, failed to commit redo log since %s"
,
pTrans
->
id
,
terrstr
());
...
...
source/dnode/mnode/impl/src/mndDb.c
浏览文件 @
3810b5d4
...
...
@@ -544,7 +544,7 @@ static int32_t mndCreateDb(SMnode *pMnode, SRpcMsg *pReq, SCreateDbReq *pCreate,
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_CONFLICT_DB
,
pReq
,
"create-db"
);
if
(
pTrans
==
NULL
)
goto
_OVER
;
// mndTransSetSerial(pTrans);
m
Debug
(
"trans:%d, used to create db:%s"
,
pTrans
->
id
,
pCreate
->
db
);
m
Info
(
"trans:%d, used to create db:%s"
,
pTrans
->
id
,
pCreate
->
db
);
mndTransSetDbName
(
pTrans
,
dbObj
.
name
,
NULL
);
mndTransSetOper
(
pTrans
,
MND_OPER_CREATE_DB
);
...
...
@@ -580,7 +580,7 @@ static int32_t mndProcessCreateDbReq(SRpcMsg *pReq) {
goto
_OVER
;
}
m
Debug
(
"db:%s, start to create, vgroups:%d"
,
createReq
.
db
,
createReq
.
numOfVgroups
);
m
Info
(
"db:%s, start to create, vgroups:%d"
,
createReq
.
db
,
createReq
.
numOfVgroups
);
if
(
mndCheckDbPrivilege
(
pMnode
,
pReq
->
info
.
conn
.
user
,
MND_OPER_CREATE_DB
,
NULL
)
!=
0
)
{
goto
_OVER
;
}
...
...
@@ -588,7 +588,7 @@ static int32_t mndProcessCreateDbReq(SRpcMsg *pReq) {
pDb
=
mndAcquireDb
(
pMnode
,
createReq
.
db
);
if
(
pDb
!=
NULL
)
{
if
(
createReq
.
ignoreExist
)
{
m
Debug
(
"db:%s, already exist, ignore exist is set"
,
createReq
.
db
);
m
Info
(
"db:%s, already exist, ignore exist is set"
,
createReq
.
db
);
code
=
0
;
goto
_OVER
;
}
else
{
...
...
@@ -597,7 +597,7 @@ static int32_t mndProcessCreateDbReq(SRpcMsg *pReq) {
}
}
else
if
(
terrno
==
TSDB_CODE_SDB_OBJ_CREATING
)
{
if
(
mndSetRpcInfoForDbTrans
(
pMnode
,
pReq
,
MND_OPER_CREATE_DB
,
createReq
.
db
)
==
0
)
{
m
Debug
(
"db:%s, is creating and response after trans finished"
,
createReq
.
db
);
m
Info
(
"db:%s, is creating and response after trans finished"
,
createReq
.
db
);
code
=
TSDB_CODE_ACTION_IN_PROGRESS
;
goto
_OVER
;
}
else
{
...
...
@@ -775,7 +775,7 @@ static int32_t mndSetAlterDbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj *
static
int32_t
mndAlterDb
(
SMnode
*
pMnode
,
SRpcMsg
*
pReq
,
SDbObj
*
pOld
,
SDbObj
*
pNew
)
{
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_CONFLICT_DB
,
pReq
,
"alter-db"
);
if
(
pTrans
==
NULL
)
return
-
1
;
m
Debug
(
"trans:%d, used to alter db:%s"
,
pTrans
->
id
,
pOld
->
name
);
m
Info
(
"trans:%d, used to alter db:%s"
,
pTrans
->
id
,
pOld
->
name
);
int32_t
code
=
-
1
;
mndTransSetDbName
(
pTrans
,
pOld
->
name
,
NULL
);
...
...
@@ -802,7 +802,7 @@ static int32_t mndProcessAlterDbReq(SRpcMsg *pReq) {
goto
_OVER
;
}
m
Debug
(
"db:%s, start to alter"
,
alterReq
.
db
);
m
Info
(
"db:%s, start to alter"
,
alterReq
.
db
);
pDb
=
mndAcquireDb
(
pMnode
,
alterReq
.
db
);
if
(
pDb
==
NULL
)
{
...
...
@@ -1030,7 +1030,7 @@ static int32_t mndDropDb(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb) {
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_CONFLICT_DB
,
pReq
,
"drop-db"
);
if
(
pTrans
==
NULL
)
goto
_OVER
;
m
Debug
(
"trans:%d, used to drop db:%s"
,
pTrans
->
id
,
pDb
->
name
);
m
Info
(
"trans:%d, used to drop db:%s"
,
pTrans
->
id
,
pDb
->
name
);
mndTransSetDbName
(
pTrans
,
pDb
->
name
,
NULL
);
if
(
mndCheckTopicExist
(
pMnode
,
pDb
)
<
0
)
goto
_OVER
;
...
...
@@ -1079,7 +1079,7 @@ static int32_t mndProcessDropDbReq(SRpcMsg *pReq) {
goto
_OVER
;
}
m
Debug
(
"db:%s, start to drop"
,
dropReq
.
db
);
m
Info
(
"db:%s, start to drop"
,
dropReq
.
db
);
pDb
=
mndAcquireDb
(
pMnode
,
dropReq
.
db
);
if
(
pDb
==
NULL
)
{
...
...
@@ -1306,11 +1306,11 @@ int32_t mndValidateDbInfo(SMnode *pMnode, SDbVgVersion *pDbs, int32_t numOfDbs,
int32_t
numOfTable
=
mndGetDBTableNum
(
pDb
,
pMnode
);
if
(
pDbVgVersion
->
vgVersion
>=
pDb
->
vgVersion
&&
numOfTable
==
pDbVgVersion
->
numOfTable
)
{
m
Debug
(
"db:%s, version and numOfTable not changed"
,
pDbVgVersion
->
dbFName
);
m
Info
(
"db:%s, version and numOfTable not changed"
,
pDbVgVersion
->
dbFName
);
mndReleaseDb
(
pMnode
,
pDb
);
continue
;
}
else
{
m
Debug
(
"db:%s, vgroup version changed from %d to %d"
,
pDbVgVersion
->
dbFName
,
pDbVgVersion
->
vgVersion
,
m
Info
(
"db:%s, vgroup version changed from %d to %d"
,
pDbVgVersion
->
dbFName
,
pDbVgVersion
->
vgVersion
,
pDb
->
vgVersion
);
}
...
...
@@ -1363,7 +1363,7 @@ static int32_t mndProcessCompactDbReq(SRpcMsg *pReq) {
goto
_OVER
;
}
m
Debug
(
"db:%s, start to compact"
,
compactReq
.
db
);
m
Info
(
"db:%s, start to compact"
,
compactReq
.
db
);
pDb
=
mndAcquireDb
(
pMnode
,
compactReq
.
db
);
if
(
pDb
==
NULL
)
{
...
...
@@ -1413,7 +1413,7 @@ static int32_t mndTrimDb(SMnode *pMnode, SDbObj *pDb) {
if
(
code
!=
0
)
{
mError
(
"vgId:%d, failed to send vnode-trim request to vnode since 0x%x"
,
pVgroup
->
vgId
,
code
);
}
else
{
m
Debug
(
"vgId:%d, send vnode-trim request to vnode, time:%d"
,
pVgroup
->
vgId
,
trimReq
.
timestamp
);
m
Info
(
"vgId:%d, send vnode-trim request to vnode, time:%d"
,
pVgroup
->
vgId
,
trimReq
.
timestamp
);
}
sdbRelease
(
pSdb
,
pVgroup
);
}
...
...
@@ -1432,7 +1432,7 @@ static int32_t mndProcessTrimDbReq(SRpcMsg *pReq) {
goto
_OVER
;
}
m
Debug
(
"db:%s, start to trim"
,
trimReq
.
db
);
m
Info
(
"db:%s, start to trim"
,
trimReq
.
db
);
pDb
=
mndAcquireDb
(
pMnode
,
trimReq
.
db
);
if
(
pDb
==
NULL
)
{
...
...
source/dnode/mnode/impl/src/mndDnode.c
浏览文件 @
3810b5d4
...
...
@@ -106,7 +106,7 @@ static int32_t mndCreateDefaultDnode(SMnode *pMnode) {
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_CONFLICT_GLOBAL
,
NULL
,
"create-dnode"
);
if
(
pTrans
==
NULL
)
goto
_OVER
;
m
Debug
(
"trans:%d, used to create dnode:%s on first deploy"
,
pTrans
->
id
,
dnodeObj
.
ep
);
m
Info
(
"trans:%d, used to create dnode:%s on first deploy"
,
pTrans
->
id
,
dnodeObj
.
ep
);
pRaw
=
mndDnodeActionEncode
(
&
dnodeObj
);
if
(
pRaw
==
NULL
||
mndTransAppendCommitlog
(
pTrans
,
pRaw
)
!=
0
)
goto
_OVER
;
...
...
@@ -326,7 +326,7 @@ static int32_t mndProcessStatusReq(SRpcMsg *pReq) {
if
(
statusReq
.
dnodeId
==
0
)
{
pDnode
=
mndAcquireDnodeByEp
(
pMnode
,
statusReq
.
dnodeEp
);
if
(
pDnode
==
NULL
)
{
m
Debug
(
"dnode:%s, not created yet"
,
statusReq
.
dnodeEp
);
m
Info
(
"dnode:%s, not created yet"
,
statusReq
.
dnodeEp
);
goto
_OVER
;
}
}
else
{
...
...
@@ -435,7 +435,7 @@ static int32_t mndProcessStatusReq(SRpcMsg *pReq) {
mInfo
(
"dnode:%d, from offline to online, memory avail:%"
PRId64
" total:%"
PRId64
" cores:%.2f"
,
pDnode
->
id
,
statusReq
.
memAvail
,
statusReq
.
memTotal
,
statusReq
.
numOfCores
);
}
else
{
m
Debug
(
"dnode:%d, send dnode epset, online:%d dnodeVer:%"
PRId64
":%"
PRId64
" reboot:%d"
,
pDnode
->
id
,
online
,
m
Info
(
"dnode:%d, send dnode epset, online:%d dnodeVer:%"
PRId64
":%"
PRId64
" reboot:%d"
,
pDnode
->
id
,
online
,
statusReq
.
dnodeVer
,
dnodeVer
,
reboot
);
}
...
...
@@ -490,7 +490,7 @@ static int32_t mndCreateDnode(SMnode *pMnode, SRpcMsg *pReq, SCreateDnodeReq *pC
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_CONFLICT_GLOBAL
,
pReq
,
"create-dnode"
);
if
(
pTrans
==
NULL
)
goto
_OVER
;
m
Debug
(
"trans:%d, used to create dnode:%s"
,
pTrans
->
id
,
dnodeObj
.
ep
);
m
Info
(
"trans:%d, used to create dnode:%s"
,
pTrans
->
id
,
dnodeObj
.
ep
);
pRaw
=
mndDnodeActionEncode
(
&
dnodeObj
);
if
(
pRaw
==
NULL
||
mndTransAppendCommitlog
(
pTrans
,
pRaw
)
!=
0
)
goto
_OVER
;
...
...
source/dnode/mnode/impl/src/mndFunc.c
浏览文件 @
3810b5d4
...
...
@@ -222,7 +222,7 @@ static int32_t mndCreateFunc(SMnode *pMnode, SRpcMsg *pReq, SCreateFuncReq *pCre
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_CONFLICT_NOTHING
,
pReq
,
"create-func"
);
if
(
pTrans
==
NULL
)
goto
_OVER
;
m
Debug
(
"trans:%d, used to create func:%s"
,
pTrans
->
id
,
pCreate
->
name
);
m
Info
(
"trans:%d, used to create func:%s"
,
pTrans
->
id
,
pCreate
->
name
);
SSdbRaw
*
pRedoRaw
=
mndFuncActionEncode
(
&
func
);
if
(
pRedoRaw
==
NULL
||
mndTransAppendRedolog
(
pTrans
,
pRedoRaw
)
!=
0
)
goto
_OVER
;
...
...
@@ -252,7 +252,7 @@ static int32_t mndDropFunc(SMnode *pMnode, SRpcMsg *pReq, SFuncObj *pFunc) {
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_CONFLICT_NOTHING
,
pReq
,
"drop-func"
);
if
(
pTrans
==
NULL
)
goto
_OVER
;
m
Debug
(
"trans:%d, used to drop user:%s"
,
pTrans
->
id
,
pFunc
->
name
);
m
Info
(
"trans:%d, used to drop user:%s"
,
pTrans
->
id
,
pFunc
->
name
);
SSdbRaw
*
pRedoRaw
=
mndFuncActionEncode
(
pFunc
);
if
(
pRedoRaw
==
NULL
||
mndTransAppendRedolog
(
pTrans
,
pRedoRaw
)
!=
0
)
goto
_OVER
;
...
...
@@ -286,7 +286,7 @@ static int32_t mndProcessCreateFuncReq(SRpcMsg *pReq) {
goto
_OVER
;
}
m
Debug
(
"func:%s, start to create"
,
createReq
.
name
);
m
Info
(
"func:%s, start to create"
,
createReq
.
name
);
if
(
mndCheckOperPrivilege
(
pMnode
,
pReq
->
info
.
conn
.
user
,
MND_OPER_CREATE_FUNC
)
!=
0
)
{
goto
_OVER
;
}
...
...
@@ -294,7 +294,7 @@ static int32_t mndProcessCreateFuncReq(SRpcMsg *pReq) {
pFunc
=
mndAcquireFunc
(
pMnode
,
createReq
.
name
);
if
(
pFunc
!=
NULL
)
{
if
(
createReq
.
igExists
)
{
m
Debug
(
"func:%s, already exist, ignore exist is set"
,
createReq
.
name
);
m
Info
(
"func:%s, already exist, ignore exist is set"
,
createReq
.
name
);
code
=
0
;
goto
_OVER
;
}
else
{
...
...
@@ -349,7 +349,7 @@ static int32_t mndProcessDropFuncReq(SRpcMsg *pReq) {
goto
_OVER
;
}
m
Debug
(
"func:%s, start to drop"
,
dropReq
.
name
);
m
Info
(
"func:%s, start to drop"
,
dropReq
.
name
);
if
(
mndCheckOperPrivilege
(
pMnode
,
pReq
->
info
.
conn
.
user
,
MND_OPER_DROP_FUNC
)
!=
0
)
{
goto
_OVER
;
}
...
...
@@ -362,7 +362,7 @@ static int32_t mndProcessDropFuncReq(SRpcMsg *pReq) {
pFunc
=
mndAcquireFunc
(
pMnode
,
dropReq
.
name
);
if
(
pFunc
==
NULL
)
{
if
(
dropReq
.
igNotExists
)
{
m
Debug
(
"func:%s, not exist, ignore not exist is set"
,
dropReq
.
name
);
m
Info
(
"func:%s, not exist, ignore not exist is set"
,
dropReq
.
name
);
code
=
0
;
goto
_OVER
;
}
else
{
...
...
source/dnode/mnode/impl/src/mndMain.c
浏览文件 @
3810b5d4
...
...
@@ -65,7 +65,7 @@ static void mndPullupTrans(SMnode *pMnode) {
}
}
static
void
mnd
TtlTimer
(
SMnode
*
pMnode
)
{
static
void
mnd
PullupTtl
(
SMnode
*
pMnode
)
{
int32_t
contLen
=
0
;
void
*
pReq
=
mndBuildTimerMsg
(
&
contLen
);
SRpcMsg
rpcMsg
=
{.
msgType
=
TDMT_MND_TTL_TIMER
,
.
pCont
=
pReq
,
.
contLen
=
contLen
};
...
...
@@ -90,7 +90,7 @@ static void mndPullupTelem(SMnode *pMnode) {
}
}
static
void
mnd
GrantHeartBea
t
(
SMnode
*
pMnode
)
{
static
void
mnd
PullupGran
t
(
SMnode
*
pMnode
)
{
int32_t
contLen
=
0
;
void
*
pReq
=
mndBuildTimerMsg
(
&
contLen
);
if
(
pReq
!=
NULL
)
{
...
...
@@ -121,7 +121,7 @@ static void *mndThreadFp(void *param) {
if
(
mndGetStop
(
pMnode
))
break
;
if
(
lastTime
%
(
tsTtlPushInterval
*
10
)
==
1
)
{
mnd
TtlTimer
(
pMnode
);
mnd
PullupTtl
(
pMnode
);
}
if
(
lastTime
%
(
tsTransPullupInterval
*
10
)
==
0
)
{
...
...
@@ -137,7 +137,7 @@ static void *mndThreadFp(void *param) {
}
if
(
lastTime
%
(
tsGrantHBInterval
*
10
)
==
0
)
{
mnd
GrantHeartBea
t
(
pMnode
);
mnd
PullupGran
t
(
pMnode
);
}
if
((
lastTime
%
(
tsUptimeInterval
*
10
))
==
((
tsUptimeInterval
-
1
)
*
10
))
{
...
...
@@ -300,7 +300,7 @@ static void mndCleanupSteps(SMnode *pMnode, int32_t pos) {
for
(
int32_t
s
=
pos
;
s
>=
0
;
s
--
)
{
SMnodeStep
*
pStep
=
taosArrayGet
(
pMnode
->
pSteps
,
s
);
m
Debug
(
"%s will cleanup"
,
pStep
->
name
);
m
Info
(
"%s will cleanup"
,
pStep
->
name
);
if
(
pStep
->
cleanupFp
!=
NULL
)
{
(
*
pStep
->
cleanupFp
)(
pMnode
);
}
...
...
@@ -324,7 +324,7 @@ static int32_t mndExecSteps(SMnode *pMnode) {
terrno
=
code
;
return
-
1
;
}
else
{
m
Debug
(
"%s is initialized"
,
pStep
->
name
);
m
Info
(
"%s is initialized"
,
pStep
->
name
);
tmsgReportStartup
(
pStep
->
name
,
"initialized"
);
}
}
...
...
@@ -341,7 +341,7 @@ static void mndSetOptions(SMnode *pMnode, const SMnodeOpt *pOption) {
}
SMnode
*
mndOpen
(
const
char
*
path
,
const
SMnodeOpt
*
pOption
)
{
m
Debug
(
"start to open mnode in %s"
,
path
);
m
Info
(
"start to open mnode in %s"
,
path
);
SMnode
*
pMnode
=
taosMemoryCalloc
(
1
,
sizeof
(
SMnode
));
if
(
pMnode
==
NULL
)
{
...
...
@@ -390,7 +390,7 @@ SMnode *mndOpen(const char *path, const SMnodeOpt *pOption) {
return
NULL
;
}
m
Debug
(
"mnode open successfully "
);
m
Info
(
"mnode open successfully "
);
return
pMnode
;
}
...
...
@@ -400,24 +400,24 @@ void mndPreClose(SMnode *pMnode) {
syncLeaderTransfer
(
pMnode
->
syncMgmt
.
sync
);
/*
m
Debug
("vgId:1, mnode start leader transfer");
m
Info
("vgId:1, mnode start leader transfer");
// wait for leader transfer finish
while (!atomic_load_8(&(pMnode->syncMgmt.leaderTransferFinish))) {
taosMsleep(10);
m
Debug
("vgId:1, mnode waiting for leader transfer");
m
Info
("vgId:1, mnode waiting for leader transfer");
}
m
Debug
("vgId:1, mnode finish leader transfer");
m
Info
("vgId:1, mnode finish leader transfer");
*/
}
}
void
mndClose
(
SMnode
*
pMnode
)
{
if
(
pMnode
!=
NULL
)
{
m
Debug
(
"start to close mnode"
);
m
Info
(
"start to close mnode"
);
mndCleanupSteps
(
pMnode
,
-
1
);
taosMemoryFreeClear
(
pMnode
->
path
);
taosMemoryFreeClear
(
pMnode
);
m
Debug
(
"mnode is closed"
);
m
Info
(
"mnode is closed"
);
}
}
...
...
source/dnode/mnode/impl/src/mndQnode.c
浏览文件 @
3810b5d4
...
...
@@ -251,7 +251,7 @@ static int32_t mndCreateQnode(SMnode *pMnode, SRpcMsg *pReq, SDnodeObj *pDnode,
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_CONFLICT_NOTHING
,
pReq
,
"create-qnode"
);
if
(
pTrans
==
NULL
)
goto
_OVER
;
m
Debug
(
"trans:%d, used to create qnode:%d"
,
pTrans
->
id
,
pCreate
->
dnodeId
);
m
Info
(
"trans:%d, used to create qnode:%d"
,
pTrans
->
id
,
pCreate
->
dnodeId
);
if
(
mndSetCreateQnodeRedoLogs
(
pTrans
,
&
qnodeObj
)
!=
0
)
goto
_OVER
;
if
(
mndSetCreateQnodeUndoLogs
(
pTrans
,
&
qnodeObj
)
!=
0
)
goto
_OVER
;
if
(
mndSetCreateQnodeCommitLogs
(
pTrans
,
&
qnodeObj
)
!=
0
)
goto
_OVER
;
...
...
@@ -278,7 +278,7 @@ static int32_t mndProcessCreateQnodeReq(SRpcMsg *pReq) {
goto
_OVER
;
}
m
Debug
(
"qnode:%d, start to create"
,
createReq
.
dnodeId
);
m
Info
(
"qnode:%d, start to create"
,
createReq
.
dnodeId
);
if
(
mndCheckOperPrivilege
(
pMnode
,
pReq
->
info
.
conn
.
user
,
MND_OPER_CREATE_QNODE
)
!=
0
)
{
goto
_OVER
;
}
...
...
@@ -367,7 +367,7 @@ static int32_t mndDropQnode(SMnode *pMnode, SRpcMsg *pReq, SQnodeObj *pObj) {
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_CONFLICT_NOTHING
,
pReq
,
"drop-qnode"
);
if
(
pTrans
==
NULL
)
goto
_OVER
;
m
Debug
(
"trans:%d, used to drop qnode:%d"
,
pTrans
->
id
,
pObj
->
id
);
m
Info
(
"trans:%d, used to drop qnode:%d"
,
pTrans
->
id
,
pObj
->
id
);
if
(
mndSetDropQnodeInfoToTrans
(
pMnode
,
pTrans
,
pObj
)
!=
0
)
goto
_OVER
;
if
(
mndTransPrepare
(
pMnode
,
pTrans
)
!=
0
)
goto
_OVER
;
...
...
@@ -389,7 +389,7 @@ static int32_t mndProcessDropQnodeReq(SRpcMsg *pReq) {
goto
_OVER
;
}
m
Debug
(
"qnode:%d, start to drop"
,
dropReq
.
dnodeId
);
m
Info
(
"qnode:%d, start to drop"
,
dropReq
.
dnodeId
);
if
(
mndCheckOperPrivilege
(
pMnode
,
pReq
->
info
.
conn
.
user
,
MND_OPER_DROP_QNODE
)
!=
0
)
{
goto
_OVER
;
}
...
...
source/dnode/mnode/impl/src/mndSma.c
浏览文件 @
3810b5d4
...
...
@@ -591,7 +591,7 @@ static int32_t mndCreateSma(SMnode *pMnode, SRpcMsg *pReq, SMCreateSmaReq *pCrea
if
(
pTrans
==
NULL
)
goto
_OVER
;
mndTransSetDbName
(
pTrans
,
pDb
->
name
,
NULL
);
mndTransSetSerial
(
pTrans
);
m
Debug
(
"trans:%d, used to create sma:%s stream:%s"
,
pTrans
->
id
,
pCreate
->
name
,
streamObj
.
name
);
m
Info
(
"trans:%d, used to create sma:%s stream:%s"
,
pTrans
->
id
,
pCreate
->
name
,
streamObj
.
name
);
if
(
mndSetCreateSmaRedoLogs
(
pMnode
,
pTrans
,
&
smaObj
)
!=
0
)
goto
_OVER
;
if
(
mndSetCreateSmaVgroupRedoLogs
(
pMnode
,
pTrans
,
&
streamObj
.
fixedSinkVg
)
!=
0
)
goto
_OVER
;
...
...
@@ -603,8 +603,8 @@ static int32_t mndCreateSma(SMnode *pMnode, SRpcMsg *pReq, SMCreateSmaReq *pCrea
if
(
mndPersistStream
(
pMnode
,
pTrans
,
&
streamObj
)
!=
0
)
goto
_OVER
;
if
(
mndTransPrepare
(
pMnode
,
pTrans
)
!=
0
)
goto
_OVER
;
m
Debug
(
"mndSma: create sma index %s %"
PRIi64
" on stb:%"
PRIi64
", dstSuid:%"
PRIi64
" dstTb:%s dstVg:%d"
,
pCreate
->
name
,
smaObj
.
uid
,
smaObj
.
stbUid
,
smaObj
.
dstTbUid
,
smaObj
.
dstTbName
,
smaObj
.
dstVgId
);
m
Info
(
"sma:%s, uid:%"
PRIi64
" create on stb:%"
PRIi64
", dstSuid:%"
PRIi64
" dstTb:%s dstVg:%d"
,
pCreate
->
name
,
smaObj
.
uid
,
smaObj
.
stbUid
,
smaObj
.
dstTbUid
,
smaObj
.
dstTbName
,
smaObj
.
dstVgId
);
code
=
0
;
...
...
@@ -665,7 +665,7 @@ static int32_t mndProcessCreateSmaReq(SRpcMsg *pReq) {
goto
_OVER
;
}
m
Debug
(
"sma:%s, start to create"
,
createReq
.
name
);
m
Info
(
"sma:%s, start to create"
,
createReq
.
name
);
if
(
mndCheckCreateSmaReq
(
&
createReq
)
!=
0
)
{
goto
_OVER
;
}
...
...
@@ -689,7 +689,7 @@ static int32_t mndProcessCreateSmaReq(SRpcMsg *pReq) {
pSma
=
mndAcquireSma
(
pMnode
,
createReq
.
name
);
if
(
pSma
!=
NULL
)
{
if
(
createReq
.
igExists
)
{
m
Debug
(
"sma:%s, already exist in sma:%s, ignore exist is set"
,
createReq
.
name
,
pSma
->
name
);
m
Info
(
"sma:%s, already exist in sma:%s, ignore exist is set"
,
createReq
.
name
,
pSma
->
name
);
code
=
0
;
goto
_OVER
;
}
else
{
...
...
@@ -802,7 +802,7 @@ static int32_t mndDropSma(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SSmaObj *p
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_CONFLICT_DB
,
pReq
,
"drop-sma"
);
if
(
pTrans
==
NULL
)
goto
_OVER
;
m
Debug
(
"trans:%d, used to drop sma:%s"
,
pTrans
->
id
,
pSma
->
name
);
m
Info
(
"trans:%d, used to drop sma:%s"
,
pTrans
->
id
,
pSma
->
name
);
mndTransSetDbName
(
pTrans
,
pDb
->
name
,
NULL
);
mndTransSetSerial
(
pTrans
);
...
...
@@ -929,12 +929,12 @@ static int32_t mndProcessDropSmaReq(SRpcMsg *pReq) {
goto
_OVER
;
}
m
Debug
(
"sma:%s, start to drop"
,
dropReq
.
name
);
m
Info
(
"sma:%s, start to drop"
,
dropReq
.
name
);
pSma
=
mndAcquireSma
(
pMnode
,
dropReq
.
name
);
if
(
pSma
==
NULL
)
{
if
(
dropReq
.
igNotExists
)
{
m
Debug
(
"sma:%s, not exist, ignore not exist is set"
,
dropReq
.
name
);
m
Info
(
"sma:%s, not exist, ignore not exist is set"
,
dropReq
.
name
);
code
=
0
;
goto
_OVER
;
}
else
{
...
...
source/dnode/mnode/impl/src/mndSnode.c
浏览文件 @
3810b5d4
...
...
@@ -256,7 +256,7 @@ static int32_t mndCreateSnode(SMnode *pMnode, SRpcMsg *pReq, SDnodeObj *pDnode,
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_CONFLICT_NOTHING
,
pReq
,
"create-snode"
);
if
(
pTrans
==
NULL
)
goto
_OVER
;
m
Debug
(
"trans:%d, used to create snode:%d"
,
pTrans
->
id
,
pCreate
->
dnodeId
);
m
Info
(
"trans:%d, used to create snode:%d"
,
pTrans
->
id
,
pCreate
->
dnodeId
);
if
(
mndSetCreateSnodeRedoLogs
(
pTrans
,
&
snodeObj
)
!=
0
)
goto
_OVER
;
if
(
mndSetCreateSnodeUndoLogs
(
pTrans
,
&
snodeObj
)
!=
0
)
goto
_OVER
;
...
...
@@ -287,7 +287,7 @@ static int32_t mndProcessCreateSnodeReq(SRpcMsg *pReq) {
goto
_OVER
;
}
m
Debug
(
"snode:%d, start to create"
,
createReq
.
dnodeId
);
m
Info
(
"snode:%d, start to create"
,
createReq
.
dnodeId
);
if
(
mndCheckOperPrivilege
(
pMnode
,
pReq
->
info
.
conn
.
user
,
MND_OPER_CREATE_SNODE
)
!=
0
)
{
goto
_OVER
;
}
...
...
@@ -378,7 +378,7 @@ static int32_t mndDropSnode(SMnode *pMnode, SRpcMsg *pReq, SSnodeObj *pObj) {
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_CONFLICT_NOTHING
,
pReq
,
"drop-snode"
);
if
(
pTrans
==
NULL
)
goto
_OVER
;
m
Debug
(
"trans:%d, used to drop snode:%d"
,
pTrans
->
id
,
pObj
->
id
);
m
Info
(
"trans:%d, used to drop snode:%d"
,
pTrans
->
id
,
pObj
->
id
);
if
(
mndSetDropSnodeInfoToTrans
(
pMnode
,
pTrans
,
pObj
)
!=
0
)
goto
_OVER
;
if
(
mndTransPrepare
(
pMnode
,
pTrans
)
!=
0
)
goto
_OVER
;
...
...
@@ -403,7 +403,7 @@ static int32_t mndProcessDropSnodeReq(SRpcMsg *pReq) {
goto
_OVER
;
}
m
Debug
(
"snode:%d, start to drop"
,
dropReq
.
dnodeId
);
m
Info
(
"snode:%d, start to drop"
,
dropReq
.
dnodeId
);
if
(
mndCheckOperPrivilege
(
pMnode
,
pReq
->
info
.
conn
.
user
,
MND_OPER_DROP_SNODE
)
!=
0
)
{
goto
_OVER
;
}
...
...
source/dnode/mnode/impl/src/mndStb.c
浏览文件 @
3810b5d4
...
...
@@ -803,7 +803,7 @@ static int32_t mndCreateStb(SMnode *pMnode, SRpcMsg *pReq, SMCreateStbReq *pCrea
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_CONFLICT_DB_INSIDE
,
pReq
,
"create-stb"
);
if
(
pTrans
==
NULL
)
goto
_OVER
;
m
Debug
(
"trans:%d, used to create stb:%s"
,
pTrans
->
id
,
pCreate
->
name
);
m
Info
(
"trans:%d, used to create stb:%s"
,
pTrans
->
id
,
pCreate
->
name
);
if
(
mndBuildStbFromReq
(
pMnode
,
&
stbObj
,
pCreate
,
pDb
)
!=
0
)
goto
_OVER
;
if
(
mndAddStbToTrans
(
pMnode
,
pTrans
,
pDb
,
&
stbObj
)
<
0
)
goto
_OVER
;
if
(
mndTransPrepare
(
pMnode
,
pTrans
)
!=
0
)
goto
_OVER
;
...
...
@@ -854,7 +854,7 @@ static int32_t mndProcessTtlTimer(SRpcMsg *pReq) {
if
(
code
!=
0
)
{
mError
(
"vgId:%d, failed to send drop ttl table request to vnode since 0x%x"
,
pVgroup
->
vgId
,
code
);
}
else
{
m
Debug
(
"vgId:%d, send drop ttl table request to vnode, time:%d"
,
pVgroup
->
vgId
,
ttlReq
.
timestamp
);
m
Info
(
"vgId:%d, send drop ttl table request to vnode, time:%d"
,
pVgroup
->
vgId
,
ttlReq
.
timestamp
);
}
sdbRelease
(
pSdb
,
pVgroup
);
}
...
...
@@ -943,7 +943,7 @@ static int32_t mndProcessCreateStbReq(SRpcMsg *pReq) {
goto
_OVER
;
}
m
Debug
(
"stb:%s, start to create"
,
createReq
.
name
);
m
Info
(
"stb:%s, start to create"
,
createReq
.
name
);
if
(
mndCheckCreateStbReq
(
&
createReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
_OVER
;
...
...
@@ -953,7 +953,7 @@ static int32_t mndProcessCreateStbReq(SRpcMsg *pReq) {
if
(
pStb
!=
NULL
)
{
if
(
createReq
.
igExists
)
{
if
(
createReq
.
source
==
TD_REQ_FROM_APP
)
{
m
Debug
(
"stb:%s, already exist, ignore exist is set"
,
createReq
.
name
);
m
Info
(
"stb:%s, already exist, ignore exist is set"
,
createReq
.
name
);
code
=
0
;
goto
_OVER
;
}
else
if
(
pStb
->
uid
!=
createReq
.
suid
)
{
...
...
@@ -1144,7 +1144,7 @@ static int32_t mndAddSuperTableTag(const SStbObj *pOld, SStbObj *pNew, SArray *p
pSchema
->
colId
=
pNew
->
nextColId
;
pNew
->
nextColId
++
;
m
Debug
(
"stb:%s, start to add tag %s"
,
pNew
->
name
,
pSchema
->
name
);
m
Info
(
"stb:%s, start to add tag %s"
,
pNew
->
name
,
pSchema
->
name
);
}
pNew
->
tagVer
++
;
...
...
@@ -1159,7 +1159,7 @@ static int32_t mndCheckAlterColForTopic(SMnode *pMnode, const char *stbFullName,
pIter
=
sdbFetch
(
pSdb
,
SDB_TOPIC
,
pIter
,
(
void
**
)
&
pTopic
);
if
(
pIter
==
NULL
)
break
;
m
Debug
(
"topic:%s, check tag and column modifiable, stb:%s suid:%"
PRId64
" colId:%d, subType:%d sql:%s"
,
m
Info
(
"topic:%s, check tag and column modifiable, stb:%s suid:%"
PRId64
" colId:%d, subType:%d sql:%s"
,
pTopic
->
name
,
stbFullName
,
suid
,
colId
,
pTopic
->
subType
,
pTopic
->
sql
);
if
(
pTopic
->
subType
!=
TOPIC_SUB_TYPE__COLUMN
)
{
sdbRelease
(
pSdb
,
pTopic
);
...
...
@@ -1177,11 +1177,11 @@ static int32_t mndCheckAlterColForTopic(SMnode *pMnode, const char *stbFullName,
SNode
*
pNode
=
NULL
;
FOREACH
(
pNode
,
pNodeList
)
{
SColumnNode
*
pCol
=
(
SColumnNode
*
)
pNode
;
m
Debug
(
"topic:%s, check colId:%d tableId:%"
PRId64
" ctbStbUid:%"
PRId64
,
pTopic
->
name
,
pCol
->
colId
,
m
Info
(
"topic:%s, check colId:%d tableId:%"
PRId64
" ctbStbUid:%"
PRId64
,
pTopic
->
name
,
pCol
->
colId
,
pCol
->
tableId
,
pTopic
->
ctbStbUid
);
if
(
pCol
->
tableId
!=
suid
&&
pTopic
->
ctbStbUid
!=
suid
)
{
m
Debug
(
"topic:%s, check colId:%d passed"
,
pTopic
->
name
,
pCol
->
colId
);
m
Info
(
"topic:%s, check colId:%d passed"
,
pTopic
->
name
,
pCol
->
colId
);
goto
NEXT
;
}
if
(
pCol
->
colId
>
0
&&
pCol
->
colId
==
colId
)
{
...
...
@@ -1192,7 +1192,7 @@ static int32_t mndCheckAlterColForTopic(SMnode *pMnode, const char *stbFullName,
mError
(
"topic:%s, check colId:%d conflicted"
,
pTopic
->
name
,
pCol
->
colId
);
return
-
1
;
}
m
Debug
(
"topic:%s, check colId:%d passed"
,
pTopic
->
name
,
pCol
->
colId
);
m
Info
(
"topic:%s, check colId:%d passed"
,
pTopic
->
name
,
pCol
->
colId
);
}
NEXT:
...
...
@@ -1224,7 +1224,7 @@ static int32_t mndCheckAlterColForStream(SMnode *pMnode, const char *stbFullName
SColumnNode
*
pCol
=
(
SColumnNode
*
)
pNode
;
if
(
pCol
->
tableId
!=
suid
)
{
m
Debug
(
"stream:%s, check colId:%d passed"
,
pStream
->
name
,
pCol
->
colId
);
m
Info
(
"stream:%s, check colId:%d passed"
,
pStream
->
name
,
pCol
->
colId
);
goto
NEXT
;
}
if
(
pCol
->
colId
>
0
&&
pCol
->
colId
==
colId
)
{
...
...
@@ -1235,7 +1235,7 @@ static int32_t mndCheckAlterColForStream(SMnode *pMnode, const char *stbFullName
mError
(
"stream:%s, check colId:%d conflicted"
,
pStream
->
name
,
pCol
->
colId
);
return
-
1
;
}
m
Debug
(
"stream:%s, check colId:%d passed"
,
pStream
->
name
,
pCol
->
colId
);
m
Info
(
"stream:%s, check colId:%d passed"
,
pStream
->
name
,
pCol
->
colId
);
}
NEXT:
...
...
@@ -1254,7 +1254,7 @@ static int32_t mndCheckAlterColForTSma(SMnode *pMnode, const char *stbFullName,
pIter
=
sdbFetch
(
pSdb
,
SDB_SMA
,
pIter
,
(
void
**
)
&
pSma
);
if
(
pIter
==
NULL
)
break
;
m
Debug
(
"tsma:%s, check tag and column modifiable, stb:%s suid:%"
PRId64
" colId:%d, sql:%s"
,
pSma
->
name
,
m
Info
(
"tsma:%s, check tag and column modifiable, stb:%s suid:%"
PRId64
" colId:%d, sql:%s"
,
pSma
->
name
,
stbFullName
,
suid
,
colId
,
pSma
->
sql
);
SNode
*
pAst
=
NULL
;
...
...
@@ -1270,10 +1270,10 @@ static int32_t mndCheckAlterColForTSma(SMnode *pMnode, const char *stbFullName,
SNode
*
pNode
=
NULL
;
FOREACH
(
pNode
,
pNodeList
)
{
SColumnNode
*
pCol
=
(
SColumnNode
*
)
pNode
;
m
Debug
(
"tsma:%s, check colId:%d tableId:%"
PRId64
,
pSma
->
name
,
pCol
->
colId
,
pCol
->
tableId
);
m
Info
(
"tsma:%s, check colId:%d tableId:%"
PRId64
,
pSma
->
name
,
pCol
->
colId
,
pCol
->
tableId
);
if
((
pCol
->
tableId
!=
suid
)
&&
(
pSma
->
stbUid
!=
suid
))
{
m
Debug
(
"tsma:%s, check colId:%d passed"
,
pSma
->
name
,
pCol
->
colId
);
m
Info
(
"tsma:%s, check colId:%d passed"
,
pSma
->
name
,
pCol
->
colId
);
goto
NEXT
;
}
if
((
pCol
->
colId
)
>
0
&&
(
pCol
->
colId
==
colId
))
{
...
...
@@ -1284,7 +1284,7 @@ static int32_t mndCheckAlterColForTSma(SMnode *pMnode, const char *stbFullName,
mError
(
"tsma:%s, check colId:%d conflicted"
,
pSma
->
name
,
pCol
->
colId
);
return
-
1
;
}
m
Debug
(
"tsma:%s, check colId:%d passed"
,
pSma
->
name
,
pCol
->
colId
);
m
Info
(
"tsma:%s, check colId:%d passed"
,
pSma
->
name
,
pCol
->
colId
);
}
NEXT:
...
...
@@ -1329,7 +1329,7 @@ static int32_t mndDropSuperTableTag(SMnode *pMnode, const SStbObj *pOld, SStbObj
pNew
->
numOfTags
--
;
pNew
->
tagVer
++
;
m
Debug
(
"stb:%s, start to drop tag %s"
,
pNew
->
name
,
tagName
);
m
Info
(
"stb:%s, start to drop tag %s"
,
pNew
->
name
,
tagName
);
return
0
;
}
...
...
@@ -1374,7 +1374,7 @@ static int32_t mndAlterStbTagName(SMnode *pMnode, const SStbObj *pOld, SStbObj *
memcpy
(
pSchema
->
name
,
newTagName
,
TSDB_COL_NAME_LEN
);
pNew
->
tagVer
++
;
m
Debug
(
"stb:%s, start to modify tag %s to %s"
,
pNew
->
name
,
oldTagName
,
newTagName
);
m
Info
(
"stb:%s, start to modify tag %s to %s"
,
pNew
->
name
,
oldTagName
,
newTagName
);
return
0
;
}
...
...
@@ -1409,7 +1409,7 @@ static int32_t mndAlterStbTagBytes(SMnode *pMnode, const SStbObj *pOld, SStbObj
pTag
->
bytes
=
pField
->
bytes
;
pNew
->
tagVer
++
;
m
Debug
(
"stb:%s, start to modify tag len %s to %d"
,
pNew
->
name
,
pField
->
name
,
pField
->
bytes
);
m
Info
(
"stb:%s, start to modify tag len %s to %d"
,
pNew
->
name
,
pField
->
name
,
pField
->
bytes
);
return
0
;
}
...
...
@@ -1443,7 +1443,7 @@ static int32_t mndAddSuperTableColumn(const SStbObj *pOld, SStbObj *pNew, SArray
pSchema
->
colId
=
pNew
->
nextColId
;
pNew
->
nextColId
++
;
m
Debug
(
"stb:%s, start to add column %s"
,
pNew
->
name
,
pSchema
->
name
);
m
Info
(
"stb:%s, start to add column %s"
,
pNew
->
name
,
pSchema
->
name
);
}
pNew
->
colVer
++
;
...
...
@@ -1480,7 +1480,7 @@ static int32_t mndDropSuperTableColumn(SMnode *pMnode, const SStbObj *pOld, SStb
pNew
->
numOfColumns
--
;
pNew
->
colVer
++
;
m
Debug
(
"stb:%s, start to drop col %s"
,
pNew
->
name
,
colName
);
m
Info
(
"stb:%s, start to drop col %s"
,
pNew
->
name
,
colName
);
return
0
;
}
...
...
@@ -1524,7 +1524,7 @@ static int32_t mndAlterStbColumnBytes(SMnode *pMnode, const SStbObj *pOld, SStbO
pCol
->
bytes
=
pField
->
bytes
;
pNew
->
colVer
++
;
m
Debug
(
"stb:%s, start to modify col len %s to %d"
,
pNew
->
name
,
pField
->
name
,
pField
->
bytes
);
m
Info
(
"stb:%s, start to modify col len %s to %d"
,
pNew
->
name
,
pField
->
name
,
pField
->
bytes
);
return
0
;
}
...
...
@@ -1846,7 +1846,7 @@ static int32_t mndAlterStbImp(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SStbOb
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_CONFLICT_DB_INSIDE
,
pReq
,
"alter-stb"
);
if
(
pTrans
==
NULL
)
goto
_OVER
;
m
Debug
(
"trans:%d, used to alter stb:%s"
,
pTrans
->
id
,
pStb
->
name
);
m
Info
(
"trans:%d, used to alter stb:%s"
,
pTrans
->
id
,
pStb
->
name
);
mndTransSetDbName
(
pTrans
,
pDb
->
name
,
pStb
->
name
);
if
(
needRsp
)
{
...
...
@@ -1942,7 +1942,7 @@ static int32_t mndProcessAlterStbReq(SRpcMsg *pReq) {
goto
_OVER
;
}
m
Debug
(
"stb:%s, start to alter"
,
alterReq
.
name
);
m
Info
(
"stb:%s, start to alter"
,
alterReq
.
name
);
if
(
mndCheckAlterStbReq
(
&
alterReq
)
!=
0
)
goto
_OVER
;
pDb
=
mndAcquireDbByStb
(
pMnode
,
alterReq
.
name
);
...
...
@@ -2045,7 +2045,7 @@ static int32_t mndDropStb(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SStbObj *p
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_CONFLICT_DB_INSIDE
,
pReq
,
"drop-stb"
);
if
(
pTrans
==
NULL
)
goto
_OVER
;
m
Debug
(
"trans:%d, used to drop stb:%s"
,
pTrans
->
id
,
pStb
->
name
);
m
Info
(
"trans:%d, used to drop stb:%s"
,
pTrans
->
id
,
pStb
->
name
);
mndTransSetDbName
(
pTrans
,
pDb
->
name
,
pStb
->
name
);
if
(
mndSetDropStbRedoLogs
(
pMnode
,
pTrans
,
pStb
)
!=
0
)
goto
_OVER
;
...
...
@@ -2169,12 +2169,12 @@ static int32_t mndProcessDropStbReq(SRpcMsg *pReq) {
goto
_OVER
;
}
m
Debug
(
"stb:%s, start to drop"
,
dropReq
.
name
);
m
Info
(
"stb:%s, start to drop"
,
dropReq
.
name
);
pStb
=
mndAcquireStb
(
pMnode
,
dropReq
.
name
);
if
(
pStb
==
NULL
)
{
if
(
dropReq
.
igNotExists
)
{
m
Debug
(
"stb:%s, not exist, ignore not exist is set"
,
dropReq
.
name
);
m
Info
(
"stb:%s, not exist, ignore not exist is set"
,
dropReq
.
name
);
code
=
0
;
goto
_OVER
;
}
else
{
...
...
@@ -2237,17 +2237,17 @@ static int32_t mndProcessTableMetaReq(SRpcMsg *pReq) {
}
if
(
0
==
strcmp
(
infoReq
.
dbFName
,
TSDB_INFORMATION_SCHEMA_DB
))
{
m
Debug
(
"information_schema table:%s.%s, start to retrieve meta"
,
infoReq
.
dbFName
,
infoReq
.
tbName
);
m
Info
(
"information_schema table:%s.%s, start to retrieve meta"
,
infoReq
.
dbFName
,
infoReq
.
tbName
);
if
(
mndBuildInsTableSchema
(
pMnode
,
infoReq
.
dbFName
,
infoReq
.
tbName
,
sysinfo
,
&
metaRsp
)
!=
0
)
{
goto
_OVER
;
}
}
else
if
(
0
==
strcmp
(
infoReq
.
dbFName
,
TSDB_PERFORMANCE_SCHEMA_DB
))
{
m
Debug
(
"performance_schema table:%s.%s, start to retrieve meta"
,
infoReq
.
dbFName
,
infoReq
.
tbName
);
m
Info
(
"performance_schema table:%s.%s, start to retrieve meta"
,
infoReq
.
dbFName
,
infoReq
.
tbName
);
if
(
mndBuildPerfsTableSchema
(
pMnode
,
infoReq
.
dbFName
,
infoReq
.
tbName
,
&
metaRsp
)
!=
0
)
{
goto
_OVER
;
}
}
else
{
m
Debug
(
"stb:%s.%s, start to retrieve meta"
,
infoReq
.
dbFName
,
infoReq
.
tbName
);
m
Info
(
"stb:%s.%s, start to retrieve meta"
,
infoReq
.
dbFName
,
infoReq
.
tbName
);
if
(
mndBuildStbSchema
(
pMnode
,
infoReq
.
dbFName
,
infoReq
.
tbName
,
&
metaRsp
,
NULL
)
!=
0
)
{
goto
_OVER
;
}
...
...
@@ -2294,17 +2294,17 @@ static int32_t mndProcessTableCfgReq(SRpcMsg *pReq) {
}
if
(
0
==
strcmp
(
cfgReq
.
dbFName
,
TSDB_INFORMATION_SCHEMA_DB
))
{
m
Debug
(
"information_schema table:%s.%s, start to retrieve cfg"
,
cfgReq
.
dbFName
,
cfgReq
.
tbName
);
m
Info
(
"information_schema table:%s.%s, start to retrieve cfg"
,
cfgReq
.
dbFName
,
cfgReq
.
tbName
);
if
(
mndBuildInsTableCfg
(
pMnode
,
cfgReq
.
dbFName
,
cfgReq
.
tbName
,
&
cfgRsp
)
!=
0
)
{
goto
_OVER
;
}
}
else
if
(
0
==
strcmp
(
cfgReq
.
dbFName
,
TSDB_PERFORMANCE_SCHEMA_DB
))
{
m
Debug
(
"performance_schema table:%s.%s, start to retrieve cfg"
,
cfgReq
.
dbFName
,
cfgReq
.
tbName
);
m
Info
(
"performance_schema table:%s.%s, start to retrieve cfg"
,
cfgReq
.
dbFName
,
cfgReq
.
tbName
);
if
(
mndBuildPerfsTableCfg
(
pMnode
,
cfgReq
.
dbFName
,
cfgReq
.
tbName
,
&
cfgRsp
)
!=
0
)
{
goto
_OVER
;
}
}
else
{
m
Debug
(
"stb:%s.%s, start to retrieve cfg"
,
cfgReq
.
dbFName
,
cfgReq
.
tbName
);
m
Info
(
"stb:%s.%s, start to retrieve cfg"
,
cfgReq
.
dbFName
,
cfgReq
.
tbName
);
if
(
mndBuildStbCfg
(
pMnode
,
cfgReq
.
dbFName
,
cfgReq
.
tbName
,
&
cfgRsp
)
!=
0
)
{
goto
_OVER
;
}
...
...
@@ -2363,7 +2363,7 @@ int32_t mndValidateStbInfo(SMnode *pMnode, SSTableVersion *pStbVersions, int32_t
STableMetaRsp
metaRsp
=
{
0
};
int32_t
smaVer
=
0
;
m
Debug
(
"stb:%s.%s, start to retrieve meta"
,
pStbVersion
->
dbFName
,
pStbVersion
->
stbName
);
m
Info
(
"stb:%s.%s, start to retrieve meta"
,
pStbVersion
->
dbFName
,
pStbVersion
->
stbName
);
if
(
mndBuildStbSchema
(
pMnode
,
pStbVersion
->
dbFName
,
pStbVersion
->
stbName
,
&
metaRsp
,
&
smaVer
)
!=
0
)
{
metaRsp
.
numOfColumns
=
-
1
;
metaRsp
.
suid
=
pStbVersion
->
suid
;
...
...
source/dnode/mnode/impl/src/mndStream.c
浏览文件 @
3810b5d4
...
...
@@ -266,7 +266,7 @@ static int32_t mndBuildStreamObjFromCreateReq(SMnode *pMnode, SStreamObj *pObj,
SNode
*
pAst
=
NULL
;
SQueryPlan
*
pPlan
=
NULL
;
m
Debug
(
"stream:%s to create"
,
pCreate
->
name
);
m
Info
(
"stream:%s to create"
,
pCreate
->
name
);
memcpy
(
pObj
->
name
,
pCreate
->
name
,
TSDB_STREAM_FNAME_LEN
);
pObj
->
createTime
=
taosGetTimestampMs
();
pObj
->
updateTime
=
pObj
->
createTime
;
...
...
@@ -285,7 +285,7 @@ static int32_t mndBuildStreamObjFromCreateReq(SMnode *pMnode, SStreamObj *pObj,
SDbObj
*
pSourceDb
=
mndAcquireDb
(
pMnode
,
pCreate
->
sourceDB
);
if
(
pSourceDb
==
NULL
)
{
/*ASSERT(0);*/
m
Debug
(
"stream:%s failed to create, source db %s not exist"
,
pCreate
->
name
,
pObj
->
sourceDb
);
m
Info
(
"stream:%s failed to create, source db %s not exist"
,
pCreate
->
name
,
pObj
->
sourceDb
);
terrno
=
TSDB_CODE_MND_DB_NOT_EXIST
;
return
-
1
;
}
...
...
@@ -295,7 +295,7 @@ static int32_t mndBuildStreamObjFromCreateReq(SMnode *pMnode, SStreamObj *pObj,
SDbObj
*
pTargetDb
=
mndAcquireDbByStb
(
pMnode
,
pObj
->
targetSTbName
);
if
(
pTargetDb
==
NULL
)
{
m
Debug
(
"stream:%s failed to create, target db %s not exist"
,
pCreate
->
name
,
pObj
->
targetDb
);
m
Info
(
"stream:%s failed to create, target db %s not exist"
,
pCreate
->
name
,
pObj
->
targetDb
);
terrno
=
TSDB_CODE_MND_DB_NOT_EXIST
;
return
-
1
;
}
...
...
@@ -638,7 +638,7 @@ static int32_t mndProcessCreateStreamReq(SRpcMsg *pReq) {
goto
_OVER
;
}
m
Debug
(
"stream:%s, start to create, sql:%s"
,
createStreamReq
.
name
,
createStreamReq
.
sql
);
m
Info
(
"stream:%s, start to create, sql:%s"
,
createStreamReq
.
name
,
createStreamReq
.
sql
);
if
(
mndCheckCreateStreamReq
(
&
createStreamReq
)
!=
0
)
{
mError
(
"stream:%s, failed to create since %s"
,
createStreamReq
.
name
,
terrstr
());
...
...
@@ -648,7 +648,7 @@ static int32_t mndProcessCreateStreamReq(SRpcMsg *pReq) {
pStream
=
mndAcquireStream
(
pMnode
,
createStreamReq
.
name
);
if
(
pStream
!=
NULL
)
{
if
(
createStreamReq
.
igExists
)
{
m
Debug
(
"stream:%s, already exist, ignore exist is set"
,
createStreamReq
.
name
);
m
Info
(
"stream:%s, already exist, ignore exist is set"
,
createStreamReq
.
name
);
code
=
0
;
goto
_OVER
;
}
else
{
...
...
@@ -672,7 +672,7 @@ static int32_t mndProcessCreateStreamReq(SRpcMsg *pReq) {
goto
_OVER
;
}
mndTransSetDbName
(
pTrans
,
createStreamReq
.
sourceDB
,
streamObj
.
targetDb
);
// hack way
m
Debug
(
"trans:%d, used to create stream:%s"
,
pTrans
->
id
,
createStreamReq
.
name
);
m
Info
(
"trans:%d, used to create stream:%s"
,
pTrans
->
id
,
createStreamReq
.
name
);
// create stb for stream
if
(
mndCreateStbForStream
(
pMnode
,
pTrans
,
&
streamObj
,
pReq
->
info
.
conn
.
user
)
<
0
)
{
...
...
@@ -746,7 +746,7 @@ static int32_t mndProcessDropStreamReq(SRpcMsg *pReq) {
if
(
pStream
==
NULL
)
{
if
(
dropReq
.
igNotExists
)
{
m
Debug
(
"stream:%s, not exist, ignore not exist is set"
,
dropReq
.
name
);
m
Info
(
"stream:%s, not exist, ignore not exist is set"
,
dropReq
.
name
);
sdbRelease
(
pMnode
->
pSdb
,
pStream
);
return
0
;
}
else
{
...
...
@@ -765,7 +765,7 @@ static int32_t mndProcessDropStreamReq(SRpcMsg *pReq) {
sdbRelease
(
pMnode
->
pSdb
,
pStream
);
return
-
1
;
}
m
Debug
(
"trans:%d, used to drop stream:%s"
,
pTrans
->
id
,
dropReq
.
name
);
m
Info
(
"trans:%d, used to drop stream:%s"
,
pTrans
->
id
,
dropReq
.
name
);
// drop all tasks
if
(
mndDropStreamTasks
(
pMnode
,
pTrans
,
pStream
)
<
0
)
{
...
...
@@ -810,7 +810,7 @@ static int32_t mndProcessRecoverStreamReq(SRpcMsg *pReq) {
if (pStream == NULL) {
if (recoverReq.igNotExists) {
m
Debug
("stream:%s, not exist, ignore not exist is set", recoverReq.name);
m
Info
("stream:%s, not exist, ignore not exist is set", recoverReq.name);
sdbRelease(pMnode->pSdb, pStream);
return 0;
} else {
...
...
@@ -829,7 +829,7 @@ static int32_t mndProcessRecoverStreamReq(SRpcMsg *pReq) {
sdbRelease(pMnode->pSdb, pStream);
return -1;
}
m
Debug
("trans:%d, used to drop stream:%s", pTrans->id, recoverReq.name);
m
Info
("trans:%d, used to drop stream:%s", pTrans->id, recoverReq.name);
// broadcast to recover all tasks
if (mndRecoverStreamTasks(pMnode, pTrans, pStream) < 0) {
...
...
source/dnode/mnode/impl/src/mndSubscribe.c
浏览文件 @
3810b5d4
...
...
@@ -658,7 +658,7 @@ static int32_t mndProcessDropCgroupReq(SRpcMsg *pReq) {
SMqSubscribeObj
*
pSub
=
mndAcquireSubscribe
(
pMnode
,
dropReq
.
cgroup
,
dropReq
.
topic
);
if
(
pSub
==
NULL
)
{
if
(
dropReq
.
igNotExists
)
{
m
Debug
(
"cgroup:%s on topic:%s, not exist, ignore not exist is set"
,
dropReq
.
cgroup
,
dropReq
.
topic
);
m
Info
(
"cgroup:%s on topic:%s, not exist, ignore not exist is set"
,
dropReq
.
cgroup
,
dropReq
.
topic
);
return
0
;
}
else
{
terrno
=
TSDB_CODE_MND_SUBSCRIBE_NOT_EXIST
;
...
...
@@ -681,7 +681,7 @@ static int32_t mndProcessDropCgroupReq(SRpcMsg *pReq) {
return
-
1
;
}
m
Debug
(
"trans:%d, used to drop cgroup:%s on topic %s"
,
pTrans
->
id
,
dropReq
.
cgroup
,
dropReq
.
topic
);
m
Info
(
"trans:%d, used to drop cgroup:%s on topic %s"
,
pTrans
->
id
,
dropReq
.
cgroup
,
dropReq
.
topic
);
if
(
mndDropOffsetBySubKey
(
pMnode
,
pTrans
,
pSub
->
key
)
<
0
)
{
ASSERT
(
0
);
...
...
source/dnode/mnode/impl/src/mndSync.c
浏览文件 @
3810b5d4
...
...
@@ -105,11 +105,11 @@ void mndRestoreFinish(struct SSyncFSM *pFsm) {
SMnode
*
pMnode
=
pFsm
->
data
;
if
(
!
pMnode
->
deploy
)
{
mInfo
(
"
mnode
sync restore finished, and will handle outstanding transactions"
);
mInfo
(
"
vgId:1,
sync restore finished, and will handle outstanding transactions"
);
mndTransPullup
(
pMnode
);
mndSetRestore
(
pMnode
,
true
);
}
else
{
mInfo
(
"
mnode
sync restore finished"
);
mInfo
(
"
vgId:1,
sync restore finished"
);
}
}
...
...
@@ -228,7 +228,7 @@ int32_t mndInitSync(SMnode *pMnode) {
syncInfo
.
isStandBy
=
pMgmt
->
standby
;
syncInfo
.
snapshotStrategy
=
SYNC_STRATEGY_STANDARD_SNAPSHOT
;
mInfo
(
"
start to open mnode
sync, standby:%d"
,
pMgmt
->
standby
);
mInfo
(
"
vgId:1, start to open
sync, standby:%d"
,
pMgmt
->
standby
);
if
(
pMgmt
->
standby
||
pMgmt
->
replica
.
id
>
0
)
{
SSyncCfg
*
pCfg
=
&
syncInfo
.
syncCfg
;
pCfg
->
replicaNum
=
1
;
...
...
@@ -236,7 +236,7 @@ int32_t mndInitSync(SMnode *pMnode) {
SNodeInfo
*
pNode
=
&
pCfg
->
nodeInfo
[
0
];
tstrncpy
(
pNode
->
nodeFqdn
,
pMgmt
->
replica
.
fqdn
,
sizeof
(
pNode
->
nodeFqdn
));
pNode
->
nodePort
=
pMgmt
->
replica
.
port
;
mInfo
(
"
mnode
ep:%s:%u"
,
pNode
->
nodeFqdn
,
pNode
->
nodePort
);
mInfo
(
"
vgId:1,
ep:%s:%u"
,
pNode
->
nodeFqdn
,
pNode
->
nodePort
);
}
tsem_init
(
&
pMgmt
->
syncSem
,
0
,
0
);
...
...
@@ -255,14 +255,14 @@ int32_t mndInitSync(SMnode *pMnode) {
setHeartbeatTimerMS(pMgmt->sync, 300);
*/
m
Debug
(
"mnode-sync is opened, id:%"
PRId64
,
pMgmt
->
sync
);
m
Info
(
"mnode-sync is opened, id:%"
PRId64
,
pMgmt
->
sync
);
return
0
;
}
void
mndCleanupSync
(
SMnode
*
pMnode
)
{
SSyncMgmt
*
pMgmt
=
&
pMnode
->
syncMgmt
;
syncStop
(
pMgmt
->
sync
);
m
Debug
(
"mnode-sync is stopped, id:%"
PRId64
,
pMgmt
->
sync
);
m
Info
(
"mnode-sync is stopped, id:%"
PRId64
,
pMgmt
->
sync
);
tsem_destroy
(
&
pMgmt
->
syncSem
);
memset
(
pMgmt
,
0
,
sizeof
(
SSyncMgmt
));
...
...
@@ -314,7 +314,7 @@ void mndSyncStart(SMnode *pMnode) {
SSyncMgmt
*
pMgmt
=
&
pMnode
->
syncMgmt
;
syncSetMsgCb
(
pMgmt
->
sync
,
&
pMnode
->
msgCb
);
syncStart
(
pMgmt
->
sync
);
mInfo
(
"
mnode
sync started, id:%"
PRId64
" standby:%d"
,
pMgmt
->
sync
,
pMgmt
->
standby
);
mInfo
(
"
vgId:1,
sync started, id:%"
PRId64
" standby:%d"
,
pMgmt
->
sync
,
pMgmt
->
standby
);
}
void
mndSyncStop
(
SMnode
*
pMnode
)
{
...
...
source/dnode/mnode/impl/src/mndTopic.c
浏览文件 @
3810b5d4
...
...
@@ -358,7 +358,7 @@ static int32_t extractTopicTbInfo(SNode *pAst, SMqTopicObj *pTopic) {
}
static
int32_t
mndCreateTopic
(
SMnode
*
pMnode
,
SRpcMsg
*
pReq
,
SCMCreateTopicReq
*
pCreate
,
SDbObj
*
pDb
)
{
m
Debug
(
"topic:%s to create"
,
pCreate
->
name
);
m
Info
(
"topic:%s to create"
,
pCreate
->
name
);
SMqTopicObj
topicObj
=
{
0
};
tstrncpy
(
topicObj
.
name
,
pCreate
->
name
,
TSDB_TOPIC_FNAME_LEN
);
tstrncpy
(
topicObj
.
db
,
pDb
->
name
,
TSDB_DB_FNAME_LEN
);
...
...
@@ -448,7 +448,7 @@ static int32_t mndCreateTopic(SMnode *pMnode, SRpcMsg *pReq, SCMCreateTopicReq *
taosMemoryFreeClear
(
topicObj
.
physicalPlan
);
return
-
1
;
}
m
Debug
(
"trans:%d, used to create topic:%s"
,
pTrans
->
id
,
pCreate
->
name
);
m
Info
(
"trans:%d, used to create topic:%s"
,
pTrans
->
id
,
pCreate
->
name
);
SSdbRaw
*
pCommitRaw
=
mndTopicActionEncode
(
&
topicObj
);
if
(
pCommitRaw
==
NULL
||
mndTransAppendCommitlog
(
pTrans
,
pCommitRaw
)
!=
0
)
{
...
...
@@ -541,7 +541,7 @@ static int32_t mndProcessCreateTopicReq(SRpcMsg *pReq) {
goto
_OVER
;
}
m
Debug
(
"topic:%s, start to create, sql:%s"
,
createTopicReq
.
name
,
createTopicReq
.
sql
);
m
Info
(
"topic:%s, start to create, sql:%s"
,
createTopicReq
.
name
,
createTopicReq
.
sql
);
if
(
mndCheckCreateTopicReq
(
&
createTopicReq
)
!=
0
)
{
mError
(
"topic:%s, failed to create since %s"
,
createTopicReq
.
name
,
terrstr
());
...
...
@@ -551,7 +551,7 @@ static int32_t mndProcessCreateTopicReq(SRpcMsg *pReq) {
pTopic
=
mndAcquireTopic
(
pMnode
,
createTopicReq
.
name
);
if
(
pTopic
!=
NULL
)
{
if
(
createTopicReq
.
igExists
)
{
m
Debug
(
"topic:%s, already exist, ignore exist is set"
,
createTopicReq
.
name
);
m
Info
(
"topic:%s, already exist, ignore exist is set"
,
createTopicReq
.
name
);
code
=
0
;
goto
_OVER
;
}
else
{
...
...
@@ -619,7 +619,7 @@ static int32_t mndProcessDropTopicReq(SRpcMsg *pReq) {
SMqTopicObj
*
pTopic
=
mndAcquireTopic
(
pMnode
,
dropReq
.
name
);
if
(
pTopic
==
NULL
)
{
if
(
dropReq
.
igNotExists
)
{
m
Debug
(
"topic:%s, not exist, ignore not exist is set"
,
dropReq
.
name
);
m
Info
(
"topic:%s, not exist, ignore not exist is set"
,
dropReq
.
name
);
return
0
;
}
else
{
terrno
=
TSDB_CODE_MND_TOPIC_NOT_EXIST
;
...
...
@@ -671,7 +671,7 @@ static int32_t mndProcessDropTopicReq(SRpcMsg *pReq) {
return
-
1
;
}
m
Debug
(
"trans:%d, used to drop topic:%s"
,
pTrans
->
id
,
pTopic
->
name
);
m
Info
(
"trans:%d, used to drop topic:%s"
,
pTrans
->
id
,
pTopic
->
name
);
#if 0
if (mndDropOffsetByTopic(pMnode, pTrans, dropReq.name) < 0) {
...
...
source/dnode/mnode/impl/src/mndTrans.c
浏览文件 @
3810b5d4
...
...
@@ -321,7 +321,7 @@ static SSdbRow *mndTransActionDecode(SSdbRaw *pRaw) {
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
dataLen
,
_OVER
)
action
.
pRaw
=
taosMemoryMalloc
(
dataLen
);
if
(
action
.
pRaw
==
NULL
)
goto
_OVER
;
//
mTrace("raw:%p, is created", pData);
mTrace
(
"raw:%p, is created"
,
pData
);
SDB_GET_BINARY
(
pRaw
,
dataPos
,
(
void
*
)
action
.
pRaw
,
dataLen
,
_OVER
);
if
(
taosArrayPush
(
pTrans
->
redoActions
,
&
action
)
==
NULL
)
goto
_OVER
;
action
.
pRaw
=
NULL
;
...
...
@@ -357,7 +357,7 @@ static SSdbRow *mndTransActionDecode(SSdbRaw *pRaw) {
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
dataLen
,
_OVER
)
action
.
pRaw
=
taosMemoryMalloc
(
dataLen
);
if
(
action
.
pRaw
==
NULL
)
goto
_OVER
;
//
mTrace("raw:%p, is created", action.pRaw);
mTrace
(
"raw:%p, is created"
,
action
.
pRaw
);
SDB_GET_BINARY
(
pRaw
,
dataPos
,
(
void
*
)
action
.
pRaw
,
dataLen
,
_OVER
);
if
(
taosArrayPush
(
pTrans
->
undoActions
,
&
action
)
==
NULL
)
goto
_OVER
;
action
.
pRaw
=
NULL
;
...
...
@@ -393,7 +393,7 @@ static SSdbRow *mndTransActionDecode(SSdbRaw *pRaw) {
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
dataLen
,
_OVER
)
action
.
pRaw
=
taosMemoryMalloc
(
dataLen
);
if
(
action
.
pRaw
==
NULL
)
goto
_OVER
;
//
mTrace("raw:%p, is created", action.pRaw);
mTrace
(
"raw:%p, is created"
,
action
.
pRaw
);
SDB_GET_BINARY
(
pRaw
,
dataPos
,
(
void
*
)
action
.
pRaw
,
dataLen
,
_OVER
);
if
(
taosArrayPush
(
pTrans
->
commitActions
,
&
action
)
==
NULL
)
goto
_OVER
;
action
.
pRaw
=
NULL
;
...
...
@@ -824,7 +824,7 @@ static bool mndCheckTransConflict(SMnode *pMnode, STrans *pNew) {
pNew
->
id
,
pNew
->
dbname
,
pNew
->
stbname
,
pNew
->
conflict
,
pTrans
->
id
,
pTrans
->
dbname
,
pTrans
->
stbname
,
pTrans
->
conflict
);
}
else
{
m
Debug
(
"trans:%d, db:%s stb:%s type:%d, not conflict with trans:%d db:%s stb:%s type:%d"
,
pNew
->
id
,
m
Info
(
"trans:%d, db:%s stb:%s type:%d, not conflict with trans:%d db:%s stb:%s type:%d"
,
pNew
->
id
,
pNew
->
dbname
,
pNew
->
stbname
,
pNew
->
conflict
,
pTrans
->
id
,
pTrans
->
dbname
,
pTrans
->
stbname
,
pTrans
->
conflict
);
}
...
...
source/dnode/mnode/impl/src/mndUser.c
浏览文件 @
3810b5d4
...
...
@@ -79,14 +79,14 @@ static int32_t mndCreateDefaultUser(SMnode *pMnode, char *acct, char *user, char
if
(
pRaw
==
NULL
)
return
-
1
;
sdbSetRawStatus
(
pRaw
,
SDB_STATUS_READY
);
m
Debug
(
"user:%s, will be created when deploying, raw:%p"
,
userObj
.
user
,
pRaw
);
m
Info
(
"user:%s, will be created when deploying, raw:%p"
,
userObj
.
user
,
pRaw
);
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_CONFLICT_NOTHING
,
NULL
,
"create-user"
);
if
(
pTrans
==
NULL
)
{
mError
(
"user:%s, failed to create since %s"
,
userObj
.
user
,
terrstr
());
return
-
1
;
}
m
Debug
(
"trans:%d, used to create user:%s"
,
pTrans
->
id
,
userObj
.
user
);
m
Info
(
"trans:%d, used to create user:%s"
,
pTrans
->
id
,
userObj
.
user
);
if
(
mndTransAppendCommitlog
(
pTrans
,
pRaw
)
!=
0
)
{
mError
(
"trans:%d, failed to commit redo log since %s"
,
pTrans
->
id
,
terrstr
());
...
...
@@ -304,7 +304,7 @@ static int32_t mndCreateUser(SMnode *pMnode, char *acct, SCreateUserReq *pCreate
mError
(
"user:%s, failed to create since %s"
,
pCreate
->
user
,
terrstr
());
return
-
1
;
}
m
Debug
(
"trans:%d, used to create user:%s"
,
pTrans
->
id
,
pCreate
->
user
);
m
Info
(
"trans:%d, used to create user:%s"
,
pTrans
->
id
,
pCreate
->
user
);
SSdbRaw
*
pCommitRaw
=
mndUserActionEncode
(
&
userObj
);
if
(
pCommitRaw
==
NULL
||
mndTransAppendCommitlog
(
pTrans
,
pCommitRaw
)
!=
0
)
{
...
...
@@ -336,7 +336,7 @@ static int32_t mndProcessCreateUserReq(SRpcMsg *pReq) {
goto
_OVER
;
}
m
Debug
(
"user:%s, start to create"
,
createReq
.
user
);
m
Info
(
"user:%s, start to create"
,
createReq
.
user
);
if
(
mndCheckOperPrivilege
(
pMnode
,
pReq
->
info
.
conn
.
user
,
MND_OPER_CREATE_USER
)
!=
0
)
{
goto
_OVER
;
}
...
...
@@ -388,7 +388,7 @@ static int32_t mndAlterUser(SMnode *pMnode, SUserObj *pOld, SUserObj *pNew, SRpc
mError
(
"user:%s, failed to alter since %s"
,
pOld
->
user
,
terrstr
());
return
-
1
;
}
m
Debug
(
"trans:%d, used to alter user:%s"
,
pTrans
->
id
,
pOld
->
user
);
m
Info
(
"trans:%d, used to alter user:%s"
,
pTrans
->
id
,
pOld
->
user
);
SSdbRaw
*
pCommitRaw
=
mndUserActionEncode
(
pNew
);
if
(
pCommitRaw
==
NULL
||
mndTransAppendCommitlog
(
pTrans
,
pCommitRaw
)
!=
0
)
{
...
...
@@ -446,7 +446,7 @@ static int32_t mndProcessAlterUserReq(SRpcMsg *pReq) {
goto
_OVER
;
}
m
Debug
(
"user:%s, start to alter"
,
alterReq
.
user
);
m
Info
(
"user:%s, start to alter"
,
alterReq
.
user
);
if
(
alterReq
.
user
[
0
]
==
0
)
{
terrno
=
TSDB_CODE_MND_INVALID_USER_FORMAT
;
...
...
@@ -603,7 +603,7 @@ static int32_t mndDropUser(SMnode *pMnode, SRpcMsg *pReq, SUserObj *pUser) {
mError
(
"user:%s, failed to drop since %s"
,
pUser
->
user
,
terrstr
());
return
-
1
;
}
m
Debug
(
"trans:%d, used to drop user:%s"
,
pTrans
->
id
,
pUser
->
user
);
m
Info
(
"trans:%d, used to drop user:%s"
,
pTrans
->
id
,
pUser
->
user
);
SSdbRaw
*
pCommitRaw
=
mndUserActionEncode
(
pUser
);
if
(
pCommitRaw
==
NULL
||
mndTransAppendCommitlog
(
pTrans
,
pCommitRaw
)
!=
0
)
{
...
...
@@ -634,7 +634,7 @@ static int32_t mndProcessDropUserReq(SRpcMsg *pReq) {
goto
_OVER
;
}
m
Debug
(
"user:%s, start to drop"
,
dropReq
.
user
);
m
Info
(
"user:%s, start to drop"
,
dropReq
.
user
);
if
(
mndCheckOperPrivilege
(
pMnode
,
pReq
->
info
.
conn
.
user
,
MND_OPER_DROP_USER
)
!=
0
)
{
goto
_OVER
;
}
...
...
source/dnode/mnode/impl/src/mndVgroup.c
浏览文件 @
3810b5d4
...
...
@@ -404,7 +404,7 @@ static bool mndBuildDnodesArrayFp(SMnode *pMnode, void *pObj, void *p1, void *p2
pDnode
->
numOfVnodes
=
mndGetVnodesNum
(
pMnode
,
pDnode
->
id
);
pDnode
->
memUsed
=
mndGetVnodesMemory
(
pMnode
,
pDnode
->
id
);
m
Debug
(
"dnode:%d, vnodes:%d supportVnodes:%d isMnode:%d online:%d memory avail:%"
PRId64
" used:%"
PRId64
,
pDnode
->
id
,
m
Info
(
"dnode:%d, vnodes:%d supportVnodes:%d isMnode:%d online:%d memory avail:%"
PRId64
" used:%"
PRId64
,
pDnode
->
id
,
pDnode
->
numOfVnodes
,
pDnode
->
numOfSupportVnodes
,
isMnode
,
online
,
pDnode
->
memAvail
,
pDnode
->
memUsed
);
if
(
isMnode
)
{
...
...
@@ -855,7 +855,7 @@ int32_t mndAddVnodeToVgroup(SMnode *pMnode, SVgObj *pVgroup, SArray *pArray) {
taosArraySort
(
pArray
,
(
__compar_fn_t
)
mndCompareDnodeVnodes
);
for
(
int32_t
i
=
0
;
i
<
taosArrayGetSize
(
pArray
);
++
i
)
{
SDnodeObj
*
pDnode
=
taosArrayGet
(
pArray
,
i
);
m
Debug
(
"dnode:%d, equivalent vnodes:%d"
,
pDnode
->
id
,
pDnode
->
numOfVnodes
);
m
Info
(
"dnode:%d, equivalent vnodes:%d"
,
pDnode
->
id
,
pDnode
->
numOfVnodes
);
}
SVnodeGid
*
pVgid
=
&
pVgroup
->
vnodeGid
[
pVgroup
->
replica
];
...
...
@@ -905,7 +905,7 @@ int32_t mndRemoveVnodeFromVgroup(SMnode *pMnode, SVgObj *pVgroup, SArray *pArray
taosArraySort
(
pArray
,
(
__compar_fn_t
)
mndCompareDnodeVnodes
);
for
(
int32_t
i
=
0
;
i
<
taosArrayGetSize
(
pArray
);
++
i
)
{
SDnodeObj
*
pDnode
=
taosArrayGet
(
pArray
,
i
);
m
Debug
(
"dnode:%d, equivalent vnodes:%d"
,
pDnode
->
id
,
pDnode
->
numOfVnodes
);
m
Info
(
"dnode:%d, equivalent vnodes:%d"
,
pDnode
->
id
,
pDnode
->
numOfVnodes
);
}
int32_t
code
=
-
1
;
...
...
@@ -1174,7 +1174,7 @@ int32_t mndSetMoveVgroupsInfoToTrans(SMnode *pMnode, STrans *pTrans, int32_t del
static
int32_t
mndAddIncVgroupReplicaToTrans
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SDbObj
*
pDb
,
SVgObj
*
pVgroup
,
int32_t
newDnodeId
)
{
m
Debug
(
"vgId:%d, will add 1 vnode, replica:%d dnode:%d"
,
pVgroup
->
vgId
,
pVgroup
->
replica
,
newDnodeId
);
m
Info
(
"vgId:%d, will add 1 vnode, replica:%d dnode:%d"
,
pVgroup
->
vgId
,
pVgroup
->
replica
,
newDnodeId
);
SVnodeGid
*
pGid
=
&
pVgroup
->
vnodeGid
[
pVgroup
->
replica
];
pVgroup
->
replica
++
;
...
...
@@ -1190,7 +1190,7 @@ static int32_t mndAddIncVgroupReplicaToTrans(SMnode *pMnode, STrans *pTrans, SDb
static
int32_t
mndAddDecVgroupReplicaFromTrans
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SDbObj
*
pDb
,
SVgObj
*
pVgroup
,
int32_t
delDnodeId
)
{
m
Debug
(
"vgId:%d, will remove 1 vnode, replica:%d dnode:%d"
,
pVgroup
->
vgId
,
pVgroup
->
replica
,
delDnodeId
);
m
Info
(
"vgId:%d, will remove 1 vnode, replica:%d dnode:%d"
,
pVgroup
->
vgId
,
pVgroup
->
replica
,
delDnodeId
);
SVnodeGid
*
pGid
=
NULL
;
SVnodeGid
delGid
=
{
0
};
...
...
@@ -1226,7 +1226,7 @@ static int32_t mndRedistributeVgroup(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb,
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_CONFLICT_GLOBAL
,
pReq
,
"red-vgroup"
);
if
(
pTrans
==
NULL
)
goto
_OVER
;
mndTransSetSerial
(
pTrans
);
m
Debug
(
"trans:%d, used to redistribute vgroup, vgId:%d"
,
pTrans
->
id
,
pVgroup
->
vgId
);
m
Info
(
"trans:%d, used to redistribute vgroup, vgId:%d"
,
pTrans
->
id
,
pVgroup
->
vgId
);
SVgObj
newVg
=
{
0
};
memcpy
(
&
newVg
,
pVgroup
,
sizeof
(
SVgObj
));
...
...
@@ -1609,7 +1609,7 @@ static int32_t mndSplitVgroup(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SVgObj
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_CONFLICT_GLOBAL
,
pReq
,
"split-vgroup"
);
if
(
pTrans
==
NULL
)
goto
_OVER
;
mndTransSetSerial
(
pTrans
);
m
Debug
(
"trans:%d, used to split vgroup, vgId:%d"
,
pTrans
->
id
,
pVgroup
->
vgId
);
m
Info
(
"trans:%d, used to split vgroup, vgId:%d"
,
pTrans
->
id
,
pVgroup
->
vgId
);
SVgObj
newVg1
=
{
0
};
memcpy
(
&
newVg1
,
pVgroup
,
sizeof
(
SVgObj
));
...
...
@@ -1666,7 +1666,7 @@ static int32_t mndProcessSplitVgroupMsg(SRpcMsg *pReq) {
SVgObj
*
pVgroup
=
NULL
;
SDbObj
*
pDb
=
NULL
;
m
Debug
(
"vgId:%d, start to split"
,
vgId
);
m
Info
(
"vgId:%d, start to split"
,
vgId
);
if
(
mndCheckOperPrivilege
(
pMnode
,
pReq
->
info
.
conn
.
user
,
MND_OPER_SPLIT_VGROUP
)
!=
0
)
{
goto
_OVER
;
}
...
...
@@ -1777,13 +1777,13 @@ static int32_t mndBalanceVgroup(SMnode *pMnode, SRpcMsg *pReq, SArray *pArray) {
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_CONFLICT_GLOBAL
,
pReq
,
"balance-vgroup"
);
if
(
pTrans
==
NULL
)
goto
_OVER
;
mndTransSetSerial
(
pTrans
);
m
Debug
(
"trans:%d, used to balance vgroup"
,
pTrans
->
id
);
m
Info
(
"trans:%d, used to balance vgroup"
,
pTrans
->
id
);
while
(
1
)
{
taosArraySort
(
pArray
,
(
__compar_fn_t
)
mndCompareDnodeVnodes
);
for
(
int32_t
i
=
0
;
i
<
taosArrayGetSize
(
pArray
);
++
i
)
{
SDnodeObj
*
pDnode
=
taosArrayGet
(
pArray
,
i
);
m
Debug
(
"dnode:%d, equivalent vnodes:%d support:%d, score:%f"
,
pDnode
->
id
,
pDnode
->
numOfVnodes
,
m
Info
(
"dnode:%d, equivalent vnodes:%d support:%d, score:%f"
,
pDnode
->
id
,
pDnode
->
numOfVnodes
,
pDnode
->
numOfSupportVnodes
,
(
float
)
pDnode
->
numOfVnodes
/
pDnode
->
numOfSupportVnodes
);
}
...
...
@@ -1792,7 +1792,7 @@ static int32_t mndBalanceVgroup(SMnode *pMnode, SRpcMsg *pReq, SArray *pArray) {
float
srcScore
=
(
float
)(
pSrc
->
numOfVnodes
-
1
)
/
pSrc
->
numOfSupportVnodes
;
float
dstScore
=
(
float
)(
pDst
->
numOfVnodes
+
1
)
/
pDst
->
numOfSupportVnodes
;
m
Debug
(
"trans:%d, after balance, src dnode:%d score:%f, dst dnode:%d score:%f"
,
pTrans
->
id
,
pSrc
->
id
,
srcScore
,
m
Info
(
"trans:%d, after balance, src dnode:%d score:%f, dst dnode:%d score:%f"
,
pTrans
->
id
,
pSrc
->
id
,
srcScore
,
pDst
->
id
,
dstScore
);
if
(
srcScore
>
dstScore
-
0
.
000001
)
{
...
...
@@ -1803,20 +1803,20 @@ static int32_t mndBalanceVgroup(SMnode *pMnode, SRpcMsg *pReq, SArray *pArray) {
numOfVgroups
++
;
continue
;
}
else
{
m
Debug
(
"trans:%d, no vgroup need to balance from dnode:%d to dnode:%d"
,
pTrans
->
id
,
pSrc
->
id
,
pDst
->
id
);
m
Info
(
"trans:%d, no vgroup need to balance from dnode:%d to dnode:%d"
,
pTrans
->
id
,
pSrc
->
id
,
pDst
->
id
);
break
;
}
}
else
{
m
Debug
(
"trans:%d, no vgroup need to balance any more"
,
pTrans
->
id
);
m
Info
(
"trans:%d, no vgroup need to balance any more"
,
pTrans
->
id
);
break
;
}
}
if
(
numOfVgroups
<=
0
)
{
m
Debug
(
"no need to balance vgroup"
);
m
Info
(
"no need to balance vgroup"
);
code
=
0
;
}
else
{
m
Debug
(
"start to balance vgroup, numOfVgroups:%d"
,
numOfVgroups
);
m
Info
(
"start to balance vgroup, numOfVgroups:%d"
,
numOfVgroups
);
if
(
mndTransPrepare
(
pMnode
,
pTrans
)
!=
0
)
goto
_OVER
;
code
=
TSDB_CODE_ACTION_IN_PROGRESS
;
}
...
...
@@ -1865,7 +1865,7 @@ static int32_t mndProcessBalanceVgroupMsg(SRpcMsg *pReq) {
if
(
pArray
==
NULL
)
goto
_OVER
;
if
(
taosArrayGetSize
(
pArray
)
<
2
)
{
m
Debug
(
"no need to balance vgroup since dnode num less than 2"
);
m
Info
(
"no need to balance vgroup since dnode num less than 2"
);
code
=
0
;
}
else
{
code
=
mndBalanceVgroup
(
pMnode
,
pReq
,
pArray
);
...
...
source/dnode/mnode/sdb/src/sdb.c
浏览文件 @
3810b5d4
...
...
@@ -61,12 +61,12 @@ SSdb *sdbInit(SSdbOpt *pOption) {
pSdb
->
commitConfig
=
-
1
;
pSdb
->
pMnode
=
pOption
->
pMnode
;
taosThreadMutexInit
(
&
pSdb
->
filelock
,
NULL
);
m
Debug
(
"sdb init successfully
"
);
m
Info
(
"sdb init success
"
);
return
pSdb
;
}
void
sdbCleanup
(
SSdb
*
pSdb
)
{
m
Debug
(
"start to cleanup sdb"
);
m
Info
(
"start to cleanup sdb"
);
sdbWriteFile
(
pSdb
,
0
);
...
...
@@ -103,12 +103,12 @@ void sdbCleanup(SSdb *pSdb) {
pSdb
->
hashObjs
[
i
]
=
NULL
;
memset
(
&
pSdb
->
locks
[
i
],
0
,
sizeof
(
pSdb
->
locks
[
i
]));
m
Debug
(
"sdb table:%s is cleaned up"
,
sdbTableName
(
i
));
m
Info
(
"sdb table:%s is cleaned up"
,
sdbTableName
(
i
));
}
taosThreadMutexDestroy
(
&
pSdb
->
filelock
);
taosMemoryFree
(
pSdb
);
m
Debug
(
"sdb is cleaned up"
);
m
Info
(
"sdb is cleaned up"
);
}
int32_t
sdbSetTable
(
SSdb
*
pSdb
,
SSdbTable
table
)
{
...
...
@@ -139,7 +139,7 @@ int32_t sdbSetTable(SSdb *pSdb, SSdbTable table) {
pSdb
->
maxId
[
sdbType
]
=
0
;
pSdb
->
hashObjs
[
sdbType
]
=
hash
;
m
Debug
(
"sdb table:%s is initialized"
,
sdbTableName
(
sdbType
));
m
Info
(
"sdb table:%s is initialized"
,
sdbTableName
(
sdbType
));
return
0
;
}
...
...
source/dnode/mnode/sdb/src/sdbFile.c
浏览文件 @
3810b5d4
...
...
@@ -23,25 +23,25 @@
#define SDB_FILE_VER 1
static
int32_t
sdbDeployData
(
SSdb
*
pSdb
)
{
m
Debug
(
"start to deploy sdb"
);
m
Info
(
"start to deploy sdb"
);
for
(
int32_t
i
=
SDB_MAX
-
1
;
i
>=
0
;
--
i
)
{
SdbDeployFp
fp
=
pSdb
->
deployFps
[
i
];
if
(
fp
==
NULL
)
continue
;
m
Debug
(
"start to deploy sdb:%s"
,
sdbTableName
(
i
));
m
Info
(
"start to deploy sdb:%s"
,
sdbTableName
(
i
));
if
((
*
fp
)(
pSdb
->
pMnode
)
!=
0
)
{
mError
(
"failed to deploy sdb:%s since %s"
,
sdbTableName
(
i
),
terrstr
());
return
-
1
;
}
}
m
Debug
(
"sdb deploy successfully
"
);
m
Info
(
"sdb deploy success
"
);
return
0
;
}
static
void
sdbResetData
(
SSdb
*
pSdb
)
{
m
Debug
(
"start to reset sdb"
);
m
Info
(
"start to reset sdb"
);
for
(
ESdbType
i
=
0
;
i
<
SDB_MAX
;
++
i
)
{
SHashObj
*
hash
=
pSdb
->
hashObjs
[
i
];
...
...
@@ -64,7 +64,7 @@ static void sdbResetData(SSdb *pSdb) {
taosHashClear
(
pSdb
->
hashObjs
[
i
]);
pSdb
->
tableVer
[
i
]
=
0
;
pSdb
->
maxId
[
i
]
=
0
;
m
Debug
(
"sdb:%s is reset"
,
sdbTableName
(
i
));
m
Info
(
"sdb:%s is reset"
,
sdbTableName
(
i
));
}
pSdb
->
applyIndex
=
-
1
;
...
...
@@ -73,7 +73,7 @@ static void sdbResetData(SSdb *pSdb) {
pSdb
->
commitIndex
=
-
1
;
pSdb
->
commitTerm
=
-
1
;
pSdb
->
commitConfig
=
-
1
;
m
Debug
(
"sdb reset successfully
"
);
m
Info
(
"sdb reset success
"
);
}
static
int32_t
sdbReadFileHead
(
SSdb
*
pSdb
,
TdFilePtr
pFile
)
{
...
...
@@ -229,7 +229,7 @@ static int32_t sdbReadFileImp(SSdb *pSdb) {
char
file
[
PATH_MAX
]
=
{
0
};
snprintf
(
file
,
sizeof
(
file
),
"%s%ssdb.data"
,
pSdb
->
currDir
,
TD_DIRSEP
);
m
Debug
(
"start to read sdb file:%s"
,
file
);
m
Info
(
"start to read sdb file:%s"
,
file
);
SSdbRaw
*
pRaw
=
taosMemoryMalloc
(
TSDB_MAX_MSG_SIZE
+
100
);
if
(
pRaw
==
NULL
)
{
...
...
@@ -306,7 +306,7 @@ static int32_t sdbReadFileImp(SSdb *pSdb) {
pSdb
->
commitTerm
=
pSdb
->
applyTerm
;
pSdb
->
commitConfig
=
pSdb
->
applyConfig
;
memcpy
(
pSdb
->
tableVer
,
tableVer
,
sizeof
(
tableVer
));
m
Debug
(
"read sdb file:%s successfully
, commit index:%"
PRId64
" term:%"
PRId64
" config:%"
PRId64
,
file
,
m
Info
(
"read sdb file:%s success
, commit index:%"
PRId64
" term:%"
PRId64
" config:%"
PRId64
,
file
,
pSdb
->
commitIndex
,
pSdb
->
commitTerm
,
pSdb
->
commitConfig
);
_OVER:
...
...
@@ -339,7 +339,7 @@ static int32_t sdbWriteFileImp(SSdb *pSdb) {
char
curfile
[
PATH_MAX
]
=
{
0
};
snprintf
(
curfile
,
sizeof
(
curfile
),
"%s%ssdb.data"
,
pSdb
->
currDir
,
TD_DIRSEP
);
m
Debug
(
"start to write sdb file, apply index:%"
PRId64
" term:%"
PRId64
" config:%"
PRId64
", commit index:%"
PRId64
m
Info
(
"start to write sdb file, apply index:%"
PRId64
" term:%"
PRId64
" config:%"
PRId64
", commit index:%"
PRId64
" term:%"
PRId64
" config:%"
PRId64
", file:%s"
,
pSdb
->
applyIndex
,
pSdb
->
applyTerm
,
pSdb
->
applyConfig
,
pSdb
->
commitIndex
,
pSdb
->
commitTerm
,
pSdb
->
commitConfig
,
curfile
);
...
...
@@ -361,7 +361,7 @@ static int32_t sdbWriteFileImp(SSdb *pSdb) {
SdbEncodeFp
encodeFp
=
pSdb
->
encodeFps
[
i
];
if
(
encodeFp
==
NULL
)
continue
;
m
Debug
(
"write %s to sdb file, total %d rows"
,
sdbTableName
(
i
),
sdbGetSize
(
pSdb
,
i
));
m
Info
(
"write %s to sdb file, total %d rows"
,
sdbTableName
(
i
),
sdbGetSize
(
pSdb
,
i
));
SHashObj
*
hash
=
pSdb
->
hashObjs
[
i
];
TdThreadRwlock
*
pLock
=
&
pSdb
->
locks
[
i
];
...
...
@@ -437,7 +437,7 @@ static int32_t sdbWriteFileImp(SSdb *pSdb) {
pSdb
->
commitIndex
=
pSdb
->
applyIndex
;
pSdb
->
commitTerm
=
pSdb
->
applyTerm
;
pSdb
->
commitConfig
=
pSdb
->
applyConfig
;
m
Debug
(
"write sdb file successfully
, commit index:%"
PRId64
" term:%"
PRId64
" config:%"
PRId64
" file:%s"
,
m
Info
(
"write sdb file success
, commit index:%"
PRId64
" term:%"
PRId64
" config:%"
PRId64
" file:%s"
,
pSdb
->
commitIndex
,
pSdb
->
commitTerm
,
pSdb
->
commitConfig
,
curfile
);
}
...
...
@@ -519,7 +519,7 @@ static void sdbCloseIter(SSdbIter *pIter) {
pIter
->
name
=
NULL
;
}
m
Debug
(
"sdbiter:%p, is closed, total:%"
PRId64
,
pIter
,
pIter
->
total
);
m
Info
(
"sdbiter:%p, is closed, total:%"
PRId64
,
pIter
,
pIter
->
total
);
taosMemoryFree
(
pIter
);
}
...
...
@@ -556,7 +556,7 @@ int32_t sdbStartRead(SSdb *pSdb, SSdbIter **ppIter, int64_t *index, int64_t *ter
if
(
term
!=
NULL
)
*
term
=
commitTerm
;
if
(
config
!=
NULL
)
*
config
=
commitConfig
;
m
Debug
(
"sdbiter:%p, is created to read snapshot, commit index:%"
PRId64
" term:%"
PRId64
" config:%"
PRId64
m
Info
(
"sdbiter:%p, is created to read snapshot, commit index:%"
PRId64
" term:%"
PRId64
" config:%"
PRId64
" file:%s"
,
pIter
,
commitIndex
,
commitTerm
,
commitConfig
,
pIter
->
name
);
return
0
;
...
...
@@ -568,7 +568,7 @@ int32_t sdbStopRead(SSdb *pSdb, SSdbIter *pIter) {
}
int32_t
sdbDoRead
(
SSdb
*
pSdb
,
SSdbIter
*
pIter
,
void
**
ppBuf
,
int32_t
*
len
)
{
int32_t
maxlen
=
100
;
int32_t
maxlen
=
4096
;
void
*
pBuf
=
taosMemoryCalloc
(
1
,
maxlen
);
if
(
pBuf
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
...
...
@@ -584,14 +584,14 @@ int32_t sdbDoRead(SSdb *pSdb, SSdbIter *pIter, void **ppBuf, int32_t *len) {
taosMemoryFree
(
pBuf
);
return
-
1
;
}
else
if
(
readlen
==
0
)
{
m
Debug
(
"sdbiter:%p, read snapshot to the end, total:%"
PRId64
,
pIter
,
pIter
->
total
);
m
Info
(
"sdbiter:%p, read snapshot to the end, total:%"
PRId64
,
pIter
,
pIter
->
total
);
*
ppBuf
=
NULL
;
*
len
=
0
;
taosMemoryFree
(
pBuf
);
return
0
;
}
else
{
// (readlen <= maxlen)
pIter
->
total
+=
readlen
;
m
Debug
(
"sdbiter:%p, read:%d bytes from snapshot, total:%"
PRId64
,
pIter
,
readlen
,
pIter
->
total
);
m
Info
(
"sdbiter:%p, read:%d bytes from snapshot, total:%"
PRId64
,
pIter
,
readlen
,
pIter
->
total
);
*
ppBuf
=
pBuf
;
*
len
=
readlen
;
return
0
;
...
...
@@ -610,7 +610,7 @@ int32_t sdbStartWrite(SSdb *pSdb, SSdbIter **ppIter) {
}
*
ppIter
=
pIter
;
m
Debug
(
"sdbiter:%p, is created to write snapshot, file:%s"
,
pIter
,
pIter
->
name
);
m
Info
(
"sdbiter:%p, is created to write snapshot, file:%s"
,
pIter
,
pIter
->
name
);
return
0
;
}
...
...
@@ -619,7 +619,7 @@ int32_t sdbStopWrite(SSdb *pSdb, SSdbIter *pIter, bool isApply, int64_t index, i
if
(
!
isApply
)
{
sdbCloseIter
(
pIter
);
m
Debug
(
"sdbiter:%p, not apply to sdb"
,
pIter
);
m
Info
(
"sdbiter:%p, not apply to sdb"
,
pIter
);
return
0
;
}
...
...
@@ -655,7 +655,7 @@ int32_t sdbStopWrite(SSdb *pSdb, SSdbIter *pIter, bool isApply, int64_t index, i
pSdb
->
commitIndex
=
index
;
}
m
Debug
(
"sdbiter:%p, successfully
applyed to sdb"
,
pIter
);
m
Info
(
"sdbiter:%p, success
applyed to sdb"
,
pIter
);
return
0
;
}
...
...
@@ -668,6 +668,6 @@ int32_t sdbDoWrite(SSdb *pSdb, SSdbIter *pIter, void *pBuf, int32_t len) {
}
pIter
->
total
+=
writelen
;
m
Debug
(
"sdbiter:%p, write:%d bytes to snapshot, total:%"
PRId64
,
pIter
,
writelen
,
pIter
->
total
);
m
Info
(
"sdbiter:%p, write:%d bytes to snapshot, total:%"
PRId64
,
pIter
,
writelen
,
pIter
->
total
);
return
0
;
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录