提交 649e8c95 编写于 作者: A Alex Duan

Merge branch '2.6' into feat/TS-1839-V26

...@@ -240,12 +240,12 @@ def pre_test_win(){ ...@@ -240,12 +240,12 @@ def pre_test_win(){
} }
bat ''' bat '''
cd %WIN_INTERNAL_ROOT% cd %WIN_INTERNAL_ROOT%
git pull git pull origin ''' + env.CHANGE_TARGET + '''
''' '''
bat ''' bat '''
cd %WIN_COMMUNITY_ROOT% cd %WIN_COMMUNITY_ROOT%
git remote prune origin git remote prune origin
git pull git pull origin ''' + env.CHANGE_TARGET + '''
''' '''
bat ''' bat '''
cd %WIN_INTERNAL_ROOT% cd %WIN_INTERNAL_ROOT%
......
...@@ -16,7 +16,7 @@ class MockDataSource implements Iterator { ...@@ -16,7 +16,7 @@ class MockDataSource implements Iterator {
private int currentTbId = -1; private int currentTbId = -1;
// mock values // mock values
String[] location = {"LosAngeles", "SanDiego", "Hollywood", "Compton", "San Francisco"}; String[] location = {"California.LosAngeles", "California.SanDiego", "California.SanJose", "California.Campbell", "California.SanFrancisco"};
float[] current = {8.8f, 10.7f, 9.9f, 8.9f, 9.4f}; float[] current = {8.8f, 10.7f, 9.9f, 8.9f, 9.4f};
int[] voltage = {119, 116, 111, 113, 118}; int[] voltage = {119, 116, 111, 113, 118};
float[] phase = {0.32f, 0.34f, 0.33f, 0.329f, 0.141f}; float[] phase = {0.32f, 0.34f, 0.33f, 0.329f, 0.141f};
...@@ -50,4 +50,4 @@ class MockDataSource implements Iterator { ...@@ -50,4 +50,4 @@ class MockDataSource implements Iterator {
return sb.toString(); return sb.toString();
} }
} }
\ No newline at end of file
...@@ -42,7 +42,7 @@ def get_connection(): ...@@ -42,7 +42,7 @@ def get_connection():
# ANCHOR: MockDataSource # ANCHOR: MockDataSource
class MockDataSource: class MockDataSource:
location = ["LosAngeles", "SanDiego", "Hollywood", "Compton", "San Francisco"] location = ["California.LosAngeles", "California.SanDiego", "California.SanJose", "California.Campbell", "California.SanFrancisco"]
current = [8.8, 10.7, 9.9, 8.9, 9.4] current = [8.8, 10.7, 9.9, 8.9, 9.4]
voltage = [119, 116, 111, 113, 118] voltage = [119, 116, 111, 113, 118]
phase = [0.32, 0.34, 0.33, 0.329, 0.141] phase = [0.32, 0.34, 0.33, 0.329, 0.141]
......
...@@ -3,11 +3,11 @@ import time ...@@ -3,11 +3,11 @@ import time
class MockDataSource: class MockDataSource:
samples = [ samples = [
"8.8,119,0.32,LosAngeles,0", "8.8,119,0.32,California.LosAngeles,0",
"10.7,116,0.34,SanDiego,1", "10.7,116,0.34,California.SanDiego,1",
"9.9,111,0.33,Hollywood,2", "9.9,111,0.33,California.SanJose,2",
"8.9,113,0.329,Compton,3", "8.9,113,0.329,California.Campbell,3",
"9.4,118,0.141,San Francisco,4" "9.4,118,0.141,California.SanFrancisco,4"
] ]
def __init__(self, tb_name_prefix, table_count): def __init__(self, tb_name_prefix, table_count):
......
...@@ -132,7 +132,7 @@ Query OK, 2 row(s) in set (0.003128s) ...@@ -132,7 +132,7 @@ Query OK, 2 row(s) in set (0.003128s)
taosBenchmark taosBenchmark
``` ```
该命令将在数据库 test 下面自动创建一张超级表 meters,该超级表下有 1 万张表,表名为 "d0" 到 "d9999",每张表有 1 万条记录,每条记录有 (ts, current, voltage, phase) 四个字段,时间戳从 "2017-07-14 10:40:00 000" 到 "2017-07-14 10:40:09 999",每张表带有标签 location 和 groupId,groupId 被设置为 1 到 10, location 被设置为 "San Francisco" 或者 "Los Angeles"等城市名称。 该命令将在数据库 test 下面自动创建一张超级表 meters,该超级表下有 1 万张表,表名为 "d0" 到 "d9999",每张表有 1 万条记录,每条记录有 (ts, current, voltage, phase) 四个字段,时间戳从 "2017-07-14 10:40:00 000" 到 "2017-07-14 10:40:09 999",每张表带有标签 location 和 groupId,groupId 被设置为 1 到 10, location 被设置为 "California.SanFrancisco" 或者 "California.LosAngeles"等城市名称。
这条命令很快完成 1 亿条记录的插入。具体时间取决于硬件性能,即使在一台普通的 PC 服务器往往也仅需十几秒。 这条命令很快完成 1 亿条记录的插入。具体时间取决于硬件性能,即使在一台普通的 PC 服务器往往也仅需十几秒。
...@@ -154,10 +154,10 @@ taos> select count(*) from test.meters; ...@@ -154,10 +154,10 @@ taos> select count(*) from test.meters;
taos> select avg(current), max(voltage), min(phase) from test.meters; taos> select avg(current), max(voltage), min(phase) from test.meters;
``` ```
查询 location="San Francisco" 的记录总条数: 查询 location="California.SanFrancisco" 的记录总条数:
```sql ```sql
taos> select count(*) from test.meters where location="San Francisco"; taos> select count(*) from test.meters where location="California.SanFrancisco";
``` ```
查询 groupId=10 的所有记录的平均值、最大值、最小值等: 查询 groupId=10 的所有记录的平均值、最大值、最小值等:
......
...@@ -97,9 +97,9 @@ static int32_t getFieldBytesFromSmlKv(TAOS_SML_KV* kv, int32_t* bytes, uint64_t ...@@ -97,9 +97,9 @@ static int32_t getFieldBytesFromSmlKv(TAOS_SML_KV* kv, int32_t* bytes, uint64_t
// } // }
// free(ucs); // free(ucs);
// *bytes = bytesNeeded + VARSTR_HEADER_SIZE; // *bytes = bytesNeeded + VARSTR_HEADER_SIZE;
*bytes = kv->length * TSDB_NCHAR_SIZE + VARSTR_HEADER_SIZE; *bytes = (kv->length == 0 ? 1 : kv->length) * TSDB_NCHAR_SIZE + VARSTR_HEADER_SIZE;
} else if (kv->type == TSDB_DATA_TYPE_BINARY) { } else if (kv->type == TSDB_DATA_TYPE_BINARY) {
*bytes = kv->length + VARSTR_HEADER_SIZE; *bytes = (kv->length == 0 ? 1 : kv->length) + VARSTR_HEADER_SIZE;
} }
} }
return 0; return 0;
...@@ -2608,7 +2608,7 @@ int32_t tscParseLine(const char* sql, TAOS_SML_DATA_POINT* smlData, SSmlLinesInf ...@@ -2608,7 +2608,7 @@ int32_t tscParseLine(const char* sql, TAOS_SML_DATA_POINT* smlData, SSmlLinesInf
return ret; return ret;
} }
tscDebug("SML:0x%"PRIx64" Parse fields finished, num of fields:%d", info->id, smlData->fieldNum); tscDebug("SML:0x%"PRIx64" Parse fields finished, num of fields:%d", info->id, smlData->fieldNum);
if (smlData->fieldNum == 0) { if (smlData->fieldNum <= 1) {
tscDebug("SML:0x%"PRIx64" Parse fields error, no field in line", info->id); tscDebug("SML:0x%"PRIx64" Parse fields error, no field in line", info->id);
taosHashCleanup(keyHashTable); taosHashCleanup(keyHashTable);
return TSDB_CODE_TSC_LINE_SYNTAX_ERROR; return TSDB_CODE_TSC_LINE_SYNTAX_ERROR;
......
...@@ -1261,8 +1261,6 @@ static void insertBatchClean(STscStmt* pStmt) { ...@@ -1261,8 +1261,6 @@ static void insertBatchClean(STscStmt* pStmt) {
taosHashClear(pCmd->insertParam.pTableBlockHashList); taosHashClear(pCmd->insertParam.pTableBlockHashList);
tscFreeSqlResult(pSql); tscFreeSqlResult(pSql);
tscFreeSubobj(pSql); tscFreeSubobj(pSql);
tfree(pSql->pSubs);
pSql->subState.numOfSub = 0;
} }
static int insertBatchStmtExecute(STscStmt* pStmt) { static int insertBatchStmtExecute(STscStmt* pStmt) {
......
...@@ -330,7 +330,7 @@ void checkBrokenQueries(STscObj *pTscObj) { ...@@ -330,7 +330,7 @@ void checkBrokenQueries(STscObj *pTscObj) {
SSqlObj *pSql = pTscObj->sqlList; SSqlObj *pSql = pTscObj->sqlList;
while (pSql) { while (pSql) {
// avoid sqlobj may not be correctly removed from sql list // avoid sqlobj may not be correctly removed from sql list
if (pSql->sqlstr == NULL) { if (pSql->sqlstr == NULL || pSql->signature != pSql) {
pSql = pSql->next; pSql = pSql->next;
continue; continue;
} }
...@@ -3400,7 +3400,6 @@ int tscRenewTableMeta(SSqlObj *pSql) { ...@@ -3400,7 +3400,6 @@ int tscRenewTableMeta(SSqlObj *pSql) {
pthread_mutex_lock(&rootSql->mtxSubs); pthread_mutex_lock(&rootSql->mtxSubs);
tscFreeSubobj(rootSql); tscFreeSubobj(rootSql);
pthread_mutex_unlock(&rootSql->mtxSubs); pthread_mutex_unlock(&rootSql->mtxSubs);
tfree(rootSql->pSubs);
tscResetSqlCmd(&rootSql->cmd, true, rootSql->self); tscResetSqlCmd(&rootSql->cmd, true, rootSql->self);
code = getMultiTableMetaFromMnode(rootSql, pNameList, vgroupList, NULL, tscTableMetaCallBack, true); code = getMultiTableMetaFromMnode(rootSql, pNameList, vgroupList, NULL, tscTableMetaCallBack, true);
......
...@@ -232,8 +232,6 @@ static void tscProcessStreamQueryCallback(void *param, TAOS_RES *tres, int numOf ...@@ -232,8 +232,6 @@ static void tscProcessStreamQueryCallback(void *param, TAOS_RES *tres, int numOf
tscFreeSqlResult(pStream->pSql); tscFreeSqlResult(pStream->pSql);
tscFreeSubobj(pStream->pSql); tscFreeSubobj(pStream->pSql);
tfree(pStream->pSql->pSubs);
pStream->pSql->subState.numOfSub = 0;
pTableMetaInfo->vgroupList = tscVgroupInfoClear(pTableMetaInfo->vgroupList); pTableMetaInfo->vgroupList = tscVgroupInfoClear(pTableMetaInfo->vgroupList);
tscSetRetryTimer(pStream, pStream->pSql, retryDelay); tscSetRetryTimer(pStream, pStream->pSql, retryDelay);
...@@ -610,8 +608,6 @@ static void tscProcessStreamRetrieveResult(void *param, TAOS_RES *res, int numOf ...@@ -610,8 +608,6 @@ static void tscProcessStreamRetrieveResult(void *param, TAOS_RES *res, int numOf
tscFreeSqlResult(pSql); tscFreeSqlResult(pSql);
tscFreeSubobj(pSql); tscFreeSubobj(pSql);
tfree(pSql->pSubs);
pSql->subState.numOfSub = 0;
pTableMetaInfo->vgroupList = tscVgroupInfoClear(pTableMetaInfo->vgroupList); pTableMetaInfo->vgroupList = tscVgroupInfoClear(pTableMetaInfo->vgroupList);
tscSetNextLaunchTimer(pStream, pSql); tscSetNextLaunchTimer(pStream, pSql);
} }
......
...@@ -695,6 +695,12 @@ static int32_t tscLaunchRealSubqueries(SSqlObj* pSql) { ...@@ -695,6 +695,12 @@ static int32_t tscLaunchRealSubqueries(SSqlObj* pSql) {
} }
void freeJoinSubqueryObj(SSqlObj* pSql) { void freeJoinSubqueryObj(SSqlObj* pSql) {
if (pSql->subState.numOfSub == 0) {
return;
}
pthread_mutex_lock(&pSql->subState.mutex);
for (int32_t i = 0; i < pSql->subState.numOfSub; ++i) { for (int32_t i = 0; i < pSql->subState.numOfSub; ++i) {
SSqlObj* pSub = pSql->pSubs[i]; SSqlObj* pSub = pSql->pSubs[i];
if (pSub == NULL) { if (pSub == NULL) {
...@@ -707,13 +713,13 @@ void freeJoinSubqueryObj(SSqlObj* pSql) { ...@@ -707,13 +713,13 @@ void freeJoinSubqueryObj(SSqlObj* pSql) {
taos_free_result(pSub); taos_free_result(pSub);
pSql->pSubs[i] = NULL; pSql->pSubs[i] = NULL;
} }
if (pSql->subState.states) {
pthread_mutex_destroy(&pSql->subState.mutex);
}
tfree(pSql->subState.states); tfree(pSql->subState.states);
pSql->subState.numOfSub = 0; pSql->subState.numOfSub = 0;
pthread_mutex_unlock(&pSql->subState.mutex);
pthread_mutex_destroy(&pSql->subState.mutex);
} }
static int32_t quitAllSubquery(SSqlObj* pSqlSub, SSqlObj* pSqlObj, SJoinSupporter* pSupporter) { static int32_t quitAllSubquery(SSqlObj* pSqlSub, SSqlObj* pSqlObj, SJoinSupporter* pSupporter) {
...@@ -901,7 +907,6 @@ bool tscReparseSql(SSqlObj *sql, int32_t code){ ...@@ -901,7 +907,6 @@ bool tscReparseSql(SSqlObj *sql, int32_t code){
} }
tscFreeSubobj(sql); tscFreeSubobj(sql);
tfree(sql->pSubs);
sql->res.code = TSDB_CODE_SUCCESS; sql->res.code = TSDB_CODE_SUCCESS;
sql->retry++; sql->retry++;
...@@ -2180,7 +2185,6 @@ void tscHandleMasterJoinQuery(SSqlObj* pSql) { ...@@ -2180,7 +2185,6 @@ void tscHandleMasterJoinQuery(SSqlObj* pSql) {
assert((pQueryInfo->type & TSDB_QUERY_TYPE_SUBQUERY) == 0); assert((pQueryInfo->type & TSDB_QUERY_TYPE_SUBQUERY) == 0);
int32_t code = TSDB_CODE_SUCCESS; int32_t code = TSDB_CODE_SUCCESS;
pSql->subState.numOfSub = pQueryInfo->numOfTables;
if (pSql->subState.states == NULL) { if (pSql->subState.states == NULL) {
pSql->subState.states = calloc(pSql->subState.numOfSub, sizeof(*pSql->subState.states)); pSql->subState.states = calloc(pSql->subState.numOfSub, sizeof(*pSql->subState.states));
...@@ -2192,6 +2196,8 @@ void tscHandleMasterJoinQuery(SSqlObj* pSql) { ...@@ -2192,6 +2196,8 @@ void tscHandleMasterJoinQuery(SSqlObj* pSql) {
pthread_mutex_init(&pSql->subState.mutex, NULL); pthread_mutex_init(&pSql->subState.mutex, NULL);
} }
pSql->subState.numOfSub = pQueryInfo->numOfTables;
memset(pSql->subState.states, 0, sizeof(*pSql->subState.states) * pSql->subState.numOfSub); memset(pSql->subState.states, 0, sizeof(*pSql->subState.states) * pSql->subState.numOfSub);
tscDebug("0x%"PRIx64" reset all sub states to 0, start subquery, total:%d", pSql->self, pQueryInfo->numOfTables); tscDebug("0x%"PRIx64" reset all sub states to 0, start subquery, total:%d", pSql->self, pQueryInfo->numOfTables);
...@@ -2251,7 +2257,12 @@ void tscHandleMasterJoinQuery(SSqlObj* pSql) { ...@@ -2251,7 +2257,12 @@ void tscHandleMasterJoinQuery(SSqlObj* pSql) {
} }
void doCleanupSubqueries(SSqlObj *pSql, int32_t numOfSubs) { void doCleanupSubqueries(SSqlObj *pSql, int32_t numOfSubs) {
assert(numOfSubs <= pSql->subState.numOfSub && numOfSubs >= 0); pthread_mutex_lock(&pSql->subState.mutex);
if (numOfSubs > pSql->subState.numOfSub || numOfSubs <= 0 || pSql->subState.numOfSub <= 0) {
pthread_mutex_unlock(&pSql->subState.mutex);
return;
}
for(int32_t i = 0; i < numOfSubs; ++i) { for(int32_t i = 0; i < numOfSubs; ++i) {
SSqlObj* pSub = pSql->pSubs[i]; SSqlObj* pSub = pSql->pSubs[i];
...@@ -2261,6 +2272,7 @@ void doCleanupSubqueries(SSqlObj *pSql, int32_t numOfSubs) { ...@@ -2261,6 +2272,7 @@ void doCleanupSubqueries(SSqlObj *pSql, int32_t numOfSubs) {
taos_free_result(pSub); taos_free_result(pSub);
} }
pthread_mutex_unlock(&pSql->subState.mutex);
} }
void tscLockByThread(int64_t *lockedBy) { void tscLockByThread(int64_t *lockedBy) {
...@@ -2365,8 +2377,10 @@ void tscFirstRoundRetrieveCallback(void* param, TAOS_RES* tres, int numOfRows) { ...@@ -2365,8 +2377,10 @@ void tscFirstRoundRetrieveCallback(void* param, TAOS_RES* tres, int numOfRows) {
if (code != TSDB_CODE_SUCCESS) { if (code != TSDB_CODE_SUCCESS) {
tscFreeFirstRoundSup(&param); tscFreeFirstRoundSup(&param);
taos_free_result(pSql); taos_free_result(pSql);
pthread_mutex_lock(&pParent->subState.mutex);
pParent->subState.numOfSub = 0; pParent->subState.numOfSub = 0;
tfree(pParent->pSubs); tfree(pParent->pSubs);
pthread_mutex_unlock(&pParent->subState.mutex);
pParent->res.code = code; pParent->res.code = code;
tscAsyncResultOnError(pParent); tscAsyncResultOnError(pParent);
return; return;
...@@ -2469,9 +2483,11 @@ void tscFirstRoundRetrieveCallback(void* param, TAOS_RES* tres, int numOfRows) { ...@@ -2469,9 +2483,11 @@ void tscFirstRoundRetrieveCallback(void* param, TAOS_RES* tres, int numOfRows) {
tscFreeFirstRoundSup(&param); tscFreeFirstRoundSup(&param);
taos_free_result(pSql); taos_free_result(pSql);
pthread_mutex_lock(&pParent->subState.mutex);
pParent->subState.numOfSub = 0; pParent->subState.numOfSub = 0;
tfree(pParent->pSubs); tfree(pParent->pSubs);
pthread_mutex_unlock(&pParent->subState.mutex);
if (resRows == 0) { if (resRows == 0) {
pParent->cmd.command = TSDB_SQL_RETRIEVE_EMPTY_RESULT; pParent->cmd.command = TSDB_SQL_RETRIEVE_EMPTY_RESULT;
(*pParent->fp)(pParent->param, pParent, 0); (*pParent->fp)(pParent->param, pParent, 0);
...@@ -2493,8 +2509,10 @@ void tscFirstRoundCallback(void* param, TAOS_RES* tres, int code) { ...@@ -2493,8 +2509,10 @@ void tscFirstRoundCallback(void* param, TAOS_RES* tres, int code) {
tscFreeFirstRoundSup(&param); tscFreeFirstRoundSup(&param);
taos_free_result(pSql); taos_free_result(pSql);
pthread_mutex_lock(&parent->subState.mutex);
parent->subState.numOfSub = 0; parent->subState.numOfSub = 0;
tfree(parent->pSubs); tfree(parent->pSubs);
pthread_mutex_unlock(&parent->subState.mutex);
parent->res.code = c; parent->res.code = c;
tscAsyncResultOnError(parent); tscAsyncResultOnError(parent);
return; return;
...@@ -3014,7 +3032,6 @@ void tscHandleSubqueryError(SRetrieveSupport *trsupport, SSqlObj *pSql, int numO ...@@ -3014,7 +3032,6 @@ void tscHandleSubqueryError(SRetrieveSupport *trsupport, SSqlObj *pSql, int numO
} }
tscFreeSubobj(userSql); tscFreeSubobj(userSql);
tfree(userSql->pSubs);
userSql->res.code = TSDB_CODE_SUCCESS; userSql->res.code = TSDB_CODE_SUCCESS;
userSql->retry++; userSql->retry++;
...@@ -3382,7 +3399,9 @@ static bool needRetryInsert(SSqlObj* pParentObj, int32_t numOfSub) { ...@@ -3382,7 +3399,9 @@ static bool needRetryInsert(SSqlObj* pParentObj, int32_t numOfSub) {
} }
static void doFreeInsertSupporter(SSqlObj* pSqlObj) { static void doFreeInsertSupporter(SSqlObj* pSqlObj) {
assert(pSqlObj != NULL && pSqlObj->subState.numOfSub > 0); if (pSqlObj == NULL || pSqlObj->subState.numOfSub <= 0) {
return;
}
for(int32_t i = 0; i < pSqlObj->subState.numOfSub; ++i) { for(int32_t i = 0; i < pSqlObj->subState.numOfSub; ++i) {
SSqlObj* pSql = pSqlObj->pSubs[i]; SSqlObj* pSql = pSqlObj->pSubs[i];
......
...@@ -1682,6 +1682,8 @@ void tscFreeSubobj(SSqlObj* pSql) { ...@@ -1682,6 +1682,8 @@ void tscFreeSubobj(SSqlObj* pSql) {
return; return;
} }
pthread_mutex_lock(&pSql->subState.mutex);
tscDebug("0x%"PRIx64" start to free sub SqlObj, numOfSub:%d", pSql->self, pSql->subState.numOfSub); tscDebug("0x%"PRIx64" start to free sub SqlObj, numOfSub:%d", pSql->self, pSql->subState.numOfSub);
for(int32_t i = 0; i < pSql->subState.numOfSub; ++i) { for(int32_t i = 0; i < pSql->subState.numOfSub; ++i) {
...@@ -1695,12 +1697,14 @@ void tscFreeSubobj(SSqlObj* pSql) { ...@@ -1695,12 +1697,14 @@ void tscFreeSubobj(SSqlObj* pSql) {
pSql->pSubs[i] = NULL; pSql->pSubs[i] = NULL;
} }
if (pSql->subState.states) {
pthread_mutex_destroy(&pSql->subState.mutex);
}
tfree(pSql->subState.states); tfree(pSql->subState.states);
pSql->subState.numOfSub = 0; pSql->subState.numOfSub = 0;
tfree(pSql->pSubs);
pthread_mutex_unlock(&pSql->subState.mutex);
pthread_mutex_destroy(&pSql->subState.mutex);
} }
/** /**
...@@ -1768,9 +1772,6 @@ void tscFreeSqlObj(SSqlObj* pSql) { ...@@ -1768,9 +1772,6 @@ void tscFreeSqlObj(SSqlObj* pSql) {
pSql->fp = NULL; pSql->fp = NULL;
tfree(pSql->sqlstr); tfree(pSql->sqlstr);
tfree(pSql->pBuf); tfree(pSql->pBuf);
tfree(pSql->pSubs);
pSql->subState.numOfSub = 0;
pSql->self = 0; pSql->self = 0;
tscFreeSqlResult(pSql); tscFreeSqlResult(pSql);
...@@ -4161,10 +4162,7 @@ static void tscSubqueryCompleteCallback(void* param, TAOS_RES* tres, int code) { ...@@ -4161,10 +4162,7 @@ static void tscSubqueryCompleteCallback(void* param, TAOS_RES* tres, int code) {
} }
tscFreeSubobj(pParentSql); tscFreeSubobj(pParentSql);
tfree(pParentSql->pSubs);
tscFreeSubobj(rootObj); tscFreeSubobj(rootObj);
tfree(rootObj->pSubs);
rootObj->res.code = TSDB_CODE_SUCCESS; rootObj->res.code = TSDB_CODE_SUCCESS;
rootObj->retry++; rootObj->retry++;
...@@ -4207,19 +4205,9 @@ static void tscSubqueryCompleteCallback(void* param, TAOS_RES* tres, int code) { ...@@ -4207,19 +4205,9 @@ static void tscSubqueryCompleteCallback(void* param, TAOS_RES* tres, int code) {
int32_t doInitSubState(SSqlObj* pSql, int32_t numOfSubqueries) { int32_t doInitSubState(SSqlObj* pSql, int32_t numOfSubqueries) {
//bug fix. Above doInitSubState level, the loop invocation with the same SSqlObj will be fail. //bug fix. Above doInitSubState level, the loop invocation with the same SSqlObj will be fail.
//assert(pSql->subState.numOfSub == 0 && pSql->pSubs == NULL && pSql->subState.states == NULL); //assert(pSql->subState.numOfSub == 0 && pSql->pSubs == NULL && pSql->subState.states == NULL);
if(pSql->pSubs) { tscFreeSubobj(pSql);
free(pSql->pSubs);
pSql->pSubs = NULL;
}
if(pSql->subState.states) {
free(pSql->subState.states);
pSql->subState.states = NULL;
}
pSql->subState.numOfSub = numOfSubqueries;
pSql->pSubs = calloc(pSql->subState.numOfSub, POINTER_BYTES); pSql->pSubs = calloc(numOfSubqueries, POINTER_BYTES);
pSql->subState.states = calloc(pSql->subState.numOfSub, sizeof(int8_t)); pSql->subState.states = calloc(pSql->subState.numOfSub, sizeof(int8_t));
int32_t code = pthread_mutex_init(&pSql->subState.mutex, NULL); int32_t code = pthread_mutex_init(&pSql->subState.mutex, NULL);
...@@ -4227,6 +4215,8 @@ int32_t doInitSubState(SSqlObj* pSql, int32_t numOfSubqueries) { ...@@ -4227,6 +4215,8 @@ int32_t doInitSubState(SSqlObj* pSql, int32_t numOfSubqueries) {
return TSDB_CODE_TSC_OUT_OF_MEMORY; return TSDB_CODE_TSC_OUT_OF_MEMORY;
} }
pSql->subState.numOfSub = numOfSubqueries;
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
...@@ -4332,6 +4322,7 @@ void executeQuery(SSqlObj* pSql, SQueryInfo* pQueryInfo) { ...@@ -4332,6 +4322,7 @@ void executeQuery(SSqlObj* pSql, SQueryInfo* pQueryInfo) {
return; return;
_error: _error:
for(int32_t i = 0; i < numOfInit; ++i) { for(int32_t i = 0; i < numOfInit; ++i) {
SSqlObj* p = pSql->pSubs[i]; SSqlObj* p = pSql->pSubs[i];
tscFreeSqlObj(p); tscFreeSqlObj(p);
...@@ -4616,16 +4607,7 @@ void tscTryQueryNextClause(SSqlObj* pSql, __async_cb_func_t fp) { ...@@ -4616,16 +4607,7 @@ void tscTryQueryNextClause(SSqlObj* pSql, __async_cb_func_t fp) {
pRes->final = finalBk; pRes->final = finalBk;
pRes->numOfTotal = num; pRes->numOfTotal = num;
pthread_mutex_lock(&pSql->subState.mutex); tscFreeSubobj(pSql);
for(int32_t i = 0; i < pSql->subState.numOfSub; ++i) {
taos_free_result(pSql->pSubs[i]);
}
tfree(pSql->pSubs);
tfree(pSql->subState.states);
pSql->subState.numOfSub = 0;
pthread_mutex_unlock(&pSql->subState.mutex);
pthread_mutex_destroy(&pSql->subState.mutex);
pSql->fp = fp; pSql->fp = fp;
......
Subproject commit 2dba49cf57cde998f768bb033619b4d8c5143127 Subproject commit 9f4c01ec83b93b2385816134071aa5e702a24079
...@@ -9946,7 +9946,7 @@ SQInfo* createQInfoImpl(SQueryTableMsg* pQueryMsg, SGroupbyExpr* pGroupbyExpr, S ...@@ -9946,7 +9946,7 @@ SQInfo* createQInfoImpl(SQueryTableMsg* pQueryMsg, SGroupbyExpr* pGroupbyExpr, S
pTableqinfo->pGroupList = taosArrayInit(numOfGroups, POINTER_BYTES); pTableqinfo->pGroupList = taosArrayInit(numOfGroups, POINTER_BYTES);
pTableqinfo->numOfTables = pTableGroupInfo->numOfTables; pTableqinfo->numOfTables = pTableGroupInfo->numOfTables;
pTableqinfo->map = taosHashInit(pTableGroupInfo->numOfTables, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), true, HASH_NO_LOCK); pTableqinfo->map = taosHashInit(pTableGroupInfo->numOfTables, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), true, HASH_ENTRY_LOCK);
} }
pQInfo->pBuf = calloc(pTableGroupInfo->numOfTables, sizeof(STableQueryInfo)); pQInfo->pBuf = calloc(pTableGroupInfo->numOfTables, sizeof(STableQueryInfo));
...@@ -10146,10 +10146,13 @@ static void doDestroyTableQueryInfo(STableGroupInfo* pTableqinfoGroupInfo) { ...@@ -10146,10 +10146,13 @@ static void doDestroyTableQueryInfo(STableGroupInfo* pTableqinfoGroupInfo) {
} }
taosArrayDestroy(&pTableqinfoGroupInfo->pGroupList); taosArrayDestroy(&pTableqinfoGroupInfo->pGroupList);
taosHashCleanup(pTableqinfoGroupInfo->map);
SHashObj *pmap = pTableqinfoGroupInfo->map;
if (pmap == atomic_val_compare_exchange_ptr(&pTableqinfoGroupInfo->map, pmap, NULL)) {
taosHashCleanup(pmap);
}
pTableqinfoGroupInfo->pGroupList = NULL; pTableqinfoGroupInfo->pGroupList = NULL;
pTableqinfoGroupInfo->map = NULL;
pTableqinfoGroupInfo->numOfTables = 0; pTableqinfoGroupInfo->numOfTables = 0;
} }
......
...@@ -611,7 +611,6 @@ void taosHashClear(SHashObj *pHashObj) { ...@@ -611,7 +611,6 @@ void taosHashClear(SHashObj *pHashObj) {
for (int32_t i = 0; i < pHashObj->capacity; ++i) { for (int32_t i = 0; i < pHashObj->capacity; ++i) {
SHashEntry *pEntry = pHashObj->hashList[i]; SHashEntry *pEntry = pHashObj->hashList[i];
if (pEntry->num == 0) { if (pEntry->num == 0) {
assert(pEntry->next == NULL);
continue; continue;
} }
......
...@@ -22,9 +22,9 @@ from util.dnodes import * ...@@ -22,9 +22,9 @@ from util.dnodes import *
class TDTestCase: class TDTestCase:
def caseDescription(self): def caseDescription(self):
''' """
[TD-13823] taosBenchmark test cases [TD-13823] taosBenchmark test cases
''' """
return return
def init(self, conn, logSql): def init(self, conn, logSql):
...@@ -34,19 +34,19 @@ class TDTestCase: ...@@ -34,19 +34,19 @@ class TDTestCase:
def getPath(self, tool="taosBenchmark"): def getPath(self, tool="taosBenchmark"):
selfPath = os.path.dirname(os.path.realpath(__file__)) selfPath = os.path.dirname(os.path.realpath(__file__))
if ("community" in selfPath): if "community" in selfPath:
projPath = selfPath[:selfPath.find("community")] projPath = selfPath[: selfPath.find("community")]
else: else:
projPath = selfPath[:selfPath.find("tests")] projPath = selfPath[: selfPath.find("tests")]
paths = [] paths = []
for root, dirs, files in os.walk(projPath): for root, dirs, files in os.walk(projPath):
if ((tool) in files): if (tool) in files:
rootRealPath = os.path.dirname(os.path.realpath(root)) rootRealPath = os.path.dirname(os.path.realpath(root))
if ("packaging" not in rootRealPath): if "packaging" not in rootRealPath:
paths.append(os.path.join(root, tool)) paths.append(os.path.join(root, tool))
break break
if (len(paths) == 0): if len(paths) == 0:
tdLog.exit("taosBenchmark not found!") tdLog.exit("taosBenchmark not found!")
return return
else: else:
...@@ -55,7 +55,7 @@ class TDTestCase: ...@@ -55,7 +55,7 @@ class TDTestCase:
def run(self): def run(self):
binPath = self.getPath() binPath = self.getPath()
cmd = "%s -n 100 -t 100 -y" %binPath cmd = "%s -n 100 -t 100 -y" % binPath
tdLog.info("%s" % cmd) tdLog.info("%s" % cmd)
os.system("%s" % cmd) os.system("%s" % cmd)
tdSql.execute("use test") tdSql.execute("use test")
...@@ -77,14 +77,16 @@ class TDTestCase: ...@@ -77,14 +77,16 @@ class TDTestCase:
tdSql.checkData(4, 3, "TAG") tdSql.checkData(4, 3, "TAG")
tdSql.checkData(5, 0, "location") tdSql.checkData(5, 0, "location")
tdSql.checkData(5, 1, "BINARY") tdSql.checkData(5, 1, "BINARY")
tdSql.checkData(5, 2, 16) tdSql.checkData(5, 2, 24)
tdSql.checkData(5, 3, "TAG") tdSql.checkData(5, 3, "TAG")
tdSql.query("select count(*) from test.meters where groupid >= 0") tdSql.query("select count(*) from test.meters where groupid >= 0")
tdSql.checkData(0, 0, 10000) tdSql.checkData(0, 0, 10000)
tdSql.query("select count(*) from test.meters where location = 'San Francisco' or location = 'Los Angles' or location = 'San Diego' or location = 'San Jose' or \ tdSql.query(
location = 'Palo Alto' or location = 'Campbell' or location = 'Mountain View' or location = 'Sunnyvale' or location = 'Santa Clara' or location = 'Cupertino' ") "select count(*) from test.meters where location = 'California.SanFrancisco' or location = 'California.LosAngles' or location = 'California.SanDiego' or location = 'California.SanJose' or \
location = 'California.PaloAlto' or location = 'California.Campbell' or location = 'California.MountainView' or location = 'California.Sunnyvale' or location = 'California.SantaClara' or location = 'California.Cupertino' "
)
tdSql.checkData(0, 0, 10000) tdSql.checkData(0, 0, 10000)
def stop(self): def stop(self):
...@@ -93,4 +95,4 @@ class TDTestCase: ...@@ -93,4 +95,4 @@ class TDTestCase:
tdCases.addWindows(__file__, TDTestCase()) tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase())
\ No newline at end of file
...@@ -208,6 +208,14 @@ class TDTestCase: ...@@ -208,6 +208,14 @@ class TDTestCase:
tdSql.query("select * from type_json5") tdSql.query("select * from type_json5")
tdSql.checkData(0, 2, '''{"jsonC":"0"}''') tdSql.checkData(0, 2, '''{"jsonC":"0"}''')
try:
self._conn.schemaless_insert([
"measurement,host=host1 field1=12i,field2=2.0,fieldKey=\"Launch\" 1654078242716",
"measurement,host=host1"
], TDSmlProtocolType.LINE.value, TDSmlTimestampType.MILLI_SECOND.value)
tdLog.exit("%s failed: no exception happen here" % __file__)
except Exception as e:
pass
def stop(self): def stop(self):
tdSql.close() tdSql.close()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册