提交 04d97168 编写于 作者: D dmchen

more audit

上级 1aef2746
......@@ -1306,6 +1306,8 @@ void tFreeSUserAuthBatchRsp(SUserAuthBatchRsp* pRsp);
typedef struct {
char db[TSDB_DB_FNAME_LEN];
STimeWindow timeRange;
int32_t sqlLen;
char* sql;
} SCompactDbReq;
int32_t tSerializeSCompactDbReq(void* buf, int32_t bufLen, SCompactDbReq* pReq);
......@@ -1898,6 +1900,8 @@ enum {
typedef struct {
int32_t dnodeId;
int8_t restoreType;
int32_t sqlLen;
char* sql;
} SRestoreDnodeReq;
int32_t tSerializeSRestoreDnodeReq(void* buf, int32_t bufLen, SRestoreDnodeReq* pReq);
......@@ -1966,6 +1970,8 @@ int32_t tDeserializeSKillTransReq(void* buf, int32_t bufLen, SKillTransReq* pReq
typedef struct {
int32_t useless; // useless
int32_t sqlLen;
char* sql;
} SBalanceVgroupReq;
int32_t tSerializeSBalanceVgroupReq(void* buf, int32_t bufLen, SBalanceVgroupReq* pReq);
......@@ -1984,6 +1990,8 @@ typedef struct {
int32_t dnodeId1;
int32_t dnodeId2;
int32_t dnodeId3;
int32_t sqlLen;
char* sql;
} SRedistributeVgroupReq;
int32_t tSerializeSRedistributeVgroupReq(void* buf, int32_t bufLen, SRedistributeVgroupReq* pReq);
......@@ -1991,6 +1999,8 @@ int32_t tDeserializeSRedistributeVgroupReq(void* buf, int32_t bufLen, SRedistrib
typedef struct {
int32_t useless;
int32_t sqlLen;
char* sql;
} SBalanceVgroupLeaderReq;
int32_t tSerializeSBalanceVgroupLeaderReq(void* buf, int32_t bufLen, SBalanceVgroupLeaderReq* pReq);
......
......@@ -36,7 +36,7 @@ typedef struct {
int32_t auditInit(const SAuditCfg *pCfg);
void auditSend(SJson *pJson);
void auditRecord(SRpcMsg *pReq, char *oper, char *db, char *stable, int32_t detailLen, char *detail);
void auditRecord(SRpcMsg *pReq, char *operation, char *target1, char *target2, int32_t len, char *detail);
#ifdef __cplusplus
}
......
......@@ -26,6 +26,7 @@
#include "mndTrans.h"
#include "mndUser.h"
#include "tmisce.h"
#include "audit.h"
#define VGROUP_VER_NUMBER 1
#define VGROUP_RESERVE_SIZE 64
......@@ -2171,6 +2172,11 @@ static int32_t mndProcessRedistributeVgroupMsg(SRpcMsg *pReq) {
if (code == 0) code = TSDB_CODE_ACTION_IN_PROGRESS;
char obj[33] = {0};
sprintf(obj, "%d", req.vgId);
auditRecord(pReq, "RedistributeVgroup", obj, "", req.sqlLen, req.sql);
_OVER:
if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) {
mError("vgId:%d, failed to redistribute to dnode %d:%d:%d since %s", req.vgId, req.dnodeId1, req.dnodeId2,
......@@ -2981,6 +2987,8 @@ static int32_t mndProcessBalanceVgroupMsg(SRpcMsg *pReq) {
code = mndBalanceVgroup(pMnode, pReq, pArray);
}
auditRecord(pReq, "BalanceVgroup", "", "", req.sqlLen, req.sql);
_OVER:
if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) {
mError("failed to balance vgroup since %s", terrstr());
......
......@@ -29,14 +29,14 @@ int32_t auditInit(const SAuditCfg *pCfg) {
return 0;
}
extern void auditRecordImp(SRpcMsg *pReq, char *oper, char *db, char *stable, int32_t detailLen, char *detail);
extern void auditRecordImp(SRpcMsg *pReq, char *operation, char *target1, char *target2, int32_t len, char *detail);
void auditRecord(SRpcMsg *pReq, char *oper, char *db, char *stable, int32_t detailLen, char *detail) {
auditRecordImp(pReq, oper, db, stable, detailLen, detail);
void auditRecord(SRpcMsg *pReq, char *operation, char *target1, char *target2, int32_t len, char *detail) {
auditRecordImp(pReq, operation, target1, target2, len, detail);
}
#ifndef TD_ENTERPRISE
void auditRecordImp(SRpcMsg *pReq, char *oper, char *db, char *stable, int32_t detailLen, char *detail) {
void auditRecordImp(SRpcMsg *pReq, char *operation, char *target1, char *target2, int32_t len, char *detail) {
}
#endif
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册