Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
2069862b
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
2069862b
编写于
12月 18, 2020
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-2488]<fix>: fix super table bug.
上级
219e65aa
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
85 addition
and
30 deletion
+85
-30
src/common/src/tglobal.c
src/common/src/tglobal.c
+1
-1
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+2
-2
src/tsdb/inc/tsdbMain.h
src/tsdb/inc/tsdbMain.h
+1
-1
src/tsdb/src/tsdbRead.c
src/tsdb/src/tsdbRead.c
+64
-24
tests/script/general/parser/mixed_blocks.sim
tests/script/general/parser/mixed_blocks.sim
+17
-1
tests/script/general/parser/projection_limit_offset.sim
tests/script/general/parser/projection_limit_offset.sim
+0
-1
未找到文件。
src/common/src/tglobal.c
浏览文件 @
2069862b
...
...
@@ -221,7 +221,7 @@ int32_t uDebugFlag = 131;
int32_t
debugFlag
=
0
;
int32_t
sDebugFlag
=
135
;
int32_t
wDebugFlag
=
135
;
int32_t
tsdbDebugFlag
=
131
;
u
int32_t
tsdbDebugFlag
=
131
;
int32_t
cqDebugFlag
=
131
;
int32_t
(
*
monStartSystemFp
)()
=
NULL
;
...
...
src/query/src/qExecutor.c
浏览文件 @
2069862b
...
...
@@ -2182,8 +2182,8 @@ static bool isFixedOutputQuery(SQueryRuntimeEnv* pRuntimeEnv) {
// todo refactor with isLastRowQuery
bool
isPointInterpoQuery
(
SQuery
*
pQuery
)
{
for
(
int32_t
i
=
0
;
i
<
pQuery
->
numOfOutput
;
++
i
)
{
int32_t
functionI
D
=
pQuery
->
pExpr1
[
i
].
base
.
functionId
;
if
(
functionI
D
==
TSDB_FUNC_INTERP
)
{
int32_t
functionI
d
=
pQuery
->
pExpr1
[
i
].
base
.
functionId
;
if
(
functionI
d
==
TSDB_FUNC_INTERP
)
{
return
true
;
}
}
...
...
src/tsdb/inc/tsdbMain.h
浏览文件 @
2069862b
...
...
@@ -31,7 +31,7 @@
extern
"C"
{
#endif
extern
in
t
tsdbDebugFlag
;
extern
uint32_
t
tsdbDebugFlag
;
#define tsdbFatal(...) do { if (tsdbDebugFlag & DEBUG_FATAL) { taosPrintLog("TDB FATAL ", 255, __VA_ARGS__); }} while(0)
#define tsdbError(...) do { if (tsdbDebugFlag & DEBUG_ERROR) { taosPrintLog("TDB ERROR ", 255, __VA_ARGS__); }} while(0)
...
...
src/tsdb/src/tsdbRead.c
浏览文件 @
2069862b
...
...
@@ -956,9 +956,9 @@ static int32_t loadFileDataBlock(STsdbQueryHandle* pQueryHandle, SCompBlock* pBl
return
code
;
}
SDataCols
*
pT
S
Col
=
pQueryHandle
->
rhelper
.
pDataCols
[
0
];
SDataCols
*
pT
s
Col
=
pQueryHandle
->
rhelper
.
pDataCols
[
0
];
if
(
pCheckInfo
->
lastKey
<
pBlock
->
keyLast
)
{
cur
->
pos
=
binarySearchForKey
(
pT
S
Col
->
cols
[
0
].
pData
,
pBlock
->
numOfRows
,
pCheckInfo
->
lastKey
,
pQueryHandle
->
order
);
cur
->
pos
=
binarySearchForKey
(
pT
s
Col
->
cols
[
0
].
pData
,
pBlock
->
numOfRows
,
pCheckInfo
->
lastKey
,
pQueryHandle
->
order
);
}
else
{
cur
->
pos
=
pBlock
->
numOfRows
-
1
;
}
...
...
@@ -1704,7 +1704,32 @@ static int32_t createDataBlocksInfo(STsdbQueryHandle* pQueryHandle, int32_t numO
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
getDataBlocksInFilesImpl
(
STsdbQueryHandle
*
pQueryHandle
,
bool
*
exists
)
{
static
int32_t
getFirstFileDataBlock
(
STsdbQueryHandle
*
pQueryHandle
,
bool
*
exists
);
static
int32_t
getDataBlockRv
(
STsdbQueryHandle
*
pQueryHandle
,
STableBlockInfo
*
pNext
,
bool
*
exists
)
{
int32_t
step
=
ASCENDING_TRAVERSE
(
pQueryHandle
->
order
)
?
1
:
-
1
;
SQueryFilePos
*
cur
=
&
pQueryHandle
->
cur
;
while
(
1
)
{
int32_t
code
=
loadFileDataBlock
(
pQueryHandle
,
pNext
->
compBlock
,
pNext
->
pTableCheckInfo
,
exists
);
if
(
code
!=
TSDB_CODE_SUCCESS
||
*
exists
)
{
return
code
;
}
if
((
cur
->
slot
==
pQueryHandle
->
numOfBlocks
-
1
&&
ASCENDING_TRAVERSE
(
pQueryHandle
->
order
))
||
(
cur
->
slot
==
0
&&
!
ASCENDING_TRAVERSE
(
pQueryHandle
->
order
)))
{
// all data blocks in current file has been checked already, try next file if exists
return
getFirstFileDataBlock
(
pQueryHandle
,
exists
);
}
else
{
// next block of the same file
cur
->
slot
+=
step
;
cur
->
mixBlock
=
false
;
cur
->
blockCompleted
=
false
;
pNext
=
&
pQueryHandle
->
pDataBlockInfo
[
cur
->
slot
];
}
}
}
static
int32_t
getFirstFileDataBlock
(
STsdbQueryHandle
*
pQueryHandle
,
bool
*
exists
)
{
pQueryHandle
->
numOfBlocks
=
0
;
SQueryFilePos
*
cur
=
&
pQueryHandle
->
cur
;
...
...
@@ -1789,7 +1814,23 @@ static int32_t getDataBlocksInFilesImpl(STsdbQueryHandle* pQueryHandle, bool* ex
cur
->
fid
=
pQueryHandle
->
pFileGroup
->
fileId
;
STableBlockInfo
*
pBlockInfo
=
&
pQueryHandle
->
pDataBlockInfo
[
cur
->
slot
];
return
loadFileDataBlock
(
pQueryHandle
,
pBlockInfo
->
compBlock
,
pBlockInfo
->
pTableCheckInfo
,
exists
);
return
getDataBlockRv
(
pQueryHandle
,
pBlockInfo
,
exists
);
}
static
bool
isEndFileDataBlock
(
SQueryFilePos
*
cur
,
int32_t
numOfBlocks
,
bool
ascTrav
)
{
assert
(
cur
!=
NULL
&&
numOfBlocks
>
0
);
return
(
cur
->
slot
==
numOfBlocks
-
1
&&
ascTrav
)
||
(
cur
->
slot
==
0
&&
!
ascTrav
);
}
static
void
moveToNextDataBlockInCurrentFile
(
STsdbQueryHandle
*
pQueryHandle
)
{
int32_t
step
=
ASCENDING_TRAVERSE
(
pQueryHandle
->
order
)
?
1
:
-
1
;
SQueryFilePos
*
cur
=
&
pQueryHandle
->
cur
;
assert
(
cur
->
slot
<
pQueryHandle
->
numOfBlocks
&&
cur
->
slot
>=
0
);
cur
->
slot
+=
step
;
cur
->
mixBlock
=
false
;
cur
->
blockCompleted
=
false
;
}
static
int32_t
getDataBlocksInFiles
(
STsdbQueryHandle
*
pQueryHandle
,
bool
*
exists
)
{
...
...
@@ -1800,14 +1841,14 @@ static int32_t getDataBlocksInFiles(STsdbQueryHandle* pQueryHandle, bool* exists
if
(
!
pQueryHandle
->
locateStart
)
{
pQueryHandle
->
locateStart
=
true
;
STsdbCfg
*
pCfg
=
&
pQueryHandle
->
pTsdb
->
config
;
int32_t
fid
=
getFileIdFromKey
(
pQueryHandle
->
window
.
skey
,
pCfg
->
daysPerFile
,
pCfg
->
precision
);
int32_t
fid
=
getFileIdFromKey
(
pQueryHandle
->
window
.
skey
,
pCfg
->
daysPerFile
,
pCfg
->
precision
);
pthread_rwlock_rdlock
(
&
pQueryHandle
->
pTsdb
->
tsdbFileH
->
fhlock
);
tsdbInitFileGroupIter
(
pFileHandle
,
&
pQueryHandle
->
fileIter
,
pQueryHandle
->
order
);
tsdbSeekFileGroupIter
(
&
pQueryHandle
->
fileIter
,
fid
);
pthread_rwlock_unlock
(
&
pQueryHandle
->
pTsdb
->
tsdbFileH
->
fhlock
);
return
get
DataBlocksInFilesImpl
(
pQueryHandle
,
exists
);
return
get
FirstFileDataBlock
(
pQueryHandle
,
exists
);
}
else
{
// check if current file block is all consumed
STableBlockInfo
*
pBlockInfo
=
&
pQueryHandle
->
pDataBlockInfo
[
cur
->
slot
];
...
...
@@ -1815,27 +1856,26 @@ static int32_t getDataBlocksInFiles(STsdbQueryHandle* pQueryHandle, bool* exists
// current block is done, try next
if
((
!
cur
->
mixBlock
)
||
cur
->
blockCompleted
)
{
if
((
cur
->
slot
==
pQueryHandle
->
numOfBlocks
-
1
&&
ASCENDING_TRAVERSE
(
pQueryHandle
->
order
))
||
(
cur
->
slot
==
0
&&
!
ASCENDING_TRAVERSE
(
pQueryHandle
->
order
)))
{
// all data blocks in current file has been checked already, try next file if exists
return
getDataBlocksInFilesImpl
(
pQueryHandle
,
exists
);
}
else
{
// next block of the same file
int32_t
step
=
ASCENDING_TRAVERSE
(
pQueryHandle
->
order
)
?
1
:
-
1
;
cur
->
slot
+=
step
;
cur
->
mixBlock
=
false
;
cur
->
blockCompleted
=
false
;
STableBlockInfo
*
pNext
=
&
pQueryHandle
->
pDataBlockInfo
[
cur
->
slot
];
return
loadFileDataBlock
(
pQueryHandle
,
pNext
->
compBlock
,
pNext
->
pTableCheckInfo
,
exists
);
}
// all data blocks in current file has been checked already, try next file if exists
}
else
{
tsdbDebug
(
"%p continue in current data block, index:%d, pos:%d, %p"
,
pQueryHandle
,
cur
->
slot
,
cur
->
pos
,
pQueryHandle
->
qinfo
);
tsdbDebug
(
"%p continue in current data block, index:%d, pos:%d, %p"
,
pQueryHandle
,
cur
->
slot
,
cur
->
pos
,
pQueryHandle
->
qinfo
);
int32_t
code
=
handleDataMergeIfNeeded
(
pQueryHandle
,
pBlockInfo
->
compBlock
,
pCheckInfo
);
*
exists
=
pQueryHandle
->
realNumOfRows
>
0
;
*
exists
=
(
pQueryHandle
->
realNumOfRows
>
0
)
;
return
code
;
if
(
code
!=
TSDB_CODE_SUCCESS
||
*
exists
)
{
return
code
;
}
}
// current block is empty, try next block in file
// all data blocks in current file has been checked already, try next file if exists
if
(
isEndFileDataBlock
(
cur
,
pQueryHandle
->
numOfBlocks
,
ASCENDING_TRAVERSE
(
pQueryHandle
->
order
)))
{
return
getFirstFileDataBlock
(
pQueryHandle
,
exists
);
}
else
{
moveToNextDataBlockInCurrentFile
(
pQueryHandle
);
STableBlockInfo
*
pNext
=
&
pQueryHandle
->
pDataBlockInfo
[
cur
->
slot
];
return
getDataBlockRv
(
pQueryHandle
,
pNext
,
exists
);
}
}
}
...
...
tests/script/general/parser/mixed_blocks.sim
浏览文件 @
2069862b
...
...
@@ -144,4 +144,20 @@ if $data03 != 319 then
return -1
endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
print ===================> TD-2488
sql create table m1(ts timestamp, k int) tags(a int);
sql create table t1 using m1 tags(1);
sql create table t2 using m1 tags(2);
sql insert into t1 values('2020-1-1 1:1:1', 1);
sql insert into t1 values('2020-1-1 1:10:1', 2);
sql insert into t2 values('2020-1-1 1:5:1', 99);
print ================== restart server to commit data into disk
system sh/exec.sh -n dnode1 -s stop -x SIGINT
sleep 3000
system sh/exec.sh -n dnode1 -s start
print ================== server restart completed
sql select ts from m1 where ts='2020-1-1 1:5:1'
if $rows != 1 then
return -1
endi
\ No newline at end of file
tests/script/general/parser/projection_limit_offset.sim
浏览文件 @
2069862b
...
...
@@ -317,7 +317,6 @@ sql_error select count(*) from group_tb0 where ts in ('2016-1-1 12:12:12');
sql_error select count(*) from group_tb0 where ts < '12:12:12';
#===============================sql for twa==========================================
sql_error select twa(c1) from group_tb0;
sql_error select twa(c1) from group_stb0;
sql_error select twa(c2) from group_stb0 where ts<now and ts>now-1h group by t1;
sql_error select twa(c2) from group_stb0 where ts<now and ts>now-1h group by tbname,t1;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录