impose uid check for submit blocks, refer to #606

This commit is contained in:
hjxilinx 2019-10-11 10:58:06 +08:00
parent 4e45a4fd74
commit 25ff54c90c
3 changed files with 9 additions and 0 deletions

View File

@ -131,6 +131,7 @@ extern "C" {
#define TSDB_CODE_FILE_BLOCK_TS_DISORDERED 108 // time stamp in file block is disordered #define TSDB_CODE_FILE_BLOCK_TS_DISORDERED 108 // time stamp in file block is disordered
#define TSDB_CODE_INVALID_COMMIT_LOG 109 // invalid commit log may be caused by insufficient sotrage #define TSDB_CODE_INVALID_COMMIT_LOG 109 // invalid commit log may be caused by insufficient sotrage
#define TSDB_CODE_SERVER_NO_SPACE 110 #define TSDB_CODE_SERVER_NO_SPACE 110
#define TSDB_CODE_INVALID_SUBMIT_MSG 111
// message type // message type
#define TSDB_MSG_TYPE_REG 1 #define TSDB_MSG_TYPE_REG 1

View File

@ -235,4 +235,5 @@ char *tsError[] = {"success",
"timestamp disordered in file block", "timestamp disordered in file block",
"invalid commit log", "invalid commit log",
"server no disk space", "server no disk space",
"invalid submit message",
}; };

View File

@ -510,6 +510,13 @@ int vnodeProcessShellSubmitRequest(char *pMsg, int msgLen, SShellObj *pObj) {
goto _submit_over; goto _submit_over;
} }
if (pMeterObj->uid != pBlocks->uid) {
dError("vid:%d sid:%d, meterId:%s, uid:%lld, uid in msg:%lld, uid mismatch", vnode, sid, pMeterObj->meterId,
pMeterObj->uid, pBlocks->uid);
code = TSDB_CODE_INVALID_SUBMIT_MSG;
goto _submit_over;
}
// dont include sid, vid // dont include sid, vid
int subMsgLen = sizeof(pBlocks->numOfRows) + htons(pBlocks->numOfRows) * pMeterObj->bytesPerPoint; int subMsgLen = sizeof(pBlocks->numOfRows) + htons(pBlocks->numOfRows) * pMeterObj->bytesPerPoint;
int sversion = htonl(pBlocks->sversion); int sversion = htonl(pBlocks->sversion);