未验证 提交 97be346a 编写于 作者: D dapan1121 提交者: GitHub

Merge pull request #17623 from taosdata/fix/TS-1951-V26

fix(mdb): compatible v2.0 2.2 mdb file format and ignore blank
...@@ -334,6 +334,26 @@ bool appendTagsFilter(SSqlObj* pSql) { ...@@ -334,6 +334,26 @@ bool appendTagsFilter(SSqlObj* pSql) {
return false; return false;
} }
// check tags is blank or ''
char* p1 = pTscObj->tags;
if (strcmp(p1, "\'\'") == 0) {
tscDebug("TAGS 0x%" PRIx64 " tags is empty. user=%s", pSql->self, pTscObj->user);
return false;
}
bool blank = true;
while(*p1 != 0) {
if(*p1 != ' ') {
blank = false;
break;
}
++p1;
}
// 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,7 @@ int32_t tscValidateSqlInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) { ...@@ -862,7 +862,7 @@ 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."; const char* msg8 = "tags filter string length must less than 255 bytes.";
pCmd->command = pInfo->type; pCmd->command = pInfo->type;
...@@ -903,15 +903,14 @@ int32_t tscValidateSqlInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) { ...@@ -903,15 +903,14 @@ int32_t tscValidateSqlInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
} }
} else if (pUser->type == TSDB_ALTER_USER_TAGS) { } else if (pUser->type == TSDB_ALTER_USER_TAGS) {
SStrToken* pTags = &pUser->tags; SStrToken* pTags = &pUser->tags;
if(pTags->n < 4) if (pTags->n > TSDB_TAGS_LEN - 1 ) return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg8);
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg8); } else {
} else {
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg7); return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg7);
} }
} }
break; break;
} }
case TSDB_SQL_CFG_LOCAL: { case TSDB_SQL_CFG_LOCAL: {
SMiscInfo *pMiscInfo = pInfo->pMiscInfo; SMiscInfo *pMiscInfo = pInfo->pMiscInfo;
......
...@@ -377,7 +377,7 @@ void shellRunCommandOnServer(TAOS *con, char command[]) { ...@@ -377,7 +377,7 @@ void shellRunCommandOnServer(TAOS *con, char command[]) {
} else { } else {
int num_rows_affacted = taos_affected_rows(pSql); int num_rows_affacted = taos_affected_rows(pSql);
et = taosGetTimestampUs(); et = taosGetTimestampUs();
printf("Query OK, %d of %d row(s) in database (%.6fs)\n", num_rows_affacted, num_rows_affacted, (et - st) / 1E6); printf("Query OK, %d row(s) affected in set (%.6fs)\n", num_rows_affacted, (et - st) / 1E6);
#ifndef WINDOWS #ifndef WINDOWS
// call auto tab // call auto tab
......
...@@ -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.
先完成此消息的编辑!
想要评论请 注册