Merge pull request #16418 from taosdata/fix/TD-18457
fix(query): fix valgrind report uninitialized variable error
This commit is contained in:
commit
679145dcb6
|
@ -1975,7 +1975,7 @@ _OVER:
|
||||||
|
|
||||||
int32_t appendTbToReq(SHashObj* pHash, int32_t pos1, int32_t len1, int32_t pos2, int32_t len2, const char* str,
|
int32_t appendTbToReq(SHashObj* pHash, int32_t pos1, int32_t len1, int32_t pos2, int32_t len2, const char* str,
|
||||||
int32_t acctId, char* db) {
|
int32_t acctId, char* db) {
|
||||||
SName name;
|
SName name = {0};
|
||||||
|
|
||||||
if (len1 <= 0) {
|
if (len1 <= 0) {
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -188,7 +188,7 @@ typedef struct SCtgTbCache {
|
||||||
|
|
||||||
typedef struct SCtgVgCache {
|
typedef struct SCtgVgCache {
|
||||||
SRWLatch vgLock;
|
SRWLatch vgLock;
|
||||||
SDBVgInfo *vgInfo;
|
SDBVgInfo *vgInfo;
|
||||||
} SCtgVgCache;
|
} SCtgVgCache;
|
||||||
|
|
||||||
typedef struct SCtgDBCache {
|
typedef struct SCtgDBCache {
|
||||||
|
@ -224,7 +224,7 @@ typedef struct SCtgUserAuth {
|
||||||
} SCtgUserAuth;
|
} SCtgUserAuth;
|
||||||
|
|
||||||
typedef struct SCatalog {
|
typedef struct SCatalog {
|
||||||
uint64_t clusterId;
|
uint64_t clusterId;
|
||||||
SHashObj *userCache; //key:user, value:SCtgUserAuth
|
SHashObj *userCache; //key:user, value:SCtgUserAuth
|
||||||
SHashObj *dbCache; //key:dbname, value:SCtgDBCache
|
SHashObj *dbCache; //key:dbname, value:SCtgDBCache
|
||||||
SCtgRentMgmt dbRent;
|
SCtgRentMgmt dbRent;
|
||||||
|
@ -253,9 +253,9 @@ typedef struct SCtgJob {
|
||||||
int32_t jobResCode;
|
int32_t jobResCode;
|
||||||
int32_t taskIdx;
|
int32_t taskIdx;
|
||||||
SRWLatch taskLock;
|
SRWLatch taskLock;
|
||||||
|
|
||||||
uint64_t queryId;
|
uint64_t queryId;
|
||||||
SCatalog* pCtg;
|
SCatalog* pCtg;
|
||||||
SRequestConnInfo conn;
|
SRequestConnInfo conn;
|
||||||
void* userParam;
|
void* userParam;
|
||||||
catalogCallback userFp;
|
catalogCallback userFp;
|
||||||
|
@ -279,7 +279,7 @@ typedef struct SCtgMsgCtx {
|
||||||
void* lastOut;
|
void* lastOut;
|
||||||
void* out;
|
void* out;
|
||||||
char* target;
|
char* target;
|
||||||
SHashObj* pBatchs;
|
SHashObj* pBatchs;
|
||||||
} SCtgMsgCtx;
|
} SCtgMsgCtx;
|
||||||
|
|
||||||
|
|
||||||
|
@ -364,7 +364,7 @@ typedef struct SCtgCacheStat {
|
||||||
uint64_t numOfMetaHit;
|
uint64_t numOfMetaHit;
|
||||||
uint64_t numOfMetaMiss;
|
uint64_t numOfMetaMiss;
|
||||||
uint64_t numOfIndexHit;
|
uint64_t numOfIndexHit;
|
||||||
uint64_t numOfIndexMiss;
|
uint64_t numOfIndexMiss;
|
||||||
uint64_t numOfUserHit;
|
uint64_t numOfUserHit;
|
||||||
uint64_t numOfUserMiss;
|
uint64_t numOfUserMiss;
|
||||||
uint64_t numOfClear;
|
uint64_t numOfClear;
|
||||||
|
@ -451,7 +451,7 @@ typedef struct SCtgCacheOperation {
|
||||||
int32_t opId;
|
int32_t opId;
|
||||||
void *data;
|
void *data;
|
||||||
bool syncOp;
|
bool syncOp;
|
||||||
tsem_t rspSem;
|
tsem_t rspSem;
|
||||||
bool stopQueue;
|
bool stopQueue;
|
||||||
bool unLocked;
|
bool unLocked;
|
||||||
} SCtgCacheOperation;
|
} SCtgCacheOperation;
|
||||||
|
@ -466,7 +466,7 @@ typedef struct SCtgQueue {
|
||||||
bool stopQueue;
|
bool stopQueue;
|
||||||
SCtgQNode *head;
|
SCtgQNode *head;
|
||||||
SCtgQNode *tail;
|
SCtgQNode *tail;
|
||||||
tsem_t reqSem;
|
tsem_t reqSem;
|
||||||
uint64_t qRemainNum;
|
uint64_t qRemainNum;
|
||||||
} SCtgQueue;
|
} SCtgQueue;
|
||||||
|
|
||||||
|
@ -475,7 +475,7 @@ typedef struct SCatalogMgmt {
|
||||||
int32_t jobPool;
|
int32_t jobPool;
|
||||||
SRWLatch lock;
|
SRWLatch lock;
|
||||||
SCtgQueue queue;
|
SCtgQueue queue;
|
||||||
TdThread updateThread;
|
TdThread updateThread;
|
||||||
SHashObj *pCluster; //key: clusterId, value: SCatalog*
|
SHashObj *pCluster; //key: clusterId, value: SCatalog*
|
||||||
SCatalogStat stat;
|
SCatalogStat stat;
|
||||||
SCatalogCfg cfg;
|
SCatalogCfg cfg;
|
||||||
|
@ -528,8 +528,8 @@ typedef struct SCtgOperation {
|
||||||
|
|
||||||
#define CTG_META_SIZE(pMeta) (sizeof(STableMeta) + ((pMeta)->tableInfo.numOfTags + (pMeta)->tableInfo.numOfColumns) * sizeof(SSchema))
|
#define CTG_META_SIZE(pMeta) (sizeof(STableMeta) + ((pMeta)->tableInfo.numOfTags + (pMeta)->tableInfo.numOfColumns) * sizeof(SSchema))
|
||||||
|
|
||||||
#define CTG_TABLE_NOT_EXIST(code) (code == CTG_ERR_CODE_TABLE_NOT_EXIST)
|
#define CTG_TABLE_NOT_EXIST(code) (code == CTG_ERR_CODE_TABLE_NOT_EXIST)
|
||||||
#define CTG_DB_NOT_EXIST(code) (code == TSDB_CODE_MND_DB_NOT_EXIST)
|
#define CTG_DB_NOT_EXIST(code) (code == TSDB_CODE_MND_DB_NOT_EXIST)
|
||||||
|
|
||||||
#define ctgFatal(param, ...) qFatal("CTG:%p " param, pCtg, __VA_ARGS__)
|
#define ctgFatal(param, ...) qFatal("CTG:%p " param, pCtg, __VA_ARGS__)
|
||||||
#define ctgError(param, ...) qError("CTG:%p " param, pCtg, __VA_ARGS__)
|
#define ctgError(param, ...) qError("CTG:%p " param, pCtg, __VA_ARGS__)
|
||||||
|
@ -576,7 +576,7 @@ typedef struct SCtgOperation {
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
|
||||||
#define CTG_ERR_RET(c) do { int32_t _code = c; if (_code != TSDB_CODE_SUCCESS) { terrno = _code; return _code; } } while (0)
|
#define CTG_ERR_RET(c) do { int32_t _code = c; if (_code != TSDB_CODE_SUCCESS) { terrno = _code; return _code; } } while (0)
|
||||||
#define CTG_RET(c) do { int32_t _code = c; if (_code != TSDB_CODE_SUCCESS) { terrno = _code; } return _code; } while (0)
|
#define CTG_RET(c) do { int32_t _code = c; if (_code != TSDB_CODE_SUCCESS) { terrno = _code; } return _code; } while (0)
|
||||||
#define CTG_ERR_JRET(c) do { code = c; if (code != TSDB_CODE_SUCCESS) { terrno = code; goto _return; } } while (0)
|
#define CTG_ERR_JRET(c) do { code = c; if (code != TSDB_CODE_SUCCESS) { terrno = code; goto _return; } } while (0)
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1715,7 +1715,7 @@ static int32_t skipUsingClause(SInsertParseSyntaxCxt* pCxt) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t collectTableMetaKey(SInsertParseSyntaxCxt* pCxt, bool isStable, int32_t tableNo, SToken* pTbToken) {
|
static int32_t collectTableMetaKey(SInsertParseSyntaxCxt* pCxt, bool isStable, int32_t tableNo, SToken* pTbToken) {
|
||||||
SName name;
|
SName name = {0};
|
||||||
CHECK_CODE(createSName(&name, pTbToken, pCxt->pComCxt->acctId, pCxt->pComCxt->db, &pCxt->msg));
|
CHECK_CODE(createSName(&name, pTbToken, pCxt->pComCxt->acctId, pCxt->pComCxt->db, &pCxt->msg));
|
||||||
CHECK_CODE(reserveTableMetaInCacheForInsert(&name, isStable ? CATALOG_REQ_TYPE_META : CATALOG_REQ_TYPE_BOTH, tableNo,
|
CHECK_CODE(reserveTableMetaInCacheForInsert(&name, isStable ? CATALOG_REQ_TYPE_META : CATALOG_REQ_TYPE_BOTH, tableNo,
|
||||||
pCxt->pMetaCache));
|
pCxt->pMetaCache));
|
||||||
|
@ -1730,7 +1730,7 @@ static int32_t checkTableName(const char* pTableName, SMsgBuf* pMsgBuf) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t collectAutoCreateTableMetaKey(SInsertParseSyntaxCxt* pCxt, int32_t tableNo, SToken* pTbToken) {
|
static int32_t collectAutoCreateTableMetaKey(SInsertParseSyntaxCxt* pCxt, int32_t tableNo, SToken* pTbToken) {
|
||||||
SName name;
|
SName name = {0};
|
||||||
CHECK_CODE(createSName(&name, pTbToken, pCxt->pComCxt->acctId, pCxt->pComCxt->db, &pCxt->msg));
|
CHECK_CODE(createSName(&name, pTbToken, pCxt->pComCxt->acctId, pCxt->pComCxt->db, &pCxt->msg));
|
||||||
CHECK_CODE(checkTableName(name.tname, &pCxt->msg));
|
CHECK_CODE(checkTableName(name.tname, &pCxt->msg));
|
||||||
CHECK_CODE(reserveTableMetaInCacheForInsert(&name, CATALOG_REQ_TYPE_VGROUP, tableNo, pCxt->pMetaCache));
|
CHECK_CODE(reserveTableMetaInCacheForInsert(&name, CATALOG_REQ_TYPE_VGROUP, tableNo, pCxt->pMetaCache));
|
||||||
|
|
|
@ -252,11 +252,15 @@ SHashObj *taosHashInit(size_t capacity, _hash_fn_t fn, bool update, SHashLockTyp
|
||||||
|
|
||||||
// the max slots is not defined by user
|
// the max slots is not defined by user
|
||||||
pHashObj->capacity = taosHashCapacity((int32_t)capacity);
|
pHashObj->capacity = taosHashCapacity((int32_t)capacity);
|
||||||
|
pHashObj->size = 0;
|
||||||
|
|
||||||
pHashObj->equalFp = memcmp;
|
pHashObj->equalFp = memcmp;
|
||||||
pHashObj->hashFp = fn;
|
pHashObj->hashFp = fn;
|
||||||
pHashObj->type = type;
|
pHashObj->type = type;
|
||||||
|
pHashObj->lock = 0;
|
||||||
pHashObj->enableUpdate = update;
|
pHashObj->enableUpdate = update;
|
||||||
|
pHashObj->freeFp = NULL;
|
||||||
|
pHashObj->callbackFp = NULL;
|
||||||
|
|
||||||
ASSERT((pHashObj->capacity & (pHashObj->capacity - 1)) == 0);
|
ASSERT((pHashObj->capacity & (pHashObj->capacity - 1)) == 0);
|
||||||
|
|
||||||
|
@ -329,7 +333,7 @@ int32_t taosHashPut(SHashObj *pHashObj, const void *key, size_t keyLen, const vo
|
||||||
// disable resize
|
// disable resize
|
||||||
taosHashRLock(pHashObj);
|
taosHashRLock(pHashObj);
|
||||||
|
|
||||||
int32_t slot = HASH_INDEX(hashVal, pHashObj->capacity);
|
uint32_t slot = HASH_INDEX(hashVal, pHashObj->capacity);
|
||||||
SHashEntry *pe = pHashObj->hashList[slot];
|
SHashEntry *pe = pHashObj->hashList[slot];
|
||||||
|
|
||||||
taosHashEntryWLock(pHashObj, pe);
|
taosHashEntryWLock(pHashObj, pe);
|
||||||
|
|
Loading…
Reference in New Issue