Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
5f5d72b2
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
5f5d72b2
编写于
10月 27, 2022
作者:
G
Ganlin Zhao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: add audit db for DDL storage
上级
0a3b4046
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
36 addition
and
14 deletion
+36
-14
src/mnode/inc/mnodeDef.h
src/mnode/inc/mnodeDef.h
+5
-5
src/mnode/src/mnodeDb.c
src/mnode/src/mnodeDb.c
+4
-1
src/mnode/src/mnodeTable.c
src/mnode/src/mnodeTable.c
+27
-8
未找到文件。
src/mnode/inc/mnodeDef.h
浏览文件 @
5f5d72b2
src/mnode/src/mnodeDb.c
浏览文件 @
5f5d72b2
...
...
@@ -1128,6 +1128,8 @@ static int32_t mnodeAlterDbFp(SMnodeMsg *pMsg) {
mDebug
(
"db:%s, all vgroups is altered"
,
pDb
->
name
);
mLInfo
(
"db:%s, is alterd by %s"
,
pDb
->
name
,
mnodeGetUserFromMsg
(
pMsg
));
monSaveAuditLog
(
MON_DDL_CMD_ALTER_DATABASE
,
mnodeGetUserFromMsg
(
pMsg
),
pDb
->
name
,
true
);
// in case there is no vnode for this db currently(no table in db,etc.)
if
(
pMsg
->
expected
==
0
)
{
SSdbRow
row
=
{
...
...
@@ -1184,7 +1186,7 @@ static int32_t mnodeAlterDb(SDbObj *pDb, SAlterDbMsg *pAlter, void *pMsg) {
if
(
code
!=
TSDB_CODE_SUCCESS
&&
code
!=
TSDB_CODE_MND_ACTION_IN_PROGRESS
)
{
mError
(
"db:%s, failed to alter, reason:%s"
,
pDb
->
name
,
tstrerror
(
code
));
}
}
}
return
code
;
}
...
...
@@ -1214,6 +1216,7 @@ static int32_t mnodeDropDbCb(SMnodeMsg *pMsg, int32_t code) {
}
else
{
mLInfo
(
"db:%s, is dropped by %s"
,
pDb
->
name
,
mnodeGetUserFromMsg
(
pMsg
));
}
monSaveAuditLog
(
MON_DDL_CMD_DROP_DATABASE
,
mnodeGetUserFromMsg
(
pMsg
),
pDb
->
name
,
!
code
);
return
code
;
}
...
...
src/mnode/src/mnodeTable.c
浏览文件 @
5f5d72b2
...
...
@@ -38,6 +38,7 @@
#include "mnodeSdb.h"
#include "mnodeShow.h"
#include "mnodeTable.h"
#include "mnodeUser.h"
#include "mnodeVgroup.h"
#include "mnodeWrite.h"
#include "mnodeRead.h"
...
...
@@ -1056,6 +1057,7 @@ static int32_t mnodeCreateSuperTableCb(SMnodeMsg *pMsg, int32_t code) {
if
(
pMsg
->
pBatchMasterMsg
)
pMsg
->
pBatchMasterMsg
->
received
++
;
}
monSaveAuditLog
(
MON_DDL_CMD_CREATE_SUPER_TABLE
,
mnodeGetUserFromMsg
(
pMsg
),
pTable
->
info
.
tableId
,
!
code
);
// if super table create by batch msg, check done and send finished to client
if
(
pMsg
->
pBatchMasterMsg
)
{
...
...
@@ -1171,11 +1173,12 @@ static int32_t mnodeDropSuperTableCb(SMnodeMsg *pMsg, int32_t code) {
SSTableObj
*
pTable
=
(
SSTableObj
*
)
pMsg
->
pTable
;
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
mError
(
"msg:%p, app:%p stable:%s, failed to drop, sdb error"
,
pMsg
,
pMsg
->
rpcMsg
.
ahandle
,
pTable
->
info
.
tableId
);
monSaveAuditLog
(
MON_DDL_CMD_DROP_SUPER_TABLE
,
mnodeGetUserFromMsg
(
pMsg
),
pTable
->
info
.
tableId
,
false
);
return
code
;
}
mLInfo
(
"msg:%p, app:%p stable:%s, is dropped from sdb"
,
pMsg
,
pMsg
->
rpcMsg
.
ahandle
,
pTable
->
info
.
tableId
);
monSaveAuditLog
(
MON_DDL_CMD_DROP_SUPER_TABLE
,
mnodeGetUserFromMsg
(
pMsg
),
pTable
->
info
.
tableId
,
true
);
SSTableObj
*
pStable
=
(
SSTableObj
*
)
pMsg
->
pTable
;
if
(
pStable
->
vgHash
!=
NULL
/*pStable->numOfTables != 0*/
)
{
...
...
@@ -1250,6 +1253,8 @@ static int32_t mnodeAddSuperTableTagCb(SMnodeMsg *pMsg, int32_t code) {
if
(
code
==
TSDB_CODE_SUCCESS
)
{
code
=
mnodeGetSuperTableMeta
(
pMsg
);
}
monSaveAuditLog
(
MON_DDL_CMD_ADD_TAG
,
mnodeGetUserFromMsg
(
pMsg
),
pStable
->
info
.
tableId
,
!
code
);
return
code
;
}
...
...
@@ -1308,6 +1313,8 @@ static int32_t mnodeDropSuperTableTagCb(SMnodeMsg *pMsg, int32_t code) {
if
(
code
==
TSDB_CODE_SUCCESS
)
{
code
=
mnodeGetSuperTableMeta
(
pMsg
);
}
monSaveAuditLog
(
MON_DDL_CMD_DROP_TAG
,
mnodeGetUserFromMsg
(
pMsg
),
pStable
->
info
.
tableId
,
!
code
);
return
code
;
}
...
...
@@ -1345,6 +1352,8 @@ static int32_t mnodeModifySuperTableTagNameCb(SMnodeMsg *pMsg, int32_t code) {
if
(
code
==
TSDB_CODE_SUCCESS
)
{
code
=
mnodeGetSuperTableMeta
(
pMsg
);
}
monSaveAuditLog
(
MON_DDL_CMD_CHANGE_TAG
,
mnodeGetUserFromMsg
(
pMsg
),
pStable
->
info
.
tableId
,
!
code
);
return
code
;
}
...
...
@@ -1403,6 +1412,8 @@ static int32_t mnodeAddSuperTableColumnCb(SMnodeMsg *pMsg, int32_t code) {
if
(
code
==
TSDB_CODE_SUCCESS
)
{
code
=
mnodeGetSuperTableMeta
(
pMsg
);
}
monSaveAuditLog
(
MON_DDL_CMD_ADD_COLUMN
,
mnodeGetUserFromMsg
(
pMsg
),
pStable
->
info
.
tableId
,
!
code
);
return
code
;
}
...
...
@@ -1474,6 +1485,8 @@ static int32_t mnodeDropSuperTableColumnCb(SMnodeMsg *pMsg, int32_t code) {
if
(
code
==
TSDB_CODE_SUCCESS
)
{
code
=
mnodeGetSuperTableMeta
(
pMsg
);
}
monSaveAuditLog
(
MON_DDL_CMD_DROP_COLUMN
,
mnodeGetUserFromMsg
(
pMsg
),
pStable
->
info
.
tableId
,
!
code
);
return
code
;
}
...
...
@@ -1522,6 +1535,8 @@ static int32_t mnodeChangeSuperTableColumnCb(SMnodeMsg *pMsg, int32_t code) {
if
(
code
==
TSDB_CODE_SUCCESS
)
{
code
=
mnodeGetSuperTableMeta
(
pMsg
);
}
monSaveAuditLog
(
MON_DDL_CMD_MODIFY_COLUMN
,
mnodeGetUserFromMsg
(
pMsg
),
pStable
->
info
.
tableId
,
!
code
);
return
code
;
}
...
...
@@ -2294,6 +2309,7 @@ static int32_t mnodeSendDropChildTableMsg(SMnodeMsg *pMsg, bool needReturn) {
if
(
pDrop
==
NULL
)
{
mError
(
"msg:%p, app:%p ctable:%s, failed to drop ctable, no enough memory"
,
pMsg
,
pMsg
->
rpcMsg
.
ahandle
,
pTable
->
info
.
tableId
);
monSaveAuditLog
(
MON_DDL_CMD_DROP_TABLE
,
mnodeGetUserFromMsg
(
pMsg
),
pTable
->
info
.
tableId
,
false
);
return
TSDB_CODE_MND_OUT_OF_MEMORY
;
}
...
...
@@ -2308,6 +2324,8 @@ static int32_t mnodeSendDropChildTableMsg(SMnodeMsg *pMsg, bool needReturn) {
mInfo
(
"msg:%p, app:%p ctable:%s, send drop ctable msg, vgId:%d sid:%d uid:%"
PRIu64
,
pMsg
,
pMsg
->
rpcMsg
.
ahandle
,
pDrop
->
tableFname
,
pTable
->
vgId
,
pTable
->
tid
,
pTable
->
uid
);
monSaveAuditLog
(
MON_DDL_CMD_DROP_TABLE
,
mnodeGetUserFromMsg
(
pMsg
),
pTable
->
info
.
tableId
,
true
);
SRpcMsg
rpcMsg
=
{
.
ahandle
=
pMsg
,
.
pCont
=
pDrop
,
...
...
@@ -2327,6 +2345,7 @@ static int32_t mnodeDropChildTableCb(SMnodeMsg *pMsg, int32_t code) {
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
SCTableObj
*
pTable
=
(
SCTableObj
*
)
pMsg
->
pTable
;
mError
(
"msg:%p, app:%p ctable:%s, failed to drop, sdb error"
,
pMsg
,
pMsg
->
rpcMsg
.
ahandle
,
pTable
->
info
.
tableId
);
monSaveAuditLog
(
MON_DDL_CMD_DROP_TABLE
,
mnodeGetUserFromMsg
(
pMsg
),
pTable
->
info
.
tableId
,
false
);
return
code
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录