fix:[TD-31017]process return value in client
This commit is contained in:
parent
ce324cf4bc
commit
3e8daeeb91
|
@ -245,7 +245,12 @@ int32_t processUseDbRsp(void* param, SDataBuf* pMsg, int32_t code) {
|
|||
if (TSDB_CODE_MND_DB_NOT_EXIST == code || TSDB_CODE_MND_DB_IN_CREATING == code ||
|
||||
TSDB_CODE_MND_DB_IN_DROPPING == code) {
|
||||
SUseDbRsp usedbRsp = {0};
|
||||
(void)tDeserializeSUseDbRsp(pMsg->pData, pMsg->len, &usedbRsp);
|
||||
code = tDeserializeSUseDbRsp(pMsg->pData, pMsg->len, &usedbRsp);
|
||||
if(code != 0){
|
||||
tscError("0x%" PRIx64 " failed to deserialize SUseDbRsp", pRequest->requestId);
|
||||
tFreeSUsedbRsp(&usedbRsp);
|
||||
return TAOS_GET_TERRNO(code);
|
||||
}
|
||||
struct SCatalog* pCatalog = NULL;
|
||||
|
||||
if (usedbRsp.vgVersion >= 0) { // cached in local
|
||||
|
@ -255,7 +260,13 @@ int32_t processUseDbRsp(void* param, SDataBuf* pMsg, int32_t code) {
|
|||
tscWarn("0x%" PRIx64 "catalogGetHandle failed, clusterId:%" PRIx64 ", error:%s", pRequest->requestId, clusterId,
|
||||
tstrerror(code1));
|
||||
} else {
|
||||
(void)catalogRemoveDB(pCatalog, usedbRsp.db, usedbRsp.uid);
|
||||
code = catalogRemoveDB(pCatalog, usedbRsp.db, usedbRsp.uid);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
tscError("0x%" PRIx64 "catalogRemoveDB failed, db:%s, uid:%" PRId64 ", error:%s", pRequest->requestId,
|
||||
usedbRsp.db, usedbRsp.uid, tstrerror(code));
|
||||
tFreeSUsedbRsp(&usedbRsp);
|
||||
return TAOS_GET_TERRNO(code);
|
||||
}
|
||||
}
|
||||
}
|
||||
tFreeSUsedbRsp(&usedbRsp);
|
||||
|
@ -270,14 +281,19 @@ int32_t processUseDbRsp(void* param, SDataBuf* pMsg, int32_t code) {
|
|||
doRequestCallback(pRequest, pRequest->code);
|
||||
|
||||
} else {
|
||||
tsem_post(&pRequest->body.rspSem);
|
||||
(void)tsem_post(&pRequest->body.rspSem);
|
||||
}
|
||||
|
||||
return code;
|
||||
}
|
||||
|
||||
SUseDbRsp usedbRsp = {0};
|
||||
(void)tDeserializeSUseDbRsp(pMsg->pData, pMsg->len, &usedbRsp);
|
||||
code = tDeserializeSUseDbRsp(pMsg->pData, pMsg->len, &usedbRsp);
|
||||
if (code != 0){
|
||||
tscError("0x%" PRIx64 " failed to deserialize SUseDbRsp", pRequest->requestId);
|
||||
tFreeSUsedbRsp(&usedbRsp);
|
||||
return TAOS_GET_TERRNO(code);
|
||||
}
|
||||
|
||||
if (strlen(usedbRsp.db) == 0) {
|
||||
if (usedbRsp.errCode != 0) {
|
||||
|
@ -300,7 +316,9 @@ int32_t processUseDbRsp(void* param, SDataBuf* pMsg, int32_t code) {
|
|||
}
|
||||
|
||||
SName name = {0};
|
||||
(void)tNameFromString(&name, usedbRsp.db, T_NAME_ACCT | T_NAME_DB);
|
||||
if(tNameFromString(&name, usedbRsp.db, T_NAME_ACCT | T_NAME_DB) != TSDB_CODE_SUCCESS) {
|
||||
tscError("0x%" PRIx64 " failed to parse db name:%s", pRequest->requestId, usedbRsp.db);
|
||||
}
|
||||
|
||||
SUseDbOutput output = {0};
|
||||
code = queryBuildUseDbOutput(&output, &usedbRsp);
|
||||
|
@ -317,7 +335,10 @@ int32_t processUseDbRsp(void* param, SDataBuf* pMsg, int32_t code) {
|
|||
tscWarn("catalogGetHandle failed, clusterId:%" PRIx64 ", error:%s", pRequest->pTscObj->pAppInfo->clusterId,
|
||||
tstrerror(code1));
|
||||
} else {
|
||||
(void)catalogUpdateDBVgInfo(pCatalog, output.db, output.dbId, output.dbVgroup);
|
||||
code = catalogUpdateDBVgInfo(pCatalog, output.db, output.dbId, output.dbVgroup);
|
||||
if(code != 0){
|
||||
tscError("0x%" PRIx64 " failed to update db vgroup info since %s", pRequest->requestId, tstrerror(code));
|
||||
}
|
||||
output.dbVgroup = NULL;
|
||||
}
|
||||
}
|
||||
|
@ -326,7 +347,9 @@ int32_t processUseDbRsp(void* param, SDataBuf* pMsg, int32_t code) {
|
|||
tFreeSUsedbRsp(&usedbRsp);
|
||||
|
||||
char db[TSDB_DB_NAME_LEN] = {0};
|
||||
(void)tNameGetDbName(&name, db);
|
||||
if(tNameGetDbName(&name, db) != TSDB_CODE_SUCCESS) {
|
||||
tscError("0x%" PRIx64 " failed to get db name since %s", pRequest->requestId, tstrerror(code));
|
||||
}
|
||||
|
||||
setConnectionDB(pRequest->pTscObj, db);
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ static char* readFile(TdFilePtr pFile, int64_t *offset, int64_t size){
|
|||
return NULL;
|
||||
}
|
||||
char* buf = pCont;
|
||||
strcat(buf++, "[");
|
||||
(void)strcat(buf++, "[");
|
||||
int64_t readSize = taosReadFile(pFile, buf, SLOW_LOG_SEND_SIZE_MAX);
|
||||
if (readSize <= 0) {
|
||||
if (readSize < 0){
|
||||
|
@ -153,7 +153,7 @@ TEST(clientMonitorTest, ReadOneFile) {
|
|||
const int size = 10;
|
||||
for(int i = 0; i < batch; i++){
|
||||
char value[size] = {0};
|
||||
memset(value, '0' + i, size - 1);
|
||||
(void)memset(value, '0' + i, size - 1);
|
||||
if (taosWriteFile(pFile, value, strlen(value) + 1) < 0){
|
||||
uError("failed to write len to file:%p since %s", pFile, terrstr());
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -31,7 +31,7 @@ Testbase MndTestTopic::test;
|
|||
|
||||
void* MndTestTopic::BuildCreateDbReq(const char* dbname, int32_t* pContLen) {
|
||||
SCreateDbReq createReq = {0};
|
||||
strcpy(createReq.db, dbname);
|
||||
(void)strcpy(createReq.db, dbname);
|
||||
createReq.numOfVgroups = 2;
|
||||
createReq.buffer = -1;
|
||||
createReq.pageSize = -1;
|
||||
|
@ -53,7 +53,8 @@ void* MndTestTopic::BuildCreateDbReq(const char* dbname, int32_t* pContLen) {
|
|||
|
||||
int32_t contLen = tSerializeSCreateDbReq(NULL, 0, &createReq);
|
||||
void* pReq = rpcMallocCont(contLen);
|
||||
tSerializeSCreateDbReq(pReq, contLen, &createReq);
|
||||
assert(pReq != NULL);
|
||||
(void)tSerializeSCreateDbReq(pReq, contLen, &createReq);
|
||||
|
||||
*pContLen = contLen;
|
||||
return pReq;
|
||||
|
@ -61,14 +62,15 @@ void* MndTestTopic::BuildCreateDbReq(const char* dbname, int32_t* pContLen) {
|
|||
|
||||
void* MndTestTopic::BuildCreateTopicReq(const char* topicName, const char* sql, int32_t* pContLen) {
|
||||
SCMCreateTopicReq createReq = {0};
|
||||
strcpy(createReq.name, topicName);
|
||||
(void)strcpy(createReq.name, topicName);
|
||||
createReq.igExists = 0;
|
||||
createReq.sql = (char*)sql;
|
||||
createReq.ast = NULL;
|
||||
|
||||
int32_t contLen = tSerializeSCMCreateTopicReq(NULL, 0, &createReq);
|
||||
void* pReq = rpcMallocCont(contLen);
|
||||
tSerializeSCMCreateTopicReq(pReq, contLen, &createReq);
|
||||
assert(pReq != NULL);
|
||||
(void)tSerializeSCMCreateTopicReq(pReq, contLen, &createReq);
|
||||
|
||||
*pContLen = contLen;
|
||||
return pReq;
|
||||
|
@ -76,11 +78,12 @@ void* MndTestTopic::BuildCreateTopicReq(const char* topicName, const char* sql,
|
|||
|
||||
void* MndTestTopic::BuildDropTopicReq(const char* topicName, int32_t* pContLen) {
|
||||
SMDropTopicReq dropReq = {0};
|
||||
strcpy(dropReq.name, topicName);
|
||||
(void)strcpy(dropReq.name, topicName);
|
||||
|
||||
int32_t contLen = tSerializeSMDropTopicReq(NULL, 0, &dropReq);
|
||||
void* pReq = rpcMallocCont(contLen);
|
||||
tSerializeSMDropTopicReq(pReq, contLen, &dropReq);
|
||||
assert(pReq != NULL);
|
||||
(void)tSerializeSMDropTopicReq(pReq, contLen, &dropReq);
|
||||
|
||||
*pContLen = contLen;
|
||||
return pReq;
|
||||
|
|
Loading…
Reference in New Issue