fix(query): fix coverity issues.
This commit is contained in:
parent
0c9145645b
commit
61a7001274
|
@ -189,27 +189,46 @@ void tmq_commit_cb_print(tmq_t* tmq, int32_t code, void* param) {
|
||||||
|
|
||||||
tmq_t* build_consumer() {
|
tmq_t* build_consumer() {
|
||||||
tmq_conf_res_t code;
|
tmq_conf_res_t code;
|
||||||
|
tmq_t* tmq = NULL;
|
||||||
|
|
||||||
tmq_conf_t* conf = tmq_conf_new();
|
tmq_conf_t* conf = tmq_conf_new();
|
||||||
code = tmq_conf_set(conf, "enable.auto.commit", "true");
|
code = tmq_conf_set(conf, "enable.auto.commit", "true");
|
||||||
if (TMQ_CONF_OK != code) return NULL;
|
if (TMQ_CONF_OK != code) {
|
||||||
|
goto _end;
|
||||||
|
}
|
||||||
code = tmq_conf_set(conf, "auto.commit.interval.ms", "1000");
|
code = tmq_conf_set(conf, "auto.commit.interval.ms", "1000");
|
||||||
if (TMQ_CONF_OK != code) return NULL;
|
if (TMQ_CONF_OK != code) {
|
||||||
|
goto _end;
|
||||||
|
}
|
||||||
code = tmq_conf_set(conf, "group.id", "cgrpName");
|
code = tmq_conf_set(conf, "group.id", "cgrpName");
|
||||||
if (TMQ_CONF_OK != code) return NULL;
|
if (TMQ_CONF_OK != code) {
|
||||||
|
goto _end;
|
||||||
|
}
|
||||||
code = tmq_conf_set(conf, "client.id", "user defined name");
|
code = tmq_conf_set(conf, "client.id", "user defined name");
|
||||||
if (TMQ_CONF_OK != code) return NULL;
|
if (TMQ_CONF_OK != code) {
|
||||||
|
goto _end;
|
||||||
|
}
|
||||||
code = tmq_conf_set(conf, "td.connect.user", "root");
|
code = tmq_conf_set(conf, "td.connect.user", "root");
|
||||||
if (TMQ_CONF_OK != code) return NULL;
|
if (TMQ_CONF_OK != code) {
|
||||||
|
goto _end;
|
||||||
|
}
|
||||||
code = tmq_conf_set(conf, "td.connect.pass", "taosdata");
|
code = tmq_conf_set(conf, "td.connect.pass", "taosdata");
|
||||||
if (TMQ_CONF_OK != code) return NULL;
|
if (TMQ_CONF_OK != code) {
|
||||||
|
goto _end;
|
||||||
|
}
|
||||||
code = tmq_conf_set(conf, "auto.offset.reset", "earliest");
|
code = tmq_conf_set(conf, "auto.offset.reset", "earliest");
|
||||||
if (TMQ_CONF_OK != code) return NULL;
|
if (TMQ_CONF_OK != code) {
|
||||||
|
goto _end;
|
||||||
|
}
|
||||||
code = tmq_conf_set(conf, "experimental.snapshot.enable", "false");
|
code = tmq_conf_set(conf, "experimental.snapshot.enable", "false");
|
||||||
if (TMQ_CONF_OK != code) return NULL;
|
if (TMQ_CONF_OK != code) {
|
||||||
|
goto _end;
|
||||||
|
}
|
||||||
|
|
||||||
tmq_conf_set_auto_commit_cb(conf, tmq_commit_cb_print, NULL);
|
tmq_conf_set_auto_commit_cb(conf, tmq_commit_cb_print, NULL);
|
||||||
|
tmq = tmq_consumer_new(conf, NULL, 0);
|
||||||
|
|
||||||
tmq_t* tmq = tmq_consumer_new(conf, NULL, 0);
|
_end:
|
||||||
tmq_conf_destroy(conf);
|
tmq_conf_destroy(conf);
|
||||||
return tmq;
|
return tmq;
|
||||||
}
|
}
|
||||||
|
|
|
@ -148,7 +148,7 @@ bool tsdbDelFileIsSame(SDelFile *pDelFile1, SDelFile *pDelFile2) { return pDelFi
|
||||||
|
|
||||||
int32_t tsdbDFileRollback(STsdb *pTsdb, SDFileSet *pSet, EDataFileT ftype) {
|
int32_t tsdbDFileRollback(STsdb *pTsdb, SDFileSet *pSet, EDataFileT ftype) {
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
int64_t size;
|
int64_t size = 0;
|
||||||
int64_t n;
|
int64_t n;
|
||||||
TdFilePtr pFD;
|
TdFilePtr pFD;
|
||||||
char fname[TSDB_FILENAME_LEN];
|
char fname[TSDB_FILENAME_LEN];
|
||||||
|
@ -167,7 +167,7 @@ int32_t tsdbDFileRollback(STsdb *pTsdb, SDFileSet *pSet, EDataFileT ftype) {
|
||||||
tPutSmaFile(hdr, pSet->pSmaF);
|
tPutSmaFile(hdr, pSet->pSmaF);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ASSERT(0);
|
goto _err; // make the coverity scan happy
|
||||||
}
|
}
|
||||||
|
|
||||||
taosCalcChecksumAppend(0, hdr, TSDB_FHDR_SIZE);
|
taosCalcChecksumAppend(0, hdr, TSDB_FHDR_SIZE);
|
||||||
|
|
|
@ -1148,7 +1148,6 @@ int32_t getGroupIdFromTagsVal(void* pMeta, uint64_t uid, SNodeList* pGroupNode,
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
REPLACE_NODE(pNew);
|
REPLACE_NODE(pNew);
|
||||||
} else {
|
} else {
|
||||||
taosMemoryFree(keyBuf);
|
|
||||||
nodesDestroyList(groupNew);
|
nodesDestroyList(groupNew);
|
||||||
metaReaderClear(&mr);
|
metaReaderClear(&mr);
|
||||||
return code;
|
return code;
|
||||||
|
@ -1166,7 +1165,6 @@ int32_t getGroupIdFromTagsVal(void* pMeta, uint64_t uid, SNodeList* pGroupNode,
|
||||||
if (pValue->node.resType.type == TSDB_DATA_TYPE_JSON) {
|
if (pValue->node.resType.type == TSDB_DATA_TYPE_JSON) {
|
||||||
if (tTagIsJson(data)) {
|
if (tTagIsJson(data)) {
|
||||||
terrno = TSDB_CODE_QRY_JSON_IN_GROUP_ERROR;
|
terrno = TSDB_CODE_QRY_JSON_IN_GROUP_ERROR;
|
||||||
taosMemoryFree(keyBuf);
|
|
||||||
nodesDestroyList(groupNew);
|
nodesDestroyList(groupNew);
|
||||||
metaReaderClear(&mr);
|
metaReaderClear(&mr);
|
||||||
return terrno;
|
return terrno;
|
||||||
|
|
|
@ -353,7 +353,6 @@ int32_t qUpdateQualifiedTableId(qTaskInfo_t tinfo, const SArray* tableIdList, bo
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo refactor STableList
|
|
||||||
bool assignUid = false;
|
bool assignUid = false;
|
||||||
size_t bufLen = (pScanInfo->pGroupTags != NULL) ? getTableTagsBufLen(pScanInfo->pGroupTags) : 0;
|
size_t bufLen = (pScanInfo->pGroupTags != NULL) ? getTableTagsBufLen(pScanInfo->pGroupTags) : 0;
|
||||||
char* keyBuf = NULL;
|
char* keyBuf = NULL;
|
||||||
|
|
|
@ -3019,8 +3019,8 @@ int32_t tblCountScanGetInputs(SNodeList* groupTags, SName* tableName, STableCoun
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
strncpy(supp->dbNameFilter, tNameGetDbNameP(tableName), TSDB_DB_NAME_LEN);
|
tstrncpy(supp->dbNameFilter, tNameGetDbNameP(tableName), TSDB_DB_NAME_LEN);
|
||||||
strncpy(supp->stbNameFilter, tNameGetTableName(tableName), TSDB_TABLE_NAME_LEN);
|
tstrncpy(supp->stbNameFilter, tNameGetTableName(tableName), TSDB_TABLE_NAME_LEN);
|
||||||
}
|
}
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue