[td-225] refactor.
This commit is contained in:
parent
bc602464b0
commit
67c3831601
|
@ -405,7 +405,8 @@ void tscTableMetaCallBack(void *param, TAOS_RES *res, int code) {
|
|||
SSqlRes *pRes = &pSql->res;
|
||||
pRes->code = code;
|
||||
|
||||
const char* msg = (pCmd->command == TSDB_SQL_STABLEVGROUP)? "vgroup-list":"table-meta";
|
||||
SSqlObj *sub = (SSqlObj*) res;
|
||||
const char* msg = (sub->cmd.command == TSDB_SQL_STABLEVGROUP)? "vgroup-list":"table-meta";
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
tscError("%p get %s failed, code:%s", pSql, msg, tstrerror(code));
|
||||
goto _error;
|
||||
|
|
|
@ -744,10 +744,10 @@ static void tidTagRetrieveCallback(void* param, TAOS_RES* tres, int32_t numOfRow
|
|||
tscBuildVgroupTableInfo(pParentSql, pTableMetaInfo2, s2);
|
||||
|
||||
SSqlObj* psub1 = pParentSql->pSubs[0];
|
||||
((SJoinSupporter*)psub1->param)->pVgroupTables = tscCloneVgroupTableInfo(pTableMetaInfo1->pVgroupTables);
|
||||
((SJoinSupporter*)psub1->param)->pVgroupTables = tscVgroupTableInfoClone(pTableMetaInfo1->pVgroupTables);
|
||||
|
||||
SSqlObj* psub2 = pParentSql->pSubs[1];
|
||||
((SJoinSupporter*)psub2->param)->pVgroupTables = tscCloneVgroupTableInfo(pTableMetaInfo2->pVgroupTables);
|
||||
((SJoinSupporter*)psub2->param)->pVgroupTables = tscVgroupTableInfoClone(pTableMetaInfo2->pVgroupTables);
|
||||
|
||||
pParentSql->subState.numOfSub = 2;
|
||||
pParentSql->subState.numOfRemain = pParentSql->subState.numOfSub;
|
||||
|
|
|
@ -251,16 +251,16 @@ static const char isIdChar[] = {
|
|||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, /* 7x */
|
||||
};
|
||||
|
||||
static void* KeywordHashTable = NULL;
|
||||
static void* keywordHashTable = NULL;
|
||||
|
||||
static void doInitKeywordsTable(void) {
|
||||
int numOfEntries = tListLen(keywordTable);
|
||||
|
||||
KeywordHashTable = taosHashInit(numOfEntries, MurmurHash3_32, true, false);
|
||||
keywordHashTable = taosHashInit(numOfEntries, MurmurHash3_32, true, false);
|
||||
for (int32_t i = 0; i < numOfEntries; i++) {
|
||||
keywordTable[i].len = (uint8_t)strlen(keywordTable[i].name);
|
||||
void* ptr = &keywordTable[i];
|
||||
taosHashPut(KeywordHashTable, keywordTable[i].name, keywordTable[i].len, (void*)&ptr, POINTER_BYTES);
|
||||
taosHashPut(keywordHashTable, keywordTable[i].name, keywordTable[i].len, (void*)&ptr, POINTER_BYTES);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -282,7 +282,7 @@ int tSQLKeywordCode(const char* z, int n) {
|
|||
}
|
||||
}
|
||||
|
||||
SKeyword** pKey = (SKeyword**)taosHashGet(KeywordHashTable, key, n);
|
||||
SKeyword** pKey = (SKeyword**)taosHashGet(keywordHashTable, key, n);
|
||||
return (pKey != NULL)? (*pKey)->type:TK_ID;
|
||||
}
|
||||
|
||||
|
@ -660,5 +660,8 @@ SStrToken tStrGetToken(char* str, int32_t* i, bool isPrevOptr, uint32_t numOfIgn
|
|||
bool isKeyWord(const char* z, int32_t len) { return (tSQLKeywordCode((char*)z, len) != TK_ID); }
|
||||
|
||||
void taosCleanupKeywordsTable() {
|
||||
taosHashCleanup(KeywordHashTable);
|
||||
void* m = keywordHashTable;
|
||||
if (m != NULL && atomic_val_compare_exchange_ptr(&keywordHashTable, m, 0) == m) {
|
||||
taosHashCleanup(m);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue