Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
26186e7f
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1185
Star
22015
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
26186e7f
编写于
4月 04, 2020
作者:
S
slguan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-93] revert some codes
上级
64f57318
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
49 addition
and
26 deletion
+49
-26
src/inc/mnode.h
src/inc/mnode.h
+5
-0
src/mnode/inc/mgmtAcct.h
src/mnode/inc/mgmtAcct.h
+2
-0
src/mnode/inc/mgmtVgroup.h
src/mnode/inc/mgmtVgroup.h
+2
-0
src/mnode/src/mgmtAcct.c
src/mnode/src/mgmtAcct.c
+6
-0
src/mnode/src/mgmtDb.c
src/mnode/src/mgmtDb.c
+2
-2
src/mnode/src/mgmtDnode.c
src/mnode/src/mgmtDnode.c
+1
-0
src/mnode/src/mgmtProfile.c
src/mnode/src/mgmtProfile.c
+1
-0
src/mnode/src/mgmtSdb.c
src/mnode/src/mgmtSdb.c
+9
-13
src/mnode/src/mgmtTable.c
src/mnode/src/mgmtTable.c
+7
-7
src/mnode/src/mgmtUser.c
src/mnode/src/mgmtUser.c
+4
-3
src/mnode/src/mgmtVgroup.c
src/mnode/src/mgmtVgroup.c
+9
-0
tests/script/sh/deploy.sh
tests/script/sh/deploy.sh
+1
-1
未找到文件。
src/inc/mnode.h
浏览文件 @
26186e7f
...
...
@@ -59,6 +59,7 @@ typedef struct {
char
mnodeName
[
TSDB_DNODE_NAME_LEN
+
1
];
int8_t
reserved
[
15
];
int8_t
updateEnd
[
1
];
int32_t
refCount
;
int
syncFd
;
void
*
hbTimer
;
void
*
pSync
;
...
...
@@ -84,6 +85,7 @@ typedef struct {
char
dnodeName
[
TSDB_DNODE_NAME_LEN
+
1
];
int8_t
reserved
[
15
];
int8_t
updateEnd
[
1
];
int32_t
refCount
;
SVnodeLoad
vload
[
TSDB_MAX_VNODES
];
int32_t
status
;
uint32_t
lastReboot
;
// time stamp for last reboot
...
...
@@ -151,6 +153,7 @@ typedef struct _vg_obj {
int8_t
lbStatus
;
int8_t
reserved
[
14
];
int8_t
updateEnd
[
1
];
int32_t
refCount
;
struct
_vg_obj
*
prev
,
*
next
;
struct
_db_obj
*
pDb
;
int32_t
numOfTables
;
...
...
@@ -216,6 +219,7 @@ typedef struct _acctObj {
int8_t
dirty
;
int8_t
reserved
[
14
];
int8_t
updateEnd
[
1
];
int32_t
refCount
;
SAcctInfo
acctInfo
;
pthread_mutex_t
mutex
;
}
SAcctObj
;
...
...
@@ -248,6 +252,7 @@ typedef struct {
void
*
pCont
;
SUserObj
*
pUser
;
SDbObj
*
pDb
;
SVgObj
*
pVgroup
;
STableInfo
*
pTable
;
}
SQueuedMsg
;
...
...
src/mnode/inc/mgmtAcct.h
浏览文件 @
26186e7f
...
...
@@ -30,6 +30,8 @@ typedef enum {
int32_t
acctInit
();
void
acctCleanUp
();
SAcctObj
*
acctGetAcct
(
char
*
acctName
);
void
acctIncRef
(
SAcctObj
*
pAcct
);
void
acctDecRef
(
SAcctObj
*
pAcct
);
int32_t
acctCheck
(
SAcctObj
*
pAcct
,
EAcctGrantType
type
);
void
acctAddDb
(
SAcctObj
*
pAcct
,
SDbObj
*
pDb
);
...
...
src/mnode/inc/mgmtVgroup.h
浏览文件 @
26186e7f
...
...
@@ -27,6 +27,8 @@ extern "C" {
int32_t
mgmtInitVgroups
();
void
mgmtCleanUpVgroups
();
SVgObj
*
mgmtGetVgroup
(
int32_t
vgId
);
void
mgmtIncVgroupRef
(
SVgObj
*
pVgroup
);
void
mgmtDecVgroupRef
(
SVgObj
*
pVgroup
);
void
mgmtDropAllVgroups
(
SDbObj
*
pDropDb
);
void
mgmtCreateVgroup
(
SQueuedMsg
*
pMsg
,
SDbObj
*
pDb
);
...
...
src/mnode/src/mgmtAcct.c
浏览文件 @
26186e7f
...
...
@@ -32,25 +32,31 @@ int32_t acctInit() {
void
acctCleanUp
()
{}
SAcctObj
*
acctGetAcct
(
char
*
acctName
)
{
return
&
tsAcctObj
;
}
void
acctIncRef
(
SAcctObj
*
pAcct
)
{}
void
acctDecRef
(
SAcctObj
*
pAcct
)
{}
int32_t
acctCheck
(
SAcctObj
*
pAcct
,
EAcctGrantType
type
)
{
return
TSDB_CODE_SUCCESS
;
}
#endif
void
acctAddDb
(
SAcctObj
*
pAcct
,
SDbObj
*
pDb
)
{
atomic_add_fetch_32
(
&
pAcct
->
acctInfo
.
numOfDbs
,
1
);
pDb
->
pAcct
=
pAcct
;
acctIncRef
(
pAcct
);
}
void
acctRemoveDb
(
SAcctObj
*
pAcct
,
SDbObj
*
pDb
)
{
atomic_sub_fetch_32
(
&
pAcct
->
acctInfo
.
numOfDbs
,
1
);
pDb
->
pAcct
=
NULL
;
acctIncRef
(
pAcct
);
}
void
acctAddUser
(
SAcctObj
*
pAcct
,
SUserObj
*
pUser
)
{
atomic_add_fetch_32
(
&
pAcct
->
acctInfo
.
numOfUsers
,
1
);
pUser
->
pAcct
=
pAcct
;
acctIncRef
(
pAcct
);
}
void
acctRemoveUser
(
SAcctObj
*
pAcct
,
SUserObj
*
pUser
)
{
atomic_sub_fetch_32
(
&
pAcct
->
acctInfo
.
numOfUsers
,
1
);
pUser
->
pAcct
=
NULL
;
acctIncRef
(
pAcct
);
}
\ No newline at end of file
src/mnode/src/mgmtDb.c
浏览文件 @
26186e7f
...
...
@@ -33,7 +33,7 @@
#include "mgmtUser.h"
#include "mgmtVgroup.h"
void
*
tsDbSdb
=
NULL
;
static
void
*
tsDbSdb
=
NULL
;
static
int32_t
tsDbUpdateSize
;
static
int32_t
mgmtCreateDb
(
SAcctObj
*
pAcct
,
SCMCreateDbMsg
*
pCreate
);
...
...
@@ -116,7 +116,7 @@ int32_t mgmtInitDbs() {
.
tableName
=
"dbs"
,
.
hashSessions
=
TSDB_MAX_DBS
,
.
maxRowSize
=
tsDbUpdateSize
,
.
refCountPos
=
0
,
//
(int8_t *)(&tObj.refCount) - (int8_t *)&tObj,
.
refCountPos
=
(
int8_t
*
)(
&
tObj
.
refCount
)
-
(
int8_t
*
)
&
tObj
,
.
keyType
=
SDB_KEY_TYPE_STRING
,
.
insertFp
=
mgmtDbActionInsert
,
.
deleteFp
=
mgmtDbActionDelete
,
...
...
src/mnode/src/mgmtDnode.c
浏览文件 @
26186e7f
...
...
@@ -215,6 +215,7 @@ void mgmtProcessDnodeStatusMsg(SRpcMsg *rpcMsg) {
mPrint
(
"dnode:%d, vgroup:%d not exist in mnode, drop it"
,
pDnode
->
dnodeId
,
pDnode
->
vload
[
j
].
vgId
);
mgmtSendDropVnodeMsg
(
pDnode
->
vload
[
j
].
vgId
,
&
ipSet
,
NULL
);
}
mgmtDecVgroupRef
(
pVgroup
);
}
if
(
pDnode
->
status
!=
TSDB_DN_STATUS_READY
)
{
...
...
src/mnode/src/mgmtProfile.c
浏览文件 @
26186e7f
...
...
@@ -789,6 +789,7 @@ void mgmtFreeQueuedMsg(SQueuedMsg *pMsg) {
rpcFreeCont
(
pMsg
->
pCont
);
if
(
pMsg
->
pUser
)
mgmtDecUserRef
(
pMsg
->
pUser
);
if
(
pMsg
->
pDb
)
mgmtDecDbRef
(
pMsg
->
pDb
);
if
(
pMsg
->
pVgroup
)
mgmtDecVgroupRef
(
pMsg
->
pVgroup
);
if
(
pMsg
->
pTable
)
mgmtDecTableRef
(
pMsg
->
pTable
);
free
(
pMsg
);
}
...
...
src/mnode/src/mgmtSdb.c
浏览文件 @
26186e7f
...
...
@@ -433,25 +433,21 @@ static SRowMeta *sdbGetRowMeta(void *handle, void *key) {
void
sdbIncRef
(
void
*
handle
,
void
*
pRow
)
{
if
(
pRow
)
{
SSdbTable
*
pTable
=
handle
;
if
(
pTable
->
refCountPos
>
0
)
{
int32_t
*
pRefCount
=
(
int32_t
*
)(
pRow
+
pTable
->
refCountPos
);
atomic_add_fetch_32
(
pRefCount
,
1
);
sdbTrace
(
"add ref to record:%s:%s:%d"
,
pTable
->
tableName
,
sdbGetkeyStr
(
pTable
,
pRow
),
*
pRefCount
);
}
int32_t
*
pRefCount
=
(
int32_t
*
)(
pRow
+
pTable
->
refCountPos
);
atomic_add_fetch_32
(
pRefCount
,
1
);
sdbTrace
(
"add ref to record:%s:%s:%d"
,
pTable
->
tableName
,
sdbGetkeyStr
(
pTable
,
pRow
),
*
pRefCount
);
}
}
void
sdbDecRef
(
void
*
handle
,
void
*
pRow
)
{
if
(
pRow
)
{
SSdbTable
*
pTable
=
handle
;
if
(
pTable
->
refCountPos
>
0
)
{
int32_t
*
pRefCount
=
(
int32_t
*
)(
pRow
+
pTable
->
refCountPos
);
int32_t
refCount
=
atomic_sub_fetch_32
(
pRefCount
,
1
);
sdbTrace
(
"def ref of record:%s:%s:%d"
,
pTable
->
tableName
,
sdbGetkeyStr
(
pTable
,
pRow
),
*
pRefCount
);
if
(
refCount
<=
0
)
{
SSdbOperDesc
oper
=
{.
pObj
=
pRow
};
(
*
pTable
->
destroyFp
)(
&
oper
);
}
int32_t
*
pRefCount
=
(
int32_t
*
)(
pRow
+
pTable
->
refCountPos
);
int32_t
refCount
=
atomic_sub_fetch_32
(
pRefCount
,
1
);
sdbTrace
(
"def ref of record:%s:%s:%d"
,
pTable
->
tableName
,
sdbGetkeyStr
(
pTable
,
pRow
),
*
pRefCount
);
if
(
refCount
<=
0
)
{
SSdbOperDesc
oper
=
{.
pObj
=
pRow
};
(
*
pTable
->
destroyFp
)(
&
oper
);
}
}
}
...
...
src/mnode/src/mgmtTable.c
浏览文件 @
26186e7f
...
...
@@ -45,8 +45,8 @@
#include "mgmtUser.h"
#include "mgmtVgroup.h"
void
*
tsChildTableSdb
;
void
*
tsSuperTableSdb
;
static
void
*
tsChildTableSdb
;
static
void
*
tsSuperTableSdb
;
static
int32_t
tsChildTableUpdateSize
;
static
int32_t
tsSuperTableUpdateSize
;
...
...
@@ -239,7 +239,7 @@ static int32_t mgmtInitChildTables() {
.
tableName
=
"ctables"
,
.
hashSessions
=
tsMaxTables
,
.
maxRowSize
=
sizeof
(
SChildTableObj
)
+
sizeof
(
SSchema
)
*
TSDB_MAX_COLUMNS
,
.
refCountPos
=
0
,
//
(int8_t *)(&tObj.refCount) - (int8_t *)&tObj,
.
refCountPos
=
(
int8_t
*
)(
&
tObj
.
refCount
)
-
(
int8_t
*
)
&
tObj
,
.
keyType
=
SDB_KEY_TYPE_STRING
,
.
insertFp
=
mgmtChildTableActionInsert
,
.
deleteFp
=
mgmtChildTableActionDelete
,
...
...
@@ -415,7 +415,7 @@ static int32_t mgmtInitSuperTables() {
.
tableName
=
"stables"
,
.
hashSessions
=
TSDB_MAX_SUPER_TABLES
,
.
maxRowSize
=
tsSuperTableUpdateSize
+
sizeof
(
SSchema
)
*
TSDB_MAX_COLUMNS
,
.
refCountPos
=
0
,
//
(int8_t *)(&tObj.refCount) - (int8_t *)&tObj,
.
refCountPos
=
(
int8_t
*
)(
&
tObj
.
refCount
)
-
(
int8_t
*
)
&
tObj
,
.
keyType
=
SDB_KEY_TYPE_STRING
,
.
insertFp
=
mgmtSuperTableActionInsert
,
.
deleteFp
=
mgmtSuperTableActionDelete
,
...
...
@@ -1355,7 +1355,7 @@ static void mgmtProcessCreateChildTableMsg(SQueuedMsg *pMsg) {
return
;
}
SVgObj
*
pVgroup
=
mgmtGetAvailableVgroup
(
pMsg
->
pDb
);
SVgObj
*
pVgroup
=
pMsg
->
pVgroup
=
mgmtGetAvailableVgroup
(
pMsg
->
pDb
);
if
(
pVgroup
==
NULL
)
{
mTrace
(
"table:%s, start to create a new vgroup"
,
pCreate
->
tableId
);
mgmtCreateVgroup
(
mgmtCloneQueuedMsg
(
pMsg
),
pMsg
->
pDb
);
...
...
@@ -1397,7 +1397,7 @@ static void mgmtProcessCreateChildTableMsg(SQueuedMsg *pMsg) {
void
mgmtProcessDropChildTableMsg
(
SQueuedMsg
*
pMsg
)
{
SChildTableObj
*
pTable
=
(
SChildTableObj
*
)
pMsg
->
pTable
;
SVgObj
*
pVgroup
=
mgmtGetVgroup
(
pTable
->
vgId
);
SVgObj
*
pVgroup
=
pMsg
->
pVgroup
=
mgmtGetVgroup
(
pTable
->
vgId
);
if
(
pVgroup
==
NULL
)
{
mError
(
"table:%s, failed to drop ctable, vgroup not exist"
,
pTable
->
info
.
tableId
);
mgmtSendSimpleResp
(
pMsg
->
thandle
,
TSDB_CODE_OTHERS
);
...
...
@@ -1817,7 +1817,7 @@ static void mgmtProcessDropTableRsp(SRpcMsg *rpcMsg) {
return
;
}
SVgObj
*
pVgroup
=
mgmtGetVgroup
(
pTable
->
vgId
);
SVgObj
*
pVgroup
=
pMsg
->
pVgroup
=
mgmtGetVgroup
(
pTable
->
vgId
);
if
(
pVgroup
==
NULL
)
{
mError
(
"table:%s, failed to get vgroup"
,
pTable
->
info
.
tableId
);
mgmtSendSimpleResp
(
queueMsg
->
thandle
,
TSDB_CODE_INVALID_VGROUP_ID
);
...
...
src/mnode/src/mgmtUser.c
浏览文件 @
26186e7f
...
...
@@ -25,7 +25,7 @@
#include "mgmtShell.h"
#include "mgmtUser.h"
void
*
tsUserSdb
=
NULL
;
static
void
*
tsUserSdb
=
NULL
;
static
int32_t
tsUserUpdateSize
=
0
;
static
int32_t
mgmtGetUserMeta
(
STableMetaMsg
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
);
static
int32_t
mgmtRetrieveUsers
(
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
,
void
*
pConn
);
...
...
@@ -97,7 +97,7 @@ int32_t mgmtInitUsers() {
.
tableName
=
"users"
,
.
hashSessions
=
TSDB_MAX_USERS
,
.
maxRowSize
=
tsUserUpdateSize
,
.
refCountPos
=
0
,
//
(int8_t *)(&tObj.refCount) - (int8_t *)&tObj,
.
refCountPos
=
(
int8_t
*
)(
&
tObj
.
refCount
)
-
(
int8_t
*
)
&
tObj
,
.
keyType
=
SDB_KEY_TYPE_STRING
,
.
insertFp
=
mgmtUserActionInsert
,
.
deleteFp
=
mgmtUserActionDelete
,
...
...
@@ -117,7 +117,8 @@ int32_t mgmtInitUsers() {
mgmtCreateUser
(
pAcct
,
"root"
,
"taosdata"
);
mgmtCreateUser
(
pAcct
,
"monitor"
,
tsInternalPass
);
mgmtCreateUser
(
pAcct
,
"_root"
,
tsInternalPass
);
acctDecRef
(
pAcct
);
mgmtAddShellMsgHandle
(
TSDB_MSG_TYPE_CM_CREATE_USER
,
mgmtProcessCreateUserMsg
);
mgmtAddShellMsgHandle
(
TSDB_MSG_TYPE_CM_ALTER_USER
,
mgmtProcessAlterUserMsg
);
mgmtAddShellMsgHandle
(
TSDB_MSG_TYPE_CM_DROP_USER
,
mgmtProcessDropUserMsg
);
...
...
src/mnode/src/mgmtVgroup.c
浏览文件 @
26186e7f
...
...
@@ -149,6 +149,7 @@ int32_t mgmtInitVgroups() {
.
tableName
=
"vgroups"
,
.
hashSessions
=
TSDB_MAX_VGROUPS
,
.
maxRowSize
=
tsVgUpdateSize
,
.
refCountPos
=
(
int8_t
*
)(
&
tObj
.
refCount
)
-
(
int8_t
*
)
&
tObj
,
.
keyType
=
SDB_KEY_TYPE_AUTO
,
.
insertFp
=
mgmtVgroupActionInsert
,
.
deleteFp
=
mgmtVgroupActionDelete
,
...
...
@@ -174,6 +175,14 @@ int32_t mgmtInitVgroups() {
return
0
;
}
void
mgmtIncVgroupRef
(
SVgObj
*
pVgroup
)
{
return
sdbIncRef
(
tsVgroupSdb
,
pVgroup
);
}
void
mgmtDecVgroupRef
(
SVgObj
*
pVgroup
)
{
return
sdbDecRef
(
tsVgroupSdb
,
pVgroup
);
}
SVgObj
*
mgmtGetVgroup
(
int32_t
vgId
)
{
return
(
SVgObj
*
)
sdbGetRow
(
tsVgroupSdb
,
&
vgId
);
}
...
...
tests/script/sh/deploy.sh
浏览文件 @
26186e7f
...
...
@@ -92,7 +92,7 @@ echo "internalIp $NODE_IP" >> $TAOS_CFG
echo
"privateIp
$NODE_IP
"
>>
$TAOS_CFG
echo
"dDebugFlag 135"
>>
$TAOS_CFG
echo
"mDebugFlag 199"
>>
$TAOS_CFG
echo
"sdbDebugFlag 1
35
"
>>
$TAOS_CFG
echo
"sdbDebugFlag 1
99
"
>>
$TAOS_CFG
echo
"rpcDebugFlag 135"
>>
$TAOS_CFG
echo
"tmrDebugFlag 131"
>>
$TAOS_CFG
echo
"cDebugFlag 135"
>>
$TAOS_CFG
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录