Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
605e6320
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
605e6320
编写于
5月 13, 2020
作者:
B
Bomin Zhang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix failed test cases
上级
98baaf51
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
47 addition
and
33 deletion
+47
-33
src/client/src/tscServer.c
src/client/src/tscServer.c
+4
-3
src/client/src/tscSub.c
src/client/src/tscSub.c
+4
-4
src/query/src/queryExecutor.c
src/query/src/queryExecutor.c
+38
-25
tests/script/general/cache/new_metrics.sim
tests/script/general/cache/new_metrics.sim
+1
-1
未找到文件。
src/client/src/tscServer.c
浏览文件 @
605e6320
...
...
@@ -39,7 +39,7 @@ int (*tscProcessMsgRsp[TSDB_SQL_MAX])(SSqlObj *pSql);
void
tscProcessActivityTimer
(
void
*
handle
,
void
*
tmrId
);
int
tscKeepConn
[
TSDB_SQL_MAX
]
=
{
0
};
TSKEY
tscGetSubscriptionProgress
(
void
*
sub
,
int64_t
uid
);
TSKEY
tscGetSubscriptionProgress
(
void
*
sub
,
int64_t
uid
,
TSKEY
dflt
);
void
tscUpdateSubscriptionProgress
(
void
*
sub
,
int64_t
uid
,
TSKEY
ts
);
void
tscSaveSubscriptionProgress
(
void
*
sub
);
...
...
@@ -575,6 +575,7 @@ static int32_t tscEstimateQueryMsgSize(SSqlCmd *pCmd, int32_t clauseIndex) {
static
char
*
doSerializeTableInfo
(
SQueryTableMsg
*
pQueryMsg
,
SSqlObj
*
pSql
,
char
*
pMsg
)
{
STableMetaInfo
*
pTableMetaInfo
=
tscGetTableMetaInfoFromCmd
(
&
pSql
->
cmd
,
pSql
->
cmd
.
clauseIndex
,
0
);
TSKEY
dfltKey
=
htobe64
(
pQueryMsg
->
window
.
skey
);
STableMeta
*
pTableMeta
=
pTableMetaInfo
->
pTableMeta
;
if
(
UTIL_TABLE_IS_NORMAL_TABLE
(
pTableMetaInfo
)
||
pTableMetaInfo
->
pVgroupTables
==
NULL
)
{
...
...
@@ -596,7 +597,7 @@ static char *doSerializeTableInfo(SQueryTableMsg* pQueryMsg, SSqlObj *pSql, char
STableIdInfo
*
pTableIdInfo
=
(
STableIdInfo
*
)
pMsg
;
pTableIdInfo
->
tid
=
htonl
(
pTableMeta
->
sid
);
pTableIdInfo
->
uid
=
htobe64
(
pTableMeta
->
uid
);
pTableIdInfo
->
key
=
htobe64
(
tscGetSubscriptionProgress
(
pSql
->
pSubscription
,
pTableMeta
->
uid
));
pTableIdInfo
->
key
=
htobe64
(
tscGetSubscriptionProgress
(
pSql
->
pSubscription
,
pTableMeta
->
uid
,
dfltKey
));
pQueryMsg
->
numOfTables
=
htonl
(
1
);
// set the number of tables
...
...
@@ -624,7 +625,7 @@ static char *doSerializeTableInfo(SQueryTableMsg* pQueryMsg, SSqlObj *pSql, char
STableIdInfo
*
pTableIdInfo
=
(
STableIdInfo
*
)
pMsg
;
pTableIdInfo
->
tid
=
htonl
(
pItem
->
tid
);
pTableIdInfo
->
uid
=
htobe64
(
pItem
->
uid
);
pTableIdInfo
->
key
=
htobe64
(
tscGetSubscriptionProgress
(
pSql
->
pSubscription
,
pItem
->
uid
));
pTableIdInfo
->
key
=
htobe64
(
tscGetSubscriptionProgress
(
pSql
->
pSubscription
,
pItem
->
uid
,
dfltKey
));
pMsg
+=
sizeof
(
STableIdInfo
);
}
}
...
...
src/client/src/tscSub.c
浏览文件 @
605e6320
...
...
@@ -56,16 +56,16 @@ static int tscCompareSubscriptionProgress(const void* a, const void* b) {
return
0
;
}
TSKEY
tscGetSubscriptionProgress
(
void
*
sub
,
int64_t
uid
)
{
TSKEY
tscGetSubscriptionProgress
(
void
*
sub
,
int64_t
uid
,
TSKEY
dflt
)
{
if
(
sub
==
NULL
)
{
return
0
;
return
dflt
;
}
SSub
*
pSub
=
(
SSub
*
)
sub
;
SSubscriptionProgress
target
=
{.
uid
=
uid
,
.
key
=
0
};
SSubscriptionProgress
*
p
=
taosArraySearch
(
pSub
->
progress
,
tscCompareSubscriptionProgress
,
&
target
);
if
(
p
==
NULL
)
{
return
INT64_MIN
;
return
dflt
;
}
return
p
->
key
;
}
...
...
@@ -228,7 +228,7 @@ static int tscUpdateSubscription(STscObj* pObj, SSub* pSub) {
for
(
size_t
i
=
0
;
i
<
numOfTables
;
i
++
)
{
STidTags
*
tt
=
taosArrayGet
(
tables
,
i
);
SSubscriptionProgress
p
=
{
.
uid
=
tt
->
uid
};
p
.
key
=
tscGetSubscriptionProgress
(
pSub
,
tt
->
uid
);
p
.
key
=
tscGetSubscriptionProgress
(
pSub
,
tt
->
uid
,
INT64_MIN
);
taosArrayPush
(
progress
,
&
p
);
}
taosArraySort
(
progress
,
tscCompareSubscriptionProgress
);
...
...
src/query/src/queryExecutor.c
浏览文件 @
605e6320
...
...
@@ -4162,38 +4162,51 @@ static bool skipTimeInterval(SQueryRuntimeEnv *pRuntimeEnv) {
return
true
;
}
int32_t
doInitQInfo
(
SQInfo
*
pQInfo
,
void
*
param
,
void
*
tsdb
,
int32_t
vgId
,
bool
isSTableQuery
)
{
SQueryRuntimeEnv
*
pRuntimeEnv
=
&
pQInfo
->
runtimeEnv
;
static
void
setupQueryHandle
(
void
*
tsdb
,
SQInfo
*
pQInfo
,
bool
isSTableQuery
)
{
SQueryRuntimeEnv
*
pRuntimeEnv
=
&
pQInfo
->
runtimeEnv
;
SQuery
*
pQuery
=
pQInfo
->
runtimeEnv
.
pQuery
;
int32_t
code
=
TSDB_CODE_SUCCESS
;
setScanLimitationByResultBuffer
(
pQuery
);
changeExecuteScanOrder
(
pQuery
,
false
);
if
(
onlyQueryTags
(
pQuery
))
{
return
;
}
if
(
isSTableQuery
&&
(
!
isIntervalQuery
(
pQuery
))
&&
(
!
isFixedOutputQuery
(
pQuery
)))
{
return
;
}
STsdbQueryCond
cond
=
{
.
twindow
=
pQuery
->
window
,
.
order
=
pQuery
->
order
.
order
,
.
colList
=
pQuery
->
colList
,
.
numOfCols
=
pQuery
->
numOfCols
,
.
twindow
=
pQuery
->
window
,
.
order
=
pQuery
->
order
.
order
,
.
colList
=
pQuery
->
colList
,
.
numOfCols
=
pQuery
->
numOfCols
,
};
// normal query setup the queryhandle here
if
(
!
onlyQueryTags
(
pQuery
))
{
if
(
!
isSTableQuery
&&
isFirstLastRowQuery
(
pQuery
))
{
// in case of last_row query, invoke a different API.
pRuntimeEnv
->
pQueryHandle
=
tsdbQueryLastRow
(
tsdb
,
&
cond
,
&
pQInfo
->
tableIdGroupInfo
);
}
else
if
(
!
isSTableQuery
||
isIntervalQuery
(
pQuery
)
||
isFixedOutputQuery
(
pQuery
))
{
if
(
pQInfo
->
groupInfo
.
numOfTables
==
1
)
{
SArray
*
pa
=
taosArrayGetP
(
pQInfo
->
groupInfo
.
pGroupList
,
0
);
SGroupItem
*
pItem
=
taosArrayGet
(
pa
,
0
);
cond
.
twindow
=
pItem
->
info
->
win
;
}
pRuntimeEnv
->
pQueryHandle
=
tsdbQueryTables
(
tsdb
,
&
cond
,
&
pQInfo
->
tableIdGroupInfo
);
}
if
(
!
isSTableQuery
&&
(
pQInfo
->
groupInfo
.
numOfTables
==
1
)
&&
(
cond
.
order
==
TSDB_ORDER_ASC
)
&&
(
!
isIntervalQuery
(
pQuery
))
&&
(
!
isGroupbyNormalCol
(
pQuery
->
pGroupbyExpr
))
&&
(
!
isFixedOutputQuery
(
pQuery
))
)
{
SArray
*
pa
=
taosArrayGetP
(
pQInfo
->
groupInfo
.
pGroupList
,
0
);
SGroupItem
*
pItem
=
taosArrayGet
(
pa
,
0
);
cond
.
twindow
=
pItem
->
info
->
win
;
}
pRuntimeEnv
->
pQueryHandle
=
tsdbQueryTables
(
tsdb
,
&
cond
,
&
pQInfo
->
tableIdGroupInfo
);
}
int32_t
doInitQInfo
(
SQInfo
*
pQInfo
,
void
*
param
,
void
*
tsdb
,
int32_t
vgId
,
bool
isSTableQuery
)
{
SQueryRuntimeEnv
*
pRuntimeEnv
=
&
pQInfo
->
runtimeEnv
;
SQuery
*
pQuery
=
pQInfo
->
runtimeEnv
.
pQuery
;
int32_t
code
=
TSDB_CODE_SUCCESS
;
setScanLimitationByResultBuffer
(
pQuery
);
changeExecuteScanOrder
(
pQuery
,
false
);
setupQueryHandle
(
tsdb
,
pQInfo
,
isSTableQuery
);
pQInfo
->
tsdb
=
tsdb
;
pQInfo
->
vgId
=
vgId
;
...
...
@@ -5772,7 +5785,7 @@ static SQInfo *createQInfoImpl(SQueryTableMsg *pQueryMsg, SArray* pTableIdList,
if
(
pTableId
!=
NULL
)
{
window
.
skey
=
pTableId
->
key
;
}
else
{
window
.
skey
=
INT64_MIN
;
window
.
skey
=
pQueryMsg
->
window
.
skey
;
}
item
.
info
=
createTableQueryInfo
(
&
pQInfo
->
runtimeEnv
,
item
.
id
,
window
);
item
.
info
->
groupIdx
=
i
;
...
...
tests/script/general/cache/new_metrics.sim
浏览文件 @
605e6320
...
...
@@ -27,7 +27,7 @@ sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol bool)
$i = 0
while $i < 5
$tb = $tbPrefix . $i
sql create table $tb using $mt tags(
0
)
sql create table $tb using $mt tags(
$i
)
$x = 0
while $x < $rowNum
$val = $x * 60000
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录