提交 157caa36 编写于 作者: A Alex Duan

fix(mdb): compatible v2.0 2.2 mdb file format and ignore blank

上级 fb908b7e
...@@ -334,6 +334,22 @@ bool appendTagsFilter(SSqlObj* pSql) { ...@@ -334,6 +334,22 @@ bool appendTagsFilter(SSqlObj* pSql) {
return false; return false;
} }
// check tags is blank
size_t len = strlen(pTscObj->tags);
char* p = pTscObj->tags;
bool blank = true;
while(*p != 0) {
if(*p != ' ') {
blank = false;
break;
}
}
// result
if(blank) {
tscDebug("TAGS 0x%" PRIx64 " tags is all blank. user=%s", pSql->self, pTscObj->user);
return false;
}
char * p = insertTags(pSql->sqlstr, pTscObj->tags); char * p = insertTags(pSql->sqlstr, pTscObj->tags);
if(p == NULL) { if(p == NULL) {
return false; return false;
......
...@@ -862,7 +862,6 @@ int32_t tscValidateSqlInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) { ...@@ -862,7 +862,6 @@ int32_t tscValidateSqlInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
const char* msg3 = "name too long"; const char* msg3 = "name too long";
const char* msg5 = "invalid user rights"; const char* msg5 = "invalid user rights";
const char* msg7 = "not support options"; const char* msg7 = "not support options";
const char* msg8 = "tags filter length must over 3 bytes.";
pCmd->command = pInfo->type; pCmd->command = pInfo->type;
...@@ -901,10 +900,7 @@ int32_t tscValidateSqlInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) { ...@@ -901,10 +900,7 @@ int32_t tscValidateSqlInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
} else { } else {
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg5); return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg5);
} }
} else if (pUser->type == TSDB_ALTER_USER_TAGS) { }
SStrToken* pTags = &pUser->tags;
if(pTags->n < 4)
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg8);
} else { } else {
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg7); return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg7);
} }
......
...@@ -97,7 +97,7 @@ static int32_t mnodeUserActionDecode(SSdbRow *pRow) { ...@@ -97,7 +97,7 @@ static int32_t mnodeUserActionDecode(SSdbRow *pRow) {
SUserObj *pUser = (SUserObj *)calloc(1, sizeof(SUserObj)); SUserObj *pUser = (SUserObj *)calloc(1, sizeof(SUserObj));
if (pUser == NULL) return TSDB_CODE_MND_OUT_OF_MEMORY; if (pUser == NULL) return TSDB_CODE_MND_OUT_OF_MEMORY;
memcpy(pUser, pRow->rowData, tsUserUpdateSize); memcpy(pUser, pRow->rowData, pRow->rowSize);
pRow->pObj = pUser; pRow->pObj = pUser;
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册