Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
00c3be67
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看板
提交
00c3be67
编写于
10月 27, 2022
作者:
G
Ganlin Zhao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: add audit db for DDL storage
上级
5f5d72b2
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
13 addition
and
8 deletion
+13
-8
src/inc/monitor.h
src/inc/monitor.h
+0
-2
src/mnode/src/mnodeTable.c
src/mnode/src/mnodeTable.c
+11
-0
src/plugins/monitor/src/monMain.c
src/plugins/monitor/src/monMain.c
+2
-6
未找到文件。
src/inc/monitor.h
浏览文件 @
00c3be67
...
...
@@ -46,8 +46,6 @@ typedef enum {
MON_DDL_CMD_ADD_TAG
,
MON_DDL_CMD_DROP_TAG
,
MON_DDL_CMD_CHANGE_TAG
,
MON_DDL_CMD_MODIFY_TAG
,
MON_DDL_CMD_SET_TAG
,
}
EMonDDLCmdType
;
typedef
struct
{
...
...
src/mnode/src/mnodeTable.c
浏览文件 @
00c3be67
...
...
@@ -2088,6 +2088,9 @@ static int32_t mnodeDoCreateChildTableCb(SMnodeMsg *pMsg, int32_t code) {
SCreateTableMsg
*
pCreate
=
(
SCreateTableMsg
*
)
((
char
*
)
pMsg
->
rpcMsg
.
pCont
+
sizeof
(
SCMCreateTableMsg
));
assert
(
pTable
);
monSaveAuditLog
((
pTable
->
info
.
type
==
TSDB_CHILD_TABLE
)
?
MON_DDL_CMD_CREATE_CHILD_TABLE
:
MON_DDL_CMD_CREATE_TABLE
,
mnodeGetUserFromMsg
(
pMsg
),
pTable
->
info
.
tableId
,
!
code
);
if
(
code
==
TSDB_CODE_SUCCESS
)
{
if
(
pCreate
->
getMeta
)
{
mDebug
(
"msg:%p, app:%p table:%s, created in dnode and continue to get meta, thandle:%p"
,
pMsg
,
...
...
@@ -2116,6 +2119,7 @@ static int32_t mnodeDoCreateChildTableCb(SMnodeMsg *pMsg, int32_t code) {
}
else
{
mError
(
"msg:%p, app:%p table:%s, failed to create table sid:%d, uid:%"
PRIu64
", reason:%s"
,
pMsg
,
pMsg
->
rpcMsg
.
ahandle
,
pTable
->
info
.
tableId
,
pTable
->
tid
,
pTable
->
uid
,
tstrerror
(
code
));
SSdbRow
desc
=
{.
type
=
SDB_OPER_GLOBAL
,
.
pObj
=
pTable
,
.
pTable
=
tsChildTableSdb
};
sdbDeleteRow
(
&
desc
);
...
...
@@ -2433,6 +2437,7 @@ static int32_t mnodeAddNormalTableColumn(SMnodeMsg *pMsg, SSchema schema[], int3
SDbObj
*
pDb
=
pMsg
->
pDb
;
if
(
ncols
<=
0
)
{
mError
(
"msg:%p, app:%p ctable:%s, add column, ncols:%d <= 0"
,
pMsg
,
pMsg
->
rpcMsg
.
ahandle
,
pTable
->
info
.
tableId
,
ncols
);
monSaveAuditLog
(
MON_DDL_CMD_ADD_COLUMN
,
mnodeGetUserFromMsg
(
pMsg
),
pTable
->
info
.
tableId
,
false
);
return
TSDB_CODE_MND_APP_ERROR
;
}
...
...
@@ -2440,6 +2445,7 @@ static int32_t mnodeAddNormalTableColumn(SMnodeMsg *pMsg, SSchema schema[], int3
if
(
mnodeFindNormalTableColumnIndex
(
pTable
,
schema
[
i
].
name
)
>
0
)
{
mError
(
"msg:%p, app:%p ctable:%s, add column, column:%s already exist"
,
pMsg
,
pMsg
->
rpcMsg
.
ahandle
,
pTable
->
info
.
tableId
,
schema
[
i
].
name
);
monSaveAuditLog
(
MON_DDL_CMD_ADD_COLUMN
,
mnodeGetUserFromMsg
(
pMsg
),
pTable
->
info
.
tableId
,
false
);
return
TSDB_CODE_MND_FIELD_ALREAY_EXIST
;
}
}
...
...
@@ -2464,6 +2470,7 @@ static int32_t mnodeAddNormalTableColumn(SMnodeMsg *pMsg, SSchema schema[], int3
}
mInfo
(
"msg:%p, app:%p ctable %s, start to add column"
,
pMsg
,
pMsg
->
rpcMsg
.
ahandle
,
pTable
->
info
.
tableId
);
monSaveAuditLog
(
MON_DDL_CMD_ADD_COLUMN
,
mnodeGetUserFromMsg
(
pMsg
),
pTable
->
info
.
tableId
,
true
);
SSdbRow
row
=
{
.
type
=
SDB_OPER_GLOBAL
,
...
...
@@ -2483,6 +2490,7 @@ static int32_t mnodeDropNormalTableColumn(SMnodeMsg *pMsg, char *colName) {
if
(
col
<=
0
)
{
mError
(
"msg:%p, app:%p ctable:%s, drop column, column:%s not exist"
,
pMsg
,
pMsg
->
rpcMsg
.
ahandle
,
pTable
->
info
.
tableId
,
colName
);
monSaveAuditLog
(
MON_DDL_CMD_DROP_COLUMN
,
mnodeGetUserFromMsg
(
pMsg
),
pTable
->
info
.
tableId
,
false
);
return
TSDB_CODE_MND_FIELD_NOT_EXIST
;
}
...
...
@@ -2497,6 +2505,7 @@ static int32_t mnodeDropNormalTableColumn(SMnodeMsg *pMsg, char *colName) {
}
mInfo
(
"msg:%p, app:%p ctable %s, start to drop column %s"
,
pMsg
,
pMsg
->
rpcMsg
.
ahandle
,
pTable
->
info
.
tableId
,
colName
);
monSaveAuditLog
(
MON_DDL_CMD_DROP_COLUMN
,
mnodeGetUserFromMsg
(
pMsg
),
pTable
->
info
.
tableId
,
true
);
SSdbRow
row
=
{
.
type
=
SDB_OPER_GLOBAL
,
...
...
@@ -2517,6 +2526,7 @@ static int32_t mnodeChangeNormalTableColumn(SMnodeMsg *pMsg) {
if
(
col
<
0
)
{
mError
(
"msg:%p, app:%p ctable:%s, change column, name: %s"
,
pMsg
,
pMsg
->
rpcMsg
.
ahandle
,
pTable
->
info
.
tableId
,
name
);
monSaveAuditLog
(
MON_DDL_CMD_MODIFY_COLUMN
,
mnodeGetUserFromMsg
(
pMsg
),
pTable
->
info
.
tableId
,
false
);
return
TSDB_CODE_MND_FIELD_NOT_EXIST
;
}
...
...
@@ -2527,6 +2537,7 @@ static int32_t mnodeChangeNormalTableColumn(SMnodeMsg *pMsg) {
mInfo
(
"msg:%p, app:%p ctable %s, start to modify column %s len to %d"
,
pMsg
,
pMsg
->
rpcMsg
.
ahandle
,
pTable
->
info
.
tableId
,
name
,
schema
->
bytes
);
monSaveAuditLog
(
MON_DDL_CMD_MODIFY_COLUMN
,
mnodeGetUserFromMsg
(
pMsg
),
pTable
->
info
.
tableId
,
true
);
SSdbRow
row
=
{
.
type
=
SDB_OPER_GLOBAL
,
...
...
src/plugins/monitor/src/monMain.c
浏览文件 @
00c3be67
...
...
@@ -1461,15 +1461,11 @@ static bool monConvDDLType2Str(int8_t type, char *buf, int32_t len) {
break
;
}
case
MON_DDL_CMD_MODIFY_COLUMN
:
{
strncpy
(
buf
,
"MODIFY COLUMN"
,
len
);
break
;
}
case
MON_DDL_CMD_MODIFY_TAG
:
{
strncpy
(
buf
,
"MODIFY TAG"
,
len
);
strncpy
(
buf
,
"MODIFY COLUMN/TAG LENGTH"
,
len
);
break
;
}
case
MON_DDL_CMD_CHANGE_TAG
:
{
strncpy
(
buf
,
"CHANGE TAG"
,
len
);
strncpy
(
buf
,
"CHANGE TAG
NAME
"
,
len
);
break
;
}
default:
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录