提交 e45701a6 编写于 作者: H hjxilinx

[TD-32] fix bugs in super table query

上级 ff144921
...@@ -514,7 +514,7 @@ void tscTableMetaCallBack(void *param, TAOS_RES *res, int code) { ...@@ -514,7 +514,7 @@ void tscTableMetaCallBack(void *param, TAOS_RES *res, int code) {
tscTansformSQLFunctionForSTableQuery(pQueryInfo); tscTansformSQLFunctionForSTableQuery(pQueryInfo);
tscIncStreamExecutionCount(pSql->pStream); tscIncStreamExecutionCount(pSql->pStream);
} else { } else {
tscTrace("%p get tableMeta/metricMeta successfully", pSql); tscTrace("%p get tableMeta successfully", pSql);
} }
tscDoQuery(pSql); tscDoQuery(pSql);
......
...@@ -605,7 +605,7 @@ int32_t tscLocalReducerEnvCreate(SSqlObj *pSql, tExtMemBuffer ***pMemBuffer, tOr ...@@ -605,7 +605,7 @@ int32_t tscLocalReducerEnvCreate(SSqlObj *pSql, tExtMemBuffer ***pMemBuffer, tOr
SQueryInfo * pQueryInfo = tscGetQueryInfoDetail(pCmd, pCmd->clauseIndex); SQueryInfo * pQueryInfo = tscGetQueryInfoDetail(pCmd, pCmd->clauseIndex);
STableMetaInfo *pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0); STableMetaInfo *pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0);
// (*pMemBuffer) = (tExtMemBuffer **)malloc(POINTER_BYTES * pTableMetaInfo->pMetricMeta->numOfVnodes); (*pMemBuffer) = (tExtMemBuffer **)malloc(POINTER_BYTES * 1);
if (*pMemBuffer == NULL) { if (*pMemBuffer == NULL) {
tscError("%p failed to allocate memory", pSql); tscError("%p failed to allocate memory", pSql);
pRes->code = TSDB_CODE_CLI_OUT_OF_MEMORY; pRes->code = TSDB_CODE_CLI_OUT_OF_MEMORY;
......
...@@ -1011,8 +1011,9 @@ int32_t tscHandleMasterSTableQuery(SSqlObj *pSql) { ...@@ -1011,8 +1011,9 @@ int32_t tscHandleMasterSTableQuery(SSqlObj *pSql) {
SQueryInfo * pQueryInfo = tscGetQueryInfoDetail(pCmd, pCmd->clauseIndex); SQueryInfo * pQueryInfo = tscGetQueryInfoDetail(pCmd, pCmd->clauseIndex);
STableMetaInfo *pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0); STableMetaInfo *pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0);
int32_t numOfSubQueries = 0; int32_t numOfSubQueries = 1;
// int32_t numOfSubQueries = pTableMetaInfo->pMetricMeta->numOfVnodes; // int32_t numOfSubQueries = pTableMetaInfo->pMetricMeta->numOfVnodes;
assert(numOfSubQueries > 0); assert(numOfSubQueries > 0);
int32_t ret = tscLocalReducerEnvCreate(pSql, &pMemoryBuf, &pDesc, &pModel, nBufferSize); int32_t ret = tscLocalReducerEnvCreate(pSql, &pMemoryBuf, &pDesc, &pModel, nBufferSize);
......
...@@ -48,10 +48,10 @@ typedef struct STSElem { ...@@ -48,10 +48,10 @@ typedef struct STSElem {
} STSElem; } STSElem;
typedef struct STSCursor { typedef struct STSCursor {
int32_t vnodeIndex; int32_t vnodeIndex;
int32_t blockIndex; int32_t blockIndex;
int32_t tsIndex; int32_t tsIndex;
int32_t order; uint32_t order;
} STSCursor; } STSCursor;
typedef struct STSBlock { typedef struct STSBlock {
......
...@@ -32,12 +32,6 @@ typedef struct SData { ...@@ -32,12 +32,6 @@ typedef struct SData {
char data[]; char data[];
} SData; } SData;
enum {
// ST_QUERY_KILLED = 0, // query killed
ST_QUERY_PAUSED = 1, // query paused, due to full of the response buffer
ST_QUERY_COMPLETED = 2, // query completed
};
struct SColumnFilterElem; struct SColumnFilterElem;
typedef bool (*__filter_func_t)(struct SColumnFilterElem* pFilter, char* val1, char* val2); typedef bool (*__filter_func_t)(struct SColumnFilterElem* pFilter, char* val1, char* val2);
typedef int32_t (*__block_search_fn_t)(char* data, int32_t num, int64_t key, int32_t order); typedef int32_t (*__block_search_fn_t)(char* data, int32_t num, int64_t key, int32_t order);
...@@ -60,18 +54,20 @@ typedef struct SWindowStatus { ...@@ -60,18 +54,20 @@ typedef struct SWindowStatus {
} SWindowStatus; } SWindowStatus;
typedef struct SWindowResult { typedef struct SWindowResult {
uint16_t numOfRows; uint16_t numOfRows; // number of rows of current time window
SPosInfo pos; // Position of current result in disk-based output buffer SPosInfo pos; // Position of current result in disk-based output buffer
SResultInfo* resultInfo; // For each result column, there is a resultInfo SResultInfo* resultInfo; // For each result column, there is a resultInfo
STimeWindow window; // The time window that current result covers. STimeWindow window; // The time window that current result covers.
SWindowStatus status; SWindowStatus status; // this result status: closed or opened
} SWindowResult; } SWindowResult;
typedef struct SResultRec { typedef struct SResultRec {
int64_t total; int64_t total; // total generated result size in rows
int64_t size; int64_t size; // current result set size in rows
int64_t capacity; int64_t capacity; // capacity of current result output buffer
int32_t threshold; // the threshold size, when the number of rows in result buffer, return to client
// result size threshold in rows. If the result buffer is larger than this, pause query and return to client
int32_t threshold;
} SResultRec; } SResultRec;
typedef struct SWindowResInfo { typedef struct SWindowResInfo {
...@@ -99,7 +95,6 @@ typedef struct SSingleColumnFilterInfo { ...@@ -99,7 +95,6 @@ typedef struct SSingleColumnFilterInfo {
void* pData; void* pData;
} SSingleColumnFilterInfo; } SSingleColumnFilterInfo;
/* intermediate pos during multimeter query involves interval */
typedef struct STableQueryInfo { typedef struct STableQueryInfo {
int64_t lastKey; int64_t lastKey;
STimeWindow win; STimeWindow win;
...@@ -107,7 +102,7 @@ typedef struct STableQueryInfo { ...@@ -107,7 +102,7 @@ typedef struct STableQueryInfo {
int16_t queryRangeSet; // denote if the query range is set, only available for interval query int16_t queryRangeSet; // denote if the query range is set, only available for interval query
int64_t tag; int64_t tag;
STSCursor cur; STSCursor cur;
int32_t sid; // for retrieve the page id list int32_t tid; // for retrieve the page id list
SWindowResInfo windowResInfo; SWindowResInfo windowResInfo;
} STableQueryInfo; } STableQueryInfo;
...@@ -116,7 +111,6 @@ typedef struct STableDataInfo { ...@@ -116,7 +111,6 @@ typedef struct STableDataInfo {
int32_t numOfBlocks; int32_t numOfBlocks;
int32_t start; // start block index int32_t start; // start block index
int32_t tableIndex; int32_t tableIndex;
void* pMeterObj;
int32_t groupIdx; // group id in table list int32_t groupIdx; // group id in table list
STableQueryInfo* pTableQInfo; STableQueryInfo* pTableQInfo;
} STableDataInfo; } STableDataInfo;
......
此差异已折叠。
...@@ -349,10 +349,10 @@ static int tsdbAddTableToMeta(STsdbMeta *pMeta, STable *pTable, bool addIdx) { ...@@ -349,10 +349,10 @@ static int tsdbAddTableToMeta(STsdbMeta *pMeta, STable *pTable, bool addIdx) {
} else { } else {
// add non-super table to the array // add non-super table to the array
pMeta->tables[pTable->tableId.tid] = pTable; pMeta->tables[pTable->tableId.tid] = pTable;
if (pTable->type == TSDB_CHILD_TABLE) { if (pTable->type == TSDB_CHILD_TABLE && addIdx) { // add STABLE to the index
// add STABLE to the index
tsdbAddTableIntoIndex(pMeta, pTable); tsdbAddTableIntoIndex(pMeta, pTable);
} }
pMeta->nTables++; pMeta->nTables++;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册