Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
272b524b
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1192
Star
22018
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
272b524b
编写于
4月 25, 2021
作者:
H
haojun Liao
提交者:
GitHub
4月 25, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #5900 from taosdata/feature/qrefactor
Feature/qrefactor
上级
00f254b5
ae325bdd
变更
67
展开全部
隐藏空白更改
内联
并排
Showing
67 changed file
with
3290 addition
and
2113 deletion
+3290
-2113
cmake/define.inc
cmake/define.inc
+6
-5
src/client/jni/com_taosdata_jdbc_TSDBJNIConnector.h
src/client/jni/com_taosdata_jdbc_TSDBJNIConnector.h
+8
-0
src/client/src/TSDBJNIConnector.c
src/client/src/TSDBJNIConnector.c
+17
-0
src/client/src/tscAsync.c
src/client/src/tscAsync.c
+8
-8
src/client/src/tscLocalMerge.c
src/client/src/tscLocalMerge.c
+7
-7
src/client/src/tscParseInsert.c
src/client/src/tscParseInsert.c
+2
-2
src/client/src/tscProfile.c
src/client/src/tscProfile.c
+6
-6
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+33
-12
src/client/src/tscServer.c
src/client/src/tscServer.c
+35
-34
src/client/src/tscSql.c
src/client/src/tscSql.c
+11
-11
src/client/src/tscStream.c
src/client/src/tscStream.c
+35
-22
src/client/src/tscSubquery.c
src/client/src/tscSubquery.c
+76
-75
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+12
-12
src/common/src/tvariant.c
src/common/src/tvariant.c
+16
-6
src/connector/go
src/connector/go
+1
-1
src/connector/python/linux/python2/setup.py
src/connector/python/linux/python2/setup.py
+1
-1
src/connector/python/linux/python2/taos/cursor.py
src/connector/python/linux/python2/taos/cursor.py
+1
-1
src/cq/src/cqMain.c
src/cq/src/cqMain.c
+25
-6
src/inc/ttokendef.h
src/inc/ttokendef.h
+2
-0
src/kit/shell/src/shellWindows.c
src/kit/shell/src/shellWindows.c
+6
-2
src/kit/taosdemo/taosdemo.c
src/kit/taosdemo/taosdemo.c
+1076
-945
src/os/inc/os.h
src/os/inc/os.h
+4
-0
src/os/inc/osMips64.h
src/os/inc/osMips64.h
+87
-0
src/os/src/darwin/darwinSysInfo.c
src/os/src/darwin/darwinSysInfo.c
+1
-1
src/os/src/detail/osSysinfo.c
src/os/src/detail/osSysinfo.c
+1
-1
src/plugins/http/inc/httpContext.h
src/plugins/http/inc/httpContext.h
+1
-1
src/plugins/http/src/httpContext.c
src/plugins/http/src/httpContext.c
+5
-5
src/plugins/http/src/httpHandle.c
src/plugins/http/src/httpHandle.c
+1
-0
src/plugins/http/src/httpServer.c
src/plugins/http/src/httpServer.c
+3
-3
src/plugins/http/src/httpSql.c
src/plugins/http/src/httpSql.c
+2
-0
src/query/inc/qSqlparser.h
src/query/inc/qSqlparser.h
+8
-1
src/query/inc/sql.y
src/query/inc/sql.y
+2
-0
src/query/src/qAggMain.c
src/query/src/qAggMain.c
+31
-21
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+50
-47
src/query/src/qExtbuffer.c
src/query/src/qExtbuffer.c
+11
-38
src/query/src/qResultbuf.c
src/query/src/qResultbuf.c
+3
-3
src/query/src/qSqlParser.c
src/query/src/qSqlParser.c
+12
-1
src/query/src/queryMain.c
src/query/src/queryMain.c
+18
-18
src/query/src/sql.c
src/query/src/sql.c
+371
-362
src/tsdb/src/tsdbRead.c
src/tsdb/src/tsdbRead.c
+34
-29
src/util/src/tcompare.c
src/util/src/tcompare.c
+4
-0
src/util/src/tcrc32c.c
src/util/src/tcrc32c.c
+4
-4
src/util/src/tlog.c
src/util/src/tlog.c
+2
-1
src/util/src/tnettest.c
src/util/src/tnettest.c
+10
-10
src/util/src/ttimer.c
src/util/src/ttimer.c
+1
-1
src/vnode/src/vnodeRead.c
src/vnode/src/vnodeRead.c
+6
-6
tests/examples/C#/C#checker/C#checker.cs
tests/examples/C#/C#checker/C#checker.cs
+357
-348
tests/examples/C#/TDengineTest.cs
tests/examples/C#/TDengineTest.cs
+49
-23
tests/examples/C#/taosdemo/taosdemo.cs
tests/examples/C#/taosdemo/taosdemo.cs
+44
-21
tests/examples/c/apitest.c
tests/examples/c/apitest.c
+5
-1
tests/examples/go/taosdemo.go
tests/examples/go/taosdemo.go
+148
-2
tests/perftest-scripts/perftest-query.sh
tests/perftest-scripts/perftest-query.sh
+1
-1
tests/pytest/alter/alterTabAddTagWithNULL.py
tests/pytest/alter/alterTabAddTagWithNULL.py
+85
-0
tests/pytest/alter/alterTimestampColDataProcess.py
tests/pytest/alter/alterTimestampColDataProcess.py
+73
-0
tests/pytest/fulltest.sh
tests/pytest/fulltest.sh
+11
-0
tests/pytest/query/queryFilterTswithDateUnit.py
tests/pytest/query/queryFilterTswithDateUnit.py
+166
-0
tests/pytest/query/queryNormal.py
tests/pytest/query/queryNormal.py
+27
-1
tests/pytest/query/querySecondtscolumnTowherenow.py
tests/pytest/query/querySecondtscolumnTowherenow.py
+131
-0
tests/pytest/stream/new.py
tests/pytest/stream/new.py
+1
-1
tests/pytest/stream/stream2.py
tests/pytest/stream/stream2.py
+3
-0
tests/pytest/stream/sys.py
tests/pytest/stream/sys.py
+1
-1
tests/pytest/tools/taosdemoTestTblAlt.py
tests/pytest/tools/taosdemoTestTblAlt.py
+2
-2
tests/pytest/util/sql.py
tests/pytest/util/sql.py
+9
-0
tests/script/general/parser/first_last_query.sim
tests/script/general/parser/first_last_query.sim
+47
-1
tests/script/general/parser/select_with_tags.sim
tests/script/general/parser/select_with_tags.sim
+1
-1
tests/script/general/stream/stream_1970.sim
tests/script/general/stream/stream_1970.sim
+73
-0
tests/tsim/src/simSystem.c
tests/tsim/src/simSystem.c
+0
-1
未找到文件。
cmake/define.inc
浏览文件 @
272b524b
...
@@ -69,7 +69,6 @@ IF (TD_LINUX_32)
...
@@ -69,7 +69,6 @@ IF (TD_LINUX_32)
ENDIF
()
ENDIF
()
IF
(
TD_ARM_64
)
IF
(
TD_ARM_64
)
ADD_DEFINITIONS
(
-
D_M_X64
)
ADD_DEFINITIONS
(
-
D_TD_ARM_64
)
ADD_DEFINITIONS
(
-
D_TD_ARM_64
)
ADD_DEFINITIONS
(
-
D_TD_ARM_
)
ADD_DEFINITIONS
(
-
D_TD_ARM_
)
ADD_DEFINITIONS
(
-
DUSE_LIBICONV
)
ADD_DEFINITIONS
(
-
DUSE_LIBICONV
)
...
@@ -86,17 +85,19 @@ IF (TD_ARM_32)
...
@@ -86,17 +85,19 @@ IF (TD_ARM_32)
ENDIF
()
ENDIF
()
IF
(
TD_MIPS_64
)
IF
(
TD_MIPS_64
)
ADD_DEFINITIONS
(
-
D_TD_MIPS_64_
)
ADD_DEFINITIONS
(
-
D_TD_MIPS_
)
ADD_DEFINITIONS
(
-
D_TD_MIPS_64
)
ADD_DEFINITIONS
(
-
DUSE_LIBICONV
)
ADD_DEFINITIONS
(
-
DUSE_LIBICONV
)
MESSAGE
(
STATUS
"mips64 is defined"
)
MESSAGE
(
STATUS
"mips64 is defined"
)
SET
(
COMMON_FLAGS
"-std=gnu99 -Wall -Werror -fPIC -
gdwarf-2 -msse4.2
-D_FILE_OFFSET_BITS=64 -D_LARGE_FILE"
)
SET
(
COMMON_FLAGS
"-std=gnu99 -Wall -Werror -fPIC -
fsigned-char -fpack-struct=8
-D_FILE_OFFSET_BITS=64 -D_LARGE_FILE"
)
ENDIF
()
ENDIF
()
IF
(
TD_MIPS_32
)
IF
(
TD_MIPS_32
)
ADD_DEFINITIONS
(
-
D_TD_MIPS_32_
)
ADD_DEFINITIONS
(
-
D_TD_MIPS_
)
ADD_DEFINITIONS
(
-
D_TD_MIPS_32
)
ADD_DEFINITIONS
(
-
DUSE_LIBICONV
)
ADD_DEFINITIONS
(
-
DUSE_LIBICONV
)
MESSAGE
(
STATUS
"mips32 is defined"
)
MESSAGE
(
STATUS
"mips32 is defined"
)
SET
(
COMMON_FLAGS
"-std=gnu99 -Wall -Werror -fPIC -
gdwarf-2 -msse4.2 -
D_FILE_OFFSET_BITS=64 -D_LARGE_FILE"
)
SET
(
COMMON_FLAGS
"-std=gnu99 -Wall -Werror -fPIC -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE"
)
ENDIF
()
ENDIF
()
IF
(
TD_APLHINE
)
IF
(
TD_APLHINE
)
...
...
src/client/jni/com_taosdata_jdbc_TSDBJNIConnector.h
浏览文件 @
272b524b
...
@@ -49,6 +49,14 @@ JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_setOptions
...
@@ -49,6 +49,14 @@ JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_setOptions
JNIEXPORT
jstring
JNICALL
Java_com_taosdata_jdbc_TSDBJNIConnector_getTsCharset
JNIEXPORT
jstring
JNICALL
Java_com_taosdata_jdbc_TSDBJNIConnector_getTsCharset
(
JNIEnv
*
,
jclass
);
(
JNIEnv
*
,
jclass
);
/*
* Class: com_taosdata_jdbc_TSDBJNIConnector
* Method: getResultTimePrecision
* Signature: (J)J
*/
JNIEXPORT
jint
JNICALL
Java_com_taosdata_jdbc_TDDBJNIConnector_getResultTimePrecision
(
JNIEnv
*
,
jobject
,
jlong
,
jlong
);
/*
/*
* Class: com_taosdata_jdbc_TSDBJNIConnector
* Class: com_taosdata_jdbc_TSDBJNIConnector
* Method: connectImp
* Method: connectImp
...
...
src/client/src/TSDBJNIConnector.c
浏览文件 @
272b524b
...
@@ -671,3 +671,20 @@ JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_validateCreateTab
...
@@ -671,3 +671,20 @@ JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_validateCreateTab
JNIEXPORT
jstring
JNICALL
Java_com_taosdata_jdbc_TSDBJNIConnector_getTsCharset
(
JNIEnv
*
env
,
jobject
jobj
)
{
JNIEXPORT
jstring
JNICALL
Java_com_taosdata_jdbc_TSDBJNIConnector_getTsCharset
(
JNIEnv
*
env
,
jobject
jobj
)
{
return
(
*
env
)
->
NewStringUTF
(
env
,
(
const
char
*
)
tsCharset
);
return
(
*
env
)
->
NewStringUTF
(
env
,
(
const
char
*
)
tsCharset
);
}
}
JNIEXPORT
jint
JNICALL
Java_com_taosdata_jdbc_TDDBJNIConnector_getResultTimePrecision
(
JNIEnv
*
env
,
jobject
jobj
,
jlong
con
,
jlong
res
)
{
TAOS
*
tscon
=
(
TAOS
*
)
con
;
if
(
tscon
==
NULL
)
{
jniError
(
"jobj:%p, connection is closed"
,
jobj
);
return
JNI_CONNECTION_NULL
;
}
TAOS_RES
*
result
=
(
TAOS_RES
*
)
res
;
if
(
result
==
NULL
)
{
jniError
(
"jobj:%p, conn:%p, resultset is null"
,
jobj
,
tscon
);
return
JNI_RESULT_SET_NULL
;
}
return
taos_result_precision
(
result
);
}
\ No newline at end of file
src/client/src/tscAsync.c
浏览文件 @
272b524b
...
@@ -57,7 +57,7 @@ void doAsyncQuery(STscObj* pObj, SSqlObj* pSql, __async_cb_func_t fp, void* para
...
@@ -57,7 +57,7 @@ void doAsyncQuery(STscObj* pObj, SSqlObj* pSql, __async_cb_func_t fp, void* para
strntolower
(
pSql
->
sqlstr
,
sqlstr
,
(
int32_t
)
sqlLen
);
strntolower
(
pSql
->
sqlstr
,
sqlstr
,
(
int32_t
)
sqlLen
);
tscDebugL
(
"
%p SQL: %s"
,
pSql
,
pSql
->
sqlstr
);
tscDebugL
(
"
0x%"
PRIx64
" SQL: %s"
,
pSql
->
self
,
pSql
->
sqlstr
);
pCmd
->
curSql
=
pSql
->
sqlstr
;
pCmd
->
curSql
=
pSql
->
sqlstr
;
int32_t
code
=
tsParseSql
(
pSql
,
true
);
int32_t
code
=
tsParseSql
(
pSql
,
true
);
...
@@ -283,7 +283,7 @@ void tscQueueAsyncError(void(*fp), void *param, int32_t code) {
...
@@ -283,7 +283,7 @@ void tscQueueAsyncError(void(*fp), void *param, int32_t code) {
static
void
tscAsyncResultCallback
(
SSchedMsg
*
pMsg
)
{
static
void
tscAsyncResultCallback
(
SSchedMsg
*
pMsg
)
{
SSqlObj
*
pSql
=
(
SSqlObj
*
)
taosAcquireRef
(
tscObjRef
,
(
int64_t
)
pMsg
->
ahandle
);
SSqlObj
*
pSql
=
(
SSqlObj
*
)
taosAcquireRef
(
tscObjRef
,
(
int64_t
)
pMsg
->
ahandle
);
if
(
pSql
==
NULL
||
pSql
->
signature
!=
pSql
)
{
if
(
pSql
==
NULL
||
pSql
->
signature
!=
pSql
)
{
tscDebug
(
"%p SqlObj is freed, not add into queue async res"
,
p
Sql
);
tscDebug
(
"%p SqlObj is freed, not add into queue async res"
,
p
Msg
->
ahandle
);
return
;
return
;
}
}
...
@@ -372,13 +372,13 @@ void tscTableMetaCallBack(void *param, TAOS_RES *res, int code) {
...
@@ -372,13 +372,13 @@ void tscTableMetaCallBack(void *param, TAOS_RES *res, int code) {
goto
_error
;
goto
_error
;
}
}
tscDebug
(
"
%p get %s successfully"
,
pSql
,
msg
);
tscDebug
(
"
0x%"
PRIx64
" get %s successfully"
,
pSql
->
self
,
msg
);
if
(
pSql
->
pStream
==
NULL
)
{
if
(
pSql
->
pStream
==
NULL
)
{
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
pCmd
->
clauseIndex
);
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
pCmd
->
clauseIndex
);
// check if it is a sub-query of super table query first, if true, enter another routine
// check if it is a sub-query of super table query first, if true, enter another routine
if
(
TSDB_QUERY_HAS_TYPE
(
pQueryInfo
->
type
,
(
TSDB_QUERY_TYPE_STABLE_SUBQUERY
|
TSDB_QUERY_TYPE_SUBQUERY
|
TSDB_QUERY_TYPE_TAG_FILTER_QUERY
)))
{
if
(
TSDB_QUERY_HAS_TYPE
(
pQueryInfo
->
type
,
(
TSDB_QUERY_TYPE_STABLE_SUBQUERY
|
TSDB_QUERY_TYPE_SUBQUERY
|
TSDB_QUERY_TYPE_TAG_FILTER_QUERY
)))
{
tscDebug
(
"
%p update local table meta, continue to process sql and send the corresponding query"
,
pSql
);
tscDebug
(
"
0x%"
PRIx64
" update local table meta, continue to process sql and send the corresponding query"
,
pSql
->
self
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
0
);
...
@@ -402,7 +402,7 @@ void tscTableMetaCallBack(void *param, TAOS_RES *res, int code) {
...
@@ -402,7 +402,7 @@ void tscTableMetaCallBack(void *param, TAOS_RES *res, int code) {
return
;
return
;
}
else
{
// continue to process normal async query
}
else
{
// continue to process normal async query
if
(
pCmd
->
parseFinished
)
{
if
(
pCmd
->
parseFinished
)
{
tscDebug
(
"
%p update local table meta, continue to process sql and send corresponding query"
,
pSql
);
tscDebug
(
"
0x%"
PRIx64
" update local table meta, continue to process sql and send corresponding query"
,
pSql
->
self
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetTableMetaInfoFromCmd
(
pCmd
,
pCmd
->
clauseIndex
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetTableMetaInfoFromCmd
(
pCmd
,
pCmd
->
clauseIndex
,
0
);
code
=
tscGetTableMeta
(
pSql
,
pTableMetaInfo
);
code
=
tscGetTableMeta
(
pSql
,
pTableMetaInfo
);
...
@@ -416,7 +416,7 @@ void tscTableMetaCallBack(void *param, TAOS_RES *res, int code) {
...
@@ -416,7 +416,7 @@ void tscTableMetaCallBack(void *param, TAOS_RES *res, int code) {
assert
(
pCmd
->
command
!=
TSDB_SQL_INSERT
);
assert
(
pCmd
->
command
!=
TSDB_SQL_INSERT
);
if
(
pCmd
->
command
==
TSDB_SQL_SELECT
)
{
if
(
pCmd
->
command
==
TSDB_SQL_SELECT
)
{
tscDebug
(
"
%p redo parse sql string and proceed"
,
pSql
);
tscDebug
(
"
0x%"
PRIx64
" redo parse sql string and proceed"
,
pSql
->
self
);
pCmd
->
parseFinished
=
false
;
pCmd
->
parseFinished
=
false
;
tscResetSqlCmd
(
pCmd
,
true
);
tscResetSqlCmd
(
pCmd
,
true
);
...
@@ -436,7 +436,7 @@ void tscTableMetaCallBack(void *param, TAOS_RES *res, int code) {
...
@@ -436,7 +436,7 @@ void tscTableMetaCallBack(void *param, TAOS_RES *res, int code) {
taosReleaseRef
(
tscObjRef
,
pSql
->
self
);
taosReleaseRef
(
tscObjRef
,
pSql
->
self
);
return
;
return
;
}
else
{
}
else
{
tscDebug
(
"
%p continue parse sql after get table meta"
,
pSql
);
tscDebug
(
"
0x%"
PRIx64
" continue parse sql after get table meta"
,
pSql
->
self
);
code
=
tsParseSql
(
pSql
,
false
);
code
=
tsParseSql
(
pSql
,
false
);
if
(
code
==
TSDB_CODE_TSC_ACTION_IN_PROGRESS
)
{
if
(
code
==
TSDB_CODE_TSC_ACTION_IN_PROGRESS
)
{
...
@@ -486,7 +486,7 @@ void tscTableMetaCallBack(void *param, TAOS_RES *res, int code) {
...
@@ -486,7 +486,7 @@ void tscTableMetaCallBack(void *param, TAOS_RES *res, int code) {
}
}
}
}
tscDebug
(
"
%p stream:%p meta is updated, start new query, command:%d"
,
pSql
,
pSql
->
pStream
,
pSql
->
cmd
.
command
);
tscDebug
(
"
0x%"
PRIx64
" stream:%p meta is updated, start new query, command:%d"
,
pSql
->
self
,
pSql
->
pStream
,
pSql
->
cmd
.
command
);
if
(
!
pSql
->
cmd
.
parseFinished
)
{
if
(
!
pSql
->
cmd
.
parseFinished
)
{
tsParseSql
(
pSql
,
false
);
tsParseSql
(
pSql
,
false
);
}
}
...
...
src/client/src/tscLocalMerge.c
浏览文件 @
272b524b
...
@@ -193,7 +193,7 @@ void tscCreateLocalMerger(tExtMemBuffer **pMemBuffer, int32_t numOfBuffer, tOrde
...
@@ -193,7 +193,7 @@ void tscCreateLocalMerger(tExtMemBuffer **pMemBuffer, int32_t numOfBuffer, tOrde
for
(
int32_t
i
=
0
;
i
<
numOfBuffer
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfBuffer
;
++
i
)
{
int32_t
len
=
pMemBuffer
[
i
]
->
fileMeta
.
flushoutData
.
nLength
;
int32_t
len
=
pMemBuffer
[
i
]
->
fileMeta
.
flushoutData
.
nLength
;
if
(
len
==
0
)
{
if
(
len
==
0
)
{
tscDebug
(
"
%p no data retrieved from orderOfVnode:%d"
,
pSql
,
i
+
1
);
tscDebug
(
"
0x%"
PRIx64
" no data retrieved from orderOfVnode:%d"
,
pSql
->
self
,
i
+
1
);
continue
;
continue
;
}
}
...
@@ -203,7 +203,7 @@ void tscCreateLocalMerger(tExtMemBuffer **pMemBuffer, int32_t numOfBuffer, tOrde
...
@@ -203,7 +203,7 @@ void tscCreateLocalMerger(tExtMemBuffer **pMemBuffer, int32_t numOfBuffer, tOrde
if
(
numOfFlush
==
0
||
numOfBuffer
==
0
)
{
if
(
numOfFlush
==
0
||
numOfBuffer
==
0
)
{
tscLocalReducerEnvDestroy
(
pMemBuffer
,
pDesc
,
finalmodel
,
pFFModel
,
numOfBuffer
);
tscLocalReducerEnvDestroy
(
pMemBuffer
,
pDesc
,
finalmodel
,
pFFModel
,
numOfBuffer
);
pCmd
->
command
=
TSDB_SQL_RETRIEVE_EMPTY_RESULT
;
// no result, set the result empty
pCmd
->
command
=
TSDB_SQL_RETRIEVE_EMPTY_RESULT
;
// no result, set the result empty
tscDebug
(
"
%p retrieved no data"
,
pSql
);
tscDebug
(
"
0x%"
PRIx64
" retrieved no data"
,
pSql
->
self
);
return
;
return
;
}
}
...
@@ -235,7 +235,7 @@ void tscCreateLocalMerger(tExtMemBuffer **pMemBuffer, int32_t numOfBuffer, tOrde
...
@@ -235,7 +235,7 @@ void tscCreateLocalMerger(tExtMemBuffer **pMemBuffer, int32_t numOfBuffer, tOrde
pReducer
->
numOfVnode
=
numOfBuffer
;
pReducer
->
numOfVnode
=
numOfBuffer
;
pReducer
->
pDesc
=
pDesc
;
pReducer
->
pDesc
=
pDesc
;
tscDebug
(
"
%p the number of merged leaves is: %d"
,
pSql
,
pReducer
->
numOfBuffer
);
tscDebug
(
"
0x%"
PRIx64
" the number of merged leaves is: %d"
,
pSql
->
self
,
pReducer
->
numOfBuffer
);
int32_t
idx
=
0
;
int32_t
idx
=
0
;
for
(
int32_t
i
=
0
;
i
<
numOfBuffer
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfBuffer
;
++
i
)
{
...
@@ -258,7 +258,7 @@ void tscCreateLocalMerger(tExtMemBuffer **pMemBuffer, int32_t numOfBuffer, tOrde
...
@@ -258,7 +258,7 @@ void tscCreateLocalMerger(tExtMemBuffer **pMemBuffer, int32_t numOfBuffer, tOrde
ds
->
pageId
=
0
;
ds
->
pageId
=
0
;
ds
->
rowIdx
=
0
;
ds
->
rowIdx
=
0
;
tscDebug
(
"
%p load data from disk into memory, orderOfVnode:%d, total:%d"
,
pSql
,
i
+
1
,
idx
+
1
);
tscDebug
(
"
0x%"
PRIx64
" load data from disk into memory, orderOfVnode:%d, total:%d"
,
pSql
->
self
,
i
+
1
,
idx
+
1
);
tExtMemBufferLoadData
(
pMemBuffer
[
i
],
&
(
ds
->
filePage
),
j
,
0
);
tExtMemBufferLoadData
(
pMemBuffer
[
i
],
&
(
ds
->
filePage
),
j
,
0
);
#ifdef _DEBUG_VIEW
#ifdef _DEBUG_VIEW
printf
(
"load data page into mem for build loser tree: %"
PRIu64
" rows
\n
"
,
ds
->
filePage
.
num
);
printf
(
"load data page into mem for build loser tree: %"
PRIu64
" rows
\n
"
,
ds
->
filePage
.
num
);
...
@@ -272,7 +272,7 @@ void tscCreateLocalMerger(tExtMemBuffer **pMemBuffer, int32_t numOfBuffer, tOrde
...
@@ -272,7 +272,7 @@ void tscCreateLocalMerger(tExtMemBuffer **pMemBuffer, int32_t numOfBuffer, tOrde
#endif
#endif
if
(
ds
->
filePage
.
num
==
0
)
{
// no data in this flush, the index does not increase
if
(
ds
->
filePage
.
num
==
0
)
{
// no data in this flush, the index does not increase
tscDebug
(
"
%p flush data is empty, ignore %d flush record"
,
pSql
,
idx
);
tscDebug
(
"
0x%"
PRIx64
" flush data is empty, ignore %d flush record"
,
pSql
->
self
,
idx
);
tfree
(
ds
);
tfree
(
ds
);
continue
;
continue
;
}
}
...
@@ -547,10 +547,10 @@ void tscDestroyLocalMerger(SSqlObj *pSql) {
...
@@ -547,10 +547,10 @@ void tscDestroyLocalMerger(SSqlObj *pSql) {
pLocalMerge
->
numOfCompleted
=
0
;
pLocalMerge
->
numOfCompleted
=
0
;
free
(
pLocalMerge
);
free
(
pLocalMerge
);
}
else
{
}
else
{
tscDebug
(
"
%p already freed or another free function is invoked"
,
pSql
);
tscDebug
(
"
0x%"
PRIx64
" already freed or another free function is invoked"
,
pSql
->
self
);
}
}
tscDebug
(
"
%p free local reducer finished"
,
pSql
);
tscDebug
(
"
0x%"
PRIx64
" free local reducer finished"
,
pSql
->
self
);
}
}
static
int32_t
createOrderDescriptor
(
tOrderDescriptor
**
pOrderDesc
,
SSqlCmd
*
pCmd
,
SColumnModel
*
pModel
)
{
static
int32_t
createOrderDescriptor
(
tOrderDescriptor
**
pOrderDesc
,
SSqlCmd
*
pCmd
,
SColumnModel
*
pModel
)
{
...
...
src/client/src/tscParseInsert.c
浏览文件 @
272b524b
...
@@ -1089,7 +1089,7 @@ int tsParseInsertSql(SSqlObj *pSql) {
...
@@ -1089,7 +1089,7 @@ int tsParseInsertSql(SSqlObj *pSql) {
str
=
pCmd
->
curSql
;
str
=
pCmd
->
curSql
;
}
}
tscDebug
(
"
%p create data block list hashList:%p"
,
pSql
,
pCmd
->
pTableBlockHashList
);
tscDebug
(
"
0x%"
PRIx64
" create data block list hashList:%p"
,
pSql
->
self
,
pCmd
->
pTableBlockHashList
);
while
(
1
)
{
while
(
1
)
{
int32_t
index
=
0
;
int32_t
index
=
0
;
...
@@ -1303,7 +1303,7 @@ int tsParseSql(SSqlObj *pSql, bool initial) {
...
@@ -1303,7 +1303,7 @@ int tsParseSql(SSqlObj *pSql, bool initial) {
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
if
((
!
pCmd
->
parseFinished
)
&&
(
!
initial
))
{
if
((
!
pCmd
->
parseFinished
)
&&
(
!
initial
))
{
tscDebug
(
"
%p resume to parse sql: %s"
,
pSql
,
pCmd
->
curSql
);
tscDebug
(
"
0x%"
PRIx64
" resume to parse sql: %s"
,
pSql
->
self
,
pCmd
->
curSql
);
}
}
ret
=
tscAllocPayload
(
&
pSql
->
cmd
,
TSDB_DEFAULT_PAYLOAD_SIZE
);
ret
=
tscAllocPayload
(
&
pSql
->
cmd
,
TSDB_DEFAULT_PAYLOAD_SIZE
);
...
...
src/client/src/tscProfile.c
浏览文件 @
272b524b
...
@@ -61,7 +61,7 @@ void tscAddIntoSqlList(SSqlObj *pSql) {
...
@@ -61,7 +61,7 @@ void tscAddIntoSqlList(SSqlObj *pSql) {
pSql
->
stime
=
taosGetTimestampMs
();
pSql
->
stime
=
taosGetTimestampMs
();
pSql
->
listed
=
1
;
pSql
->
listed
=
1
;
tscDebug
(
"
%p added into sqlList"
,
pSql
);
tscDebug
(
"
0x%"
PRIx64
" added into sqlList"
,
pSql
->
self
);
}
}
void
tscSaveSlowQueryFpCb
(
void
*
param
,
TAOS_RES
*
result
,
int
code
)
{
void
tscSaveSlowQueryFpCb
(
void
*
param
,
TAOS_RES
*
result
,
int
code
)
{
...
@@ -99,7 +99,7 @@ void tscSaveSlowQuery(SSqlObj *pSql) {
...
@@ -99,7 +99,7 @@ void tscSaveSlowQuery(SSqlObj *pSql) {
return
;
return
;
}
}
tscDebug
(
"
%p query time:%"
PRId64
" sql:%s"
,
pSql
,
pSql
->
res
.
useconds
,
pSql
->
sqlstr
);
tscDebug
(
"
0x%"
PRIx64
" query time:%"
PRId64
" sql:%s"
,
pSql
->
self
,
pSql
->
res
.
useconds
,
pSql
->
sqlstr
);
int32_t
sqlSize
=
(
int32_t
)(
TSDB_SLOW_QUERY_SQL_LEN
+
size
);
int32_t
sqlSize
=
(
int32_t
)(
TSDB_SLOW_QUERY_SQL_LEN
+
size
);
char
*
sql
=
malloc
(
sqlSize
);
char
*
sql
=
malloc
(
sqlSize
);
...
@@ -141,7 +141,7 @@ void tscRemoveFromSqlList(SSqlObj *pSql) {
...
@@ -141,7 +141,7 @@ void tscRemoveFromSqlList(SSqlObj *pSql) {
pSql
->
listed
=
0
;
pSql
->
listed
=
0
;
tscSaveSlowQuery
(
pSql
);
tscSaveSlowQuery
(
pSql
);
tscDebug
(
"
%p removed from sqlList"
,
pSql
);
tscDebug
(
"
0x%"
PRIx64
" removed from sqlList"
,
pSql
->
self
);
}
}
void
tscKillQuery
(
STscObj
*
pObj
,
uint32_t
killId
)
{
void
tscKillQuery
(
STscObj
*
pObj
,
uint32_t
killId
)
{
...
@@ -158,7 +158,7 @@ void tscKillQuery(STscObj *pObj, uint32_t killId) {
...
@@ -158,7 +158,7 @@ void tscKillQuery(STscObj *pObj, uint32_t killId) {
if
(
pSql
==
NULL
)
{
if
(
pSql
==
NULL
)
{
tscError
(
"failed to kill query, id:%d, it may have completed/terminated"
,
killId
);
tscError
(
"failed to kill query, id:%d, it may have completed/terminated"
,
killId
);
}
else
{
}
else
{
tscDebug
(
"
%p query is killed, queryId:%d"
,
pSql
,
killId
);
tscDebug
(
"
0x%"
PRIx64
" query is killed, queryId:%d"
,
pSql
->
self
,
killId
);
taos_stop_query
(
pSql
);
taos_stop_query
(
pSql
);
}
}
}
}
...
@@ -213,7 +213,7 @@ void tscKillStream(STscObj *pObj, uint32_t killId) {
...
@@ -213,7 +213,7 @@ void tscKillStream(STscObj *pObj, uint32_t killId) {
pthread_mutex_unlock
(
&
pObj
->
mutex
);
pthread_mutex_unlock
(
&
pObj
->
mutex
);
if
(
pStream
)
{
if
(
pStream
)
{
tscDebug
(
"
%p stream:%p is killed, streamId:%d"
,
pStream
->
pSql
,
pStream
,
killId
);
tscDebug
(
"
0x%"
PRIx64
" stream:%p is killed, streamId:%d"
,
pStream
->
pSql
->
self
,
pStream
,
killId
);
if
(
pStream
->
callback
)
{
if
(
pStream
->
callback
)
{
pStream
->
callback
(
pStream
->
param
);
pStream
->
callback
(
pStream
->
param
);
}
}
...
@@ -273,7 +273,7 @@ int tscBuildQueryStreamDesc(void *pMsg, STscObj *pObj) {
...
@@ -273,7 +273,7 @@ int tscBuildQueryStreamDesc(void *pMsg, STscObj *pObj) {
pSdesc
->
num
=
htobe64
(
pStream
->
num
);
pSdesc
->
num
=
htobe64
(
pStream
->
num
);
pSdesc
->
useconds
=
htobe64
(
pStream
->
useconds
);
pSdesc
->
useconds
=
htobe64
(
pStream
->
useconds
);
pSdesc
->
stime
=
htobe64
(
pStream
->
stime
-
pStream
->
interval
.
interval
);
pSdesc
->
stime
=
(
pStream
->
stime
==
INT64_MIN
)
?
htobe64
(
pStream
->
stime
)
:
htobe64
(
pStream
->
stime
-
pStream
->
interval
.
interval
);
pSdesc
->
ctime
=
htobe64
(
pStream
->
ctime
);
pSdesc
->
ctime
=
htobe64
(
pStream
->
ctime
);
pSdesc
->
slidingTime
=
htobe64
(
pStream
->
interval
.
sliding
);
pSdesc
->
slidingTime
=
htobe64
(
pStream
->
interval
.
sliding
);
...
...
src/client/src/tscSQLParser.c
浏览文件 @
272b524b
...
@@ -1608,7 +1608,7 @@ bool isValidDistinctSql(SQueryInfo* pQueryInfo) {
...
@@ -1608,7 +1608,7 @@ bool isValidDistinctSql(SQueryInfo* pQueryInfo) {
int32_t
parseSelectClause
(
SSqlCmd
*
pCmd
,
int32_t
clauseIndex
,
SArray
*
pSelectList
,
bool
isSTable
,
bool
joinQuery
,
bool
timeWindowQuery
)
{
int32_t
parseSelectClause
(
SSqlCmd
*
pCmd
,
int32_t
clauseIndex
,
SArray
*
pSelectList
,
bool
isSTable
,
bool
joinQuery
,
bool
timeWindowQuery
)
{
assert
(
pSelectList
!=
NULL
&&
pCmd
!=
NULL
);
assert
(
pSelectList
!=
NULL
&&
pCmd
!=
NULL
);
const
char
*
msg1
=
"too many columns in selection clause"
;
const
char
*
msg2
=
"functions or others can not be mixed up"
;
const
char
*
msg2
=
"functions or others can not be mixed up"
;
const
char
*
msg3
=
"not support query expression"
;
const
char
*
msg3
=
"not support query expression"
;
const
char
*
msg5
=
"invalid function name"
;
const
char
*
msg5
=
"invalid function name"
;
...
@@ -1657,7 +1657,7 @@ int32_t parseSelectClause(SSqlCmd* pCmd, int32_t clauseIndex, SArray* pSelectLis
...
@@ -1657,7 +1657,7 @@ int32_t parseSelectClause(SSqlCmd* pCmd, int32_t clauseIndex, SArray* pSelectLis
}
}
if
(
pQueryInfo
->
fieldsInfo
.
numOfOutput
>
TSDB_MAX_COLUMNS
)
{
if
(
pQueryInfo
->
fieldsInfo
.
numOfOutput
>
TSDB_MAX_COLUMNS
)
{
return
TSDB_CODE_TSC_INVALID_SQL
;
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg1
)
;
}
}
}
}
...
@@ -3078,7 +3078,7 @@ static SColumnFilterInfo* addColumnFilterInfo(SColumn* pColumn) {
...
@@ -3078,7 +3078,7 @@ static SColumnFilterInfo* addColumnFilterInfo(SColumn* pColumn) {
return
pColFilterInfo
;
return
pColFilterInfo
;
}
}
static
int32_t
doExtractColumnFilterInfo
(
SSqlCmd
*
pCmd
,
SQueryInfo
*
pQueryInfo
,
SColumnFilterInfo
*
pColumnFilter
,
static
int32_t
doExtractColumnFilterInfo
(
SSqlCmd
*
pCmd
,
SQueryInfo
*
pQueryInfo
,
S
TableMeta
*
pTableMeta
,
S
ColumnFilterInfo
*
pColumnFilter
,
int16_t
colType
,
tSqlExpr
*
pExpr
)
{
int16_t
colType
,
tSqlExpr
*
pExpr
)
{
const
char
*
msg
=
"not supported filter condition"
;
const
char
*
msg
=
"not supported filter condition"
;
...
@@ -3093,6 +3093,12 @@ static int32_t doExtractColumnFilterInfo(SSqlCmd* pCmd, SQueryInfo* pQueryInfo,
...
@@ -3093,6 +3093,12 @@ static int32_t doExtractColumnFilterInfo(SSqlCmd* pCmd, SQueryInfo* pQueryInfo,
if
(
TSDB_CODE_SUCCESS
!=
retVal
)
{
if
(
TSDB_CODE_SUCCESS
!=
retVal
)
{
return
retVal
;
return
retVal
;
}
}
}
else
if
((
colType
==
TSDB_DATA_TYPE_TIMESTAMP
)
&&
(
TSDB_DATA_TYPE_BIGINT
==
pRight
->
value
.
nType
))
{
STableComInfo
tinfo
=
tscGetTableInfo
(
pTableMeta
);
if
((
tinfo
.
precision
==
TSDB_TIME_PRECISION_MILLI
)
&&
(
pRight
->
flags
&
(
1
<<
EXPR_FLAG_US_TIMESTAMP
)))
{
pRight
->
value
.
i64
/=
1000
;
}
}
}
int32_t
retVal
=
TSDB_CODE_SUCCESS
;
int32_t
retVal
=
TSDB_CODE_SUCCESS
;
...
@@ -3291,7 +3297,7 @@ static int32_t extractColumnFilterInfo(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SC
...
@@ -3291,7 +3297,7 @@ static int32_t extractColumnFilterInfo(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SC
int16_t
colType
=
pSchema
->
type
;
int16_t
colType
=
pSchema
->
type
;
return
doExtractColumnFilterInfo
(
pCmd
,
pQueryInfo
,
pColFilter
,
colType
,
pExpr
);
return
doExtractColumnFilterInfo
(
pCmd
,
pQueryInfo
,
p
TableMeta
,
p
ColFilter
,
colType
,
pExpr
);
}
}
static
int32_t
getTablenameCond
(
SSqlCmd
*
pCmd
,
SQueryInfo
*
pQueryInfo
,
tSqlExpr
*
pTableCond
,
SStringBuilder
*
sb
)
{
static
int32_t
getTablenameCond
(
SSqlCmd
*
pCmd
,
SQueryInfo
*
pQueryInfo
,
tSqlExpr
*
pTableCond
,
SStringBuilder
*
sb
)
{
...
@@ -3916,6 +3922,10 @@ int32_t getQueryCondExpr(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSqlExpr** pExpr
...
@@ -3916,6 +3922,10 @@ int32_t getQueryCondExpr(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSqlExpr** pExpr
const
char
*
msg1
=
"query condition between different columns must use 'AND'"
;
const
char
*
msg1
=
"query condition between different columns must use 'AND'"
;
if
((
*
pExpr
)
->
flags
&
(
1
<<
EXPR_FLAG_TS_ERROR
))
{
return
TSDB_CODE_TSC_INVALID_SQL
;
}
tSqlExpr
*
pLeft
=
(
*
pExpr
)
->
pLeft
;
tSqlExpr
*
pLeft
=
(
*
pExpr
)
->
pLeft
;
tSqlExpr
*
pRight
=
(
*
pExpr
)
->
pRight
;
tSqlExpr
*
pRight
=
(
*
pExpr
)
->
pRight
;
...
@@ -3953,6 +3963,14 @@ int32_t getQueryCondExpr(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSqlExpr** pExpr
...
@@ -3953,6 +3963,14 @@ int32_t getQueryCondExpr(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSqlExpr** pExpr
exchangeExpr
(
*
pExpr
);
exchangeExpr
(
*
pExpr
);
if
(
pLeft
->
tokenId
==
TK_ID
&&
pRight
->
tokenId
==
TK_TIMESTAMP
&&
(
pRight
->
flags
&
(
1
<<
EXPR_FLAG_TIMESTAMP_VAR
)))
{
return
TSDB_CODE_TSC_INVALID_SQL
;
}
if
((
pLeft
->
flags
&
(
1
<<
EXPR_FLAG_TS_ERROR
))
||
(
pRight
->
flags
&
(
1
<<
EXPR_FLAG_TS_ERROR
)))
{
return
TSDB_CODE_TSC_INVALID_SQL
;
}
return
handleExprInQueryCond
(
pCmd
,
pQueryInfo
,
pExpr
,
pCondExpr
,
type
,
parentOptr
);
return
handleExprInQueryCond
(
pCmd
,
pQueryInfo
,
pExpr
,
pCondExpr
,
type
,
parentOptr
);
}
}
...
@@ -5508,15 +5526,15 @@ int32_t parseLimitClause(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t clauseIn
...
@@ -5508,15 +5526,15 @@ int32_t parseLimitClause(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t clauseIn
pQueryInfo
->
clauseLimit
=
pQueryInfo
->
limit
.
limit
;
pQueryInfo
->
clauseLimit
=
pQueryInfo
->
limit
.
limit
;
pQueryInfo
->
slimit
=
pQuerySqlNode
->
slimit
;
pQueryInfo
->
slimit
=
pQuerySqlNode
->
slimit
;
tscDebug
(
"
%p limit:%"
PRId64
", offset:%"
PRId64
" slimit:%"
PRId64
", soffset:%"
PRId64
,
pSql
,
pQueryInfo
->
limit
.
limit
,
tscDebug
(
"
0x%"
PRIx64
" limit:%"
PRId64
", offset:%"
PRId64
" slimit:%"
PRId64
", soffset:%"
PRId64
,
pSql
->
self
,
pQueryInfo
->
limit
.
offset
,
pQueryInfo
->
slimit
.
limit
,
pQueryInfo
->
slimit
.
offset
);
pQueryInfo
->
limit
.
limit
,
pQueryInfo
->
limit
.
offset
,
pQueryInfo
->
slimit
.
limit
,
pQueryInfo
->
slimit
.
offset
);
if
(
pQueryInfo
->
slimit
.
offset
<
0
||
pQueryInfo
->
limit
.
offset
<
0
)
{
if
(
pQueryInfo
->
slimit
.
offset
<
0
||
pQueryInfo
->
limit
.
offset
<
0
)
{
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg0
);
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg0
);
}
}
if
(
pQueryInfo
->
limit
.
limit
==
0
)
{
if
(
pQueryInfo
->
limit
.
limit
==
0
)
{
tscDebug
(
"
%p limit 0, no output result"
,
pSql
);
tscDebug
(
"
0x%"
PRIx64
" limit 0, no output result"
,
pSql
->
self
);
pQueryInfo
->
command
=
TSDB_SQL_RETRIEVE_EMPTY_RESULT
;
pQueryInfo
->
command
=
TSDB_SQL_RETRIEVE_EMPTY_RESULT
;
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
...
@@ -5538,7 +5556,7 @@ int32_t parseLimitClause(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t clauseIn
...
@@ -5538,7 +5556,7 @@ int32_t parseLimitClause(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t clauseIn
}
}
if
(
pQueryInfo
->
slimit
.
limit
==
0
)
{
if
(
pQueryInfo
->
slimit
.
limit
==
0
)
{
tscDebug
(
"
%p slimit 0, no output result"
,
pSql
);
tscDebug
(
"
0x%"
PRIx64
" slimit 0, no output result"
,
pSql
->
self
);
pQueryInfo
->
command
=
TSDB_SQL_RETRIEVE_EMPTY_RESULT
;
pQueryInfo
->
command
=
TSDB_SQL_RETRIEVE_EMPTY_RESULT
;
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
...
@@ -5556,7 +5574,7 @@ int32_t parseLimitClause(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t clauseIn
...
@@ -5556,7 +5574,7 @@ int32_t parseLimitClause(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t clauseIn
// No tables included. No results generated. Query results are empty.
// No tables included. No results generated. Query results are empty.
if
(
pTableMetaInfo
->
vgroupList
->
numOfVgroups
==
0
)
{
if
(
pTableMetaInfo
->
vgroupList
->
numOfVgroups
==
0
)
{
tscDebug
(
"
%p no table in super table, no output result"
,
pSql
);
tscDebug
(
"
0x%"
PRIx64
" no table in super table, no output result"
,
pSql
->
self
);
pQueryInfo
->
command
=
TSDB_SQL_RETRIEVE_EMPTY_RESULT
;
pQueryInfo
->
command
=
TSDB_SQL_RETRIEVE_EMPTY_RESULT
;
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
...
@@ -6326,7 +6344,7 @@ void tscPrintSelectClause(SSqlObj* pSql, int32_t subClauseIndex) {
...
@@ -6326,7 +6344,7 @@ void tscPrintSelectClause(SSqlObj* pSql, int32_t subClauseIndex) {
int32_t
totalBufSize
=
1024
;
int32_t
totalBufSize
=
1024
;
char
str
[
1024
]
=
{
0
};
char
str
[
1024
+
1
]
=
{
0
};
int32_t
offset
=
0
;
int32_t
offset
=
0
;
offset
+=
sprintf
(
str
,
"num:%d ["
,
size
);
offset
+=
sprintf
(
str
,
"num:%d ["
,
size
);
...
@@ -6351,7 +6369,7 @@ void tscPrintSelectClause(SSqlObj* pSql, int32_t subClauseIndex) {
...
@@ -6351,7 +6369,7 @@ void tscPrintSelectClause(SSqlObj* pSql, int32_t subClauseIndex) {
assert
(
offset
<
totalBufSize
);
assert
(
offset
<
totalBufSize
);
str
[
offset
]
=
']'
;
str
[
offset
]
=
']'
;
assert
(
offset
<
totalBufSize
);
assert
(
offset
<
totalBufSize
);
tscDebug
(
"
%p select clause:%s"
,
pSql
,
str
);
tscDebug
(
"
0x%"
PRIx64
" select clause:%s"
,
pSql
->
self
,
str
);
}
}
int32_t
doCheckForCreateTable
(
SSqlObj
*
pSql
,
int32_t
subClauseIndex
,
SSqlInfo
*
pInfo
)
{
int32_t
doCheckForCreateTable
(
SSqlObj
*
pSql
,
int32_t
subClauseIndex
,
SSqlInfo
*
pInfo
)
{
...
@@ -6927,7 +6945,10 @@ static int32_t handleExprInHavingClause(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, t
...
@@ -6927,7 +6945,10 @@ static int32_t handleExprInHavingClause(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, t
}
}
}
}
int32_t
ret
=
doExtractColumnFilterInfo
(
pCmd
,
pQueryInfo
,
pColFilter
,
pInfo
->
field
.
type
,
pExpr
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
0
);
STableMeta
*
pTableMeta
=
pTableMetaInfo
->
pTableMeta
;
int32_t
ret
=
doExtractColumnFilterInfo
(
pCmd
,
pQueryInfo
,
pTableMeta
,
pColFilter
,
pInfo
->
field
.
type
,
pExpr
);
if
(
ret
)
{
if
(
ret
)
{
return
ret
;
return
ret
;
}
}
...
...
src/client/src/tscServer.c
浏览文件 @
272b524b
...
@@ -147,7 +147,7 @@ static void tscUpdateVgroupInfo(SSqlObj *pSql, SRpcEpSet *pEpSet) {
...
@@ -147,7 +147,7 @@ static void tscUpdateVgroupInfo(SSqlObj *pSql, SRpcEpSet *pEpSet) {
// Update the local cached epSet info cached by SqlObj
// Update the local cached epSet info cached by SqlObj
int32_t
inUse
=
pSql
->
epSet
.
inUse
;
int32_t
inUse
=
pSql
->
epSet
.
inUse
;
tscDumpEpSetFromVgroupInfo
(
&
pSql
->
epSet
,
&
vgroupInfo
);
tscDumpEpSetFromVgroupInfo
(
&
pSql
->
epSet
,
&
vgroupInfo
);
tscDebug
(
"
%p update the epSet in SqlObj, in use before:%d, after:%d"
,
pSql
,
inUse
,
pSql
->
epSet
.
inUse
);
tscDebug
(
"
0x%"
PRIx64
" update the epSet in SqlObj, in use before:%d, after:%d"
,
pSql
->
self
,
inUse
,
pSql
->
epSet
.
inUse
);
}
}
...
@@ -245,11 +245,11 @@ void tscProcessHeartBeatRsp(void *param, TAOS_RES *tres, int code) {
...
@@ -245,11 +245,11 @@ void tscProcessHeartBeatRsp(void *param, TAOS_RES *tres, int code) {
if
(
pObj
->
hbrid
!=
0
)
{
if
(
pObj
->
hbrid
!=
0
)
{
int32_t
waitingDuring
=
tsShellActivityTimer
*
500
;
int32_t
waitingDuring
=
tsShellActivityTimer
*
500
;
tscDebug
(
"
%p send heartbeat in %dms"
,
pSql
,
waitingDuring
);
tscDebug
(
"
0x%"
PRIx64
" send heartbeat in %dms"
,
pSql
->
self
,
waitingDuring
);
taosTmrReset
(
tscProcessActivityTimer
,
waitingDuring
,
(
void
*
)
pObj
->
rid
,
tscTmr
,
&
pObj
->
pTimer
);
taosTmrReset
(
tscProcessActivityTimer
,
waitingDuring
,
(
void
*
)
pObj
->
rid
,
tscTmr
,
&
pObj
->
pTimer
);
}
else
{
}
else
{
tscDebug
(
"
%p start to close tscObj:%p, not send heartbeat again"
,
pSql
,
pObj
);
tscDebug
(
"
0x%"
PRIx64
" start to close tscObj:%p, not send heartbeat again"
,
pSql
->
self
,
pObj
);
}
}
}
}
...
@@ -326,7 +326,7 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcEpSet *pEpSet) {
...
@@ -326,7 +326,7 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcEpSet *pEpSet) {
pSql
->
rpcRid
=
-
1
;
pSql
->
rpcRid
=
-
1
;
if
(
pObj
->
signature
!=
pObj
)
{
if
(
pObj
->
signature
!=
pObj
)
{
tscDebug
(
"
%p DB connection is closed, cmd:%d pObj:%p signature:%p"
,
pSql
,
pCmd
->
command
,
pObj
,
pObj
->
signature
);
tscDebug
(
"
0x%"
PRIx64
" DB connection is closed, cmd:%d pObj:%p signature:%p"
,
pSql
->
self
,
pCmd
->
command
,
pObj
,
pObj
->
signature
);
taosRemoveRef
(
tscObjRef
,
handle
);
taosRemoveRef
(
tscObjRef
,
handle
);
taosReleaseRef
(
tscObjRef
,
handle
);
taosReleaseRef
(
tscObjRef
,
handle
);
...
@@ -336,8 +336,8 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcEpSet *pEpSet) {
...
@@ -336,8 +336,8 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcEpSet *pEpSet) {
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
0
);
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
0
);
if
(
pQueryInfo
!=
NULL
&&
pQueryInfo
->
type
==
TSDB_QUERY_TYPE_FREE_RESOURCE
)
{
if
(
pQueryInfo
!=
NULL
&&
pQueryInfo
->
type
==
TSDB_QUERY_TYPE_FREE_RESOURCE
)
{
tscDebug
(
"
%p
sqlObj needs to be released or DB connection is closed, cmd:%d type:%d, pObj:%p signature:%p"
,
tscDebug
(
"
0x%"
PRIx64
"
sqlObj needs to be released or DB connection is closed, cmd:%d type:%d, pObj:%p signature:%p"
,
pSql
,
pCmd
->
command
,
pQueryInfo
->
type
,
pObj
,
pObj
->
signature
);
pSql
->
self
,
pCmd
->
command
,
pQueryInfo
->
type
,
pObj
,
pObj
->
signature
);
taosRemoveRef
(
tscObjRef
,
handle
);
taosRemoveRef
(
tscObjRef
,
handle
);
taosReleaseRef
(
tscObjRef
,
handle
);
taosReleaseRef
(
tscObjRef
,
handle
);
...
@@ -396,13 +396,13 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcEpSet *pEpSet) {
...
@@ -396,13 +396,13 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcEpSet *pEpSet) {
pRes
->
rspLen
=
0
;
pRes
->
rspLen
=
0
;
if
(
pRes
->
code
==
TSDB_CODE_TSC_QUERY_CANCELLED
)
{
if
(
pRes
->
code
==
TSDB_CODE_TSC_QUERY_CANCELLED
)
{
tscDebug
(
"
%p query is cancelled, code:%s"
,
pSql
,
tstrerror
(
pRes
->
code
));
tscDebug
(
"
0x%"
PRIx64
" query is cancelled, code:%s"
,
pSql
->
self
,
tstrerror
(
pRes
->
code
));
}
else
{
}
else
{
pRes
->
code
=
rpcMsg
->
code
;
pRes
->
code
=
rpcMsg
->
code
;
}
}
if
(
pRes
->
code
==
TSDB_CODE_SUCCESS
)
{
if
(
pRes
->
code
==
TSDB_CODE_SUCCESS
)
{
tscDebug
(
"
%p reset retry counter to be 0 due to success rsp, old:%d"
,
pSql
,
pSql
->
retry
);
tscDebug
(
"
0x%"
PRIx64
" reset retry counter to be 0 due to success rsp, old:%d"
,
pSql
->
self
,
pSql
->
retry
);
pSql
->
retry
=
0
;
pSql
->
retry
=
0
;
}
}
...
@@ -437,10 +437,10 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcEpSet *pEpSet) {
...
@@ -437,10 +437,10 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcEpSet *pEpSet) {
pMsg
->
numOfFailedBlocks
=
htonl
(
pMsg
->
numOfFailedBlocks
);
pMsg
->
numOfFailedBlocks
=
htonl
(
pMsg
->
numOfFailedBlocks
);
pRes
->
numOfRows
+=
pMsg
->
affectedRows
;
pRes
->
numOfRows
+=
pMsg
->
affectedRows
;
tscDebug
(
"
%p SQL cmd:%s, code:%s inserted rows:%d rspLen:%d"
,
pSql
,
sqlCmd
[
pCmd
->
command
],
tscDebug
(
"
0x%"
PRIx64
" SQL cmd:%s, code:%s inserted rows:%d rspLen:%d"
,
pSql
->
self
,
sqlCmd
[
pCmd
->
command
],
tstrerror
(
pRes
->
code
),
pMsg
->
affectedRows
,
pRes
->
rspLen
);
tstrerror
(
pRes
->
code
),
pMsg
->
affectedRows
,
pRes
->
rspLen
);
}
else
{
}
else
{
tscDebug
(
"
%p SQL cmd:%s, code:%s rspLen:%d"
,
pSql
,
sqlCmd
[
pCmd
->
command
],
tstrerror
(
pRes
->
code
),
pRes
->
rspLen
);
tscDebug
(
"
0x%"
PRIx64
" SQL cmd:%s, code:%s rspLen:%d"
,
pSql
->
self
,
sqlCmd
[
pCmd
->
command
],
tstrerror
(
pRes
->
code
),
pRes
->
rspLen
);
}
}
}
}
...
@@ -461,7 +461,7 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcEpSet *pEpSet) {
...
@@ -461,7 +461,7 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcEpSet *pEpSet) {
if
(
shouldFree
)
{
// in case of table-meta/vgrouplist query, automatically free it
if
(
shouldFree
)
{
// in case of table-meta/vgrouplist query, automatically free it
taosRemoveRef
(
tscObjRef
,
handle
);
taosRemoveRef
(
tscObjRef
,
handle
);
tscDebug
(
"
%p sqlObj is automatically freed"
,
pSql
);
tscDebug
(
"
0x%"
PRIx64
" sqlObj is automatically freed"
,
pSql
->
self
);
}
}
taosReleaseRef
(
tscObjRef
,
handle
);
taosReleaseRef
(
tscObjRef
,
handle
);
...
@@ -522,7 +522,7 @@ int tscProcessSql(SSqlObj *pSql) {
...
@@ -522,7 +522,7 @@ int tscProcessSql(SSqlObj *pSql) {
assert
((
pQueryInfo
->
numOfTables
==
0
&&
pQueryInfo
->
command
==
TSDB_SQL_HB
)
||
pQueryInfo
->
numOfTables
>
0
);
assert
((
pQueryInfo
->
numOfTables
==
0
&&
pQueryInfo
->
command
==
TSDB_SQL_HB
)
||
pQueryInfo
->
numOfTables
>
0
);
}
}
tscDebug
(
"
%p SQL cmd:%s will be processed, name:%s, type:%d"
,
pSql
,
sqlCmd
[
pCmd
->
command
],
name
,
type
);
tscDebug
(
"
0x%"
PRIx64
" SQL cmd:%s will be processed, name:%s, type:%d"
,
pSql
->
self
,
sqlCmd
[
pCmd
->
command
],
name
,
type
);
if
(
pCmd
->
command
<
TSDB_SQL_MGMT
)
{
// the pTableMetaInfo cannot be NULL
if
(
pCmd
->
command
<
TSDB_SQL_MGMT
)
{
// the pTableMetaInfo cannot be NULL
if
(
pTableMetaInfo
==
NULL
)
{
if
(
pTableMetaInfo
==
NULL
)
{
pSql
->
res
.
code
=
TSDB_CODE_TSC_APP_ERROR
;
pSql
->
res
.
code
=
TSDB_CODE_TSC_APP_ERROR
;
...
@@ -562,11 +562,12 @@ int tscBuildFetchMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
...
@@ -562,11 +562,12 @@ int tscBuildFetchMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
}
}
pRetrieveMsg
->
header
.
vgId
=
htonl
(
vgId
);
pRetrieveMsg
->
header
.
vgId
=
htonl
(
vgId
);
tscDebug
(
"
%p build fetch msg from vgId:%d, vgIndex:%d, qId:%"
PRIu64
,
pSql
,
vgId
,
vgIndex
,
pSql
->
res
.
qId
);
tscDebug
(
"
0x%"
PRIx64
" build fetch msg from vgId:%d, vgIndex:%d, qId:0x%"
PRIx64
,
pSql
->
self
,
vgId
,
vgIndex
,
pSql
->
res
.
qId
);
}
else
{
}
else
{
STableMeta
*
pTableMeta
=
pTableMetaInfo
->
pTableMeta
;
STableMeta
*
pTableMeta
=
pTableMetaInfo
->
pTableMeta
;
pRetrieveMsg
->
header
.
vgId
=
htonl
(
pTableMeta
->
vgId
);
pRetrieveMsg
->
header
.
vgId
=
htonl
(
pTableMeta
->
vgId
);
tscDebug
(
"%p build fetch msg from only one vgroup, vgId:%d, qId:%"
PRIu64
,
pSql
,
pTableMeta
->
vgId
,
pSql
->
res
.
qId
);
tscDebug
(
"0x%"
PRIx64
" build fetch msg from only one vgroup, vgId:%d, qId:0x%"
PRIx64
,
pSql
->
self
,
pTableMeta
->
vgId
,
pSql
->
res
.
qId
);
}
}
pSql
->
cmd
.
payloadLen
=
sizeof
(
SRetrieveTableMsg
);
pSql
->
cmd
.
payloadLen
=
sizeof
(
SRetrieveTableMsg
);
...
@@ -605,7 +606,7 @@ int tscBuildSubmitMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
...
@@ -605,7 +606,7 @@ int tscBuildSubmitMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
taosHashGetClone
(
tscVgroupMap
,
&
pTableMeta
->
vgId
,
sizeof
(
pTableMeta
->
vgId
),
NULL
,
&
vgroupInfo
,
sizeof
(
SNewVgroupInfo
));
taosHashGetClone
(
tscVgroupMap
,
&
pTableMeta
->
vgId
,
sizeof
(
pTableMeta
->
vgId
),
NULL
,
&
vgroupInfo
,
sizeof
(
SNewVgroupInfo
));
tscDumpEpSetFromVgroupInfo
(
&
pSql
->
epSet
,
&
vgroupInfo
);
tscDumpEpSetFromVgroupInfo
(
&
pSql
->
epSet
,
&
vgroupInfo
);
tscDebug
(
"
%p build submit msg, vgId:%d numOfTables:%d numberOfEP:%d"
,
pSql
,
pTableMeta
->
vgId
,
pSql
->
cmd
.
numOfTablesInSubmit
,
tscDebug
(
"
0x%"
PRIx64
" build submit msg, vgId:%d numOfTables:%d numberOfEP:%d"
,
pSql
->
self
,
pTableMeta
->
vgId
,
pSql
->
cmd
.
numOfTablesInSubmit
,
pSql
->
epSet
.
numOfEps
);
pSql
->
epSet
.
numOfEps
);
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
...
@@ -671,7 +672,7 @@ static char *doSerializeTableInfo(SQueryTableMsg* pQueryMsg, SSqlObj *pSql, char
...
@@ -671,7 +672,7 @@ static char *doSerializeTableInfo(SQueryTableMsg* pQueryMsg, SSqlObj *pSql, char
vgId
=
pVgroupInfo
->
vgId
;
vgId
=
pVgroupInfo
->
vgId
;
tscSetDnodeEpSet
(
&
pSql
->
epSet
,
pVgroupInfo
);
tscSetDnodeEpSet
(
&
pSql
->
epSet
,
pVgroupInfo
);
tscDebug
(
"
%p query on stable, vgIndex:%d, numOfVgroups:%d"
,
pSql
,
index
,
pTableMetaInfo
->
vgroupList
->
numOfVgroups
);
tscDebug
(
"
0x%"
PRIx64
" query on stable, vgIndex:%d, numOfVgroups:%d"
,
pSql
->
self
,
index
,
pTableMetaInfo
->
vgroupList
->
numOfVgroups
);
}
else
{
}
else
{
vgId
=
pTableMeta
->
vgId
;
vgId
=
pTableMeta
->
vgId
;
...
@@ -704,7 +705,7 @@ static char *doSerializeTableInfo(SQueryTableMsg* pQueryMsg, SSqlObj *pSql, char
...
@@ -704,7 +705,7 @@ static char *doSerializeTableInfo(SQueryTableMsg* pQueryMsg, SSqlObj *pSql, char
int32_t
numOfTables
=
(
int32_t
)
taosArrayGetSize
(
pTableIdList
->
itemList
);
int32_t
numOfTables
=
(
int32_t
)
taosArrayGetSize
(
pTableIdList
->
itemList
);
pQueryMsg
->
numOfTables
=
htonl
(
numOfTables
);
// set the number of tables
pQueryMsg
->
numOfTables
=
htonl
(
numOfTables
);
// set the number of tables
tscDebug
(
"
%p query on stable, vgId:%d, numOfTables:%d, vgIndex:%d, numOfVgroups:%d"
,
pSql
,
tscDebug
(
"
0x%"
PRIx64
" query on stable, vgId:%d, numOfTables:%d, vgIndex:%d, numOfVgroups:%d"
,
pSql
->
self
,
pTableIdList
->
vgInfo
.
vgId
,
numOfTables
,
index
,
numOfVgroups
);
pTableIdList
->
vgInfo
.
vgId
,
numOfTables
,
index
,
numOfVgroups
);
// serialize each table id info
// serialize each table id info
...
@@ -722,7 +723,7 @@ static char *doSerializeTableInfo(SQueryTableMsg* pQueryMsg, SSqlObj *pSql, char
...
@@ -722,7 +723,7 @@ static char *doSerializeTableInfo(SQueryTableMsg* pQueryMsg, SSqlObj *pSql, char
char
n
[
TSDB_TABLE_FNAME_LEN
]
=
{
0
};
char
n
[
TSDB_TABLE_FNAME_LEN
]
=
{
0
};
tNameExtractFullName
(
&
pTableMetaInfo
->
name
,
n
);
tNameExtractFullName
(
&
pTableMetaInfo
->
name
,
n
);
tscDebug
(
"
%p vgId:%d, query on table:%s, tid:%d, uid:%"
PRIu64
,
pSql
,
htonl
(
pQueryMsg
->
head
.
vgId
),
n
,
pTableMeta
->
id
.
tid
,
pTableMeta
->
id
.
uid
);
tscDebug
(
"
0x%"
PRIx64
" vgId:%d, query on table:%s, tid:%d, uid:%"
PRIu64
,
pSql
->
self
,
htonl
(
pQueryMsg
->
head
.
vgId
),
n
,
pTableMeta
->
id
.
tid
,
pTableMeta
->
id
.
uid
);
return
pMsg
;
return
pMsg
;
}
}
...
@@ -1139,7 +1140,7 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
...
@@ -1139,7 +1140,7 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
int32_t
msgLen
=
(
int32_t
)(
pMsg
-
pCmd
->
payload
);
int32_t
msgLen
=
(
int32_t
)(
pMsg
-
pCmd
->
payload
);
tscDebug
(
"
%p msg built success, len:%d bytes"
,
pSql
,
msgLen
);
tscDebug
(
"
0x%"
PRIx64
" msg built success, len:%d bytes"
,
pSql
->
self
,
msgLen
);
pCmd
->
payloadLen
=
msgLen
;
pCmd
->
payloadLen
=
msgLen
;
pSql
->
cmd
.
msgType
=
TSDB_MSG_TYPE_QUERY
;
pSql
->
cmd
.
msgType
=
TSDB_MSG_TYPE_QUERY
;
...
@@ -1837,7 +1838,7 @@ int tscBuildMultiMeterMetaMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
...
@@ -1837,7 +1838,7 @@ int tscBuildMultiMeterMetaMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
assert(pCmd->payloadLen + minMsgSize() <= pCmd->allocSize);
assert(pCmd->payloadLen + minMsgSize() <= pCmd->allocSize);
tscDebug("
%p build load multi-metermeta msg completed, numOfTables:%d, msg size:%d", pSql
, pCmd->count,
tscDebug("
0x%"PRIx64" build load multi-metermeta msg completed, numOfTables:%d, msg size:%d", pSql->self
, pCmd->count,
pCmd->payloadLen);
pCmd->payloadLen);
return pCmd->payloadLen;
return pCmd->payloadLen;
...
@@ -2017,7 +2018,7 @@ int tscProcessTableMetaRsp(SSqlObj *pSql) {
...
@@ -2017,7 +2018,7 @@ int tscProcessTableMetaRsp(SSqlObj *pSql) {
}
}
}
}
tscDebug
(
"
%p recv table meta, uid:%"
PRIu64
", tid:%d, name:%s"
,
pSql
,
pTableMeta
->
id
.
uid
,
pTableMeta
->
id
.
tid
,
tscDebug
(
"
0x%"
PRIx64
" recv table meta, uid:%"
PRIu64
", tid:%d, name:%s"
,
pSql
->
self
,
pTableMeta
->
id
.
uid
,
pTableMeta
->
id
.
tid
,
tNameGetTableName
(
&
pTableMetaInfo
->
name
));
tNameGetTableName
(
&
pTableMetaInfo
->
name
));
free
(
pTableMeta
);
free
(
pTableMeta
);
...
@@ -2124,7 +2125,7 @@ int tscProcessMultiMeterMetaRsp(SSqlObj *pSql) {
...
@@ -2124,7 +2125,7 @@ int tscProcessMultiMeterMetaRsp(SSqlObj *pSql) {
pSql->res.code = TSDB_CODE_SUCCESS;
pSql->res.code = TSDB_CODE_SUCCESS;
pSql->res.numOfTotal = i;
pSql->res.numOfTotal = i;
tscDebug("
%p load multi-metermeta resp from complete num:%d", pSql
, pSql->res.numOfTotal);
tscDebug("
0x%"PRIx64" load multi-metermeta resp from complete num:%d", pSql->self
, pSql->res.numOfTotal);
#endif
#endif
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
...
@@ -2292,7 +2293,7 @@ static void createHbObj(STscObj* pObj) {
...
@@ -2292,7 +2293,7 @@ static void createHbObj(STscObj* pObj) {
pSql
->
signature
=
pSql
;
pSql
->
signature
=
pSql
;
registerSqlObj
(
pSql
);
registerSqlObj
(
pSql
);
tscDebug
(
"
%p HB is allocated, pObj:%p"
,
pSql
,
pObj
);
tscDebug
(
"
0x%"
PRIx64
" HB is allocated, pObj:%p"
,
pSql
->
self
,
pObj
);
pObj
->
hbrid
=
pSql
->
self
;
pObj
->
hbrid
=
pSql
->
self
;
}
}
...
@@ -2318,7 +2319,7 @@ int tscProcessConnectRsp(SSqlObj *pSql) {
...
@@ -2318,7 +2319,7 @@ int tscProcessConnectRsp(SSqlObj *pSql) {
tscUpdateMgmtEpSet
(
pSql
,
&
pConnect
->
epSet
);
tscUpdateMgmtEpSet
(
pSql
,
&
pConnect
->
epSet
);
for
(
int
i
=
0
;
i
<
pConnect
->
epSet
.
numOfEps
;
++
i
)
{
for
(
int
i
=
0
;
i
<
pConnect
->
epSet
.
numOfEps
;
++
i
)
{
tscDebug
(
"
%p epSet.fqdn[%d]: %s, pObj:%p"
,
pSql
,
i
,
pConnect
->
epSet
.
fqdn
[
i
],
pObj
);
tscDebug
(
"
0x%"
PRIx64
" epSet.fqdn[%d]: %s, pObj:%p"
,
pSql
->
self
,
i
,
pConnect
->
epSet
.
fqdn
[
i
],
pObj
);
}
}
}
}
...
@@ -2362,7 +2363,7 @@ int tscProcessDropTableRsp(SSqlObj *pSql) {
...
@@ -2362,7 +2363,7 @@ int tscProcessDropTableRsp(SSqlObj *pSql) {
tNameExtractFullName
(
&
pTableMetaInfo
->
name
,
name
);
tNameExtractFullName
(
&
pTableMetaInfo
->
name
,
name
);
taosHashRemove
(
tscTableMetaInfo
,
name
,
strnlen
(
name
,
TSDB_TABLE_FNAME_LEN
));
taosHashRemove
(
tscTableMetaInfo
,
name
,
strnlen
(
name
,
TSDB_TABLE_FNAME_LEN
));
tscDebug
(
"
%p remove table meta after drop table:%s, numOfRemain:%d"
,
pSql
,
name
,
(
int32_t
)
taosHashGetSize
(
tscTableMetaInfo
));
tscDebug
(
"
0x%"
PRIx64
" remove table meta after drop table:%s, numOfRemain:%d"
,
pSql
->
self
,
name
,
(
int32_t
)
taosHashGetSize
(
tscTableMetaInfo
));
pTableMetaInfo
->
pTableMeta
=
NULL
;
pTableMetaInfo
->
pTableMeta
=
NULL
;
return
0
;
return
0
;
...
@@ -2374,7 +2375,7 @@ int tscProcessAlterTableMsgRsp(SSqlObj *pSql) {
...
@@ -2374,7 +2375,7 @@ int tscProcessAlterTableMsgRsp(SSqlObj *pSql) {
char
name
[
TSDB_TABLE_FNAME_LEN
]
=
{
0
};
char
name
[
TSDB_TABLE_FNAME_LEN
]
=
{
0
};
tNameExtractFullName
(
&
pTableMetaInfo
->
name
,
name
);
tNameExtractFullName
(
&
pTableMetaInfo
->
name
,
name
);
tscDebug
(
"
%p remove tableMeta in hashMap after alter-table: %s"
,
pSql
,
name
);
tscDebug
(
"
0x%"
PRIx64
" remove tableMeta in hashMap after alter-table: %s"
,
pSql
->
self
,
name
);
bool
isSuperTable
=
UTIL_TABLE_IS_SUPER_TABLE
(
pTableMetaInfo
);
bool
isSuperTable
=
UTIL_TABLE_IS_SUPER_TABLE
(
pTableMetaInfo
);
taosHashRemove
(
tscTableMetaInfo
,
name
,
strnlen
(
name
,
TSDB_TABLE_FNAME_LEN
));
taosHashRemove
(
tscTableMetaInfo
,
name
,
strnlen
(
name
,
TSDB_TABLE_FNAME_LEN
));
...
@@ -2405,7 +2406,7 @@ int tscProcessQueryRsp(SSqlObj *pSql) {
...
@@ -2405,7 +2406,7 @@ int tscProcessQueryRsp(SSqlObj *pSql) {
pRes
->
data
=
NULL
;
pRes
->
data
=
NULL
;
tscResetForNextRetrieve
(
pRes
);
tscResetForNextRetrieve
(
pRes
);
tscDebug
(
"
%p query rsp received, qId:%"
PRIu64
,
pSql
,
pRes
->
qId
);
tscDebug
(
"
0x%"
PRIx64
" query rsp received, qId:0x%"
PRIx64
,
pSql
->
self
,
pRes
->
qId
);
return
0
;
return
0
;
}
}
...
@@ -2463,7 +2464,7 @@ int tscProcessRetrieveRspFromNode(SSqlObj *pSql) {
...
@@ -2463,7 +2464,7 @@ int tscProcessRetrieveRspFromNode(SSqlObj *pSql) {
}
}
pRes
->
row
=
0
;
pRes
->
row
=
0
;
tscDebug
(
"
%p numOfRows:%d, offset:%"
PRId64
", complete:%d, qId:%"
PRIu64
,
pSql
,
pRes
->
numOfRows
,
pRes
->
offset
,
tscDebug
(
"
0x%"
PRIx64
" numOfRows:%d, offset:%"
PRId64
", complete:%d, qId:0x%"
PRIx64
,
pSql
->
self
,
pRes
->
numOfRows
,
pRes
->
offset
,
pRes
->
completed
,
pRes
->
qId
);
pRes
->
completed
,
pRes
->
qId
);
return
0
;
return
0
;
...
@@ -2507,14 +2508,14 @@ static int32_t getTableMetaFromMnode(SSqlObj *pSql, STableMetaInfo *pTableMetaIn
...
@@ -2507,14 +2508,14 @@ static int32_t getTableMetaFromMnode(SSqlObj *pSql, STableMetaInfo *pTableMetaIn
}
}
}
}
tscDebug
(
"%p new pSqlObj:%p to get tableMeta, auto create:%d"
,
pSql
,
pNew
,
pNew
->
cmd
.
autoCreated
);
registerSqlObj
(
pNew
);
registerSqlObj
(
pNew
);
tscDebug
(
"0x%"
PRIx64
" new pSqlObj:0x%"
PRIx64
" to get tableMeta, auto create:%d"
,
pSql
->
self
,
pNew
->
self
,
pNew
->
cmd
.
autoCreated
);
pNew
->
fp
=
tscTableMetaCallBack
;
pNew
->
fp
=
tscTableMetaCallBack
;
pNew
->
param
=
(
void
*
)
pSql
->
self
;
pNew
->
param
=
(
void
*
)
pSql
->
self
;
tscDebug
(
"
%p metaRid from %"
PRId64
" to %"
PRId64
,
pSql
,
pSql
->
metaRid
,
pNew
->
self
);
tscDebug
(
"
0x%"
PRIx64
" metaRid from %"
PRId64
" to %"
PRId64
,
pSql
->
self
,
pSql
->
metaRid
,
pNew
->
self
);
pSql
->
metaRid
=
pNew
->
self
;
pSql
->
metaRid
=
pNew
->
self
;
...
@@ -2585,7 +2586,7 @@ int tscRenewTableMeta(SSqlObj *pSql, int32_t tableIndex) {
...
@@ -2585,7 +2586,7 @@ int tscRenewTableMeta(SSqlObj *pSql, int32_t tableIndex) {
STableMeta
*
pTableMeta
=
pTableMetaInfo
->
pTableMeta
;
STableMeta
*
pTableMeta
=
pTableMetaInfo
->
pTableMeta
;
if
(
pTableMeta
)
{
if
(
pTableMeta
)
{
tscDebug
(
"
%p update table meta:%s, old meta numOfTags:%d, numOfCols:%d, uid:%"
PRId64
,
pSql
,
name
,
tscDebug
(
"
0x%"
PRIx64
" update table meta:%s, old meta numOfTags:%d, numOfCols:%d, uid:%"
PRId64
,
pSql
->
self
,
name
,
tscGetNumOfTags
(
pTableMeta
),
tscGetNumOfColumns
(
pTableMeta
),
pTableMeta
->
id
.
uid
);
tscGetNumOfTags
(
pTableMeta
),
tscGetNumOfColumns
(
pTableMeta
),
pTableMeta
->
id
.
uid
);
}
}
...
@@ -2645,12 +2646,12 @@ int tscGetSTableVgroupInfo(SSqlObj *pSql, int32_t clauseIndex) {
...
@@ -2645,12 +2646,12 @@ int tscGetSTableVgroupInfo(SSqlObj *pSql, int32_t clauseIndex) {
pNewQueryInfo
->
numOfTables
=
pQueryInfo
->
numOfTables
;
pNewQueryInfo
->
numOfTables
=
pQueryInfo
->
numOfTables
;
registerSqlObj
(
pNew
);
registerSqlObj
(
pNew
);
tscDebug
(
"
%p svgroupRid from %"
PRId64
" to %"
PRId64
,
pSql
,
pSql
->
svgroupRid
,
pNew
->
self
);
tscDebug
(
"
0x%"
PRIx64
" svgroupRid from %"
PRId64
" to %"
PRId64
,
pSql
->
self
,
pSql
->
svgroupRid
,
pNew
->
self
);
pSql
->
svgroupRid
=
pNew
->
self
;
pSql
->
svgroupRid
=
pNew
->
self
;
tscDebug
(
"
%p new sqlObj:%p to get vgroupInfo, numOfTables:%d"
,
pSql
,
pNew
,
pNewQueryInfo
->
numOfTables
);
tscDebug
(
"
0x%"
PRIx64
" new sqlObj:%p to get vgroupInfo, numOfTables:%d"
,
pSql
->
self
,
pNew
,
pNewQueryInfo
->
numOfTables
);
pNew
->
fp
=
tscTableMetaCallBack
;
pNew
->
fp
=
tscTableMetaCallBack
;
pNew
->
param
=
(
void
*
)
pSql
->
self
;
pNew
->
param
=
(
void
*
)
pSql
->
self
;
...
...
src/client/src/tscSql.c
浏览文件 @
272b524b
...
@@ -292,7 +292,7 @@ void taos_close(TAOS *taos) {
...
@@ -292,7 +292,7 @@ void taos_close(TAOS *taos) {
pHb
->
rpcRid
=
-
1
;
pHb
->
rpcRid
=
-
1
;
}
}
tscDebug
(
"
%p HB is freed"
,
pHb
);
tscDebug
(
"
0x%"
PRIx64
" HB is freed"
,
pHb
->
self
);
taosReleaseRef
(
tscObjRef
,
pHb
->
self
);
taosReleaseRef
(
tscObjRef
,
pHb
->
self
);
#ifdef __APPLE__
#ifdef __APPLE__
// to satisfy later tsem_destroy in taos_free_result
// to satisfy later tsem_destroy in taos_free_result
...
@@ -576,7 +576,7 @@ static bool tscKillQueryInDnode(SSqlObj* pSql) {
...
@@ -576,7 +576,7 @@ static bool tscKillQueryInDnode(SSqlObj* pSql) {
cmd
==
TSDB_SQL_FETCH
))
{
cmd
==
TSDB_SQL_FETCH
))
{
pQueryInfo
->
type
=
TSDB_QUERY_TYPE_FREE_RESOURCE
;
pQueryInfo
->
type
=
TSDB_QUERY_TYPE_FREE_RESOURCE
;
pCmd
->
command
=
(
pCmd
->
command
>
TSDB_SQL_MGMT
)
?
TSDB_SQL_RETRIEVE
:
TSDB_SQL_FETCH
;
pCmd
->
command
=
(
pCmd
->
command
>
TSDB_SQL_MGMT
)
?
TSDB_SQL_RETRIEVE
:
TSDB_SQL_FETCH
;
tscDebug
(
"
%p send msg to dnode to free qhandle ASAP before free sqlObj, command:%s"
,
pSql
,
sqlCmd
[
pCmd
->
command
]);
tscDebug
(
"
0x%"
PRIx64
" send msg to dnode to free qhandle ASAP before free sqlObj, command:%s"
,
pSql
->
self
,
sqlCmd
[
pCmd
->
command
]);
tscProcessSql
(
pSql
);
tscProcessSql
(
pSql
);
return
false
;
return
false
;
...
@@ -594,7 +594,7 @@ void taos_free_result(TAOS_RES *res) {
...
@@ -594,7 +594,7 @@ void taos_free_result(TAOS_RES *res) {
bool
freeNow
=
tscKillQueryInDnode
(
pSql
);
bool
freeNow
=
tscKillQueryInDnode
(
pSql
);
if
(
freeNow
)
{
if
(
freeNow
)
{
tscDebug
(
"
%p free sqlObj in cache"
,
pSql
);
tscDebug
(
"
0x%"
PRIx64
" free sqlObj in cache"
,
pSql
->
self
);
taosReleaseRef
(
tscObjRef
,
pSql
->
self
);
taosReleaseRef
(
tscObjRef
,
pSql
->
self
);
}
}
}
}
...
@@ -708,7 +708,7 @@ static void tscKillSTableQuery(SSqlObj *pSql) {
...
@@ -708,7 +708,7 @@ static void tscKillSTableQuery(SSqlObj *pSql) {
tscUnlockByThread
(
&
pSql
->
squeryLock
);
tscUnlockByThread
(
&
pSql
->
squeryLock
);
tscDebug
(
"
%p super table query cancelled"
,
pSql
);
tscDebug
(
"
0x%"
PRIx64
" super table query cancelled"
,
pSql
->
self
);
}
}
void
taos_stop_query
(
TAOS_RES
*
res
)
{
void
taos_stop_query
(
TAOS_RES
*
res
)
{
...
@@ -717,7 +717,7 @@ void taos_stop_query(TAOS_RES *res) {
...
@@ -717,7 +717,7 @@ void taos_stop_query(TAOS_RES *res) {
return
;
return
;
}
}
tscDebug
(
"
%p start to cancel query"
,
res
);
tscDebug
(
"
0x%"
PRIx64
" start to cancel query"
,
pSql
->
self
);
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
// set the error code for master pSqlObj firstly
// set the error code for master pSqlObj firstly
...
@@ -744,7 +744,7 @@ void taos_stop_query(TAOS_RES *res) {
...
@@ -744,7 +744,7 @@ void taos_stop_query(TAOS_RES *res) {
}
}
}
}
tscDebug
(
"
%p query is cancelled"
,
res
);
tscDebug
(
"
0x%"
PRIx64
" query is cancelled"
,
pSql
->
self
);
}
}
bool
taos_is_null
(
TAOS_RES
*
res
,
int32_t
row
,
int32_t
col
)
{
bool
taos_is_null
(
TAOS_RES
*
res
,
int32_t
row
,
int32_t
col
)
{
...
@@ -877,7 +877,7 @@ int taos_validate_sql(TAOS *taos, const char *sql) {
...
@@ -877,7 +877,7 @@ int taos_validate_sql(TAOS *taos, const char *sql) {
pRes
->
numOfClauseTotal
=
0
;
pRes
->
numOfClauseTotal
=
0
;
tscDebug
(
"
%p Valid SQL: %s pObj:%p"
,
pSql
,
sql
,
pObj
);
tscDebug
(
"
0x%"
PRIx64
" Valid SQL: %s pObj:%p"
,
pSql
->
self
,
sql
,
pObj
);
int32_t
sqlLen
=
(
int32_t
)
strlen
(
sql
);
int32_t
sqlLen
=
(
int32_t
)
strlen
(
sql
);
if
(
sqlLen
>
tsMaxSQLStringLen
)
{
if
(
sqlLen
>
tsMaxSQLStringLen
)
{
...
@@ -889,7 +889,7 @@ int taos_validate_sql(TAOS *taos, const char *sql) {
...
@@ -889,7 +889,7 @@ int taos_validate_sql(TAOS *taos, const char *sql) {
pSql
->
sqlstr
=
realloc
(
pSql
->
sqlstr
,
sqlLen
+
1
);
pSql
->
sqlstr
=
realloc
(
pSql
->
sqlstr
,
sqlLen
+
1
);
if
(
pSql
->
sqlstr
==
NULL
)
{
if
(
pSql
->
sqlstr
==
NULL
)
{
tscError
(
"%p failed to malloc sql string buffer"
,
pSql
);
tscError
(
"%p failed to malloc sql string buffer"
,
pSql
);
tscDebug
(
"
%p Valid SQL result:%d, %s pObj:%p"
,
pSql
,
pRes
->
code
,
taos_errstr
(
pSql
),
pObj
);
tscDebug
(
"
0x%"
PRIx64
" Valid SQL result:%d, %s pObj:%p"
,
pSql
->
self
,
pRes
->
code
,
taos_errstr
(
pSql
),
pObj
);
tfree
(
pSql
);
tfree
(
pSql
);
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
}
}
...
@@ -914,7 +914,7 @@ int taos_validate_sql(TAOS *taos, const char *sql) {
...
@@ -914,7 +914,7 @@ int taos_validate_sql(TAOS *taos, const char *sql) {
}
}
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
tscDebug
(
"
%p Valid SQL result:%d, %s pObj:%p"
,
pSql
,
code
,
taos_errstr
(
pSql
),
pObj
);
tscDebug
(
"
0x%"
PRIx64
" Valid SQL result:%d, %s pObj:%p"
,
pSql
->
self
,
code
,
taos_errstr
(
pSql
),
pObj
);
}
}
taos_free_result
(
pSql
);
taos_free_result
(
pSql
);
...
@@ -1027,7 +1027,7 @@ int taos_load_table_info(TAOS *taos, const char *tableNameList) {
...
@@ -1027,7 +1027,7 @@ int taos_load_table_info(TAOS *taos, const char *tableNameList) {
pRes
->
numOfClauseTotal
=
0
;
pRes
->
numOfClauseTotal
=
0
;
assert
(
pSql
->
fp
==
NULL
);
assert
(
pSql
->
fp
==
NULL
);
tscDebug
(
"
%p tableNameList: %s pObj:%p"
,
pSql
,
tableNameList
,
pObj
);
tscDebug
(
"
0x%"
PRIx64
" tableNameList: %s pObj:%p"
,
pSql
->
self
,
tableNameList
,
pObj
);
int32_t
tblListLen
=
(
int32_t
)
strlen
(
tableNameList
);
int32_t
tblListLen
=
(
int32_t
)
strlen
(
tableNameList
);
if
(
tblListLen
>
MAX_TABLE_NAME_LENGTH
)
{
if
(
tblListLen
>
MAX_TABLE_NAME_LENGTH
)
{
...
@@ -1061,7 +1061,7 @@ int taos_load_table_info(TAOS *taos, const char *tableNameList) {
...
@@ -1061,7 +1061,7 @@ int taos_load_table_info(TAOS *taos, const char *tableNameList) {
tscDoQuery
(
pSql
);
tscDoQuery
(
pSql
);
tscDebug
(
"
%p load multi table meta result:%d %s pObj:%p"
,
pSql
,
pRes
->
code
,
taos_errstr
(
pSql
),
pObj
);
tscDebug
(
"
0x%"
PRIx64
" load multi table meta result:%d %s pObj:%p"
,
pSql
->
self
,
pRes
->
code
,
taos_errstr
(
pSql
),
pObj
);
if
((
code
=
pRes
->
code
)
!=
TSDB_CODE_SUCCESS
)
{
if
((
code
=
pRes
->
code
)
!=
TSDB_CODE_SUCCESS
)
{
tscFreeSqlObj
(
pSql
);
tscFreeSqlObj
(
pSql
);
}
}
...
...
src/client/src/tscStream.c
浏览文件 @
272b524b
...
@@ -70,7 +70,7 @@ static void setRetryInfo(SSqlStream* pStream, int32_t code) {
...
@@ -70,7 +70,7 @@ static void setRetryInfo(SSqlStream* pStream, int32_t code) {
pSql
->
res
.
code
=
code
;
pSql
->
res
.
code
=
code
;
int64_t
retryDelayTime
=
tscGetRetryDelayTime
(
pStream
,
pStream
->
interval
.
sliding
,
pStream
->
precision
);
int64_t
retryDelayTime
=
tscGetRetryDelayTime
(
pStream
,
pStream
->
interval
.
sliding
,
pStream
->
precision
);
tscDebug
(
"
%p stream:%p, get table Meta failed, retry in %"
PRId64
"ms"
,
pSql
,
pStream
,
retryDelayTime
);
tscDebug
(
"
0x%"
PRIx64
" stream:%p, get table Meta failed, retry in %"
PRId64
"ms"
,
pSql
->
self
,
pStream
,
retryDelayTime
);
tscSetRetryTimer
(
pStream
,
pSql
,
retryDelayTime
);
tscSetRetryTimer
(
pStream
,
pSql
,
retryDelayTime
);
}
}
...
@@ -101,11 +101,19 @@ static void doLaunchQuery(void* param, TAOS_RES* tres, int32_t code) {
...
@@ -101,11 +101,19 @@ static void doLaunchQuery(void* param, TAOS_RES* tres, int32_t code) {
return
;
return
;
}
}
if
(
UTIL_TABLE_IS_SUPER_TABLE
(
pTableMetaInfo
)
&&
(
pTableMetaInfo
->
pVgroupTables
==
NULL
)
&&
(
pTableMetaInfo
->
vgroupList
==
NULL
||
pTableMetaInfo
->
vgroupList
->
numOfVgroups
<=
0
))
{
tscDebug
(
"%p empty vgroup list"
,
pSql
);
pTableMetaInfo
->
vgroupList
=
tscVgroupInfoClear
(
pTableMetaInfo
->
vgroupList
);
code
=
TSDB_CODE_TSC_APP_ERROR
;
}
// failed to get table Meta or vgroup list, retry in 10sec.
// failed to get table Meta or vgroup list, retry in 10sec.
if
(
code
==
TSDB_CODE_SUCCESS
)
{
if
(
code
==
TSDB_CODE_SUCCESS
)
{
tscTansformFuncForSTableQuery
(
pQueryInfo
);
tscTansformFuncForSTableQuery
(
pQueryInfo
);
tscDebug
(
"
%p stream:%p, start stream query on:%s"
,
pSql
,
pStream
,
tNameGetTableName
(
&
pTableMetaInfo
->
name
));
tscDebug
(
"
0x%"
PRIx64
" stream:%p, start stream query on:%s"
,
pSql
->
self
,
pStream
,
tNameGetTableName
(
&
pTableMetaInfo
->
name
));
pQueryInfo
->
command
=
TSDB_SQL_SELECT
;
pSql
->
fp
=
tscProcessStreamQueryCallback
;
pSql
->
fp
=
tscProcessStreamQueryCallback
;
pSql
->
fetchFp
=
tscProcessStreamQueryCallback
;
pSql
->
fetchFp
=
tscProcessStreamQueryCallback
;
tscDoQuery
(
pSql
);
tscDoQuery
(
pSql
);
...
@@ -131,7 +139,7 @@ static void tscProcessStreamTimer(void *handle, void *tmrId) {
...
@@ -131,7 +139,7 @@ static void tscProcessStreamTimer(void *handle, void *tmrId) {
pStream
->
numOfRes
=
0
;
// reset the numOfRes.
pStream
->
numOfRes
=
0
;
// reset the numOfRes.
SSqlObj
*
pSql
=
pStream
->
pSql
;
SSqlObj
*
pSql
=
pStream
->
pSql
;
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
&
pSql
->
cmd
,
0
);
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
&
pSql
->
cmd
,
0
);
tscDebug
(
"
%p add into timer"
,
pSql
);
tscDebug
(
"
0x%"
PRIx64
" add into timer"
,
pSql
->
self
);
if
(
pStream
->
isProject
)
{
if
(
pStream
->
isProject
)
{
/*
/*
...
@@ -237,7 +245,7 @@ static void tscStreamFillTimeGap(SSqlStream* pStream, TSKEY ts) {
...
@@ -237,7 +245,7 @@ static void tscStreamFillTimeGap(SSqlStream* pStream, TSKEY ts) {
}
}
if (rowNum > 0) {
if (rowNum > 0) {
tscDebug("
%p
stream:%p %d rows padded", pSql, pStream, rowNum);
tscDebug("
0x%"PRIx64"
stream:%p %d rows padded", pSql, pStream, rowNum);
}
}
pRes->numOfRows = 0;
pRes->numOfRows = 0;
...
@@ -263,7 +271,7 @@ static void tscProcessStreamRetrieveResult(void *param, TAOS_RES *res, int numOf
...
@@ -263,7 +271,7 @@ static void tscProcessStreamRetrieveResult(void *param, TAOS_RES *res, int numOf
for
(
int32_t
i
=
0
;
i
<
numOfRows
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfRows
;
++
i
)
{
TAOS_ROW
row
=
taos_fetch_row
(
res
);
TAOS_ROW
row
=
taos_fetch_row
(
res
);
if
(
row
!=
NULL
)
{
if
(
row
!=
NULL
)
{
tscDebug
(
"
%p stream:%p fetch result"
,
pSql
,
pStream
);
tscDebug
(
"
0x%"
PRIx64
" stream:%p fetch result"
,
pSql
->
self
,
pStream
);
tscStreamFillTimeGap
(
pStream
,
*
(
TSKEY
*
)
row
[
0
]);
tscStreamFillTimeGap
(
pStream
,
*
(
TSKEY
*
)
row
[
0
]);
pStream
->
stime
=
*
(
TSKEY
*
)
row
[
0
];
pStream
->
stime
=
*
(
TSKEY
*
)
row
[
0
];
// user callback function
// user callback function
...
@@ -293,7 +301,7 @@ static void tscProcessStreamRetrieveResult(void *param, TAOS_RES *res, int numOf
...
@@ -293,7 +301,7 @@ static void tscProcessStreamRetrieveResult(void *param, TAOS_RES *res, int numOf
pStream
->
stime
+=
1
;
pStream
->
stime
+=
1
;
}
}
tscDebug
(
"
%p stream:%p, query on:%s, fetch result completed, fetched rows:%"
PRId64
,
pSql
,
pStream
,
tNameGetTableName
(
&
pTableMetaInfo
->
name
),
tscDebug
(
"
0x%"
PRIx64
" stream:%p, query on:%s, fetch result completed, fetched rows:%"
PRId64
,
pSql
->
self
,
pStream
,
tNameGetTableName
(
&
pTableMetaInfo
->
name
),
pStream
->
numOfRes
);
pStream
->
numOfRes
);
tfree
(
pTableMetaInfo
->
pTableMeta
);
tfree
(
pTableMetaInfo
->
pTableMeta
);
...
@@ -318,8 +326,8 @@ static void tscSetRetryTimer(SSqlStream *pStream, SSqlObj *pSql, int64_t timer)
...
@@ -318,8 +326,8 @@ static void tscSetRetryTimer(SSqlStream *pStream, SSqlObj *pSql, int64_t timer)
/*
/*
* current time window will be closed, since it too early to exceed the maxRetentWindow value
* current time window will be closed, since it too early to exceed the maxRetentWindow value
*/
*/
tscDebug
(
"
%p
stream:%p, etime:%"
PRId64
" is too old, exceeds the max retention time window:%"
PRId64
", stop the stream"
,
tscDebug
(
"
0x%"
PRIx64
"
stream:%p, etime:%"
PRId64
" is too old, exceeds the max retention time window:%"
PRId64
", stop the stream"
,
pStream
->
pSql
,
pStream
,
pStream
->
stime
,
pStream
->
etime
);
pStream
->
pSql
->
self
,
pStream
,
pStream
->
stime
,
pStream
->
etime
);
// TODO : How to terminate stream here
// TODO : How to terminate stream here
if
(
pStream
->
callback
)
{
if
(
pStream
->
callback
)
{
// Callback function from upper level
// Callback function from upper level
...
@@ -329,10 +337,10 @@ static void tscSetRetryTimer(SSqlStream *pStream, SSqlObj *pSql, int64_t timer)
...
@@ -329,10 +337,10 @@ static void tscSetRetryTimer(SSqlStream *pStream, SSqlObj *pSql, int64_t timer)
return
;
return
;
}
}
tscDebug
(
"
%p stream:%p, next start at %"
PRId64
", in %"
PRId64
"ms. delay:%"
PRId64
"ms qrange %"
PRId64
"-%"
PRId64
,
pStream
->
pSql
,
pStream
,
tscDebug
(
"
0x%"
PRIx64
" stream:%p, next start at %"
PRId64
", in %"
PRId64
"ms. delay:%"
PRId64
"ms qrange %"
PRId64
"-%"
PRId64
,
pStream
->
pSql
->
self
,
pStream
,
now
+
timer
,
timer
,
delay
,
pStream
->
stime
,
etime
);
now
+
timer
,
timer
,
delay
,
pStream
->
stime
,
etime
);
}
else
{
}
else
{
tscDebug
(
"
%p stream:%p, next start at %"
PRId64
", in %"
PRId64
"ms. delay:%"
PRId64
"ms qrange %"
PRId64
"-%"
PRId64
,
pStream
->
pSql
,
pStream
,
tscDebug
(
"
0x%"
PRIx64
" stream:%p, next start at %"
PRId64
", in %"
PRId64
"ms. delay:%"
PRId64
"ms qrange %"
PRId64
"-%"
PRId64
,
pStream
->
pSql
->
self
,
pStream
,
pStream
->
stime
,
timer
,
delay
,
pStream
->
stime
-
pStream
->
interval
.
interval
,
pStream
->
stime
-
1
);
pStream
->
stime
,
timer
,
delay
,
pStream
->
stime
-
pStream
->
interval
.
interval
,
pStream
->
stime
-
1
);
}
}
...
@@ -378,8 +386,8 @@ static void tscSetNextLaunchTimer(SSqlStream *pStream, SSqlObj *pSql) {
...
@@ -378,8 +386,8 @@ static void tscSetNextLaunchTimer(SSqlStream *pStream, SSqlObj *pSql) {
*/
*/
timer
=
pStream
->
interval
.
sliding
;
timer
=
pStream
->
interval
.
sliding
;
if
(
pStream
->
stime
>
pStream
->
etime
)
{
if
(
pStream
->
stime
>
pStream
->
etime
)
{
tscDebug
(
"
%p stream:%p, stime:%"
PRId64
" is larger than end time: %"
PRId64
", stop the stream"
,
pStream
->
pSql
,
pStream
,
tscDebug
(
"
0x%"
PRIx64
" stream:%p, stime:%"
PRId64
" is larger than end time: %"
PRId64
", stop the stream"
,
pStream
->
stime
,
pStream
->
etime
);
pStream
->
pSql
->
self
,
pStream
,
pStream
->
stime
,
pStream
->
etime
);
// TODO : How to terminate stream here
// TODO : How to terminate stream here
if
(
pStream
->
callback
)
{
if
(
pStream
->
callback
)
{
// Callback function from upper level
// Callback function from upper level
...
@@ -392,7 +400,7 @@ static void tscSetNextLaunchTimer(SSqlStream *pStream, SSqlObj *pSql) {
...
@@ -392,7 +400,7 @@ static void tscSetNextLaunchTimer(SSqlStream *pStream, SSqlObj *pSql) {
int64_t
stime
=
taosTimeTruncate
(
pStream
->
stime
-
1
,
&
pStream
->
interval
,
pStream
->
precision
);
int64_t
stime
=
taosTimeTruncate
(
pStream
->
stime
-
1
,
&
pStream
->
interval
,
pStream
->
precision
);
//int64_t stime = taosGetIntervalStartTimestamp(pStream->stime - 1, pStream->interval.interval, pStream->interval.interval, pStream->interval.intervalUnit, pStream->precision);
//int64_t stime = taosGetIntervalStartTimestamp(pStream->stime - 1, pStream->interval.interval, pStream->interval.interval, pStream->interval.intervalUnit, pStream->precision);
if
(
stime
>=
pStream
->
etime
)
{
if
(
stime
>=
pStream
->
etime
)
{
tscDebug
(
"
%p stream:%p, stime:%"
PRId64
" is larger than end time: %"
PRId64
", stop the stream"
,
pStream
->
pSql
,
pStream
,
tscDebug
(
"
0x%"
PRIx64
" stream:%p, stime:%"
PRId64
" is larger than end time: %"
PRId64
", stop the stream"
,
pStream
->
pSql
->
self
,
pStream
,
pStream
->
stime
,
pStream
->
etime
);
pStream
->
stime
,
pStream
->
etime
);
// TODO : How to terminate stream here
// TODO : How to terminate stream here
if
(
pStream
->
callback
)
{
if
(
pStream
->
callback
)
{
...
@@ -402,10 +410,12 @@ static void tscSetNextLaunchTimer(SSqlStream *pStream, SSqlObj *pSql) {
...
@@ -402,10 +410,12 @@ static void tscSetNextLaunchTimer(SSqlStream *pStream, SSqlObj *pSql) {
taos_close_stream
(
pStream
);
taos_close_stream
(
pStream
);
return
;
return
;
}
}
timer
=
pStream
->
stime
-
taosGetTimestamp
(
pStream
->
precision
);
if
(
pStream
->
stime
>
0
)
{
if
(
timer
<
0
)
{
timer
=
pStream
->
stime
-
taosGetTimestamp
(
pStream
->
precision
);
timer
=
0
;
if
(
timer
<
0
)
{
timer
=
0
;
}
}
}
}
}
...
@@ -479,17 +489,20 @@ static int64_t tscGetStreamStartTimestamp(SSqlObj *pSql, SSqlStream *pStream, in
...
@@ -479,17 +489,20 @@ static int64_t tscGetStreamStartTimestamp(SSqlObj *pSql, SSqlStream *pStream, in
pStream
->
interval
.
interval
=
tsProjectExecInterval
;
pStream
->
interval
.
interval
=
tsProjectExecInterval
;
pStream
->
interval
.
sliding
=
tsProjectExecInterval
;
pStream
->
interval
.
sliding
=
tsProjectExecInterval
;
if
(
stime
!=
0
)
{
// first projection start from the latest event timestamp
if
(
stime
!=
INT64_MIN
)
{
// first projection start from the latest event timestamp
assert
(
stime
>=
pQueryInfo
->
window
.
skey
);
assert
(
stime
>=
pQueryInfo
->
window
.
skey
);
stime
+=
1
;
// exclude the last records from table
stime
+=
1
;
// exclude the last records from table
}
else
{
}
else
{
stime
=
pQueryInfo
->
window
.
skey
;
stime
=
pQueryInfo
->
window
.
skey
;
}
}
}
else
{
// timewindow based aggregation stream
}
else
{
// timewindow based aggregation stream
if
(
stime
==
0
)
{
// no data in meter till now
if
(
stime
==
INT64_MIN
)
{
// no data in meter till now
if
(
pQueryInfo
->
window
.
skey
!=
INT64_MIN
)
{
if
(
pQueryInfo
->
window
.
skey
!=
INT64_MIN
)
{
stime
=
pQueryInfo
->
window
.
skey
;
stime
=
pQueryInfo
->
window
.
skey
;
}
else
{
return
stime
;
}
}
stime
=
taosTimeTruncate
(
stime
,
&
pStream
->
interval
,
pStream
->
precision
);
stime
=
taosTimeTruncate
(
stime
,
&
pStream
->
interval
,
pStream
->
precision
);
}
else
{
}
else
{
int64_t
newStime
=
taosTimeTruncate
(
stime
,
&
pStream
->
interval
,
pStream
->
precision
);
int64_t
newStime
=
taosTimeTruncate
(
stime
,
&
pStream
->
interval
,
pStream
->
precision
);
...
@@ -558,7 +571,7 @@ static void tscCreateStream(void *param, TAOS_RES *res, int code) {
...
@@ -558,7 +571,7 @@ static void tscCreateStream(void *param, TAOS_RES *res, int code) {
taosTmrReset
(
tscProcessStreamTimer
,
(
int32_t
)
starttime
,
pStream
,
tscTmr
,
&
pStream
->
pTimer
);
taosTmrReset
(
tscProcessStreamTimer
,
(
int32_t
)
starttime
,
pStream
,
tscTmr
,
&
pStream
->
pTimer
);
tscDebug
(
"
%p stream:%p is opened, query on:%s, interval:%"
PRId64
", sliding:%"
PRId64
", first launched in:%"
PRId64
", sql:%s"
,
pSql
,
tscDebug
(
"
0x%"
PRIx64
" stream:%p is opened, query on:%s, interval:%"
PRId64
", sliding:%"
PRId64
", first launched in:%"
PRId64
", sql:%s"
,
pSql
->
self
,
pStream
,
tNameGetTableName
(
&
pTableMetaInfo
->
name
),
pStream
->
interval
.
interval
,
pStream
->
interval
.
sliding
,
starttime
,
pSql
->
sqlstr
);
pStream
,
tNameGetTableName
(
&
pTableMetaInfo
->
name
),
pStream
->
interval
.
interval
,
pStream
->
interval
.
sliding
,
starttime
,
pSql
->
sqlstr
);
}
}
...
@@ -619,7 +632,7 @@ TAOS_STREAM *taos_open_stream(TAOS *taos, const char *sqlstr, void (*fp)(void *p
...
@@ -619,7 +632,7 @@ TAOS_STREAM *taos_open_stream(TAOS *taos, const char *sqlstr, void (*fp)(void *p
if
(
code
==
TSDB_CODE_SUCCESS
)
{
if
(
code
==
TSDB_CODE_SUCCESS
)
{
tscCreateStream
(
pStream
,
pSql
,
code
);
tscCreateStream
(
pStream
,
pSql
,
code
);
}
else
if
(
code
!=
TSDB_CODE_TSC_ACTION_IN_PROGRESS
)
{
}
else
if
(
code
!=
TSDB_CODE_TSC_ACTION_IN_PROGRESS
)
{
tscError
(
"%p open stream failed, sql:%s, code:%s"
,
pSql
,
sqlstr
,
tstrerror
(
pRes
->
code
));
tscError
(
"%p open stream failed, sql:%s, code:%s"
,
pSql
,
sqlstr
,
tstrerror
(
code
));
taosReleaseRef
(
tscObjRef
,
pSql
->
self
);
taosReleaseRef
(
tscObjRef
,
pSql
->
self
);
free
(
pStream
);
free
(
pStream
);
return
NULL
;
return
NULL
;
...
@@ -645,7 +658,7 @@ void taos_close_stream(TAOS_STREAM *handle) {
...
@@ -645,7 +658,7 @@ void taos_close_stream(TAOS_STREAM *handle) {
taosTmrStopA
(
&
(
pStream
->
pTimer
));
taosTmrStopA
(
&
(
pStream
->
pTimer
));
tscDebug
(
"
%p stream:%p is closed"
,
pSql
,
pStream
);
tscDebug
(
"
0x%"
PRIx64
" stream:%p is closed"
,
pSql
->
self
,
pStream
);
// notify CQ to release the pStream object
// notify CQ to release the pStream object
pStream
->
fp
(
pStream
->
param
,
NULL
,
NULL
);
pStream
->
fp
(
pStream
->
param
,
NULL
,
NULL
);
pStream
->
pSql
=
NULL
;
pStream
->
pSql
=
NULL
;
...
...
src/client/src/tscSubquery.c
浏览文件 @
272b524b
此差异已折叠。
点击以展开。
src/client/src/tscUtil.c
浏览文件 @
272b524b
...
@@ -496,10 +496,10 @@ void tscFreeSubobj(SSqlObj* pSql) {
...
@@ -496,10 +496,10 @@ void tscFreeSubobj(SSqlObj* pSql) {
return
;
return
;
}
}
tscDebug
(
"
%p start to free sub SqlObj, numOfSub:%d"
,
pSql
,
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
)
{
tscDebug
(
"
%p free sub SqlObj:%p, index:%d"
,
pSql
,
pSql
->
pSubs
[
i
],
i
);
tscDebug
(
"
0x%"
PRIx64
" free sub SqlObj:%p, index:%d"
,
pSql
->
self
,
pSql
->
pSubs
[
i
],
i
);
taos_free_result
(
pSql
->
pSubs
[
i
]);
taos_free_result
(
pSql
->
pSubs
[
i
]);
pSql
->
pSubs
[
i
]
=
NULL
;
pSql
->
pSubs
[
i
]
=
NULL
;
}
}
...
@@ -530,7 +530,7 @@ void tscFreeRegisteredSqlObj(void *pSql) {
...
@@ -530,7 +530,7 @@ void tscFreeRegisteredSqlObj(void *pSql) {
int32_t
num
=
atomic_sub_fetch_32
(
&
pTscObj
->
numOfObj
,
1
);
int32_t
num
=
atomic_sub_fetch_32
(
&
pTscObj
->
numOfObj
,
1
);
int32_t
total
=
atomic_sub_fetch_32
(
&
tscNumOfObj
,
1
);
int32_t
total
=
atomic_sub_fetch_32
(
&
tscNumOfObj
,
1
);
tscDebug
(
"
%p free SqlObj, total in tscObj:%d, total:%d"
,
pSql
,
num
,
total
);
tscDebug
(
"
0x%"
PRIx64
" free SqlObj, total in tscObj:%d, total:%d"
,
p
->
self
,
num
,
total
);
tscFreeSqlObj
(
p
);
tscFreeSqlObj
(
p
);
taosReleaseRef
(
tscRefId
,
pTscObj
->
rid
);
taosReleaseRef
(
tscRefId
,
pTscObj
->
rid
);
...
@@ -553,7 +553,7 @@ void tscFreeSqlObj(SSqlObj* pSql) {
...
@@ -553,7 +553,7 @@ void tscFreeSqlObj(SSqlObj* pSql) {
return
;
return
;
}
}
tscDebug
(
"
%p start to free sqlObj"
,
pSql
);
tscDebug
(
"
0x%"
PRIx64
" start to free sqlObj"
,
pSql
->
self
);
pSql
->
res
.
code
=
TSDB_CODE_TSC_QUERY_CANCELLED
;
pSql
->
res
.
code
=
TSDB_CODE_TSC_QUERY_CANCELLED
;
...
@@ -945,7 +945,7 @@ int32_t tscMergeTableDataBlocks(SSqlObj* pSql, bool freeBlockMap) {
...
@@ -945,7 +945,7 @@ int32_t tscMergeTableDataBlocks(SSqlObj* pSql, bool freeBlockMap) {
tscSortRemoveDataBlockDupRows
(
pOneTableBlock
);
tscSortRemoveDataBlockDupRows
(
pOneTableBlock
);
char
*
ekey
=
(
char
*
)
pBlocks
->
data
+
pOneTableBlock
->
rowSize
*
(
pBlocks
->
numOfRows
-
1
);
char
*
ekey
=
(
char
*
)
pBlocks
->
data
+
pOneTableBlock
->
rowSize
*
(
pBlocks
->
numOfRows
-
1
);
tscDebug
(
"
%p name:%s, name:%d rows:%d sversion:%d skey:%"
PRId64
", ekey:%"
PRId64
,
pSql
,
tNameGetTableName
(
&
pOneTableBlock
->
tableName
),
tscDebug
(
"
0x%"
PRIx64
" name:%s, name:%d rows:%d sversion:%d skey:%"
PRId64
", ekey:%"
PRId64
,
pSql
->
self
,
tNameGetTableName
(
&
pOneTableBlock
->
tableName
),
pBlocks
->
tid
,
pBlocks
->
numOfRows
,
pBlocks
->
sversion
,
GET_INT64_VAL
(
pBlocks
->
data
),
GET_INT64_VAL
(
ekey
));
pBlocks
->
tid
,
pBlocks
->
numOfRows
,
pBlocks
->
sversion
,
GET_INT64_VAL
(
pBlocks
->
data
),
GET_INT64_VAL
(
ekey
));
int32_t
len
=
pBlocks
->
numOfRows
*
(
pOneTableBlock
->
rowSize
+
expandSize
)
+
sizeof
(
STColumn
)
*
tscGetNumOfColumns
(
pOneTableBlock
->
pTableMeta
);
int32_t
len
=
pBlocks
->
numOfRows
*
(
pOneTableBlock
->
rowSize
+
expandSize
)
+
sizeof
(
STColumn
)
*
tscGetNumOfColumns
(
pOneTableBlock
->
pTableMeta
);
...
@@ -2109,7 +2109,7 @@ void registerSqlObj(SSqlObj* pSql) {
...
@@ -2109,7 +2109,7 @@ void registerSqlObj(SSqlObj* pSql) {
int32_t
num
=
atomic_add_fetch_32
(
&
pSql
->
pTscObj
->
numOfObj
,
1
);
int32_t
num
=
atomic_add_fetch_32
(
&
pSql
->
pTscObj
->
numOfObj
,
1
);
int32_t
total
=
atomic_add_fetch_32
(
&
tscNumOfObj
,
1
);
int32_t
total
=
atomic_add_fetch_32
(
&
tscNumOfObj
,
1
);
tscDebug
(
"
%p new SqlObj from %p, total in tscObj:%d, total:%d"
,
pSql
,
pSql
->
pTscObj
,
num
,
total
);
tscDebug
(
"
0x%"
PRIx64
" new SqlObj from %p, total in tscObj:%d, total:%d"
,
pSql
->
self
,
pSql
->
pTscObj
,
num
,
total
);
}
}
SSqlObj
*
createSimpleSubObj
(
SSqlObj
*
pSql
,
__async_cb_func_t
fp
,
void
*
param
,
int32_t
cmd
)
{
SSqlObj
*
createSimpleSubObj
(
SSqlObj
*
pSql
,
__async_cb_func_t
fp
,
void
*
param
,
int32_t
cmd
)
{
...
@@ -2376,7 +2376,7 @@ SSqlObj* createSubqueryObj(SSqlObj* pSql, int16_t tableIndex, __async_cb_func_t
...
@@ -2376,7 +2376,7 @@ SSqlObj* createSubqueryObj(SSqlObj* pSql, int16_t tableIndex, __async_cb_func_t
tscPrintSelectClause
(
pNew
,
0
);
tscPrintSelectClause
(
pNew
,
0
);
}
else
{
}
else
{
tscDebug
(
"
%p new sub insertion: %p, vnodeIdx:%d"
,
pSql
,
pNew
,
pTableMetaInfo
->
vgroupIndex
);
tscDebug
(
"
0x%"
PRIx64
" new sub insertion: %p, vnodeIdx:%d"
,
pSql
->
self
,
pNew
,
pTableMetaInfo
->
vgroupIndex
);
}
}
registerSqlObj
(
pNew
);
registerSqlObj
(
pNew
);
...
@@ -2627,7 +2627,7 @@ void tscTryQueryNextVnode(SSqlObj* pSql, __async_cb_func_t fp) {
...
@@ -2627,7 +2627,7 @@ void tscTryQueryNextVnode(SSqlObj* pSql, __async_cb_func_t fp) {
int32_t
totalVgroups
=
pTableMetaInfo
->
vgroupList
->
numOfVgroups
;
int32_t
totalVgroups
=
pTableMetaInfo
->
vgroupList
->
numOfVgroups
;
if
(
++
pTableMetaInfo
->
vgroupIndex
<
totalVgroups
)
{
if
(
++
pTableMetaInfo
->
vgroupIndex
<
totalVgroups
)
{
tscDebug
(
"
%p results from vgroup index:%d completed, try next:%d. total vgroups:%d. current numOfRes:%"
PRId64
,
pSql
,
tscDebug
(
"
0x%"
PRIx64
" results from vgroup index:%d completed, try next:%d. total vgroups:%d. current numOfRes:%"
PRId64
,
pSql
->
self
,
pTableMetaInfo
->
vgroupIndex
-
1
,
pTableMetaInfo
->
vgroupIndex
,
totalVgroups
,
pRes
->
numOfClauseTotal
);
pTableMetaInfo
->
vgroupIndex
-
1
,
pTableMetaInfo
->
vgroupIndex
,
totalVgroups
,
pRes
->
numOfClauseTotal
);
/*
/*
...
@@ -2646,8 +2646,8 @@ void tscTryQueryNextVnode(SSqlObj* pSql, __async_cb_func_t fp) {
...
@@ -2646,8 +2646,8 @@ void tscTryQueryNextVnode(SSqlObj* pSql, __async_cb_func_t fp) {
pQueryInfo
->
limit
.
offset
=
pRes
->
offset
;
pQueryInfo
->
limit
.
offset
=
pRes
->
offset
;
assert
((
pRes
->
offset
>=
0
&&
pRes
->
numOfRows
==
0
)
||
(
pRes
->
offset
==
0
&&
pRes
->
numOfRows
>=
0
));
assert
((
pRes
->
offset
>=
0
&&
pRes
->
numOfRows
==
0
)
||
(
pRes
->
offset
==
0
&&
pRes
->
numOfRows
>=
0
));
tscDebug
(
"
%p
new query to next vgroup, index:%d, limit:%"
PRId64
", offset:%"
PRId64
", glimit:%"
PRId64
,
tscDebug
(
"
0x%"
PRIx64
"
new query to next vgroup, index:%d, limit:%"
PRId64
", offset:%"
PRId64
", glimit:%"
PRId64
,
pSql
,
pTableMetaInfo
->
vgroupIndex
,
pQueryInfo
->
limit
.
limit
,
pQueryInfo
->
limit
.
offset
,
pQueryInfo
->
clauseLimit
);
pSql
->
self
,
pTableMetaInfo
->
vgroupIndex
,
pQueryInfo
->
limit
.
limit
,
pQueryInfo
->
limit
.
offset
,
pQueryInfo
->
clauseLimit
);
/*
/*
* For project query with super table join, the numOfSub is equalled to the number of all subqueries.
* For project query with super table join, the numOfSub is equalled to the number of all subqueries.
...
@@ -2664,7 +2664,7 @@ void tscTryQueryNextVnode(SSqlObj* pSql, __async_cb_func_t fp) {
...
@@ -2664,7 +2664,7 @@ void tscTryQueryNextVnode(SSqlObj* pSql, __async_cb_func_t fp) {
pSql
->
fp
=
fp
;
pSql
->
fp
=
fp
;
tscProcessSql
(
pSql
);
tscProcessSql
(
pSql
);
}
else
{
}
else
{
tscDebug
(
"
%p try all %d vnodes, query complete. current numOfRes:%"
PRId64
,
pSql
,
totalVgroups
,
pRes
->
numOfClauseTotal
);
tscDebug
(
"
0x%"
PRIx64
" try all %d vnodes, query complete. current numOfRes:%"
PRId64
,
pSql
->
self
,
totalVgroups
,
pRes
->
numOfClauseTotal
);
}
}
}
}
...
@@ -2690,7 +2690,7 @@ void tscTryQueryNextClause(SSqlObj* pSql, __async_cb_func_t fp) {
...
@@ -2690,7 +2690,7 @@ void tscTryQueryNextClause(SSqlObj* pSql, __async_cb_func_t fp) {
pSql
->
subState
.
numOfSub
=
0
;
pSql
->
subState
.
numOfSub
=
0
;
pSql
->
fp
=
fp
;
pSql
->
fp
=
fp
;
tscDebug
(
"
%p try data in the next subclause:%d, total subclause:%d"
,
pSql
,
pCmd
->
clauseIndex
,
pCmd
->
numOfClause
);
tscDebug
(
"
0x%"
PRIx64
" try data in the next subclause:%d, total subclause:%d"
,
pSql
->
self
,
pCmd
->
clauseIndex
,
pCmd
->
numOfClause
);
if
(
pCmd
->
command
>
TSDB_SQL_LOCAL
)
{
if
(
pCmd
->
command
>
TSDB_SQL_LOCAL
)
{
tscProcessLocalCmd
(
pSql
);
tscProcessLocalCmd
(
pSql
);
}
else
{
}
else
{
...
...
src/common/src/tvariant.c
浏览文件 @
272b524b
...
@@ -48,8 +48,12 @@ void tVariantCreate(tVariant *pVar, SStrToken *token) {
...
@@ -48,8 +48,12 @@ void tVariantCreate(tVariant *pVar, SStrToken *token) {
case
TSDB_DATA_TYPE_INT
:{
case
TSDB_DATA_TYPE_INT
:{
ret
=
tStrToInteger
(
token
->
z
,
token
->
type
,
token
->
n
,
&
pVar
->
i64
,
true
);
ret
=
tStrToInteger
(
token
->
z
,
token
->
type
,
token
->
n
,
&
pVar
->
i64
,
true
);
if
(
ret
!=
0
)
{
if
(
ret
!=
0
)
{
pVar
->
nType
=
-
1
;
// -1 means error type
// data overflow, try unsigned parse the input number
return
;
ret
=
tStrToInteger
(
token
->
z
,
token
->
type
,
token
->
n
,
&
pVar
->
i64
,
false
);
if
(
ret
!=
0
)
{
pVar
->
nType
=
-
1
;
// -1 means error type
return
;
}
}
}
break
;
break
;
...
@@ -525,6 +529,8 @@ static FORCE_INLINE int32_t convertToInteger(tVariant *pVariant, int64_t *result
...
@@ -525,6 +529,8 @@ static FORCE_INLINE int32_t convertToInteger(tVariant *pVariant, int64_t *result
}
}
bool
code
=
false
;
bool
code
=
false
;
uint64_t
ui
=
0
;
switch
(
type
)
{
switch
(
type
)
{
case
TSDB_DATA_TYPE_TINYINT
:
case
TSDB_DATA_TYPE_TINYINT
:
code
=
IS_VALID_TINYINT
(
*
result
);
break
;
code
=
IS_VALID_TINYINT
(
*
result
);
break
;
...
@@ -535,13 +541,17 @@ static FORCE_INLINE int32_t convertToInteger(tVariant *pVariant, int64_t *result
...
@@ -535,13 +541,17 @@ static FORCE_INLINE int32_t convertToInteger(tVariant *pVariant, int64_t *result
case
TSDB_DATA_TYPE_BIGINT
:
case
TSDB_DATA_TYPE_BIGINT
:
code
=
IS_VALID_BIGINT
(
*
result
);
break
;
code
=
IS_VALID_BIGINT
(
*
result
);
break
;
case
TSDB_DATA_TYPE_UTINYINT
:
case
TSDB_DATA_TYPE_UTINYINT
:
code
=
IS_VALID_UTINYINT
(
*
result
);
break
;
ui
=
*
result
;
code
=
IS_VALID_UTINYINT
(
ui
);
break
;
case
TSDB_DATA_TYPE_USMALLINT
:
case
TSDB_DATA_TYPE_USMALLINT
:
code
=
IS_VALID_USMALLINT
(
*
result
);
break
;
ui
=
*
result
;
code
=
IS_VALID_USMALLINT
(
ui
);
break
;
case
TSDB_DATA_TYPE_UINT
:
case
TSDB_DATA_TYPE_UINT
:
code
=
IS_VALID_UINT
(
*
result
);
break
;
ui
=
*
result
;
code
=
IS_VALID_UINT
(
ui
);
break
;
case
TSDB_DATA_TYPE_UBIGINT
:
case
TSDB_DATA_TYPE_UBIGINT
:
code
=
IS_VALID_UBIGINT
(
*
result
);
break
;
ui
=
*
result
;
code
=
IS_VALID_UBIGINT
(
ui
);
break
;
}
}
return
code
?
0
:-
1
;
return
code
?
0
:-
1
;
...
...
go
@
050667e5
比较
d9975135
...
050667e5
Subproject commit
d99751356e285696f57bc604304ffafd10287439
Subproject commit
050667e5b4d0eafa5387e4283e713559b421203f
src/connector/python/linux/python2/setup.py
浏览文件 @
272b524b
...
@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
...
@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
setuptools
.
setup
(
setuptools
.
setup
(
name
=
"taos"
,
name
=
"taos"
,
version
=
"2.0.
7
"
,
version
=
"2.0.
8
"
,
author
=
"Taosdata Inc."
,
author
=
"Taosdata Inc."
,
author_email
=
"support@taosdata.com"
,
author_email
=
"support@taosdata.com"
,
description
=
"TDengine python client package"
,
description
=
"TDengine python client package"
,
...
...
src/connector/python/linux/python2/taos/cursor.py
浏览文件 @
272b524b
...
@@ -42,7 +42,7 @@ class TDengineCursor(object):
...
@@ -42,7 +42,7 @@ class TDengineCursor(object):
def
__iter__
(
self
):
def
__iter__
(
self
):
return
self
return
self
def
__next__
(
self
):
def
next
(
self
):
if
self
.
_result
is
None
or
self
.
_fields
is
None
:
if
self
.
_result
is
None
or
self
.
_fields
is
None
:
raise
OperationalError
(
"Invalid use of fetch iterator"
)
raise
OperationalError
(
"Invalid use of fetch iterator"
)
...
...
src/cq/src/cqMain.c
浏览文件 @
272b524b
...
@@ -310,8 +310,23 @@ void *cqCreate(void *handle, uint64_t uid, int32_t sid, const char* dstTable, ch
...
@@ -310,8 +310,23 @@ void *cqCreate(void *handle, uint64_t uid, int32_t sid, const char* dstTable, ch
}
}
SCqContext
*
pContext
=
handle
;
SCqContext
*
pContext
=
handle
;
int64_t
rid
=
0
;
int64_t
rid
=
0
;
pthread_mutex_lock
(
&
pContext
->
mutex
);
SCqObj
*
pObj
=
pContext
->
pHead
;
while
(
pObj
)
{
if
(
pObj
->
uid
==
uid
)
{
rid
=
pObj
->
rid
;
pthread_mutex_unlock
(
&
pContext
->
mutex
);
return
(
void
*
)
rid
;
}
pObj
=
pObj
->
next
;
}
SCqObj
*
pObj
=
calloc
(
sizeof
(
SCqObj
),
1
);
pthread_mutex_unlock
(
&
pContext
->
mutex
);
pObj
=
calloc
(
sizeof
(
SCqObj
),
1
);
if
(
pObj
==
NULL
)
return
NULL
;
if
(
pObj
==
NULL
)
return
NULL
;
pObj
->
uid
=
uid
;
pObj
->
uid
=
uid
;
...
@@ -386,12 +401,15 @@ static void doCreateStream(void *param, TAOS_RES *result, int32_t code) {
...
@@ -386,12 +401,15 @@ static void doCreateStream(void *param, TAOS_RES *result, int32_t code) {
if
(
pObj
==
NULL
)
{
if
(
pObj
==
NULL
)
{
return
;
return
;
}
}
SCqContext
*
pContext
=
pObj
->
pContext
;
SCqContext
*
pContext
=
pObj
->
pContext
;
SSqlObj
*
pSql
=
(
SSqlObj
*
)
result
;
SSqlObj
*
pSql
=
(
SSqlObj
*
)
result
;
if
(
atomic_val_compare_exchange_ptr
(
&
(
pContext
->
dbConn
),
NULL
,
pSql
->
pTscObj
)
!=
NULL
)
{
if
(
code
==
TSDB_CODE_SUCCESS
)
{
taos_close
(
pSql
->
pTscObj
);
if
(
atomic_val_compare_exchange_ptr
(
&
(
pContext
->
dbConn
),
NULL
,
pSql
->
pTscObj
)
!=
NULL
)
{
taos_close
(
pSql
->
pTscObj
);
}
}
}
pthread_mutex_lock
(
&
pContext
->
mutex
);
pthread_mutex_lock
(
&
pContext
->
mutex
);
cqCreateStream
(
pContext
,
pObj
);
cqCreateStream
(
pContext
,
pObj
);
pthread_mutex_unlock
(
&
pContext
->
mutex
);
pthread_mutex_unlock
(
&
pContext
->
mutex
);
...
@@ -427,10 +445,11 @@ static void cqCreateStream(SCqContext *pContext, SCqObj *pObj) {
...
@@ -427,10 +445,11 @@ static void cqCreateStream(SCqContext *pContext, SCqObj *pObj) {
pObj
->
tmrId
=
taosTmrStart
(
cqProcessCreateTimer
,
1000
,
(
void
*
)
pObj
->
rid
,
pContext
->
tmrCtrl
);
pObj
->
tmrId
=
taosTmrStart
(
cqProcessCreateTimer
,
1000
,
(
void
*
)
pObj
->
rid
,
pContext
->
tmrCtrl
);
return
;
return
;
}
}
pObj
->
tmrId
=
0
;
pObj
->
tmrId
=
0
;
if
(
pObj
->
pStream
==
NULL
)
{
if
(
pObj
->
pStream
==
NULL
)
{
pObj
->
pStream
=
taos_open_stream
(
pContext
->
dbConn
,
pObj
->
sqlStr
,
cqProcessStreamRes
,
0
,
(
void
*
)
pObj
->
rid
,
NULL
);
pObj
->
pStream
=
taos_open_stream
(
pContext
->
dbConn
,
pObj
->
sqlStr
,
cqProcessStreamRes
,
INT64_MIN
,
(
void
*
)
pObj
->
rid
,
NULL
);
// TODO the pObj->pStream may be released if error happens
// TODO the pObj->pStream may be released if error happens
if
(
pObj
->
pStream
)
{
if
(
pObj
->
pStream
)
{
...
...
src/inc/ttokendef.h
浏览文件 @
272b524b
...
@@ -210,6 +210,8 @@
...
@@ -210,6 +210,8 @@
#define TK_SPACE 300
#define TK_SPACE 300
#define TK_COMMENT 301
#define TK_COMMENT 301
#define TK_ILLEGAL 302
#define TK_ILLEGAL 302
...
...
src/kit/shell/src/shellWindows.c
浏览文件 @
272b524b
...
@@ -199,15 +199,19 @@ void updateBuffer(Command *cmd) {
...
@@ -199,15 +199,19 @@ void updateBuffer(Command *cmd) {
}
}
int
isReadyGo
(
Command
*
cmd
)
{
int
isReadyGo
(
Command
*
cmd
)
{
char
total
[
MAX_COMMAND_SIZE
]
;
char
*
total
=
malloc
(
MAX_COMMAND_SIZE
)
;
memset
(
total
,
0
,
MAX_COMMAND_SIZE
);
memset
(
total
,
0
,
MAX_COMMAND_SIZE
);
sprintf
(
total
,
"%s%s"
,
cmd
->
buffer
,
cmd
->
command
);
sprintf
(
total
,
"%s%s"
,
cmd
->
buffer
,
cmd
->
command
);
char
*
reg_str
=
char
*
reg_str
=
"(^.*;
\\
s*$)|(^
\\
s*$)|(^
\\
s*exit
\\
s*$)|(^
\\
s*q
\\
s*$)|(^
\\
s*quit
\\
s*$)|(^"
"(^.*;
\\
s*$)|(^
\\
s*$)|(^
\\
s*exit
\\
s*$)|(^
\\
s*q
\\
s*$)|(^
\\
s*quit
\\
s*$)|(^"
"
\\
s*clear
\\
s*$)"
;
"
\\
s*clear
\\
s*$)"
;
if
(
regex_match
(
total
,
reg_str
,
REG_EXTENDED
|
REG_ICASE
))
return
1
;
if
(
regex_match
(
total
,
reg_str
,
REG_EXTENDED
|
REG_ICASE
))
{
free
(
total
);
return
1
;
}
free
(
total
);
return
0
;
return
0
;
}
}
...
...
src/kit/taosdemo/taosdemo.c
浏览文件 @
272b524b
此差异已折叠。
点击以展开。
src/os/inc/os.h
浏览文件 @
272b524b
...
@@ -32,6 +32,10 @@ extern "C" {
...
@@ -32,6 +32,10 @@ extern "C" {
#include "osArm32.h"
#include "osArm32.h"
#endif
#endif
#ifdef _TD_MIPS_64
#include "osMips64.h"
#endif
#ifdef _TD_LINUX_64
#ifdef _TD_LINUX_64
#include "osLinux64.h"
#include "osLinux64.h"
#endif
#endif
...
...
src/os/inc/osMips64.h
0 → 100644
浏览文件 @
272b524b
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TDENGINE_OS_MIPS64_H
#define TDENGINE_OS_MIPS64_H
#ifdef __cplusplus
extern
"C"
{
#endif
#include <stdio.h>
#include <stdlib.h>
#include <argp.h>
#include <arpa/inet.h>
#include <assert.h>
#include <ctype.h>
#include <dirent.h>
#include <endian.h>
#include <errno.h>
#include <float.h>
#include <ifaddrs.h>
#include <libgen.h>
#include <limits.h>
#include <locale.h>
#include <math.h>
#include <netdb.h>
#include <netinet/in.h>
#include <netinet/ip.h>
#include <netinet/tcp.h>
#include <netinet/udp.h>
#include <pthread.h>
#include <pwd.h>
#include <regex.h>
#include <semaphore.h>
#include <signal.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <string.h>
#include <strings.h>
#include <sys/epoll.h>
#include <sys/eventfd.h>
#include <sys/file.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <sys/sendfile.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/syscall.h>
#include <sys/statvfs.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/uio.h>
#include <sys/un.h>
#include <syslog.h>
#include <termios.h>
#include <unistd.h>
#include <wchar.h>
#include <wordexp.h>
#include <wctype.h>
#include <inttypes.h>
#include <fcntl.h>
#include <sys/utsname.h>
#include <sys/resource.h>
#include <error.h>
#include <linux/sysctl.h>
#include <math.h>
#include <poll.h>
#ifdef __cplusplus
}
#endif
#endif
src/os/src/darwin/darwinSysInfo.c
浏览文件 @
272b524b
...
@@ -217,7 +217,7 @@ void taosSetCoreDump() {}
...
@@ -217,7 +217,7 @@ void taosSetCoreDump() {}
int32_t
taosGetDiskSize
(
char
*
dataDir
,
SysDiskSize
*
diskSize
)
{
int32_t
taosGetDiskSize
(
char
*
dataDir
,
SysDiskSize
*
diskSize
)
{
struct
statvfs
info
;
struct
statvfs
info
;
if
(
statvfs
(
tsD
ataDir
,
&
info
))
{
if
(
statvfs
(
d
ataDir
,
&
info
))
{
uError
(
"failed to get disk size, dataDir:%s errno:%s"
,
tsDataDir
,
strerror
(
errno
));
uError
(
"failed to get disk size, dataDir:%s errno:%s"
,
tsDataDir
,
strerror
(
errno
));
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
return
-
1
;
return
-
1
;
...
...
src/os/src/detail/osSysinfo.c
浏览文件 @
272b524b
...
@@ -319,7 +319,7 @@ bool taosGetCpuUsage(float *sysCpuUsage, float *procCpuUsage) {
...
@@ -319,7 +319,7 @@ bool taosGetCpuUsage(float *sysCpuUsage, float *procCpuUsage) {
int32_t
taosGetDiskSize
(
char
*
dataDir
,
SysDiskSize
*
diskSize
)
{
int32_t
taosGetDiskSize
(
char
*
dataDir
,
SysDiskSize
*
diskSize
)
{
struct
statvfs
info
;
struct
statvfs
info
;
if
(
statvfs
(
tsD
ataDir
,
&
info
))
{
if
(
statvfs
(
d
ataDir
,
&
info
))
{
uError
(
"failed to get disk size, dataDir:%s errno:%s"
,
tsDataDir
,
strerror
(
errno
));
uError
(
"failed to get disk size, dataDir:%s errno:%s"
,
tsDataDir
,
strerror
(
errno
));
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
return
-
1
;
return
-
1
;
...
...
src/plugins/http/inc/httpContext.h
浏览文件 @
272b524b
...
@@ -25,7 +25,7 @@ const char *httpContextStateStr(HttpContextState state);
...
@@ -25,7 +25,7 @@ const char *httpContextStateStr(HttpContextState state);
HttpContext
*
httpCreateContext
(
SOCKET
fd
);
HttpContext
*
httpCreateContext
(
SOCKET
fd
);
bool
httpInitContext
(
HttpContext
*
pContext
);
bool
httpInitContext
(
HttpContext
*
pContext
);
HttpContext
*
httpGetContext
(
void
*
pContext
);
HttpContext
*
httpGetContext
(
void
*
pContext
);
void
httpReleaseContext
(
HttpContext
*
pContext
,
bool
clearRes
);
void
httpReleaseContext
(
HttpContext
*
pContext
/*, bool clearRes*/
);
void
httpCloseContextByServer
(
HttpContext
*
pContext
);
void
httpCloseContextByServer
(
HttpContext
*
pContext
);
void
httpCloseContextByApp
(
HttpContext
*
pContext
);
void
httpCloseContextByApp
(
HttpContext
*
pContext
);
void
httpNotifyContextClose
(
HttpContext
*
pContext
);
void
httpNotifyContextClose
(
HttpContext
*
pContext
);
...
...
src/plugins/http/src/httpContext.c
浏览文件 @
272b524b
...
@@ -146,20 +146,20 @@ HttpContext *httpGetContext(void *ptr) {
...
@@ -146,20 +146,20 @@ HttpContext *httpGetContext(void *ptr) {
return
NULL
;
return
NULL
;
}
}
void
httpReleaseContext
(
HttpContext
*
pContext
,
bool
clearRes
)
{
void
httpReleaseContext
(
HttpContext
*
pContext
/*, bool clearRes*/
)
{
int32_t
refCount
=
atomic_sub_fetch_32
(
&
pContext
->
refCount
,
1
);
int32_t
refCount
=
atomic_sub_fetch_32
(
&
pContext
->
refCount
,
1
);
if
(
refCount
<
0
)
{
if
(
refCount
<
0
)
{
httpError
(
"context:%p, is already released, refCount:%d"
,
pContext
,
refCount
);
httpError
(
"context:%p, is already released, refCount:%d"
,
pContext
,
refCount
);
return
;
return
;
}
}
/*
if (clearRes) {
if (clearRes) {
if (pContext->parser) {
if (pContext->parser) {
httpClearParser(pContext->parser);
httpClearParser(pContext->parser);
}
}
memset(&pContext->singleCmd, 0, sizeof(HttpSqlCmd));
memset(&pContext->singleCmd, 0, sizeof(HttpSqlCmd));
}
}
*/
HttpContext
**
ppContext
=
pContext
->
ppContext
;
HttpContext
**
ppContext
=
pContext
->
ppContext
;
httpTrace
(
"context:%p, is released, data:%p refCount:%d"
,
pContext
,
ppContext
,
refCount
);
httpTrace
(
"context:%p, is released, data:%p refCount:%d"
,
pContext
,
ppContext
,
refCount
);
...
@@ -217,7 +217,7 @@ void httpCloseContextByApp(HttpContext *pContext) {
...
@@ -217,7 +217,7 @@ void httpCloseContextByApp(HttpContext *pContext) {
httpContextStateStr
(
pContext
->
state
),
pContext
->
state
);
httpContextStateStr
(
pContext
->
state
),
pContext
->
state
);
}
}
httpReleaseContext
(
pContext
,
true
);
httpReleaseContext
(
pContext
/*, true*/
);
}
}
void
httpCloseContextByServer
(
HttpContext
*
pContext
)
{
void
httpCloseContextByServer
(
HttpContext
*
pContext
)
{
...
@@ -235,5 +235,5 @@ void httpCloseContextByServer(HttpContext *pContext) {
...
@@ -235,5 +235,5 @@ void httpCloseContextByServer(HttpContext *pContext) {
pContext
->
parsed
=
false
;
pContext
->
parsed
=
false
;
httpRemoveContextFromEpoll
(
pContext
);
httpRemoveContextFromEpoll
(
pContext
);
httpReleaseContext
(
pContext
,
true
);
httpReleaseContext
(
pContext
/*, true*/
);
}
}
src/plugins/http/src/httpHandle.c
浏览文件 @
272b524b
...
@@ -50,6 +50,7 @@ bool httpProcessData(HttpContext* pContext) {
...
@@ -50,6 +50,7 @@ bool httpProcessData(HttpContext* pContext) {
*/
*/
// httpCloseContextByApp(pContext);
// httpCloseContextByApp(pContext);
}
else
{
}
else
{
httpClearParser
(
pContext
->
parser
);
httpProcessRequest
(
pContext
);
httpProcessRequest
(
pContext
);
}
}
}
}
...
...
src/plugins/http/src/httpServer.c
浏览文件 @
272b524b
...
@@ -177,7 +177,7 @@ static void httpProcessHttpData(void *param) {
...
@@ -177,7 +177,7 @@ static void httpProcessHttpData(void *param) {
if
(
!
httpAlterContextState
(
pContext
,
HTTP_CONTEXT_STATE_READY
,
HTTP_CONTEXT_STATE_READY
))
{
if
(
!
httpAlterContextState
(
pContext
,
HTTP_CONTEXT_STATE_READY
,
HTTP_CONTEXT_STATE_READY
))
{
httpDebug
(
"context:%p, fd:%d, state:%s, not in ready state, ignore read events"
,
pContext
,
pContext
->
fd
,
httpDebug
(
"context:%p, fd:%d, state:%s, not in ready state, ignore read events"
,
pContext
,
pContext
->
fd
,
httpContextStateStr
(
pContext
->
state
));
httpContextStateStr
(
pContext
->
state
));
httpReleaseContext
(
pContext
,
true
);
httpReleaseContext
(
pContext
/*, true*/
);
continue
;
continue
;
}
}
...
@@ -191,7 +191,7 @@ static void httpProcessHttpData(void *param) {
...
@@ -191,7 +191,7 @@ static void httpProcessHttpData(void *param) {
(
*
(
pThread
->
processData
))(
pContext
);
(
*
(
pThread
->
processData
))(
pContext
);
atomic_fetch_add_32
(
&
pServer
->
requestNum
,
1
);
atomic_fetch_add_32
(
&
pServer
->
requestNum
,
1
);
}
else
{
}
else
{
httpReleaseContext
(
pContext
,
false
);
httpReleaseContext
(
pContext
/*, false*/
);
}
}
}
}
}
}
...
@@ -275,7 +275,7 @@ static void *httpAcceptHttpConnection(void *arg) {
...
@@ -275,7 +275,7 @@ static void *httpAcceptHttpConnection(void *arg) {
httpError
(
"context:%p, fd:%d, ip:%s, thread:%s, failed to add http fd for epoll, error:%s"
,
pContext
,
connFd
,
httpError
(
"context:%p, fd:%d, ip:%s, thread:%s, failed to add http fd for epoll, error:%s"
,
pContext
,
connFd
,
pContext
->
ipstr
,
pThread
->
label
,
strerror
(
errno
));
pContext
->
ipstr
,
pThread
->
label
,
strerror
(
errno
));
taosCloseSocket
(
pContext
->
fd
);
taosCloseSocket
(
pContext
->
fd
);
httpReleaseContext
(
pContext
,
true
);
httpReleaseContext
(
pContext
/*, true*/
);
continue
;
continue
;
}
}
...
...
src/plugins/http/src/httpSql.c
浏览文件 @
272b524b
...
@@ -376,6 +376,8 @@ void httpExecCmd(HttpContext *pContext) {
...
@@ -376,6 +376,8 @@ void httpExecCmd(HttpContext *pContext) {
httpCloseContextByApp
(
pContext
);
httpCloseContextByApp
(
pContext
);
break
;
break
;
}
}
memset
(
&
pContext
->
singleCmd
,
0
,
sizeof
(
HttpSqlCmd
));
}
}
void
httpProcessRequestCb
(
void
*
param
,
TAOS_RES
*
result
,
int32_t
code
)
{
void
httpProcessRequestCb
(
void
*
param
,
TAOS_RES
*
result
,
int32_t
code
)
{
...
...
src/query/inc/qSqlparser.h
浏览文件 @
272b524b
...
@@ -44,6 +44,12 @@ enum SQL_NODE_FROM_TYPE {
...
@@ -44,6 +44,12 @@ enum SQL_NODE_FROM_TYPE {
SQL_NODE_FROM_NAMELIST
=
2
,
SQL_NODE_FROM_NAMELIST
=
2
,
};
};
enum
SQL_EXPR_FLAG
{
EXPR_FLAG_TS_ERROR
=
1
,
EXPR_FLAG_US_TIMESTAMP
=
2
,
EXPR_FLAG_TIMESTAMP_VAR
=
3
,
};
extern
char
tTokenTypeSwitcher
[
13
];
extern
char
tTokenTypeSwitcher
[
13
];
#define toTSDBType(x) \
#define toTSDBType(x) \
...
@@ -237,7 +243,8 @@ typedef struct tSqlExpr {
...
@@ -237,7 +243,8 @@ typedef struct tSqlExpr {
SStrToken
colInfo
;
// table column info
SStrToken
colInfo
;
// table column info
tVariant
value
;
// the use input value
tVariant
value
;
// the use input value
SStrToken
token
;
// original sql expr string
SStrToken
token
;
// original sql expr string
uint32_t
flags
;
struct
tSqlExpr
*
pLeft
;
// left child
struct
tSqlExpr
*
pLeft
;
// left child
struct
tSqlExpr
*
pRight
;
// right child
struct
tSqlExpr
*
pRight
;
// right child
struct
SArray
*
pParam
;
// function parameters list
struct
SArray
*
pParam
;
// function parameters list
...
...
src/query/inc/sql.y
浏览文件 @
272b524b
...
@@ -674,6 +674,8 @@ expr(A) ::= PLUS(X) FLOAT(Y). { X.n += Y.n; X.type = TK_FLOAT; A = tSqlExprCr
...
@@ -674,6 +674,8 @@ expr(A) ::= PLUS(X) FLOAT(Y). { X.n += Y.n; X.type = TK_FLOAT; A = tSqlExprCr
expr(A) ::= STRING(X). { A = tSqlExprCreateIdValue(&X, TK_STRING);}
expr(A) ::= STRING(X). { A = tSqlExprCreateIdValue(&X, TK_STRING);}
expr(A) ::= NOW(X). { A = tSqlExprCreateIdValue(&X, TK_NOW); }
expr(A) ::= NOW(X). { A = tSqlExprCreateIdValue(&X, TK_NOW); }
expr(A) ::= VARIABLE(X). { A = tSqlExprCreateIdValue(&X, TK_VARIABLE);}
expr(A) ::= VARIABLE(X). { A = tSqlExprCreateIdValue(&X, TK_VARIABLE);}
expr(A) ::= PLUS(X) VARIABLE(Y). { X.n += Y.n; X.type = TK_VARIABLE; A = tSqlExprCreateIdValue(&X, TK_VARIABLE);}
expr(A) ::= MINUS(X) VARIABLE(Y). { X.n += Y.n; X.type = TK_VARIABLE; A = tSqlExprCreateIdValue(&X, TK_VARIABLE);}
expr(A) ::= BOOL(X). { A = tSqlExprCreateIdValue(&X, TK_BOOL);}
expr(A) ::= BOOL(X). { A = tSqlExprCreateIdValue(&X, TK_BOOL);}
expr(A) ::= NULL(X). { A = tSqlExprCreateIdValue(&X, TK_NULL);}
expr(A) ::= NULL(X). { A = tSqlExprCreateIdValue(&X, TK_NULL);}
...
...
src/query/src/qAggMain.c
浏览文件 @
272b524b
...
@@ -2482,6 +2482,29 @@ static STopBotInfo *getTopBotOutputInfo(SQLFunctionCtx *pCtx) {
...
@@ -2482,6 +2482,29 @@ static STopBotInfo *getTopBotOutputInfo(SQLFunctionCtx *pCtx) {
}
}
}
}
/*
* keep the intermediate results during scan data blocks in the format of:
* +-----------------------------------+-------------one value pair-----------+------------next value pair-----------+
* |-------------pointer area----------|----ts---+-----+-----n tags-----------|----ts---+-----+-----n tags-----------|
* +..[Value Pointer1][Value Pointer2].|timestamp|value|tags1|tags2|....|tagsn|timestamp|value|tags1|tags2|....|tagsn+
*/
static
void
buildTopBotStruct
(
STopBotInfo
*
pTopBotInfo
,
SQLFunctionCtx
*
pCtx
)
{
char
*
tmp
=
(
char
*
)
pTopBotInfo
+
sizeof
(
STopBotInfo
);
pTopBotInfo
->
res
=
(
tValuePair
**
)
tmp
;
tmp
+=
POINTER_BYTES
*
pCtx
->
param
[
0
].
i64
;
size_t
size
=
sizeof
(
tValuePair
)
+
pCtx
->
tagInfo
.
tagsLen
;
// assert(pCtx->param[0].i64 > 0);
for
(
int32_t
i
=
0
;
i
<
pCtx
->
param
[
0
].
i64
;
++
i
)
{
pTopBotInfo
->
res
[
i
]
=
(
tValuePair
*
)
tmp
;
pTopBotInfo
->
res
[
i
]
->
pTags
=
tmp
+
sizeof
(
tValuePair
);
tmp
+=
size
;
}
}
bool
topbot_datablock_filter
(
SQLFunctionCtx
*
pCtx
,
const
char
*
minval
,
const
char
*
maxval
)
{
bool
topbot_datablock_filter
(
SQLFunctionCtx
*
pCtx
,
const
char
*
minval
,
const
char
*
maxval
)
{
SResultRowCellInfo
*
pResInfo
=
GET_RES_INFO
(
pCtx
);
SResultRowCellInfo
*
pResInfo
=
GET_RES_INFO
(
pCtx
);
if
(
pResInfo
==
NULL
)
{
if
(
pResInfo
==
NULL
)
{
...
@@ -2495,6 +2518,10 @@ bool topbot_datablock_filter(SQLFunctionCtx *pCtx, const char *minval, const cha
...
@@ -2495,6 +2518,10 @@ bool topbot_datablock_filter(SQLFunctionCtx *pCtx, const char *minval, const cha
return
true
;
return
true
;
}
}
if
((
void
*
)
pTopBotInfo
->
res
[
0
]
!=
(
void
*
)((
char
*
)
pTopBotInfo
+
sizeof
(
STopBotInfo
)
+
POINTER_BYTES
*
pCtx
->
param
[
0
].
i64
))
{
buildTopBotStruct
(
pTopBotInfo
,
pCtx
);
}
tValuePair
**
pRes
=
(
tValuePair
**
)
pTopBotInfo
->
res
;
tValuePair
**
pRes
=
(
tValuePair
**
)
pTopBotInfo
->
res
;
if
(
pCtx
->
functionId
==
TSDB_FUNC_TOP
)
{
if
(
pCtx
->
functionId
==
TSDB_FUNC_TOP
)
{
...
@@ -2534,27 +2561,6 @@ bool topbot_datablock_filter(SQLFunctionCtx *pCtx, const char *minval, const cha
...
@@ -2534,27 +2561,6 @@ bool topbot_datablock_filter(SQLFunctionCtx *pCtx, const char *minval, const cha
}
}
}
}
/*
* keep the intermediate results during scan data blocks in the format of:
* +-----------------------------------+-------------one value pair-----------+------------next value pair-----------+
* |-------------pointer area----------|----ts---+-----+-----n tags-----------|----ts---+-----+-----n tags-----------|
* +..[Value Pointer1][Value Pointer2].|timestamp|value|tags1|tags2|....|tagsn|timestamp|value|tags1|tags2|....|tagsn+
*/
static
void
buildTopBotStruct
(
STopBotInfo
*
pTopBotInfo
,
SQLFunctionCtx
*
pCtx
)
{
char
*
tmp
=
(
char
*
)
pTopBotInfo
+
sizeof
(
STopBotInfo
);
pTopBotInfo
->
res
=
(
tValuePair
**
)
tmp
;
tmp
+=
POINTER_BYTES
*
pCtx
->
param
[
0
].
i64
;
size_t
size
=
sizeof
(
tValuePair
)
+
pCtx
->
tagInfo
.
tagsLen
;
// assert(pCtx->param[0].i64 > 0);
for
(
int32_t
i
=
0
;
i
<
pCtx
->
param
[
0
].
i64
;
++
i
)
{
pTopBotInfo
->
res
[
i
]
=
(
tValuePair
*
)
tmp
;
pTopBotInfo
->
res
[
i
]
->
pTags
=
tmp
+
sizeof
(
tValuePair
);
tmp
+=
size
;
}
}
static
bool
top_bottom_function_setup
(
SQLFunctionCtx
*
pCtx
)
{
static
bool
top_bottom_function_setup
(
SQLFunctionCtx
*
pCtx
)
{
if
(
!
function_setup
(
pCtx
))
{
if
(
!
function_setup
(
pCtx
))
{
return
false
;
return
false
;
...
@@ -2609,6 +2615,10 @@ static void top_function_f(SQLFunctionCtx *pCtx, int32_t index) {
...
@@ -2609,6 +2615,10 @@ static void top_function_f(SQLFunctionCtx *pCtx, int32_t index) {
STopBotInfo
*
pRes
=
getTopBotOutputInfo
(
pCtx
);
STopBotInfo
*
pRes
=
getTopBotOutputInfo
(
pCtx
);
assert
(
pRes
->
num
>=
0
);
assert
(
pRes
->
num
>=
0
);
if
((
void
*
)
pRes
->
res
[
0
]
!=
(
void
*
)((
char
*
)
pRes
+
sizeof
(
STopBotInfo
)
+
POINTER_BYTES
*
pCtx
->
param
[
0
].
i64
))
{
buildTopBotStruct
(
pRes
,
pCtx
);
}
SET_VAL
(
pCtx
,
1
,
1
);
SET_VAL
(
pCtx
,
1
,
1
);
TSKEY
ts
=
GET_TS_DATA
(
pCtx
,
index
);
TSKEY
ts
=
GET_TS_DATA
(
pCtx
,
index
);
...
...
src/query/src/qExecutor.c
浏览文件 @
272b524b
此差异已折叠。
点击以展开。
src/query/src/qExtbuffer.c
浏览文件 @
272b524b
...
@@ -354,45 +354,14 @@ static FORCE_INLINE int32_t primaryKeyComparator(int64_t f1, int64_t f2, int32_t
...
@@ -354,45 +354,14 @@ static FORCE_INLINE int32_t primaryKeyComparator(int64_t f1, int64_t f2, int32_t
static
FORCE_INLINE
int32_t
columnValueAscendingComparator
(
char
*
f1
,
char
*
f2
,
int32_t
type
,
int32_t
bytes
)
{
static
FORCE_INLINE
int32_t
columnValueAscendingComparator
(
char
*
f1
,
char
*
f2
,
int32_t
type
,
int32_t
bytes
)
{
switch
(
type
)
{
switch
(
type
)
{
case
TSDB_DATA_TYPE_INT
:
{
case
TSDB_DATA_TYPE_INT
:
DEFAULT_COMP
(
GET_INT32_VAL
(
f1
),
GET_INT32_VAL
(
f2
));
int32_t
first
=
*
(
int32_t
*
)
f1
;
case
TSDB_DATA_TYPE_DOUBLE
:
DEFAULT_DOUBLE_COMP
(
GET_DOUBLE_VAL
(
f1
),
GET_DOUBLE_VAL
(
f2
));
int32_t
second
=
*
(
int32_t
*
)
f2
;
case
TSDB_DATA_TYPE_FLOAT
:
DEFAULT_FLOAT_COMP
(
GET_FLOAT_VAL
(
f1
),
GET_FLOAT_VAL
(
f2
));
if
(
first
==
second
)
{
case
TSDB_DATA_TYPE_BIGINT
:
DEFAULT_COMP
(
GET_INT64_VAL
(
f1
),
GET_INT64_VAL
(
f2
));
return
0
;
case
TSDB_DATA_TYPE_SMALLINT
:
DEFAULT_COMP
(
GET_INT16_VAL
(
f1
),
GET_INT16_VAL
(
f2
));
}
return
(
first
<
second
)
?
-
1
:
1
;
};
case
TSDB_DATA_TYPE_DOUBLE
:
{
DEFAULT_DOUBLE_COMP
(
GET_DOUBLE_VAL
(
f1
),
GET_DOUBLE_VAL
(
f2
));
};
case
TSDB_DATA_TYPE_FLOAT
:
{
DEFAULT_FLOAT_COMP
(
GET_FLOAT_VAL
(
f1
),
GET_FLOAT_VAL
(
f2
));
};
case
TSDB_DATA_TYPE_BIGINT
:
{
int64_t
first
=
*
(
int64_t
*
)
f1
;
int64_t
second
=
*
(
int64_t
*
)
f2
;
if
(
first
==
second
)
{
return
0
;
}
return
(
first
<
second
)
?
-
1
:
1
;
};
case
TSDB_DATA_TYPE_SMALLINT
:
{
int16_t
first
=
*
(
int16_t
*
)
f1
;
int16_t
second
=
*
(
int16_t
*
)
f2
;
if
(
first
==
second
)
{
return
0
;
}
return
(
first
<
second
)
?
-
1
:
1
;
};
case
TSDB_DATA_TYPE_BOOL
:
case
TSDB_DATA_TYPE_BOOL
:
case
TSDB_DATA_TYPE_TINYINT
:
{
case
TSDB_DATA_TYPE_TINYINT
:
DEFAULT_COMP
(
GET_INT8_VAL
(
f1
),
GET_INT8_VAL
(
f2
));
int8_t
first
=
*
(
int8_t
*
)
f1
;
int8_t
second
=
*
(
int8_t
*
)
f2
;
if
(
first
==
second
)
{
return
0
;
}
return
(
first
<
second
)
?
-
1
:
1
;
};
case
TSDB_DATA_TYPE_BINARY
:
{
case
TSDB_DATA_TYPE_BINARY
:
{
int32_t
len1
=
varDataLen
(
f1
);
int32_t
len1
=
varDataLen
(
f1
);
int32_t
len2
=
varDataLen
(
f2
);
int32_t
len2
=
varDataLen
(
f2
);
...
@@ -415,6 +384,10 @@ static FORCE_INLINE int32_t columnValueAscendingComparator(char *f1, char *f2, i
...
@@ -415,6 +384,10 @@ static FORCE_INLINE int32_t columnValueAscendingComparator(char *f1, char *f2, i
}
}
return
(
ret
<
0
)
?
-
1
:
1
;
return
(
ret
<
0
)
?
-
1
:
1
;
};
};
case
TSDB_DATA_TYPE_UTINYINT
:
DEFAULT_COMP
(
GET_UINT8_VAL
(
f1
),
GET_UINT8_VAL
(
f2
));
case
TSDB_DATA_TYPE_USMALLINT
:
DEFAULT_COMP
(
GET_UINT16_VAL
(
f1
),
GET_UINT16_VAL
(
f2
));
case
TSDB_DATA_TYPE_UINT
:
DEFAULT_COMP
(
GET_UINT32_VAL
(
f1
),
GET_UINT32_VAL
(
f2
));
case
TSDB_DATA_TYPE_UBIGINT
:
DEFAULT_COMP
(
GET_UINT64_VAL
(
f1
),
GET_UINT64_VAL
(
f2
));
}
}
return
0
;
return
0
;
...
...
src/query/src/qResultbuf.c
浏览文件 @
272b524b
...
@@ -43,7 +43,7 @@ int32_t createDiskbasedResultBuffer(SDiskbasedResultBuf** pResultBuf, int32_t pa
...
@@ -43,7 +43,7 @@ int32_t createDiskbasedResultBuffer(SDiskbasedResultBuf** pResultBuf, int32_t pa
pResBuf
->
emptyDummyIdList
=
taosArrayInit
(
1
,
sizeof
(
int32_t
));
pResBuf
->
emptyDummyIdList
=
taosArrayInit
(
1
,
sizeof
(
int32_t
));
qDebug
(
"QInfo:
%"
PRIu
64
" create resBuf for output, page size:%d, inmem buf pages:%d, file:%s"
,
qId
,
pResBuf
->
pageSize
,
qDebug
(
"QInfo:
0x%"
PRIx
64
" create resBuf for output, page size:%d, inmem buf pages:%d, file:%s"
,
qId
,
pResBuf
->
pageSize
,
pResBuf
->
inMemPages
,
pResBuf
->
path
);
pResBuf
->
inMemPages
,
pResBuf
->
path
);
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
...
@@ -410,13 +410,13 @@ void destroyResultBuf(SDiskbasedResultBuf* pResultBuf) {
...
@@ -410,13 +410,13 @@ void destroyResultBuf(SDiskbasedResultBuf* pResultBuf) {
}
}
if
(
pResultBuf
->
file
!=
NULL
)
{
if
(
pResultBuf
->
file
!=
NULL
)
{
qDebug
(
"QInfo:
%"
PRIu
64
" res output buffer closed, total:%.2f Kb, inmem size:%.2f Kb, file size:%.2f Kb"
,
qDebug
(
"QInfo:
0x%"
PRIx
64
" res output buffer closed, total:%.2f Kb, inmem size:%.2f Kb, file size:%.2f Kb"
,
pResultBuf
->
qId
,
pResultBuf
->
totalBufSize
/
1024
.
0
,
listNEles
(
pResultBuf
->
lruList
)
*
pResultBuf
->
pageSize
/
1024
.
0
,
pResultBuf
->
qId
,
pResultBuf
->
totalBufSize
/
1024
.
0
,
listNEles
(
pResultBuf
->
lruList
)
*
pResultBuf
->
pageSize
/
1024
.
0
,
pResultBuf
->
fileSize
/
1024
.
0
);
pResultBuf
->
fileSize
/
1024
.
0
);
fclose
(
pResultBuf
->
file
);
fclose
(
pResultBuf
->
file
);
}
else
{
}
else
{
qDebug
(
"QInfo:
%"
PRIu
64
" res output buffer closed, total:%.2f Kb, no file created"
,
pResultBuf
->
qId
,
qDebug
(
"QInfo:
0x%"
PRIx
64
" res output buffer closed, total:%.2f Kb, no file created"
,
pResultBuf
->
qId
,
pResultBuf
->
totalBufSize
/
1024
.
0
);
pResultBuf
->
totalBufSize
/
1024
.
0
);
}
}
...
...
src/query/src/qSqlParser.c
浏览文件 @
272b524b
...
@@ -144,12 +144,15 @@ tSqlExpr *tSqlExprCreateIdValue(SStrToken *pToken, int32_t optrType) {
...
@@ -144,12 +144,15 @@ tSqlExpr *tSqlExprCreateIdValue(SStrToken *pToken, int32_t optrType) {
pSqlExpr
->
value
.
nType
=
TSDB_DATA_TYPE_BIGINT
;
pSqlExpr
->
value
.
nType
=
TSDB_DATA_TYPE_BIGINT
;
pSqlExpr
->
tokenId
=
TK_TIMESTAMP
;
// TK_TIMESTAMP used to denote the time value is in microsecond
pSqlExpr
->
tokenId
=
TK_TIMESTAMP
;
// TK_TIMESTAMP used to denote the time value is in microsecond
pSqlExpr
->
type
=
SQL_NODE_VALUE
;
pSqlExpr
->
type
=
SQL_NODE_VALUE
;
pSqlExpr
->
flags
|=
1
<<
EXPR_FLAG_US_TIMESTAMP
;
}
else
if
(
optrType
==
TK_VARIABLE
)
{
}
else
if
(
optrType
==
TK_VARIABLE
)
{
int32_t
ret
=
parseAbsoluteDuration
(
pToken
->
z
,
pToken
->
n
,
&
pSqlExpr
->
value
.
i64
);
int32_t
ret
=
parseAbsoluteDuration
(
pToken
->
z
,
pToken
->
n
,
&
pSqlExpr
->
value
.
i64
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
terrno
=
TSDB_CODE_TSC_SQL_SYNTAX_ERROR
;
terrno
=
TSDB_CODE_TSC_SQL_SYNTAX_ERROR
;
}
}
pSqlExpr
->
flags
|=
1
<<
EXPR_FLAG_US_TIMESTAMP
;
pSqlExpr
->
flags
|=
1
<<
EXPR_FLAG_TIMESTAMP_VAR
;
pSqlExpr
->
value
.
nType
=
TSDB_DATA_TYPE_BIGINT
;
pSqlExpr
->
value
.
nType
=
TSDB_DATA_TYPE_BIGINT
;
pSqlExpr
->
tokenId
=
TK_TIMESTAMP
;
pSqlExpr
->
tokenId
=
TK_TIMESTAMP
;
pSqlExpr
->
type
=
SQL_NODE_VALUE
;
pSqlExpr
->
type
=
SQL_NODE_VALUE
;
...
@@ -217,6 +220,15 @@ tSqlExpr *tSqlExprCreate(tSqlExpr *pLeft, tSqlExpr *pRight, int32_t optrType) {
...
@@ -217,6 +220,15 @@ tSqlExpr *tSqlExprCreate(tSqlExpr *pLeft, tSqlExpr *pRight, int32_t optrType) {
pExpr
->
value
.
nType
=
TSDB_DATA_TYPE_BIGINT
;
pExpr
->
value
.
nType
=
TSDB_DATA_TYPE_BIGINT
;
pExpr
->
tokenId
=
pLeft
->
tokenId
;
pExpr
->
tokenId
=
pLeft
->
tokenId
;
pExpr
->
type
=
SQL_NODE_VALUE
;
pExpr
->
type
=
SQL_NODE_VALUE
;
pExpr
->
flags
=
pLeft
->
flags
|
pRight
->
flags
;
if
((
pLeft
->
flags
&
(
1
<<
EXPR_FLAG_TIMESTAMP_VAR
))
&&
(
pRight
->
flags
&
(
1
<<
EXPR_FLAG_TIMESTAMP_VAR
)))
{
pExpr
->
flags
|=
1
<<
EXPR_FLAG_TS_ERROR
;
}
else
{
pExpr
->
flags
&=
~
(
1
<<
EXPR_FLAG_TIMESTAMP_VAR
);
pExpr
->
flags
&=
~
(
1
<<
EXPR_FLAG_TS_ERROR
);
}
switch
(
optrType
)
{
switch
(
optrType
)
{
case
TK_PLUS
:
{
case
TK_PLUS
:
{
...
@@ -245,7 +257,6 @@ tSqlExpr *tSqlExprCreate(tSqlExpr *pLeft, tSqlExpr *pRight, int32_t optrType) {
...
@@ -245,7 +257,6 @@ tSqlExpr *tSqlExprCreate(tSqlExpr *pLeft, tSqlExpr *pRight, int32_t optrType) {
tSqlExprDestroy
(
pLeft
);
tSqlExprDestroy
(
pLeft
);
tSqlExprDestroy
(
pRight
);
tSqlExprDestroy
(
pRight
);
}
else
if
((
pLeft
->
tokenId
==
TK_FLOAT
&&
pRight
->
tokenId
==
TK_INTEGER
)
||
}
else
if
((
pLeft
->
tokenId
==
TK_FLOAT
&&
pRight
->
tokenId
==
TK_INTEGER
)
||
(
pLeft
->
tokenId
==
TK_INTEGER
&&
pRight
->
tokenId
==
TK_FLOAT
)
||
(
pLeft
->
tokenId
==
TK_INTEGER
&&
pRight
->
tokenId
==
TK_FLOAT
)
||
(
pLeft
->
tokenId
==
TK_FLOAT
&&
pRight
->
tokenId
==
TK_FLOAT
))
{
(
pLeft
->
tokenId
==
TK_FLOAT
&&
pRight
->
tokenId
==
TK_FLOAT
))
{
...
...
src/query/src/queryMain.c
浏览文件 @
272b524b
...
@@ -205,7 +205,7 @@ bool qTableQuery(qinfo_t qinfo, uint64_t *qId) {
...
@@ -205,7 +205,7 @@ bool qTableQuery(qinfo_t qinfo, uint64_t *qId) {
int64_t
curOwner
=
0
;
int64_t
curOwner
=
0
;
if
((
curOwner
=
atomic_val_compare_exchange_64
(
&
pQInfo
->
owner
,
0
,
threadId
))
!=
0
)
{
if
((
curOwner
=
atomic_val_compare_exchange_64
(
&
pQInfo
->
owner
,
0
,
threadId
))
!=
0
)
{
qError
(
"QInfo:
%"
PRIu
64
"-%p qhandle is now executed by thread:%p"
,
pQInfo
->
qId
,
pQInfo
,
(
void
*
)
curOwner
);
qError
(
"QInfo:
0x%"
PRIx
64
"-%p qhandle is now executed by thread:%p"
,
pQInfo
->
qId
,
pQInfo
,
(
void
*
)
curOwner
);
pQInfo
->
code
=
TSDB_CODE_QRY_IN_EXEC
;
pQInfo
->
code
=
TSDB_CODE_QRY_IN_EXEC
;
return
false
;
return
false
;
}
}
...
@@ -215,13 +215,13 @@ bool qTableQuery(qinfo_t qinfo, uint64_t *qId) {
...
@@ -215,13 +215,13 @@ bool qTableQuery(qinfo_t qinfo, uint64_t *qId) {
pQInfo
->
startExecTs
=
taosGetTimestampSec
();
pQInfo
->
startExecTs
=
taosGetTimestampSec
();
if
(
isQueryKilled
(
pQInfo
))
{
if
(
isQueryKilled
(
pQInfo
))
{
qDebug
(
"QInfo:
%"
PRIu
64
" it is already killed, abort"
,
pQInfo
->
qId
);
qDebug
(
"QInfo:
0x%"
PRIx
64
" it is already killed, abort"
,
pQInfo
->
qId
);
return
doBuildResCheck
(
pQInfo
);
return
doBuildResCheck
(
pQInfo
);
}
}
SQueryRuntimeEnv
*
pRuntimeEnv
=
&
pQInfo
->
runtimeEnv
;
SQueryRuntimeEnv
*
pRuntimeEnv
=
&
pQInfo
->
runtimeEnv
;
if
(
pRuntimeEnv
->
tableqinfoGroupInfo
.
numOfTables
==
0
)
{
if
(
pRuntimeEnv
->
tableqinfoGroupInfo
.
numOfTables
==
0
)
{
qDebug
(
"QInfo:
%"
PRIu
64
" no table exists for query, abort"
,
pQInfo
->
qId
);
qDebug
(
"QInfo:
0x%"
PRIx
64
" no table exists for query, abort"
,
pQInfo
->
qId
);
setQueryStatus
(
pRuntimeEnv
,
QUERY_COMPLETED
);
setQueryStatus
(
pRuntimeEnv
,
QUERY_COMPLETED
);
return
doBuildResCheck
(
pQInfo
);
return
doBuildResCheck
(
pQInfo
);
}
}
...
@@ -230,21 +230,21 @@ bool qTableQuery(qinfo_t qinfo, uint64_t *qId) {
...
@@ -230,21 +230,21 @@ bool qTableQuery(qinfo_t qinfo, uint64_t *qId) {
int32_t
ret
=
setjmp
(
pQInfo
->
runtimeEnv
.
env
);
int32_t
ret
=
setjmp
(
pQInfo
->
runtimeEnv
.
env
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
pQInfo
->
code
=
ret
;
pQInfo
->
code
=
ret
;
qDebug
(
"QInfo:
%"
PRIu
64
" query abort due to error/cancel occurs, code:%s"
,
pQInfo
->
qId
,
tstrerror
(
pQInfo
->
code
));
qDebug
(
"QInfo:
0x%"
PRIx
64
" query abort due to error/cancel occurs, code:%s"
,
pQInfo
->
qId
,
tstrerror
(
pQInfo
->
code
));
return
doBuildResCheck
(
pQInfo
);
return
doBuildResCheck
(
pQInfo
);
}
}
qDebug
(
"QInfo:
%"
PRIu
64
" query task is launched"
,
pQInfo
->
qId
);
qDebug
(
"QInfo:
0x%"
PRIx
64
" query task is launched"
,
pQInfo
->
qId
);
pRuntimeEnv
->
outputBuf
=
pRuntimeEnv
->
proot
->
exec
(
pRuntimeEnv
->
proot
);
pRuntimeEnv
->
outputBuf
=
pRuntimeEnv
->
proot
->
exec
(
pRuntimeEnv
->
proot
);
if
(
isQueryKilled
(
pQInfo
))
{
if
(
isQueryKilled
(
pQInfo
))
{
qDebug
(
"QInfo:
%"
PRIu
64
" query is killed"
,
pQInfo
->
qId
);
qDebug
(
"QInfo:
0x%"
PRIx
64
" query is killed"
,
pQInfo
->
qId
);
}
else
if
(
GET_NUM_OF_RESULTS
(
pRuntimeEnv
)
==
0
)
{
}
else
if
(
GET_NUM_OF_RESULTS
(
pRuntimeEnv
)
==
0
)
{
qDebug
(
"QInfo:
%"
PRIu
64
" over, %u tables queried, %"
PRId64
" rows are returned"
,
pQInfo
->
qId
,
pRuntimeEnv
->
tableqinfoGroupInfo
.
numOfTables
,
qDebug
(
"QInfo:
0x%"
PRIx
64
" over, %u tables queried, %"
PRId64
" rows are returned"
,
pQInfo
->
qId
,
pRuntimeEnv
->
tableqinfoGroupInfo
.
numOfTables
,
pRuntimeEnv
->
resultInfo
.
total
);
pRuntimeEnv
->
resultInfo
.
total
);
}
else
{
}
else
{
qDebug
(
"QInfo:
%"
PRIu
64
" query paused, %d rows returned, numOfTotal:%"
PRId64
" rows"
,
qDebug
(
"QInfo:
0x%"
PRIx
64
" query paused, %d rows returned, numOfTotal:%"
PRId64
" rows"
,
pQInfo
->
qId
,
GET_NUM_OF_RESULTS
(
pRuntimeEnv
),
pRuntimeEnv
->
resultInfo
.
total
+
GET_NUM_OF_RESULTS
(
pRuntimeEnv
));
pQInfo
->
qId
,
GET_NUM_OF_RESULTS
(
pRuntimeEnv
),
pRuntimeEnv
->
resultInfo
.
total
+
GET_NUM_OF_RESULTS
(
pRuntimeEnv
));
}
}
...
@@ -255,13 +255,13 @@ int32_t qRetrieveQueryResultInfo(qinfo_t qinfo, bool* buildRes, void* pRspContex
...
@@ -255,13 +255,13 @@ int32_t qRetrieveQueryResultInfo(qinfo_t qinfo, bool* buildRes, void* pRspContex
SQInfo
*
pQInfo
=
(
SQInfo
*
)
qinfo
;
SQInfo
*
pQInfo
=
(
SQInfo
*
)
qinfo
;
if
(
pQInfo
==
NULL
||
!
isValidQInfo
(
pQInfo
))
{
if
(
pQInfo
==
NULL
||
!
isValidQInfo
(
pQInfo
))
{
qError
(
"QInfo:
%"
PRIu
64
" invalid qhandle"
,
pQInfo
->
qId
);
qError
(
"QInfo:
0x%"
PRIx
64
" invalid qhandle"
,
pQInfo
->
qId
);
return
TSDB_CODE_QRY_INVALID_QHANDLE
;
return
TSDB_CODE_QRY_INVALID_QHANDLE
;
}
}
*
buildRes
=
false
;
*
buildRes
=
false
;
if
(
IS_QUERY_KILLED
(
pQInfo
))
{
if
(
IS_QUERY_KILLED
(
pQInfo
))
{
qDebug
(
"QInfo:
%"
PRIu
64
" query is killed, code:0x%08x"
,
pQInfo
->
qId
,
pQInfo
->
code
);
qDebug
(
"QInfo:
0x%"
PRIx
64
" query is killed, code:0x%08x"
,
pQInfo
->
qId
,
pQInfo
->
code
);
return
pQInfo
->
code
;
return
pQInfo
->
code
;
}
}
...
@@ -281,11 +281,11 @@ int32_t qRetrieveQueryResultInfo(qinfo_t qinfo, bool* buildRes, void* pRspContex
...
@@ -281,11 +281,11 @@ int32_t qRetrieveQueryResultInfo(qinfo_t qinfo, bool* buildRes, void* pRspContex
assert
(
pQInfo
->
rspContext
==
NULL
);
assert
(
pQInfo
->
rspContext
==
NULL
);
if
(
pQInfo
->
dataReady
==
QUERY_RESULT_READY
)
{
if
(
pQInfo
->
dataReady
==
QUERY_RESULT_READY
)
{
*
buildRes
=
true
;
*
buildRes
=
true
;
qDebug
(
"QInfo:
%"
PRIu
64
" retrieve result info, rowsize:%d, rows:%d, code:%s"
,
pQInfo
->
qId
,
pQuery
->
resultRowSize
,
qDebug
(
"QInfo:
0x%"
PRIx
64
" retrieve result info, rowsize:%d, rows:%d, code:%s"
,
pQInfo
->
qId
,
pQuery
->
resultRowSize
,
GET_NUM_OF_RESULTS
(
pRuntimeEnv
),
tstrerror
(
pQInfo
->
code
));
GET_NUM_OF_RESULTS
(
pRuntimeEnv
),
tstrerror
(
pQInfo
->
code
));
}
else
{
}
else
{
*
buildRes
=
false
;
*
buildRes
=
false
;
qDebug
(
"QInfo:
%"
PRIu
64
" retrieve req set query return result after paused"
,
pQInfo
->
qId
);
qDebug
(
"QInfo:
0x%"
PRIx
64
" retrieve req set query return result after paused"
,
pQInfo
->
qId
);
pQInfo
->
rspContext
=
pRspContext
;
pQInfo
->
rspContext
=
pRspContext
;
assert
(
pQInfo
->
rspContext
!=
NULL
);
assert
(
pQInfo
->
rspContext
!=
NULL
);
}
}
...
@@ -344,10 +344,10 @@ int32_t qDumpRetrieveResult(qinfo_t qinfo, SRetrieveTableRsp **pRsp, int32_t *co
...
@@ -344,10 +344,10 @@ int32_t qDumpRetrieveResult(qinfo_t qinfo, SRetrieveTableRsp **pRsp, int32_t *co
// here current thread hold the refcount, so it is safe to free tsdbQueryHandle.
// here current thread hold the refcount, so it is safe to free tsdbQueryHandle.
*
continueExec
=
false
;
*
continueExec
=
false
;
(
*
pRsp
)
->
completed
=
1
;
// notify no more result to client
(
*
pRsp
)
->
completed
=
1
;
// notify no more result to client
qDebug
(
"QInfo:
%"
PRIu
64
" no more results to retrieve"
,
pQInfo
->
qId
);
qDebug
(
"QInfo:
0x%"
PRIx
64
" no more results to retrieve"
,
pQInfo
->
qId
);
}
else
{
}
else
{
*
continueExec
=
true
;
*
continueExec
=
true
;
qDebug
(
"QInfo:
%"
PRIu
64
" has more results to retrieve"
,
pQInfo
->
qId
);
qDebug
(
"QInfo:
0x%"
PRIx
64
" has more results to retrieve"
,
pQInfo
->
qId
);
}
}
// the memory should be freed if the code of pQInfo is not TSDB_CODE_SUCCESS
// the memory should be freed if the code of pQInfo is not TSDB_CODE_SUCCESS
...
@@ -373,7 +373,7 @@ int32_t qKillQuery(qinfo_t qinfo) {
...
@@ -373,7 +373,7 @@ int32_t qKillQuery(qinfo_t qinfo) {
return
TSDB_CODE_QRY_INVALID_QHANDLE
;
return
TSDB_CODE_QRY_INVALID_QHANDLE
;
}
}
qDebug
(
"QInfo:
%"
PRIu
64
" query killed"
,
pQInfo
->
qId
);
qDebug
(
"QInfo:
0x%"
PRIx
64
" query killed"
,
pQInfo
->
qId
);
setQueryKilled
(
pQInfo
);
setQueryKilled
(
pQInfo
);
// Wait for the query executing thread being stopped/
// Wait for the query executing thread being stopped/
...
@@ -401,7 +401,7 @@ void qDestroyQueryInfo(qinfo_t qHandle) {
...
@@ -401,7 +401,7 @@ void qDestroyQueryInfo(qinfo_t qHandle) {
return
;
return
;
}
}
qDebug
(
"QInfo:
%"
PRIu
64
" query completed"
,
pQInfo
->
qId
);
qDebug
(
"QInfo:
0x%"
PRIx
64
" query completed"
,
pQInfo
->
qId
);
queryCostStatis
(
pQInfo
);
// print the query cost summary
queryCostStatis
(
pQInfo
);
// print the query cost summary
freeQInfo
(
pQInfo
);
freeQInfo
(
pQInfo
);
}
}
...
@@ -484,7 +484,7 @@ void** qRegisterQInfo(void* pMgmt, uint64_t qId, void *qInfo) {
...
@@ -484,7 +484,7 @@ void** qRegisterQInfo(void* pMgmt, uint64_t qId, void *qInfo) {
SQueryMgmt
*
pQueryMgmt
=
pMgmt
;
SQueryMgmt
*
pQueryMgmt
=
pMgmt
;
if
(
pQueryMgmt
->
qinfoPool
==
NULL
)
{
if
(
pQueryMgmt
->
qinfoPool
==
NULL
)
{
qError
(
"QInfo:
%"
PRIu
64
"-%p failed to add qhandle into qMgmt, since qMgmt is closed"
,
qId
,
(
void
*
)
qInfo
);
qError
(
"QInfo:
0x%"
PRIx
64
"-%p failed to add qhandle into qMgmt, since qMgmt is closed"
,
qId
,
(
void
*
)
qInfo
);
terrno
=
TSDB_CODE_VND_INVALID_VGROUP_ID
;
terrno
=
TSDB_CODE_VND_INVALID_VGROUP_ID
;
return
NULL
;
return
NULL
;
}
}
...
@@ -492,7 +492,7 @@ void** qRegisterQInfo(void* pMgmt, uint64_t qId, void *qInfo) {
...
@@ -492,7 +492,7 @@ void** qRegisterQInfo(void* pMgmt, uint64_t qId, void *qInfo) {
pthread_mutex_lock
(
&
pQueryMgmt
->
lock
);
pthread_mutex_lock
(
&
pQueryMgmt
->
lock
);
if
(
pQueryMgmt
->
closed
)
{
if
(
pQueryMgmt
->
closed
)
{
pthread_mutex_unlock
(
&
pQueryMgmt
->
lock
);
pthread_mutex_unlock
(
&
pQueryMgmt
->
lock
);
qError
(
"QInfo:
%"
PRIu
64
"-%p failed to add qhandle into cache, since qMgmt is colsing"
,
qId
,
(
void
*
)
qInfo
);
qError
(
"QInfo:
0x%"
PRIx
64
"-%p failed to add qhandle into cache, since qMgmt is colsing"
,
qId
,
(
void
*
)
qInfo
);
terrno
=
TSDB_CODE_VND_INVALID_VGROUP_ID
;
terrno
=
TSDB_CODE_VND_INVALID_VGROUP_ID
;
return
NULL
;
return
NULL
;
}
else
{
}
else
{
...
...
src/query/src/sql.c
浏览文件 @
272b524b
此差异已折叠。
点击以展开。
src/tsdb/src/tsdbRead.c
浏览文件 @
272b524b
...
@@ -286,7 +286,7 @@ static SArray* createCheckInfoFromTableGroup(STsdbQueryHandle* pQueryHandle, STa
...
@@ -286,7 +286,7 @@ static SArray* createCheckInfoFromTableGroup(STsdbQueryHandle* pQueryHandle, STa
}
}
taosArrayPush
(
pTableCheckInfo
,
&
info
);
taosArrayPush
(
pTableCheckInfo
,
&
info
);
tsdbDebug
(
"%p check table uid:%"
PRId64
", tid:%d from lastKey:%"
PRId64
"
%"
PRIu
64
,
pQueryHandle
,
info
.
tableId
.
uid
,
tsdbDebug
(
"%p check table uid:%"
PRId64
", tid:%d from lastKey:%"
PRId64
"
0x%"
PRIx
64
,
pQueryHandle
,
info
.
tableId
.
uid
,
info
.
tableId
.
tid
,
info
.
lastKey
,
pQueryHandle
->
qId
);
info
.
tableId
.
tid
,
info
.
lastKey
,
pQueryHandle
->
qId
);
}
}
}
}
...
@@ -440,7 +440,7 @@ TsdbQueryHandleT* tsdbQueryTables(STsdbRepo* tsdb, STsdbQueryCond* pCond, STable
...
@@ -440,7 +440,7 @@ TsdbQueryHandleT* tsdbQueryTables(STsdbRepo* tsdb, STsdbQueryCond* pCond, STable
tsdbMayTakeMemSnapshot
(
pQueryHandle
,
psTable
);
tsdbMayTakeMemSnapshot
(
pQueryHandle
,
psTable
);
tsdbDebug
(
"%p total numOfTable:%"
PRIzu
" in query,
%"
PRIu
64
,
pQueryHandle
,
taosArrayGetSize
(
pQueryHandle
->
pTableCheckInfo
),
pQueryHandle
->
qId
);
tsdbDebug
(
"%p total numOfTable:%"
PRIzu
" in query,
0x%"
PRIx
64
,
pQueryHandle
,
taosArrayGetSize
(
pQueryHandle
->
pTableCheckInfo
),
pQueryHandle
->
qId
);
return
(
TsdbQueryHandleT
)
pQueryHandle
;
return
(
TsdbQueryHandleT
)
pQueryHandle
;
}
}
...
@@ -651,7 +651,7 @@ static bool initTableMemIterator(STsdbQueryHandle* pHandle, STableCheckInfo* pCh
...
@@ -651,7 +651,7 @@ static bool initTableMemIterator(STsdbQueryHandle* pHandle, STableCheckInfo* pCh
SDataRow
row
=
(
SDataRow
)
SL_GET_NODE_DATA
(
node
);
SDataRow
row
=
(
SDataRow
)
SL_GET_NODE_DATA
(
node
);
TSKEY
key
=
dataRowKey
(
row
);
// first timestamp in buffer
TSKEY
key
=
dataRowKey
(
row
);
// first timestamp in buffer
tsdbDebug
(
"%p uid:%"
PRId64
", tid:%d check data in mem from skey:%"
PRId64
", order:%d, ts range in buf:%"
PRId64
tsdbDebug
(
"%p uid:%"
PRId64
", tid:%d check data in mem from skey:%"
PRId64
", order:%d, ts range in buf:%"
PRId64
"-%"
PRId64
", lastKey:%"
PRId64
", numOfRows:%"
PRId64
",
%"
PRIu
64
,
"-%"
PRId64
", lastKey:%"
PRId64
", numOfRows:%"
PRId64
",
0x%"
PRIx
64
,
pHandle
,
pCheckInfo
->
tableId
.
uid
,
pCheckInfo
->
tableId
.
tid
,
key
,
order
,
pMem
->
keyFirst
,
pMem
->
keyLast
,
pHandle
,
pCheckInfo
->
tableId
.
uid
,
pCheckInfo
->
tableId
.
tid
,
key
,
order
,
pMem
->
keyFirst
,
pMem
->
keyLast
,
pCheckInfo
->
lastKey
,
pMem
->
numOfRows
,
pHandle
->
qId
);
pCheckInfo
->
lastKey
,
pMem
->
numOfRows
,
pHandle
->
qId
);
...
@@ -662,7 +662,7 @@ static bool initTableMemIterator(STsdbQueryHandle* pHandle, STableCheckInfo* pCh
...
@@ -662,7 +662,7 @@ static bool initTableMemIterator(STsdbQueryHandle* pHandle, STableCheckInfo* pCh
}
}
}
else
{
}
else
{
tsdbDebug
(
"%p uid:%"
PRId64
", tid:%d no data in mem,
%"
PRIu
64
,
pHandle
,
pCheckInfo
->
tableId
.
uid
,
pCheckInfo
->
tableId
.
tid
,
tsdbDebug
(
"%p uid:%"
PRId64
", tid:%d no data in mem,
0x%"
PRIx
64
,
pHandle
,
pCheckInfo
->
tableId
.
uid
,
pCheckInfo
->
tableId
.
tid
,
pHandle
->
qId
);
pHandle
->
qId
);
}
}
...
@@ -673,7 +673,7 @@ static bool initTableMemIterator(STsdbQueryHandle* pHandle, STableCheckInfo* pCh
...
@@ -673,7 +673,7 @@ static bool initTableMemIterator(STsdbQueryHandle* pHandle, STableCheckInfo* pCh
SDataRow
row
=
(
SDataRow
)
SL_GET_NODE_DATA
(
node
);
SDataRow
row
=
(
SDataRow
)
SL_GET_NODE_DATA
(
node
);
TSKEY
key
=
dataRowKey
(
row
);
// first timestamp in buffer
TSKEY
key
=
dataRowKey
(
row
);
// first timestamp in buffer
tsdbDebug
(
"%p uid:%"
PRId64
", tid:%d check data in imem from skey:%"
PRId64
", order:%d, ts range in buf:%"
PRId64
tsdbDebug
(
"%p uid:%"
PRId64
", tid:%d check data in imem from skey:%"
PRId64
", order:%d, ts range in buf:%"
PRId64
"-%"
PRId64
", lastKey:%"
PRId64
", numOfRows:%"
PRId64
",
%"
PRIu
64
,
"-%"
PRId64
", lastKey:%"
PRId64
", numOfRows:%"
PRId64
",
0x%"
PRIx
64
,
pHandle
,
pCheckInfo
->
tableId
.
uid
,
pCheckInfo
->
tableId
.
tid
,
key
,
order
,
pIMem
->
keyFirst
,
pIMem
->
keyLast
,
pHandle
,
pCheckInfo
->
tableId
.
uid
,
pCheckInfo
->
tableId
.
tid
,
key
,
order
,
pIMem
->
keyFirst
,
pIMem
->
keyLast
,
pCheckInfo
->
lastKey
,
pIMem
->
numOfRows
,
pHandle
->
qId
);
pCheckInfo
->
lastKey
,
pIMem
->
numOfRows
,
pHandle
->
qId
);
...
@@ -683,7 +683,7 @@ static bool initTableMemIterator(STsdbQueryHandle* pHandle, STableCheckInfo* pCh
...
@@ -683,7 +683,7 @@ static bool initTableMemIterator(STsdbQueryHandle* pHandle, STableCheckInfo* pCh
assert
(
pCheckInfo
->
lastKey
>=
key
);
assert
(
pCheckInfo
->
lastKey
>=
key
);
}
}
}
else
{
}
else
{
tsdbDebug
(
"%p uid:%"
PRId64
", tid:%d no data in imem,
%"
PRIu
64
,
pHandle
,
pCheckInfo
->
tableId
.
uid
,
pCheckInfo
->
tableId
.
tid
,
tsdbDebug
(
"%p uid:%"
PRId64
", tid:%d no data in imem,
0x%"
PRIx
64
,
pHandle
,
pCheckInfo
->
tableId
.
uid
,
pCheckInfo
->
tableId
.
tid
,
pHandle
->
qId
);
pHandle
->
qId
);
}
}
...
@@ -811,7 +811,7 @@ static bool hasMoreDataInCache(STsdbQueryHandle* pHandle) {
...
@@ -811,7 +811,7 @@ static bool hasMoreDataInCache(STsdbQueryHandle* pHandle) {
}
}
pCheckInfo
->
lastKey
=
dataRowKey
(
row
);
// first timestamp in buffer
pCheckInfo
->
lastKey
=
dataRowKey
(
row
);
// first timestamp in buffer
tsdbDebug
(
"%p uid:%"
PRId64
", tid:%d check data in buffer from skey:%"
PRId64
", order:%d,
%"
PRIu
64
,
pHandle
,
tsdbDebug
(
"%p uid:%"
PRId64
", tid:%d check data in buffer from skey:%"
PRId64
", order:%d,
0x%"
PRIx
64
,
pHandle
,
pCheckInfo
->
tableId
.
uid
,
pCheckInfo
->
tableId
.
tid
,
pCheckInfo
->
lastKey
,
pHandle
->
order
,
pHandle
->
qId
);
pCheckInfo
->
tableId
.
uid
,
pCheckInfo
->
tableId
.
tid
,
pCheckInfo
->
lastKey
,
pHandle
->
order
,
pHandle
->
qId
);
// all data in mem are checked already.
// all data in mem are checked already.
...
@@ -986,21 +986,21 @@ static int32_t doLoadFileDataBlock(STsdbQueryHandle* pQueryHandle, SBlock* pBloc
...
@@ -986,21 +986,21 @@ static int32_t doLoadFileDataBlock(STsdbQueryHandle* pQueryHandle, SBlock* pBloc
STSchema
*
pSchema
=
tsdbGetTableSchema
(
pCheckInfo
->
pTableObj
);
STSchema
*
pSchema
=
tsdbGetTableSchema
(
pCheckInfo
->
pTableObj
);
int32_t
code
=
tdInitDataCols
(
pQueryHandle
->
pDataCols
,
pSchema
);
int32_t
code
=
tdInitDataCols
(
pQueryHandle
->
pDataCols
,
pSchema
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
tsdbError
(
"%p failed to malloc buf for pDataCols,
%"
PRIu
64
,
pQueryHandle
,
pQueryHandle
->
qId
);
tsdbError
(
"%p failed to malloc buf for pDataCols,
0x%"
PRIx
64
,
pQueryHandle
,
pQueryHandle
->
qId
);
terrno
=
TSDB_CODE_TDB_OUT_OF_MEMORY
;
terrno
=
TSDB_CODE_TDB_OUT_OF_MEMORY
;
goto
_error
;
goto
_error
;
}
}
code
=
tdInitDataCols
(
pQueryHandle
->
rhelper
.
pDCols
[
0
],
pSchema
);
code
=
tdInitDataCols
(
pQueryHandle
->
rhelper
.
pDCols
[
0
],
pSchema
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
tsdbError
(
"%p failed to malloc buf for rhelper.pDataCols[0],
%"
PRIu
64
,
pQueryHandle
,
pQueryHandle
->
qId
);
tsdbError
(
"%p failed to malloc buf for rhelper.pDataCols[0],
0x%"
PRIx
64
,
pQueryHandle
,
pQueryHandle
->
qId
);
terrno
=
TSDB_CODE_TDB_OUT_OF_MEMORY
;
terrno
=
TSDB_CODE_TDB_OUT_OF_MEMORY
;
goto
_error
;
goto
_error
;
}
}
code
=
tdInitDataCols
(
pQueryHandle
->
rhelper
.
pDCols
[
1
],
pSchema
);
code
=
tdInitDataCols
(
pQueryHandle
->
rhelper
.
pDCols
[
1
],
pSchema
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
tsdbError
(
"%p failed to malloc buf for rhelper.pDataCols[1],
%"
PRIu
64
,
pQueryHandle
,
pQueryHandle
->
qId
);
tsdbError
(
"%p failed to malloc buf for rhelper.pDataCols[1],
0x%"
PRIx
64
,
pQueryHandle
,
pQueryHandle
->
qId
);
terrno
=
TSDB_CODE_TDB_OUT_OF_MEMORY
;
terrno
=
TSDB_CODE_TDB_OUT_OF_MEMORY
;
goto
_error
;
goto
_error
;
}
}
...
@@ -1036,14 +1036,14 @@ static int32_t doLoadFileDataBlock(STsdbQueryHandle* pQueryHandle, SBlock* pBloc
...
@@ -1036,14 +1036,14 @@ static int32_t doLoadFileDataBlock(STsdbQueryHandle* pQueryHandle, SBlock* pBloc
int64_t
elapsedTime
=
(
taosGetTimestampUs
()
-
st
);
int64_t
elapsedTime
=
(
taosGetTimestampUs
()
-
st
);
pQueryHandle
->
cost
.
blockLoadTime
+=
elapsedTime
;
pQueryHandle
->
cost
.
blockLoadTime
+=
elapsedTime
;
tsdbDebug
(
"%p load file block into buffer, index:%d, brange:%"
PRId64
"-%"
PRId64
", rows:%d, elapsed time:%"
PRId64
" us,
%"
PRIu
64
,
tsdbDebug
(
"%p load file block into buffer, index:%d, brange:%"
PRId64
"-%"
PRId64
", rows:%d, elapsed time:%"
PRId64
" us,
0x%"
PRIx
64
,
pQueryHandle
,
slotIndex
,
pBlock
->
keyFirst
,
pBlock
->
keyLast
,
pBlock
->
numOfRows
,
elapsedTime
,
pQueryHandle
->
qId
);
pQueryHandle
,
slotIndex
,
pBlock
->
keyFirst
,
pBlock
->
keyLast
,
pBlock
->
numOfRows
,
elapsedTime
,
pQueryHandle
->
qId
);
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
_error:
_error:
pBlock
->
numOfRows
=
0
;
pBlock
->
numOfRows
=
0
;
tsdbError
(
"%p error occurs in loading file block, index:%d, brange:%"
PRId64
"-%"
PRId64
", rows:%d,
%"
PRIu
64
,
tsdbError
(
"%p error occurs in loading file block, index:%d, brange:%"
PRId64
"-%"
PRId64
", rows:%d,
0x%"
PRIx
64
,
pQueryHandle
,
slotIndex
,
pBlock
->
keyFirst
,
pBlock
->
keyLast
,
pBlock
->
numOfRows
,
pQueryHandle
->
qId
);
pQueryHandle
,
slotIndex
,
pBlock
->
keyFirst
,
pBlock
->
keyLast
,
pBlock
->
numOfRows
,
pQueryHandle
->
qId
);
return
terrno
;
return
terrno
;
}
}
...
@@ -1066,7 +1066,7 @@ static int32_t handleDataMergeIfNeeded(STsdbQueryHandle* pQueryHandle, SBlock* p
...
@@ -1066,7 +1066,7 @@ static int32_t handleDataMergeIfNeeded(STsdbQueryHandle* pQueryHandle, SBlock* p
assert
(
cur
->
pos
>=
0
&&
cur
->
pos
<=
binfo
.
rows
);
assert
(
cur
->
pos
>=
0
&&
cur
->
pos
<=
binfo
.
rows
);
TSKEY
key
=
(
row
!=
NULL
)
?
dataRowKey
(
row
)
:
TSKEY_INITIAL_VAL
;
TSKEY
key
=
(
row
!=
NULL
)
?
dataRowKey
(
row
)
:
TSKEY_INITIAL_VAL
;
tsdbDebug
(
"%p key in mem:%"
PRId64
",
%"
PRIu
64
,
pQueryHandle
,
key
,
pQueryHandle
->
qId
);
tsdbDebug
(
"%p key in mem:%"
PRId64
",
0x%"
PRIx
64
,
pQueryHandle
,
key
,
pQueryHandle
->
qId
);
if
((
ASCENDING_TRAVERSE
(
pQueryHandle
->
order
)
&&
(
key
!=
TSKEY_INITIAL_VAL
&&
key
<=
binfo
.
window
.
ekey
))
||
if
((
ASCENDING_TRAVERSE
(
pQueryHandle
->
order
)
&&
(
key
!=
TSKEY_INITIAL_VAL
&&
key
<=
binfo
.
window
.
ekey
))
||
(
!
ASCENDING_TRAVERSE
(
pQueryHandle
->
order
)
&&
(
key
!=
TSKEY_INITIAL_VAL
&&
key
>=
binfo
.
window
.
skey
)))
{
(
!
ASCENDING_TRAVERSE
(
pQueryHandle
->
order
)
&&
(
key
!=
TSKEY_INITIAL_VAL
&&
key
>=
binfo
.
window
.
skey
)))
{
...
@@ -1406,7 +1406,11 @@ static void copyOneRowFromMem(STsdbQueryHandle* pQueryHandle, int32_t capacity,
...
@@ -1406,7 +1406,11 @@ static void copyOneRowFromMem(STsdbQueryHandle* pQueryHandle, int32_t capacity,
SET_DOUBLE_PTR
(
pData
,
value
);
SET_DOUBLE_PTR
(
pData
,
value
);
break
;
break
;
case
TSDB_DATA_TYPE_TIMESTAMP
:
case
TSDB_DATA_TYPE_TIMESTAMP
:
*
(
TSKEY
*
)
pData
=
tdGetKey
(
*
(
TKEY
*
)
value
);
if
(
pColInfo
->
info
.
colId
==
PRIMARYKEY_TIMESTAMP_COL_INDEX
)
{
*
(
TSKEY
*
)
pData
=
tdGetKey
(
*
(
TKEY
*
)
value
);
}
else
{
*
(
TSKEY
*
)
pData
=
*
(
TSKEY
*
)
value
;
}
break
;
break
;
default:
default:
memcpy
(
pData
,
value
,
pColInfo
->
info
.
bytes
);
memcpy
(
pData
,
value
,
pColInfo
->
info
.
bytes
);
...
@@ -1547,7 +1551,7 @@ static void copyAllRemainRowsFromFileBlock(STsdbQueryHandle* pQueryHandle, STabl
...
@@ -1547,7 +1551,7 @@ static void copyAllRemainRowsFromFileBlock(STsdbQueryHandle* pQueryHandle, STabl
updateInfoAfterMerge
(
pQueryHandle
,
pCheckInfo
,
numOfRows
,
pos
);
updateInfoAfterMerge
(
pQueryHandle
,
pCheckInfo
,
numOfRows
,
pos
);
doCheckGeneratedBlockRange
(
pQueryHandle
);
doCheckGeneratedBlockRange
(
pQueryHandle
);
tsdbDebug
(
"%p uid:%"
PRIu64
",tid:%d data block created, mixblock:%d, brange:%"
PRIu64
"-%"
PRIu64
" rows:%d,
%"
PRIu
64
,
tsdbDebug
(
"%p uid:%"
PRIu64
",tid:%d data block created, mixblock:%d, brange:%"
PRIu64
"-%"
PRIu64
" rows:%d,
0x%"
PRIx
64
,
pQueryHandle
,
pCheckInfo
->
tableId
.
uid
,
pCheckInfo
->
tableId
.
tid
,
cur
->
mixBlock
,
cur
->
win
.
skey
,
pQueryHandle
,
pCheckInfo
->
tableId
.
uid
,
pCheckInfo
->
tableId
.
tid
,
cur
->
mixBlock
,
cur
->
win
.
skey
,
cur
->
win
.
ekey
,
cur
->
rows
,
pQueryHandle
->
qId
);
cur
->
win
.
ekey
,
cur
->
rows
,
pQueryHandle
->
qId
);
}
}
...
@@ -1601,7 +1605,7 @@ static void doMergeTwoLevelData(STsdbQueryHandle* pQueryHandle, STableCheckInfo*
...
@@ -1601,7 +1605,7 @@ static void doMergeTwoLevelData(STsdbQueryHandle* pQueryHandle, STableCheckInfo*
int32_t
endPos
=
getEndPosInDataBlock
(
pQueryHandle
,
&
blockInfo
);
int32_t
endPos
=
getEndPosInDataBlock
(
pQueryHandle
,
&
blockInfo
);
tsdbDebug
(
"%p uid:%"
PRIu64
",tid:%d start merge data block, file block range:%"
PRIu64
"-%"
PRIu64
" rows:%d, start:%d,"
tsdbDebug
(
"%p uid:%"
PRIu64
",tid:%d start merge data block, file block range:%"
PRIu64
"-%"
PRIu64
" rows:%d, start:%d,"
"end:%d,
%"
PRIu
64
,
"end:%d,
0x%"
PRIx
64
,
pQueryHandle
,
pCheckInfo
->
tableId
.
uid
,
pCheckInfo
->
tableId
.
tid
,
blockInfo
.
window
.
skey
,
blockInfo
.
window
.
ekey
,
pQueryHandle
,
pCheckInfo
->
tableId
.
uid
,
pCheckInfo
->
tableId
.
tid
,
blockInfo
.
window
.
skey
,
blockInfo
.
window
.
ekey
,
blockInfo
.
rows
,
cur
->
pos
,
endPos
,
pQueryHandle
->
qId
);
blockInfo
.
rows
,
cur
->
pos
,
endPos
,
pQueryHandle
->
qId
);
...
@@ -1743,7 +1747,7 @@ static void doMergeTwoLevelData(STsdbQueryHandle* pQueryHandle, STableCheckInfo*
...
@@ -1743,7 +1747,7 @@ static void doMergeTwoLevelData(STsdbQueryHandle* pQueryHandle, STableCheckInfo*
updateInfoAfterMerge
(
pQueryHandle
,
pCheckInfo
,
numOfRows
,
pos
);
updateInfoAfterMerge
(
pQueryHandle
,
pCheckInfo
,
numOfRows
,
pos
);
doCheckGeneratedBlockRange
(
pQueryHandle
);
doCheckGeneratedBlockRange
(
pQueryHandle
);
tsdbDebug
(
"%p uid:%"
PRIu64
",tid:%d data block created, mixblock:%d, brange:%"
PRIu64
"-%"
PRIu64
" rows:%d,
%"
PRIu
64
,
tsdbDebug
(
"%p uid:%"
PRIu64
",tid:%d data block created, mixblock:%d, brange:%"
PRIu64
"-%"
PRIu64
" rows:%d,
0x%"
PRIx
64
,
pQueryHandle
,
pCheckInfo
->
tableId
.
uid
,
pCheckInfo
->
tableId
.
tid
,
cur
->
mixBlock
,
cur
->
win
.
skey
,
pQueryHandle
,
pCheckInfo
->
tableId
.
uid
,
pCheckInfo
->
tableId
.
tid
,
cur
->
mixBlock
,
cur
->
win
.
skey
,
cur
->
win
.
ekey
,
cur
->
rows
,
pQueryHandle
->
qId
);
cur
->
win
.
ekey
,
cur
->
rows
,
pQueryHandle
->
qId
);
}
}
...
@@ -1919,12 +1923,12 @@ static int32_t createDataBlocksInfo(STsdbQueryHandle* pQueryHandle, int32_t numO
...
@@ -1919,12 +1923,12 @@ static int32_t createDataBlocksInfo(STsdbQueryHandle* pQueryHandle, int32_t numO
memcpy
(
pQueryHandle
->
pDataBlockInfo
,
sup
.
pDataBlockInfo
[
0
],
sizeof
(
STableBlockInfo
)
*
numOfBlocks
);
memcpy
(
pQueryHandle
->
pDataBlockInfo
,
sup
.
pDataBlockInfo
[
0
],
sizeof
(
STableBlockInfo
)
*
numOfBlocks
);
cleanBlockOrderSupporter
(
&
sup
,
numOfQualTables
);
cleanBlockOrderSupporter
(
&
sup
,
numOfQualTables
);
tsdbDebug
(
"%p create data blocks info struct completed for 1 table, %d blocks not sorted
%"
PRIu
64
,
pQueryHandle
,
cnt
,
tsdbDebug
(
"%p create data blocks info struct completed for 1 table, %d blocks not sorted
0x%"
PRIx
64
,
pQueryHandle
,
cnt
,
pQueryHandle
->
qId
);
pQueryHandle
->
qId
);
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
tsdbDebug
(
"%p create data blocks info struct completed, %d blocks in %d tables
%"
PRIu
64
,
pQueryHandle
,
cnt
,
tsdbDebug
(
"%p create data blocks info struct completed, %d blocks in %d tables
0x%"
PRIx
64
,
pQueryHandle
,
cnt
,
numOfQualTables
,
pQueryHandle
->
qId
);
numOfQualTables
,
pQueryHandle
->
qId
);
assert
(
cnt
<=
numOfBlocks
&&
numOfQualTables
<=
numOfTables
);
// the pTableQueryInfo[j]->numOfBlocks may be 0
assert
(
cnt
<=
numOfBlocks
&&
numOfQualTables
<=
numOfTables
);
// the pTableQueryInfo[j]->numOfBlocks may be 0
...
@@ -1961,7 +1965,7 @@ static int32_t createDataBlocksInfo(STsdbQueryHandle* pQueryHandle, int32_t numO
...
@@ -1961,7 +1965,7 @@ static int32_t createDataBlocksInfo(STsdbQueryHandle* pQueryHandle, int32_t numO
* }
* }
*/
*/
tsdbDebug
(
"%p %d data blocks sort completed,
%"
PRIu
64
,
pQueryHandle
,
cnt
,
pQueryHandle
->
qId
);
tsdbDebug
(
"%p %d data blocks sort completed,
0x%"
PRIx
64
,
pQueryHandle
,
cnt
,
pQueryHandle
->
qId
);
cleanBlockOrderSupporter
(
&
sup
,
numOfTables
);
cleanBlockOrderSupporter
(
&
sup
,
numOfTables
);
free
(
pTree
);
free
(
pTree
);
...
@@ -2019,7 +2023,7 @@ static int32_t getFirstFileDataBlock(STsdbQueryHandle* pQueryHandle, bool* exist
...
@@ -2019,7 +2023,7 @@ static int32_t getFirstFileDataBlock(STsdbQueryHandle* pQueryHandle, bool* exist
if
((
ASCENDING_TRAVERSE
(
pQueryHandle
->
order
)
&&
win
.
skey
>
pQueryHandle
->
window
.
ekey
)
||
if
((
ASCENDING_TRAVERSE
(
pQueryHandle
->
order
)
&&
win
.
skey
>
pQueryHandle
->
window
.
ekey
)
||
(
!
ASCENDING_TRAVERSE
(
pQueryHandle
->
order
)
&&
win
.
ekey
<
pQueryHandle
->
window
.
ekey
))
{
(
!
ASCENDING_TRAVERSE
(
pQueryHandle
->
order
)
&&
win
.
ekey
<
pQueryHandle
->
window
.
ekey
))
{
tsdbUnLockFS
(
REPO_FS
(
pQueryHandle
->
pTsdb
));
tsdbUnLockFS
(
REPO_FS
(
pQueryHandle
->
pTsdb
));
tsdbDebug
(
"%p remain files are not qualified for qrange:%"
PRId64
"-%"
PRId64
", ignore,
%"
PRIu
64
,
pQueryHandle
,
tsdbDebug
(
"%p remain files are not qualified for qrange:%"
PRId64
"-%"
PRId64
", ignore,
0x%"
PRIx
64
,
pQueryHandle
,
pQueryHandle
->
window
.
skey
,
pQueryHandle
->
window
.
ekey
,
pQueryHandle
->
qId
);
pQueryHandle
->
window
.
skey
,
pQueryHandle
->
window
.
ekey
,
pQueryHandle
->
qId
);
pQueryHandle
->
pFileGroup
=
NULL
;
pQueryHandle
->
pFileGroup
=
NULL
;
assert
(
pQueryHandle
->
numOfBlocks
==
0
);
assert
(
pQueryHandle
->
numOfBlocks
==
0
);
...
@@ -2043,7 +2047,7 @@ static int32_t getFirstFileDataBlock(STsdbQueryHandle* pQueryHandle, bool* exist
...
@@ -2043,7 +2047,7 @@ static int32_t getFirstFileDataBlock(STsdbQueryHandle* pQueryHandle, bool* exist
break
;
break
;
}
}
tsdbDebug
(
"%p %d blocks found in file for %d table(s), fid:%d,
%"
PRIu
64
,
pQueryHandle
,
numOfBlocks
,
numOfTables
,
tsdbDebug
(
"%p %d blocks found in file for %d table(s), fid:%d,
0x%"
PRIx
64
,
pQueryHandle
,
numOfBlocks
,
numOfTables
,
pQueryHandle
->
pFileGroup
->
fid
,
pQueryHandle
->
qId
);
pQueryHandle
->
pFileGroup
->
fid
,
pQueryHandle
->
qId
);
assert
(
numOfBlocks
>=
0
);
assert
(
numOfBlocks
>=
0
);
...
@@ -2135,7 +2139,7 @@ int32_t tsdbGetFileBlocksDistInfo(TsdbQueryHandleT* queryHandle, STableBlockDist
...
@@ -2135,7 +2139,7 @@ int32_t tsdbGetFileBlocksDistInfo(TsdbQueryHandleT* queryHandle, STableBlockDist
if
((
ASCENDING_TRAVERSE
(
pQueryHandle
->
order
)
&&
win
.
skey
>
pQueryHandle
->
window
.
ekey
)
||
if
((
ASCENDING_TRAVERSE
(
pQueryHandle
->
order
)
&&
win
.
skey
>
pQueryHandle
->
window
.
ekey
)
||
(
!
ASCENDING_TRAVERSE
(
pQueryHandle
->
order
)
&&
win
.
ekey
<
pQueryHandle
->
window
.
ekey
))
{
(
!
ASCENDING_TRAVERSE
(
pQueryHandle
->
order
)
&&
win
.
ekey
<
pQueryHandle
->
window
.
ekey
))
{
tsdbUnLockFS
(
REPO_FS
(
pQueryHandle
->
pTsdb
));
tsdbUnLockFS
(
REPO_FS
(
pQueryHandle
->
pTsdb
));
tsdbDebug
(
"%p remain files are not qualified for qrange:%"
PRId64
"-%"
PRId64
", ignore,
%"
PRIu
64
,
pQueryHandle
,
tsdbDebug
(
"%p remain files are not qualified for qrange:%"
PRId64
"-%"
PRId64
", ignore,
0x%"
PRIx
64
,
pQueryHandle
,
pQueryHandle
->
window
.
skey
,
pQueryHandle
->
window
.
ekey
,
pQueryHandle
->
qId
);
pQueryHandle
->
window
.
skey
,
pQueryHandle
->
window
.
ekey
,
pQueryHandle
->
qId
);
pQueryHandle
->
pFileGroup
=
NULL
;
pQueryHandle
->
pFileGroup
=
NULL
;
break
;
break
;
...
@@ -2159,7 +2163,7 @@ int32_t tsdbGetFileBlocksDistInfo(TsdbQueryHandleT* queryHandle, STableBlockDist
...
@@ -2159,7 +2163,7 @@ int32_t tsdbGetFileBlocksDistInfo(TsdbQueryHandleT* queryHandle, STableBlockDist
break
;
break
;
}
}
tsdbDebug
(
"%p %d blocks found in file for %d table(s), fid:%d,
%"
PRIu
64
,
pQueryHandle
,
numOfBlocks
,
numOfTables
,
tsdbDebug
(
"%p %d blocks found in file for %d table(s), fid:%d,
0x%"
PRIx
64
,
pQueryHandle
,
numOfBlocks
,
numOfTables
,
pQueryHandle
->
pFileGroup
->
fid
,
pQueryHandle
->
qId
);
pQueryHandle
->
pFileGroup
->
fid
,
pQueryHandle
->
qId
);
if
(
numOfBlocks
==
0
)
{
if
(
numOfBlocks
==
0
)
{
...
@@ -2207,7 +2211,7 @@ static int32_t getDataBlocksInFiles(STsdbQueryHandle* pQueryHandle, bool* exists
...
@@ -2207,7 +2211,7 @@ static int32_t getDataBlocksInFiles(STsdbQueryHandle* pQueryHandle, bool* exists
if
((
!
cur
->
mixBlock
)
||
cur
->
blockCompleted
)
{
if
((
!
cur
->
mixBlock
)
||
cur
->
blockCompleted
)
{
// all data blocks in current file has been checked already, try next file if exists
// all data blocks in current file has been checked already, try next file if exists
}
else
{
}
else
{
tsdbDebug
(
"%p continue in current data block, index:%d, pos:%d,
%"
PRIu
64
,
pQueryHandle
,
cur
->
slot
,
cur
->
pos
,
tsdbDebug
(
"%p continue in current data block, index:%d, pos:%d,
0x%"
PRIx
64
,
pQueryHandle
,
cur
->
slot
,
cur
->
pos
,
pQueryHandle
->
qId
);
pQueryHandle
->
qId
);
int32_t
code
=
handleDataMergeIfNeeded
(
pQueryHandle
,
pBlockInfo
->
compBlock
,
pCheckInfo
);
int32_t
code
=
handleDataMergeIfNeeded
(
pQueryHandle
,
pBlockInfo
->
compBlock
,
pCheckInfo
);
*
exists
=
(
pQueryHandle
->
realNumOfRows
>
0
);
*
exists
=
(
pQueryHandle
->
realNumOfRows
>
0
);
...
@@ -2336,7 +2340,7 @@ static int tsdbReadRowsFromCache(STableCheckInfo* pCheckInfo, TSKEY maxKey, int
...
@@ -2336,7 +2340,7 @@ static int tsdbReadRowsFromCache(STableCheckInfo* pCheckInfo, TSKEY maxKey, int
}
}
int64_t
elapsedTime
=
taosGetTimestampUs
()
-
st
;
int64_t
elapsedTime
=
taosGetTimestampUs
()
-
st
;
tsdbDebug
(
"%p build data block from cache completed, elapsed time:%"
PRId64
" us, numOfRows:%d, numOfCols:%d,
%"
PRIu
64
,
pQueryHandle
,
tsdbDebug
(
"%p build data block from cache completed, elapsed time:%"
PRId64
" us, numOfRows:%d, numOfCols:%d,
0x%"
PRIx
64
,
pQueryHandle
,
elapsedTime
,
numOfRows
,
numOfCols
,
pQueryHandle
->
qId
);
elapsedTime
,
numOfRows
,
numOfCols
,
pQueryHandle
->
qId
);
return
numOfRows
;
return
numOfRows
;
...
@@ -3206,9 +3210,10 @@ int32_t tsdbQuerySTableByTagCond(STsdbRepo* tsdb, uint64_t uid, TSKEY skey, cons
...
@@ -3206,9 +3210,10 @@ int32_t tsdbQuerySTableByTagCond(STsdbRepo* tsdb, uint64_t uid, TSKEY skey, cons
pGroupInfo
->
numOfTables
=
(
uint32_t
)
taosArrayGetSize
(
res
);
pGroupInfo
->
numOfTables
=
(
uint32_t
)
taosArrayGetSize
(
res
);
pGroupInfo
->
pGroupList
=
createTableGroup
(
res
,
pTagSchema
,
pColIndex
,
numOfCols
,
skey
);
pGroupInfo
->
pGroupList
=
createTableGroup
(
res
,
pTagSchema
,
pColIndex
,
numOfCols
,
skey
);
tsdbDebug
(
"%p no table name/tag condition, all tables
belong to one group, numOfTables:%u"
,
tsdb
,
pGroupInfo
->
numOfTables
);
tsdbDebug
(
"%p no table name/tag condition, all tables
qualified, numOfTables:%u, group:%zu"
,
tsdb
,
taosArrayDestroy
(
res
);
pGroupInfo
->
numOfTables
,
taosArrayGetSize
(
pGroupInfo
->
pGroupList
)
);
taosArrayDestroy
(
res
);
if
(
tsdbUnlockRepoMeta
(
tsdb
)
<
0
)
goto
_error
;
if
(
tsdbUnlockRepoMeta
(
tsdb
)
<
0
)
goto
_error
;
return
ret
;
return
ret
;
}
}
...
@@ -3391,7 +3396,7 @@ void tsdbCleanupQueryHandle(TsdbQueryHandleT queryHandle) {
...
@@ -3391,7 +3396,7 @@ void tsdbCleanupQueryHandle(TsdbQueryHandleT queryHandle) {
pQueryHandle
->
next
=
doFreeColumnInfoData
(
pQueryHandle
->
next
);
pQueryHandle
->
next
=
doFreeColumnInfoData
(
pQueryHandle
->
next
);
SIOCostSummary
*
pCost
=
&
pQueryHandle
->
cost
;
SIOCostSummary
*
pCost
=
&
pQueryHandle
->
cost
;
tsdbDebug
(
"%p :io-cost summary: statis-info:%"
PRId64
" us, datablock:%"
PRId64
" us, check data:%"
PRId64
" us,
%"
PRIu
64
,
tsdbDebug
(
"%p :io-cost summary: statis-info:%"
PRId64
" us, datablock:%"
PRId64
" us, check data:%"
PRId64
" us,
0x%"
PRIx
64
,
pQueryHandle
,
pCost
->
statisInfoLoadTime
,
pCost
->
blockLoadTime
,
pCost
->
checkForNextTime
,
pQueryHandle
->
qId
);
pQueryHandle
,
pCost
->
statisInfoLoadTime
,
pCost
->
blockLoadTime
,
pCost
->
checkForNextTime
,
pQueryHandle
->
qId
);
tfree
(
pQueryHandle
);
tfree
(
pQueryHandle
);
...
...
src/util/src/tcompare.c
浏览文件 @
272b524b
...
@@ -398,6 +398,10 @@ int32_t doCompare(const char* f1, const char* f2, int32_t type, size_t size) {
...
@@ -398,6 +398,10 @@ int32_t doCompare(const char* f1, const char* f2, int32_t type, size_t size) {
case
TSDB_DATA_TYPE_SMALLINT
:
DEFAULT_COMP
(
GET_INT16_VAL
(
f1
),
GET_INT16_VAL
(
f2
));
case
TSDB_DATA_TYPE_SMALLINT
:
DEFAULT_COMP
(
GET_INT16_VAL
(
f1
),
GET_INT16_VAL
(
f2
));
case
TSDB_DATA_TYPE_TINYINT
:
case
TSDB_DATA_TYPE_TINYINT
:
case
TSDB_DATA_TYPE_BOOL
:
DEFAULT_COMP
(
GET_INT8_VAL
(
f1
),
GET_INT8_VAL
(
f2
));
case
TSDB_DATA_TYPE_BOOL
:
DEFAULT_COMP
(
GET_INT8_VAL
(
f1
),
GET_INT8_VAL
(
f2
));
case
TSDB_DATA_TYPE_UTINYINT
:
DEFAULT_COMP
(
GET_UINT8_VAL
(
f1
),
GET_UINT8_VAL
(
f2
));
case
TSDB_DATA_TYPE_USMALLINT
:
DEFAULT_COMP
(
GET_UINT16_VAL
(
f1
),
GET_UINT16_VAL
(
f2
));
case
TSDB_DATA_TYPE_UINT
:
DEFAULT_COMP
(
GET_UINT32_VAL
(
f1
),
GET_UINT32_VAL
(
f2
));
case
TSDB_DATA_TYPE_UBIGINT
:
DEFAULT_COMP
(
GET_UINT64_VAL
(
f1
),
GET_UINT64_VAL
(
f2
));
case
TSDB_DATA_TYPE_NCHAR
:
{
case
TSDB_DATA_TYPE_NCHAR
:
{
tstr
*
t1
=
(
tstr
*
)
f1
;
tstr
*
t1
=
(
tstr
*
)
f1
;
tstr
*
t2
=
(
tstr
*
)
f2
;
tstr
*
t2
=
(
tstr
*
)
f2
;
...
...
src/util/src/tcrc32c.c
浏览文件 @
272b524b
...
@@ -736,7 +736,7 @@ static uint32_t table[16][256] = {
...
@@ -736,7 +736,7 @@ static uint32_t table[16][256] = {
0x9c221d09
,
0x6e2e10f7
,
0x7dd67004
,
0x8fda7dfa
}
0x9c221d09
,
0x6e2e10f7
,
0x7dd67004
,
0x8fda7dfa
}
};
};
#if
ndef _TD_ARM_
#if
!defined(_TD_ARM_) && !defined(_TD_MIPS_)
static
uint32_t
long_shifts
[
4
][
256
]
=
{
static
uint32_t
long_shifts
[
4
][
256
]
=
{
{
0x00000000
,
0xe040e0ac
,
0xc56db7a9
,
0x252d5705
,
0x8f3719a3
,
0x6f77f90f
,
{
0x00000000
,
0xe040e0ac
,
0xc56db7a9
,
0x252d5705
,
0x8f3719a3
,
0x6f77f90f
,
0x4a5aae0a
,
0xaa1a4ea6
,
0x1b8245b7
,
0xfbc2a51b
,
0xdeeff21e
,
0x3eaf12b2
,
0x4a5aae0a
,
0xaa1a4ea6
,
0x1b8245b7
,
0xfbc2a51b
,
0xdeeff21e
,
0x3eaf12b2
,
...
@@ -1187,7 +1187,7 @@ uint32_t crc32c_sf(uint32_t crci, crc_stream input, size_t length) {
...
@@ -1187,7 +1187,7 @@ uint32_t crc32c_sf(uint32_t crci, crc_stream input, size_t length) {
}
}
return
(
uint32_t
)
crc
^
0xffffffff
;
return
(
uint32_t
)
crc
^
0xffffffff
;
}
}
#if
ndef _TD_ARM_
#if
!defined(_TD_ARM_) && !defined(_TD_MIPS_)
/* Apply the zeros operator table to crc. */
/* Apply the zeros operator table to crc. */
static
uint32_t
shift_crc
(
uint32_t
shift_table
[][
256
],
uint32_t
crc
)
{
static
uint32_t
shift_crc
(
uint32_t
shift_table
[][
256
],
uint32_t
crc
)
{
return
shift_table
[
0
][
crc
&
0xff
]
^
shift_table
[
1
][(
crc
>>
8
)
&
0xff
]
^
return
shift_table
[
0
][
crc
&
0xff
]
^
shift_table
[
1
][(
crc
>>
8
)
&
0xff
]
^
...
@@ -1198,7 +1198,7 @@ static uint32_t shift_crc(uint32_t shift_table[][256], uint32_t crc) {
...
@@ -1198,7 +1198,7 @@ static uint32_t shift_crc(uint32_t shift_table[][256], uint32_t crc) {
version. Otherwise, use the software version. */
version. Otherwise, use the software version. */
uint32_t
(
*
crc32c
)(
uint32_t
crci
,
crc_stream
bytes
,
size_t
len
)
=
crc32c_sf
;
uint32_t
(
*
crc32c
)(
uint32_t
crci
,
crc_stream
bytes
,
size_t
len
)
=
crc32c_sf
;
#if
ndef _TD_ARM_
#if
!defined(_TD_ARM_) && !defined(_TD_MIPS_)
/* Compute CRC-32C using the Intel hardware instruction. */
/* Compute CRC-32C using the Intel hardware instruction. */
uint32_t
crc32c_hw
(
uint32_t
crc
,
crc_stream
buf
,
size_t
len
)
{
uint32_t
crc32c_hw
(
uint32_t
crc
,
crc_stream
buf
,
size_t
len
)
{
crc_stream
next
=
buf
;
crc_stream
next
=
buf
;
...
@@ -1353,7 +1353,7 @@ uint32_t crc32c_hw(uint32_t crc, crc_stream buf, size_t len) {
...
@@ -1353,7 +1353,7 @@ uint32_t crc32c_hw(uint32_t crc, crc_stream buf, size_t len) {
#endif // #ifndef _TD_ARM_
#endif // #ifndef _TD_ARM_
void
taosResolveCRC
()
{
void
taosResolveCRC
()
{
#if defined _TD_ARM_ || defined WINDOWS
#if defined _TD_ARM_ || defined
_TD_MIPS_ || defined
WINDOWS
crc32c
=
crc32c_sf
;
crc32c
=
crc32c_sf
;
#else
#else
int
sse42
;
int
sse42
;
...
...
src/util/src/tlog.c
浏览文件 @
272b524b
...
@@ -416,7 +416,8 @@ void taosPrintLog(const char *flags, int32_t dflag, const char *format, ...) {
...
@@ -416,7 +416,8 @@ void taosPrintLog(const char *flags, int32_t dflag, const char *format, ...) {
}
}
}
}
if
(
dflag
&
DEBUG_SCREEN
)
taosWrite
(
1
,
buffer
,
(
uint32_t
)
len
);
if
(
dflag
&
DEBUG_SCREEN
)
taosWrite
(
1
,
buffer
,
(
uint32_t
)
len
);
if
(
dflag
==
255
)
nInfo
(
buffer
,
len
);
if
(
dflag
==
255
)
nInfo
(
buffer
,
len
);
}
}
...
...
src/util/src/tnettest.c
浏览文件 @
272b524b
...
@@ -291,16 +291,16 @@ static void taosNetCheckPort(uint32_t hostIp, int32_t startPort, int32_t endPort
...
@@ -291,16 +291,16 @@ static void taosNetCheckPort(uint32_t hostIp, int32_t startPort, int32_t endPort
info
.
port
=
port
;
info
.
port
=
port
;
ret
=
taosNetCheckTcpPort
(
&
info
);
ret
=
taosNetCheckTcpPort
(
&
info
);
if
(
ret
!=
0
)
{
if
(
ret
!=
0
)
{
uError
(
"failed to test TCP port:%d
"
,
port
);
printf
(
"failed to test TCP port:%d
\n
"
,
port
);
}
else
{
}
else
{
uInfo
(
"successed to test TCP port:%d
"
,
port
);
printf
(
"successed to test TCP port:%d
\n
"
,
port
);
}
}
ret
=
taosNetCheckUdpPort
(
&
info
);
ret
=
taosNetCheckUdpPort
(
&
info
);
if
(
ret
!=
0
)
{
if
(
ret
!=
0
)
{
uError
(
"failed to test UDP port:%d
"
,
port
);
printf
(
"failed to test UDP port:%d
\n
"
,
port
);
}
else
{
}
else
{
uInfo
(
"successed to test UDP port:%d
"
,
port
);
printf
(
"successed to test UDP port:%d
\n
"
,
port
);
}
}
}
}
}
}
...
@@ -464,9 +464,9 @@ static void taosNetTestRpc(char *host, int32_t startPort, int32_t pkgLen) {
...
@@ -464,9 +464,9 @@ static void taosNetTestRpc(char *host, int32_t startPort, int32_t pkgLen) {
int32_t
ret
=
taosNetCheckRpc
(
host
,
port
,
sendpkgLen
,
spi
,
NULL
);
int32_t
ret
=
taosNetCheckRpc
(
host
,
port
,
sendpkgLen
,
spi
,
NULL
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
uError
(
"failed to test TCP port:%d
"
,
port
);
printf
(
"failed to test TCP port:%d
\n
"
,
port
);
}
else
{
}
else
{
uInfo
(
"successed to test TCP port:%d
"
,
port
);
printf
(
"successed to test TCP port:%d
\n
"
,
port
);
}
}
if
(
pkgLen
>=
tsRpcMaxUdpSize
)
{
if
(
pkgLen
>=
tsRpcMaxUdpSize
)
{
...
@@ -477,9 +477,9 @@ static void taosNetTestRpc(char *host, int32_t startPort, int32_t pkgLen) {
...
@@ -477,9 +477,9 @@ static void taosNetTestRpc(char *host, int32_t startPort, int32_t pkgLen) {
ret
=
taosNetCheckRpc
(
host
,
port
,
pkgLen
,
spi
,
NULL
);
ret
=
taosNetCheckRpc
(
host
,
port
,
pkgLen
,
spi
,
NULL
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
uError
(
"failed to test UDP port:%d
"
,
port
);
printf
(
"failed to test UDP port:%d
\n
"
,
port
);
}
else
{
}
else
{
uInfo
(
"successed to test UDP port:%d
"
,
port
);
printf
(
"successed to test UDP port:%d
\n
"
,
port
);
}
}
}
}
...
@@ -539,7 +539,7 @@ static void taosNetTestServer(char *host, int32_t startPort, int32_t pkgLen) {
...
@@ -539,7 +539,7 @@ static void taosNetTestServer(char *host, int32_t startPort, int32_t pkgLen) {
}
}
void
taosNetTest
(
char
*
role
,
char
*
host
,
int32_t
port
,
int32_t
pkgLen
)
{
void
taosNetTest
(
char
*
role
,
char
*
host
,
int32_t
port
,
int32_t
pkgLen
)
{
tscEmbedded
=
1
;
//
tscEmbedded = 1;
if
(
host
==
NULL
)
host
=
tsLocalFqdn
;
if
(
host
==
NULL
)
host
=
tsLocalFqdn
;
if
(
port
==
0
)
port
=
tsServerPort
;
if
(
port
==
0
)
port
=
tsServerPort
;
if
(
pkgLen
<=
10
)
pkgLen
=
1000
;
if
(
pkgLen
<=
10
)
pkgLen
=
1000
;
...
@@ -559,5 +559,5 @@ void taosNetTest(char *role, char *host, int32_t port, int32_t pkgLen) {
...
@@ -559,5 +559,5 @@ void taosNetTest(char *role, char *host, int32_t port, int32_t pkgLen) {
taosNetTestStartup
(
host
,
port
);
taosNetTestStartup
(
host
,
port
);
}
}
tscEmbedded
=
0
;
//
tscEmbedded = 0;
}
}
src/util/src/ttimer.c
浏览文件 @
272b524b
...
@@ -538,7 +538,7 @@ static void taosTmrModuleInit(void) {
...
@@ -538,7 +538,7 @@ static void taosTmrModuleInit(void) {
void
*
taosTmrInit
(
int
maxNumOfTmrs
,
int
resolution
,
int
longest
,
const
char
*
label
)
{
void
*
taosTmrInit
(
int
maxNumOfTmrs
,
int
resolution
,
int
longest
,
const
char
*
label
)
{
const
char
*
ret
=
monotonicInit
();
const
char
*
ret
=
monotonicInit
();
tmr
Info
(
"ttimer monotonic clock source:%s"
,
ret
);
tmr
Debug
(
"ttimer monotonic clock source:%s"
,
ret
);
pthread_once
(
&
tmrModuleInit
,
taosTmrModuleInit
);
pthread_once
(
&
tmrModuleInit
,
taosTmrModuleInit
);
...
...
src/vnode/src/vnodeRead.c
浏览文件 @
272b524b
...
@@ -183,7 +183,7 @@ static int32_t vnodeDumpQueryResult(SRspRet *pRet, void *pVnode, uint64_t qId, v
...
@@ -183,7 +183,7 @@ static int32_t vnodeDumpQueryResult(SRspRet *pRet, void *pVnode, uint64_t qId, v
}
}
}
else
{
}
else
{
*
freeHandle
=
true
;
*
freeHandle
=
true
;
vTrace
(
"QInfo:
%"
PRIu
64
"-%p exec completed, free handle:%d"
,
qId
,
*
handle
,
*
freeHandle
);
vTrace
(
"QInfo:
0x%"
PRIx
64
"-%p exec completed, free handle:%d"
,
qId
,
*
handle
,
*
freeHandle
);
}
}
}
else
{
}
else
{
SRetrieveTableRsp
*
pRsp
=
(
SRetrieveTableRsp
*
)
rpcMallocCont
(
sizeof
(
SRetrieveTableRsp
));
SRetrieveTableRsp
*
pRsp
=
(
SRetrieveTableRsp
*
)
rpcMallocCont
(
sizeof
(
SRetrieveTableRsp
));
...
@@ -244,7 +244,7 @@ static int32_t vnodeProcessQueryMsg(SVnodeObj *pVnode, SVReadMsg *pRead) {
...
@@ -244,7 +244,7 @@ static int32_t vnodeProcessQueryMsg(SVnodeObj *pVnode, SVReadMsg *pRead) {
if
(
handle
==
NULL
)
{
// failed to register qhandle
if
(
handle
==
NULL
)
{
// failed to register qhandle
pRsp
->
code
=
terrno
;
pRsp
->
code
=
terrno
;
terrno
=
0
;
terrno
=
0
;
vError
(
"vgId:%d, QInfo:
%"
PRIu
64
"-%p register qhandle failed, return to app, code:%s"
,
pVnode
->
vgId
,
qId
,
(
void
*
)
pQInfo
,
vError
(
"vgId:%d, QInfo:
0x%"
PRIx
64
"-%p register qhandle failed, return to app, code:%s"
,
pVnode
->
vgId
,
qId
,
(
void
*
)
pQInfo
,
tstrerror
(
pRsp
->
code
));
tstrerror
(
pRsp
->
code
));
qDestroyQueryInfo
(
pQInfo
);
// destroy it directly
qDestroyQueryInfo
(
pQInfo
);
// destroy it directly
return
pRsp
->
code
;
return
pRsp
->
code
;
...
@@ -255,7 +255,7 @@ static int32_t vnodeProcessQueryMsg(SVnodeObj *pVnode, SVReadMsg *pRead) {
...
@@ -255,7 +255,7 @@ static int32_t vnodeProcessQueryMsg(SVnodeObj *pVnode, SVReadMsg *pRead) {
if
(
handle
!=
NULL
&&
if
(
handle
!=
NULL
&&
vnodeNotifyCurrentQhandle
(
pRead
->
rpcHandle
,
qId
,
*
handle
,
pVnode
->
vgId
)
!=
TSDB_CODE_SUCCESS
)
{
vnodeNotifyCurrentQhandle
(
pRead
->
rpcHandle
,
qId
,
*
handle
,
pVnode
->
vgId
)
!=
TSDB_CODE_SUCCESS
)
{
vError
(
"vgId:%d, QInfo:
%"
PRIu
64
"-%p, query discarded since link is broken, %p"
,
pVnode
->
vgId
,
qId
,
*
handle
,
vError
(
"vgId:%d, QInfo:
0x%"
PRIx
64
"-%p, query discarded since link is broken, %p"
,
pVnode
->
vgId
,
qId
,
*
handle
,
pRead
->
rpcHandle
);
pRead
->
rpcHandle
);
pRsp
->
code
=
TSDB_CODE_RPC_NETWORK_UNAVAIL
;
pRsp
->
code
=
TSDB_CODE_RPC_NETWORK_UNAVAIL
;
qReleaseQInfo
(
pVnode
->
qMgmt
,
(
void
**
)
&
handle
,
true
);
qReleaseQInfo
(
pVnode
->
qMgmt
,
(
void
**
)
&
handle
,
true
);
...
@@ -266,7 +266,7 @@ static int32_t vnodeProcessQueryMsg(SVnodeObj *pVnode, SVReadMsg *pRead) {
...
@@ -266,7 +266,7 @@ static int32_t vnodeProcessQueryMsg(SVnodeObj *pVnode, SVReadMsg *pRead) {
}
}
if
(
handle
!=
NULL
)
{
if
(
handle
!=
NULL
)
{
vTrace
(
"vgId:%d, QInfo:
%"
PRIu
64
"-%p, dnode query msg disposed, create qhandle and returns to app"
,
vgId
,
qId
,
*
handle
);
vTrace
(
"vgId:%d, QInfo:
0x%"
PRIx
64
"-%p, dnode query msg disposed, create qhandle and returns to app"
,
vgId
,
qId
,
*
handle
);
code
=
vnodePutItemIntoReadQueue
(
pVnode
,
handle
,
pRead
->
rpcHandle
);
code
=
vnodePutItemIntoReadQueue
(
pVnode
,
handle
,
pRead
->
rpcHandle
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
pRsp
->
code
=
code
;
pRsp
->
code
=
code
;
...
@@ -331,7 +331,7 @@ static int32_t vnodeProcessFetchMsg(SVnodeObj *pVnode, SVReadMsg *pRead) {
...
@@ -331,7 +331,7 @@ static int32_t vnodeProcessFetchMsg(SVnodeObj *pVnode, SVReadMsg *pRead) {
pRetrieve
->
free
=
htons
(
pRetrieve
->
free
);
pRetrieve
->
free
=
htons
(
pRetrieve
->
free
);
pRetrieve
->
qId
=
htobe64
(
pRetrieve
->
qId
);
pRetrieve
->
qId
=
htobe64
(
pRetrieve
->
qId
);
vTrace
(
"vgId:%d, qId:
%"
PRIu
64
", retrieve msg is disposed, free:%d, conn:%p"
,
pVnode
->
vgId
,
pRetrieve
->
qId
,
vTrace
(
"vgId:%d, qId:
0x%"
PRIx
64
", retrieve msg is disposed, free:%d, conn:%p"
,
pVnode
->
vgId
,
pRetrieve
->
qId
,
pRetrieve
->
free
,
pRead
->
rpcHandle
);
pRetrieve
->
free
,
pRead
->
rpcHandle
);
memset
(
pRet
,
0
,
sizeof
(
SRspRet
));
memset
(
pRet
,
0
,
sizeof
(
SRspRet
));
...
@@ -414,7 +414,7 @@ int32_t vnodeNotifyCurrentQhandle(void *handle, uint64_t qId, void *qhandle, int
...
@@ -414,7 +414,7 @@ int32_t vnodeNotifyCurrentQhandle(void *handle, uint64_t qId, void *qhandle, int
pMsg
->
header
.
vgId
=
htonl
(
vgId
);
pMsg
->
header
.
vgId
=
htonl
(
vgId
);
pMsg
->
header
.
contLen
=
htonl
(
sizeof
(
SRetrieveTableMsg
));
pMsg
->
header
.
contLen
=
htonl
(
sizeof
(
SRetrieveTableMsg
));
vTrace
(
"QInfo:
%"
PRIu
64
"-%p register qhandle to connect:%p"
,
qId
,
qhandle
,
handle
);
vTrace
(
"QInfo:
0x%"
PRIx
64
"-%p register qhandle to connect:%p"
,
qId
,
qhandle
,
handle
);
return
rpcReportProgress
(
handle
,
(
char
*
)
pMsg
,
sizeof
(
SRetrieveTableMsg
));
return
rpcReportProgress
(
handle
,
(
char
*
)
pMsg
,
sizeof
(
SRetrieveTableMsg
));
}
}
...
...
tests/examples/C#/C#checker/C#checker.cs
浏览文件 @
272b524b
此差异已折叠。
点击以展开。
tests/examples/C#/TDengineTest.cs
浏览文件 @
272b524b
...
@@ -165,7 +165,7 @@ namespace TDengineDriver
...
@@ -165,7 +165,7 @@ namespace TDengineDriver
public
void
ReadArgument
(
String
[]
argv
)
public
void
ReadArgument
(
String
[]
argv
)
{
{
PrintHelp
(
argv
);
PrintHelp
(
argv
);
host
=
this
.
GetArgumentAsString
(
argv
,
"-h"
,
"1
92.168.100.128
"
);
host
=
this
.
GetArgumentAsString
(
argv
,
"-h"
,
"1
27.0.0.1
"
);
user
=
this
.
GetArgumentAsString
(
argv
,
"-u"
,
"root"
);
user
=
this
.
GetArgumentAsString
(
argv
,
"-u"
,
"root"
);
password
=
this
.
GetArgumentAsString
(
argv
,
"-p"
,
"taosdata"
);
password
=
this
.
GetArgumentAsString
(
argv
,
"-p"
,
"taosdata"
);
dbName
=
this
.
GetArgumentAsString
(
argv
,
"-d"
,
"db"
);
dbName
=
this
.
GetArgumentAsString
(
argv
,
"-d"
,
"db"
);
...
@@ -212,42 +212,54 @@ namespace TDengineDriver
...
@@ -212,42 +212,54 @@ namespace TDengineDriver
StringBuilder
sql
=
new
StringBuilder
();
StringBuilder
sql
=
new
StringBuilder
();
sql
.
Append
(
"create database if not exists "
).
Append
(
this
.
dbName
);
sql
.
Append
(
"create database if not exists "
).
Append
(
this
.
dbName
);
IntPtr
res
=
TDengine
.
Query
(
this
.
conn
,
sql
.
ToString
());
IntPtr
res
=
TDengine
.
Query
(
this
.
conn
,
sql
.
ToString
());
if
(
res
!=
IntPtr
.
Zero
)
if
(
(
res
==
IntPtr
.
Zero
)
||
(
TDengine
.
ErrorNo
(
res
)
!=
0
)
)
{
{
Console
.
WriteLine
(
sql
.
ToString
()
+
" success"
);
Console
.
Write
(
sql
.
ToString
()
+
" failure, "
);
if
(
res
!=
IntPtr
.
Zero
)
{
Console
.
Write
(
"reason: "
+
TDengine
.
Error
(
res
));
}
Console
.
WriteLine
(
""
);
ExitProgram
();
}
}
else
else
{
{
Console
.
WriteLine
(
sql
.
ToString
()
+
" failure, reason: "
+
TDengine
.
Error
(
res
));
Console
.
WriteLine
(
sql
.
ToString
()
+
" success"
);
ExitProgram
();
}
}
TDengine
.
FreeResult
(
res
);
TDengine
.
FreeResult
(
res
);
sql
.
Clear
();
sql
.
Clear
();
sql
.
Append
(
"use "
).
Append
(
this
.
dbName
);
sql
.
Append
(
"use "
).
Append
(
this
.
dbName
);
res
=
TDengine
.
Query
(
this
.
conn
,
sql
.
ToString
());
res
=
TDengine
.
Query
(
this
.
conn
,
sql
.
ToString
());
if
(
res
!=
IntPtr
.
Zero
)
if
(
(
res
==
IntPtr
.
Zero
)
||
(
TDengine
.
ErrorNo
(
res
)
!=
0
)
)
{
{
Console
.
WriteLine
(
sql
.
ToString
()
+
" success"
);
Console
.
Write
(
sql
.
ToString
()
+
" failure, "
);
if
(
res
!=
IntPtr
.
Zero
)
{
Console
.
Write
(
"reason: "
+
TDengine
.
Error
(
res
));
}
Console
.
WriteLine
(
""
);
ExitProgram
();
}
}
else
else
{
{
Console
.
WriteLine
(
sql
.
ToString
()
+
" failure, reason: "
+
TDengine
.
Error
(
res
));
Console
.
WriteLine
(
sql
.
ToString
()
+
" success"
);
ExitProgram
();
}
}
TDengine
.
FreeResult
(
res
);
TDengine
.
FreeResult
(
res
);
sql
.
Clear
();
sql
.
Clear
();
sql
.
Append
(
"create table if not exists "
).
Append
(
this
.
stableName
).
Append
(
"(ts timestamp, v1 bool, v2 tinyint, v3 smallint, v4 int, v5 bigint, v6 float, v7 double, v8 binary(10), v9 nchar(10)) tags(t1 int)"
);
sql
.
Append
(
"create table if not exists "
).
Append
(
this
.
stableName
).
Append
(
"(ts timestamp, v1 bool, v2 tinyint, v3 smallint, v4 int, v5 bigint, v6 float, v7 double, v8 binary(10), v9 nchar(10)) tags(t1 int)"
);
res
=
TDengine
.
Query
(
this
.
conn
,
sql
.
ToString
());
res
=
TDengine
.
Query
(
this
.
conn
,
sql
.
ToString
());
if
(
res
!=
IntPtr
.
Zero
)
if
(
(
res
==
IntPtr
.
Zero
)
||
(
TDengine
.
ErrorNo
(
res
)
!=
0
)
)
{
{
Console
.
WriteLine
(
sql
.
ToString
()
+
" success"
);
Console
.
Write
(
sql
.
ToString
()
+
" failure, "
);
if
(
res
!=
IntPtr
.
Zero
)
{
Console
.
Write
(
"reason: "
+
TDengine
.
Error
(
res
));
}
Console
.
WriteLine
(
""
);
ExitProgram
();
}
}
else
else
{
{
Console
.
WriteLine
(
sql
.
ToString
()
+
" failure, reason: "
+
TDengine
.
Error
(
res
));
Console
.
WriteLine
(
sql
.
ToString
()
+
" success"
);
ExitProgram
();
}
}
TDengine
.
FreeResult
(
res
);
TDengine
.
FreeResult
(
res
);
...
@@ -257,14 +269,18 @@ namespace TDengineDriver
...
@@ -257,14 +269,18 @@ namespace TDengineDriver
sql
=
sql
.
Append
(
"create table if not exists "
).
Append
(
this
.
tablePrefix
).
Append
(
i
)
sql
=
sql
.
Append
(
"create table if not exists "
).
Append
(
this
.
tablePrefix
).
Append
(
i
)
.
Append
(
" using "
).
Append
(
this
.
stableName
).
Append
(
" tags("
).
Append
(
i
).
Append
(
")"
);
.
Append
(
" using "
).
Append
(
this
.
stableName
).
Append
(
" tags("
).
Append
(
i
).
Append
(
")"
);
res
=
TDengine
.
Query
(
this
.
conn
,
sql
.
ToString
());
res
=
TDengine
.
Query
(
this
.
conn
,
sql
.
ToString
());
if
(
res
!=
IntPtr
.
Zero
)
if
(
(
res
==
IntPtr
.
Zero
)
||
(
TDengine
.
ErrorNo
(
res
)
!=
0
)
)
{
{
Console
.
WriteLine
(
sql
.
ToString
()
+
" success"
);
Console
.
Write
(
sql
.
ToString
()
+
" failure, "
);
if
(
res
!=
IntPtr
.
Zero
)
{
Console
.
Write
(
"reason: "
+
TDengine
.
Error
(
res
));
}
Console
.
WriteLine
(
""
);
ExitProgram
();
}
}
else
else
{
{
Console
.
WriteLine
(
sql
.
ToString
()
+
" failure, reason: "
+
TDengine
.
Error
(
res
));
Console
.
WriteLine
(
sql
.
ToString
()
+
" success"
);
ExitProgram
();
}
}
TDengine
.
FreeResult
(
res
);
TDengine
.
FreeResult
(
res
);
}
}
...
@@ -298,9 +314,13 @@ namespace TDengineDriver
...
@@ -298,9 +314,13 @@ namespace TDengineDriver
.
Append
(
", 5, 6, 7, 'abc', 'def')"
);
.
Append
(
", 5, 6, 7, 'abc', 'def')"
);
}
}
IntPtr
res
=
TDengine
.
Query
(
this
.
conn
,
sql
.
ToString
());
IntPtr
res
=
TDengine
.
Query
(
this
.
conn
,
sql
.
ToString
());
if
(
res
==
IntPtr
.
Zero
)
if
(
(
res
==
IntPtr
.
Zero
)
||
(
TDengine
.
ErrorNo
(
res
)
!=
0
)
)
{
{
Console
.
WriteLine
(
sql
.
ToString
()
+
" failure, reason: "
+
TDengine
.
Error
(
res
));
Console
.
Write
(
sql
.
ToString
()
+
" failure, "
);
if
(
res
!=
IntPtr
.
Zero
)
{
Console
.
Write
(
"reason: "
+
TDengine
.
Error
(
res
));
}
Console
.
WriteLine
(
""
);
}
}
int
affectRows
=
TDengine
.
AffectRows
(
res
);
int
affectRows
=
TDengine
.
AffectRows
(
res
);
...
@@ -326,16 +346,20 @@ namespace TDengineDriver
...
@@ -326,16 +346,20 @@ namespace TDengineDriver
System
.
DateTime
start
=
new
System
.
DateTime
();
System
.
DateTime
start
=
new
System
.
DateTime
();
long
queryRows
=
0
;
long
queryRows
=
0
;
for
(
int
i
=
0
;
i
<
1
/*this.tableCount*/
;
++
i
)
for
(
int
i
=
0
;
i
<
1
/*this.tableCount*/
;
++
i
)
{
{
String
sql
=
"select * from "
+
this
.
dbName
+
"."
+
tablePrefix
+
i
;
String
sql
=
"select * from "
+
this
.
dbName
+
"."
+
tablePrefix
+
i
;
Console
.
WriteLine
(
sql
);
Console
.
WriteLine
(
sql
);
IntPtr
res
=
TDengine
.
Query
(
conn
,
sql
);
IntPtr
res
=
TDengine
.
Query
(
conn
,
sql
);
if
(
res
==
IntPtr
.
Zero
)
if
(
(
res
==
IntPtr
.
Zero
)
||
(
TDengine
.
ErrorNo
(
res
)
!=
0
)
)
{
{
Console
.
WriteLine
(
sql
+
" failure, reason: "
+
TDengine
.
Error
(
res
));
Console
.
Write
(
sql
.
ToString
()
+
" failure, "
);
if
(
res
!=
IntPtr
.
Zero
)
{
Console
.
Write
(
"reason: "
+
TDengine
.
Error
(
res
));
}
Console
.
WriteLine
(
""
);
ExitProgram
();
ExitProgram
();
}
}
...
@@ -439,8 +463,10 @@ namespace TDengineDriver
...
@@ -439,8 +463,10 @@ namespace TDengineDriver
if
(
TDengine
.
ErrorNo
(
res
)
!=
0
)
if
(
TDengine
.
ErrorNo
(
res
)
!=
0
)
{
{
Console
.
Write
(
"Query is not complete, Error {0:G}"
,
TDengine
.
ErrorNo
(
res
),
TDengine
.
Error
(
res
));
Console
.
Write
(
"Query is not complete, Error {0:G}"
,
TDengine
.
ErrorNo
(
res
),
TDengine
.
Error
(
res
));
}
}
Console
.
WriteLine
(
""
);
TDengine
.
FreeResult
(
res
);
TDengine
.
FreeResult
(
res
);
}
}
...
...
tests/examples/C#/taosdemo/taosdemo.cs
浏览文件 @
272b524b
...
@@ -370,16 +370,19 @@ namespace TDengineDriver
...
@@ -370,16 +370,19 @@ namespace TDengineDriver
StringBuilder
sql
=
new
StringBuilder
();
StringBuilder
sql
=
new
StringBuilder
();
sql
.
Append
(
"DROP DATABASE IF EXISTS "
).
Append
(
this
.
dbName
);
sql
.
Append
(
"DROP DATABASE IF EXISTS "
).
Append
(
this
.
dbName
);
IntPtr
res
=
TDengine
.
Query
(
this
.
conn
,
sql
.
ToString
());
IntPtr
res
=
TDengine
.
Query
(
this
.
conn
,
sql
.
ToString
());
if
(
res
!=
IntPtr
.
Zero
)
if
(
(
res
==
IntPtr
.
Zero
)
||
(
TDengine
.
ErrorNo
(
res
)
!=
0
)
)
{
{
VerbosePrint
(
sql
.
ToString
()
+
" success\n"
);
Console
.
Write
(
sql
.
ToString
()
+
" failure, "
);
if
(
res
!=
IntPtr
.
Zero
)
{
Console
.
Write
(
"reason: "
+
TDengine
.
Error
(
res
));
}
Console
.
WriteLine
(
""
);
CleanAndExitProgram
(
1
);
}
}
else
else
{
{
Console
.
WriteLine
(
sql
.
ToString
()
+
" failure, reason: "
+
TDengine
.
Error
(
res
));
VerbosePrint
(
sql
.
ToString
()
+
" success\n"
);
CleanAndExitProgram
(
1
);
}
}
}
}
public
void
CreateDb
()
public
void
CreateDb
()
...
@@ -387,14 +390,18 @@ namespace TDengineDriver
...
@@ -387,14 +390,18 @@ namespace TDengineDriver
StringBuilder
sql
=
new
StringBuilder
();
StringBuilder
sql
=
new
StringBuilder
();
sql
.
Append
(
"CREATE DATABASE IF NOT EXISTS "
).
Append
(
this
.
dbName
).
Append
(
" replica "
).
Append
(
this
.
replica
).
Append
(
" keep 36500"
);
sql
.
Append
(
"CREATE DATABASE IF NOT EXISTS "
).
Append
(
this
.
dbName
).
Append
(
" replica "
).
Append
(
this
.
replica
).
Append
(
" keep 36500"
);
IntPtr
res
=
TDengine
.
Query
(
this
.
conn
,
sql
.
ToString
());
IntPtr
res
=
TDengine
.
Query
(
this
.
conn
,
sql
.
ToString
());
if
(
res
!=
IntPtr
.
Zero
)
if
(
(
res
==
IntPtr
.
Zero
)
||
(
TDengine
.
ErrorNo
(
res
)
!=
0
)
)
{
{
VerbosePrint
(
sql
.
ToString
()
+
" success\n"
);
Console
.
Write
(
sql
.
ToString
()
+
" failure, "
);
if
(
res
!=
IntPtr
.
Zero
)
{
Console
.
Write
(
"reason: "
+
TDengine
.
Error
(
res
));
}
Console
.
WriteLine
(
""
);
CleanAndExitProgram
(
1
);
}
}
else
else
{
{
Console
.
WriteLine
(
sql
.
ToString
()
+
" failure, reason: "
+
TDengine
.
Error
(
res
));
VerbosePrint
(
sql
.
ToString
()
+
" success\n"
);
CleanAndExitProgram
(
1
);
}
}
TDengine
.
FreeResult
(
res
);
TDengine
.
FreeResult
(
res
);
}
}
...
@@ -408,14 +415,18 @@ namespace TDengineDriver
...
@@ -408,14 +415,18 @@ namespace TDengineDriver
Append
(
this
.
dbName
).
Append
(
"."
).
Append
(
this
.
stablePrefix
).
Append
(
this
.
dbName
).
Append
(
"."
).
Append
(
this
.
stablePrefix
).
Append
(
"(ts timestamp, v1 bool, v2 tinyint, v3 smallint, v4 int, v5 bigint, v6 float, v7 double, v8 binary(10), v9 nchar(10), v10 tinyint unsigned, v11 smallint unsigned, v12 int unsigned, v13 bigint unsigned) tags(t1 int)"
);
Append
(
"(ts timestamp, v1 bool, v2 tinyint, v3 smallint, v4 int, v5 bigint, v6 float, v7 double, v8 binary(10), v9 nchar(10), v10 tinyint unsigned, v11 smallint unsigned, v12 int unsigned, v13 bigint unsigned) tags(t1 int)"
);
IntPtr
res
=
TDengine
.
Query
(
this
.
conn
,
sql
.
ToString
());
IntPtr
res
=
TDengine
.
Query
(
this
.
conn
,
sql
.
ToString
());
if
(
res
!=
IntPtr
.
Zero
)
if
(
(
res
==
IntPtr
.
Zero
)
||
(
TDengine
.
ErrorNo
(
res
)
!=
0
)
)
{
{
VerbosePrint
(
sql
.
ToString
()
+
" success\n"
);
Console
.
Write
(
sql
.
ToString
()
+
" failure, "
);
if
(
res
!=
IntPtr
.
Zero
)
{
Console
.
Write
(
"reason: "
+
TDengine
.
Error
(
res
));
}
Console
.
WriteLine
(
""
);
CleanAndExitProgram
(
1
);
}
}
else
else
{
{
Console
.
WriteLine
(
sql
.
ToString
()
+
" failure, reason: "
+
TDengine
.
Error
(
res
));
VerbosePrint
(
sql
.
ToString
()
+
" success\n"
);
CleanAndExitProgram
(
1
);
}
}
TDengine
.
FreeResult
(
res
);
TDengine
.
FreeResult
(
res
);
}
}
...
@@ -495,9 +506,13 @@ namespace TDengineDriver
...
@@ -495,9 +506,13 @@ namespace TDengineDriver
IntPtr
res
=
TDengine
.
Query
(
conn
,
sql
);
IntPtr
res
=
TDengine
.
Query
(
conn
,
sql
);
DebugPrintFormat
(
"res: {0}\n"
,
res
);
DebugPrintFormat
(
"res: {0}\n"
,
res
);
if
(
res
==
IntPtr
.
Zero
)
if
(
(
res
==
IntPtr
.
Zero
)
||
(
TDengine
.
ErrorNo
(
res
)
!=
0
)
)
{
{
Console
.
WriteLine
(
sql
+
" failure, reason: "
+
TDengine
.
Error
(
res
));
Console
.
Write
(
sql
.
ToString
()
+
" failure, "
);
if
(
res
!=
IntPtr
.
Zero
)
{
Console
.
Write
(
"reason: "
+
TDengine
.
Error
(
res
));
}
Console
.
WriteLine
(
""
);
CleanAndExitProgram
(
1
);
CleanAndExitProgram
(
1
);
}
}
...
@@ -782,9 +797,13 @@ namespace TDengineDriver
...
@@ -782,9 +797,13 @@ namespace TDengineDriver
}
}
VerbosePrint
(
sql
.
ToString
()
+
"\n"
);
VerbosePrint
(
sql
.
ToString
()
+
"\n"
);
IntPtr
res
=
TDengine
.
Query
(
this
.
conn
,
sql
.
ToString
());
IntPtr
res
=
TDengine
.
Query
(
this
.
conn
,
sql
.
ToString
());
if
(
res
==
IntPtr
.
Zero
)
if
(
(
res
==
IntPtr
.
Zero
)
||
(
TDengine
.
ErrorNo
(
res
)
!=
0
)
)
{
{
VerbosePrint
(
sql
.
ToString
()
+
" failure, reason: "
+
TDengine
.
Error
(
res
)
+
"\n"
);
Console
.
Write
(
sql
.
ToString
()
+
" failure, "
);
if
(
res
!=
IntPtr
.
Zero
)
{
Console
.
Write
(
"reason: "
+
TDengine
.
Error
(
res
));
}
Console
.
WriteLine
(
""
);
}
}
inserted
+=
this
.
batchRows
;
inserted
+=
this
.
batchRows
;
...
@@ -861,14 +880,18 @@ namespace TDengineDriver
...
@@ -861,14 +880,18 @@ namespace TDengineDriver
sql
=
sql
.
Append
(
"(ts timestamp, v1 bool, v2 tinyint, v3 smallint, v4 int, v5 bigint, v6 float, v7 double, v8 binary(10), v9 nchar(10), v10 tinyint unsigned, v11 smallint unsigned, v12 int unsigned, v13 bigint unsigned)"
);
sql
=
sql
.
Append
(
"(ts timestamp, v1 bool, v2 tinyint, v3 smallint, v4 int, v5 bigint, v6 float, v7 double, v8 binary(10), v9 nchar(10), v10 tinyint unsigned, v11 smallint unsigned, v12 int unsigned, v13 bigint unsigned)"
);
}
}
IntPtr
res
=
TDengine
.
Query
(
this
.
conn
,
sql
.
ToString
());
IntPtr
res
=
TDengine
.
Query
(
this
.
conn
,
sql
.
ToString
());
if
(
res
!=
IntPtr
.
Zero
)
if
(
(
res
==
IntPtr
.
Zero
)
||
(
TDengine
.
ErrorNo
(
res
)
!=
0
)
)
{
{
VerbosePrint
(
sql
.
ToString
()
+
" success\n"
);
Console
.
Write
(
sql
.
ToString
()
+
" failure, "
);
if
(
res
!=
IntPtr
.
Zero
)
{
Console
.
Write
(
"reason: "
+
TDengine
.
Error
(
res
));
}
Console
.
WriteLine
(
""
);
CleanAndExitProgram
(
1
);
}
}
else
else
{
{
VerbosePrint
(
sql
.
ToString
()
+
" failure, reason: "
+
TDengine
.
Error
(
res
)
+
"\n"
);
VerbosePrint
(
sql
.
ToString
()
+
" success\n"
);
CleanAndExitProgram
(
1
);
}
}
TDengine
.
FreeResult
(
res
);
TDengine
.
FreeResult
(
res
);
}
}
...
...
tests/examples/c/apitest.c
浏览文件 @
272b524b
...
@@ -435,11 +435,15 @@ void verify_async(TAOS* taos) {
...
@@ -435,11 +435,15 @@ void verify_async(TAOS* taos) {
}
}
void
stream_callback
(
void
*
param
,
TAOS_RES
*
res
,
TAOS_ROW
row
)
{
void
stream_callback
(
void
*
param
,
TAOS_RES
*
res
,
TAOS_ROW
row
)
{
if
(
res
==
NULL
||
row
==
NULL
)
{
return
;
}
int
num_fields
=
taos_num_fields
(
res
);
int
num_fields
=
taos_num_fields
(
res
);
TAOS_FIELD
*
fields
=
taos_fetch_fields
(
res
);
TAOS_FIELD
*
fields
=
taos_fetch_fields
(
res
);
printf
(
"got one row from stream_callback
\n
"
);
printf
(
"got one row from stream_callback
\n
"
);
char
temp
[
256
];
char
temp
[
256
]
=
{
0
}
;
taos_print_row
(
temp
,
row
,
fields
,
num_fields
);
taos_print_row
(
temp
,
row
,
fields
,
num_fields
);
puts
(
temp
);
puts
(
temp
);
}
}
...
...
tests/examples/go/taosdemo.go
浏览文件 @
272b524b
此差异已折叠。
点击以展开。
tests/perftest-scripts/perftest-query.sh
浏览文件 @
272b524b
...
@@ -64,7 +64,7 @@ function runQueryPerfTest {
...
@@ -64,7 +64,7 @@ function runQueryPerfTest {
[
-f
$PERFORMANCE_TEST_REPORT
]
&&
rm
$PERFORMANCE_TEST_REPORT
[
-f
$PERFORMANCE_TEST_REPORT
]
&&
rm
$PERFORMANCE_TEST_REPORT
nohup
$WORK_DIR
/TDengine/debug/build/bin/taosd
-c
/etc/taosperf/
>
/dev/null 2>&1 &
nohup
$WORK_DIR
/TDengine/debug/build/bin/taosd
-c
/etc/taosperf/
>
/dev/null 2>&1 &
echoInfo
"Wait TDengine to start"
echoInfo
"Wait TDengine to start"
sleep
12
0
sleep
30
0
echoInfo
"Run Performance Test"
echoInfo
"Run Performance Test"
cd
$WORK_DIR
/TDengine/tests/pytest
cd
$WORK_DIR
/TDengine/tests/pytest
...
...
tests/pytest/alter/alterTabAddTagWithNULL.py
0 → 100644
浏览文件 @
272b524b
###################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
import
sys
from
util.log
import
*
from
util.cases
import
*
from
util.sql
import
*
from
util.dnodes
import
*
class
TDTestCase
:
def
init
(
self
,
conn
,
logSql
):
tdLog
.
debug
(
f
"start to execute
{
__file__
}
"
)
tdSql
.
init
(
conn
.
cursor
(),
logSql
)
def
run
(
self
):
tdSql
.
execute
(
"drop database if exists db"
)
tdSql
.
execute
(
"create database if not exists db keep 36500"
)
tdSql
.
execute
(
"use db"
)
tdLog
.
printNoPrefix
(
"==========step1:create table && insert data"
)
tdSql
.
execute
(
"create table stbtag (ts timestamp, c1 int) TAGS(t1 int)"
)
tdSql
.
execute
(
"create table tag1 using stbtag tags(1)"
)
tdLog
.
printNoPrefix
(
"==========step2:alter stb add tag create new chiltable"
)
tdSql
.
execute
(
"alter table stbtag add tag t2 int"
)
tdSql
.
execute
(
"alter table stbtag add tag t3 tinyint"
)
tdSql
.
execute
(
"alter table stbtag add tag t4 smallint "
)
tdSql
.
execute
(
"alter table stbtag add tag t5 bigint"
)
tdSql
.
execute
(
"alter table stbtag add tag t6 float "
)
tdSql
.
execute
(
"alter table stbtag add tag t7 double "
)
tdSql
.
execute
(
"alter table stbtag add tag t8 bool "
)
tdSql
.
execute
(
"alter table stbtag add tag t9 binary(10) "
)
tdSql
.
execute
(
"alter table stbtag add tag t10 nchar(10)"
)
tdSql
.
execute
(
"create table tag2 using stbtag tags(2, 22, 23, 24, 25, 26.1, 27.1, 1, 'binary9', 'nchar10')"
)
tdSql
.
query
(
"select tbname, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10 from stbtag"
)
tdSql
.
checkData
(
1
,
0
,
"tag2"
)
tdSql
.
checkData
(
1
,
1
,
2
)
tdSql
.
checkData
(
1
,
2
,
22
)
tdSql
.
checkData
(
1
,
3
,
23
)
tdSql
.
checkData
(
1
,
4
,
24
)
tdSql
.
checkData
(
1
,
5
,
25
)
tdSql
.
checkData
(
1
,
6
,
26.1
)
tdSql
.
checkData
(
1
,
7
,
27.1
)
tdSql
.
checkData
(
1
,
8
,
1
)
tdSql
.
checkData
(
1
,
9
,
"binary9"
)
tdSql
.
checkData
(
1
,
10
,
"nchar10"
)
tdLog
.
printNoPrefix
(
"==========step3:alter stb drop tag create new chiltable"
)
tdSql
.
execute
(
"alter table stbtag drop tag t2 "
)
tdSql
.
execute
(
"alter table stbtag drop tag t3 "
)
tdSql
.
execute
(
"alter table stbtag drop tag t4 "
)
tdSql
.
execute
(
"alter table stbtag drop tag t5 "
)
tdSql
.
execute
(
"alter table stbtag drop tag t6 "
)
tdSql
.
execute
(
"alter table stbtag drop tag t7 "
)
tdSql
.
execute
(
"alter table stbtag drop tag t8 "
)
tdSql
.
execute
(
"alter table stbtag drop tag t9 "
)
tdSql
.
execute
(
"alter table stbtag drop tag t10 "
)
tdSql
.
execute
(
"create table tag3 using stbtag tags(3)"
)
tdSql
.
query
(
"select * from stbtag where tbname like 'tag3' "
)
tdSql
.
checkCols
(
3
)
tdSql
.
query
(
"select tbname, t1 from stbtag where tbname like 'tag3' "
)
tdSql
.
checkData
(
0
,
1
,
3
)
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
f
"
{
__file__
}
successfully executed"
)
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
\ No newline at end of file
tests/pytest/alter/alterTimestampColDataProcess.py
0 → 100644
浏览文件 @
272b524b
此差异已折叠。
点击以展开。
tests/pytest/fulltest.sh
浏览文件 @
272b524b
...
@@ -219,6 +219,10 @@ python3 ./test.py -f query/bug3351.py
...
@@ -219,6 +219,10 @@ python3 ./test.py -f query/bug3351.py
python3 ./test.py
-f
query/bug3375.py
python3 ./test.py
-f
query/bug3375.py
python3 ./test.py
-f
query/queryJoin10tables.py
python3 ./test.py
-f
query/queryJoin10tables.py
python3 ./test.py
-f
query/queryStddevWithGroupby.py
python3 ./test.py
-f
query/queryStddevWithGroupby.py
python3 ./test.py
-f
query/querySecondtscolumnTowherenow.py
python3 ./test.py
-f
query/queryFilterTswithDateUnit.py
#stream
#stream
python3 ./test.py
-f
stream/metric_1.py
python3 ./test.py
-f
stream/metric_1.py
...
@@ -234,6 +238,8 @@ python3 ./test.py -f stream/table_n.py
...
@@ -234,6 +238,8 @@ python3 ./test.py -f stream/table_n.py
#alter table
#alter table
python3 ./test.py
-f
alter/alter_table_crash.py
python3 ./test.py
-f
alter/alter_table_crash.py
python3 ./test.py
-f
alter/alterTabAddTagWithNULL.py
python3 ./test.py
-f
alter/alterTimestampColDataProcess.py
# client
# client
python3 ./test.py
-f
client/client.py
python3 ./test.py
-f
client/client.py
...
@@ -303,6 +309,11 @@ python3 ./test.py -f insert/unsignedSmallint.py
...
@@ -303,6 +309,11 @@ python3 ./test.py -f insert/unsignedSmallint.py
python3 ./test.py
-f
insert/unsignedTinyint.py
python3 ./test.py
-f
insert/unsignedTinyint.py
python3 ./test.py
-f
query/filterAllUnsignedIntTypes.py
python3 ./test.py
-f
query/filterAllUnsignedIntTypes.py
python3 ./test.py
-f
tag_lite/unsignedInt.py
python3 ./test.py
-f
tag_lite/unsignedBigint.py
python3 ./test.py
-f
tag_lite/unsignedSmallint.py
python3 ./test.py
-f
tag_lite/unsignedTinyint.py
python3 ./test.py
-f
functions/function_percentile2.py
python3 ./test.py
-f
functions/function_percentile2.py
python3 ./test.py
-f
insert/boundary2.py
python3 ./test.py
-f
insert/boundary2.py
python3 ./test.py
-f
alter/alter_debugFlag.py
python3 ./test.py
-f
alter/alter_debugFlag.py
...
...
tests/pytest/query/queryFilterTswithDateUnit.py
0 → 100644
浏览文件 @
272b524b
此差异已折叠。
点击以展开。
tests/pytest/query/queryNormal.py
浏览文件 @
272b524b
此差异已折叠。
点击以展开。
tests/pytest/query/querySecondtscolumnTowherenow.py
0 → 100644
浏览文件 @
272b524b
此差异已折叠。
点击以展开。
tests/pytest/stream/new.py
浏览文件 @
272b524b
...
@@ -42,7 +42,7 @@ class TDTestCase:
...
@@ -42,7 +42,7 @@ class TDTestCase:
tdLog
.
info
(
"=============== step3"
)
tdLog
.
info
(
"=============== step3"
)
start
=
time
.
time
()
start
=
time
.
time
()
tdSql
.
waitedQuery
(
"select * from st"
,
1
,
1
2
0
)
tdSql
.
waitedQuery
(
"select * from st"
,
1
,
1
8
0
)
delay
=
int
(
time
.
time
()
-
start
)
+
80
delay
=
int
(
time
.
time
()
-
start
)
+
80
v
=
tdSql
.
getData
(
0
,
3
)
v
=
tdSql
.
getData
(
0
,
3
)
if
v
>=
51
:
if
v
>=
51
:
...
...
tests/pytest/stream/stream2.py
浏览文件 @
272b524b
...
@@ -88,6 +88,8 @@ class TDTestCase:
...
@@ -88,6 +88,8 @@ class TDTestCase:
except
Exception
as
e
:
except
Exception
as
e
:
tdLog
.
info
(
repr
(
e
))
tdLog
.
info
(
repr
(
e
))
time
.
sleep
(
5
)
tdSql
.
query
(
"show streams"
)
tdSql
.
query
(
"show streams"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
2
,
's0'
)
tdSql
.
checkData
(
0
,
2
,
's0'
)
...
@@ -146,6 +148,7 @@ class TDTestCase:
...
@@ -146,6 +148,7 @@ class TDTestCase:
except
Exception
as
e
:
except
Exception
as
e
:
tdLog
.
info
(
repr
(
e
))
tdLog
.
info
(
repr
(
e
))
time
.
sleep
(
5
)
tdSql
.
query
(
"show streams"
)
tdSql
.
query
(
"show streams"
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
2
,
's1'
)
tdSql
.
checkData
(
0
,
2
,
's1'
)
...
...
tests/pytest/stream/sys.py
浏览文件 @
272b524b
此差异已折叠。
点击以展开。
tests/pytest/tools/taosdemoTestTblAlt.py
浏览文件 @
272b524b
此差异已折叠。
点击以展开。
tests/pytest/util/sql.py
浏览文件 @
272b524b
此差异已折叠。
点击以展开。
tests/script/general/parser/first_last_query.sim
浏览文件 @
272b524b
此差异已折叠。
点击以展开。
tests/script/general/parser/select_with_tags.sim
浏览文件 @
272b524b
此差异已折叠。
点击以展开。
tests/script/general/stream/stream_1970.sim
0 → 100644
浏览文件 @
272b524b
此差异已折叠。
点击以展开。
tests/tsim/src/simSystem.c
浏览文件 @
272b524b
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录