Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
064b2082
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
064b2082
编写于
7月 05, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'feat/tsdb_refact' of
https://github.com/taosdata/TDengine
into feat/tsdb_snapshot
上级
9512b51e
004a6571
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
141 addition
and
81 deletion
+141
-81
examples/rust
examples/rust
+1
-1
include/util/taoserror.h
include/util/taoserror.h
+1
-1
source/common/src/tdatablock.c
source/common/src/tdatablock.c
+1
-0
source/dnode/vnode/src/inc/tsdb.h
source/dnode/vnode/src/inc/tsdb.h
+13
-12
source/dnode/vnode/src/sma/smaRollup.c
source/dnode/vnode/src/sma/smaRollup.c
+1
-1
source/dnode/vnode/src/tq/tqMeta.c
source/dnode/vnode/src/tq/tqMeta.c
+1
-0
source/dnode/vnode/src/tsdb/tsdbRead.c
source/dnode/vnode/src/tsdb/tsdbRead.c
+52
-11
source/dnode/vnode/src/tsdb/tsdbReaderWriter.c
source/dnode/vnode/src/tsdb/tsdbReaderWriter.c
+8
-8
source/dnode/vnode/src/tsdb/tsdbUtil.c
source/dnode/vnode/src/tsdb/tsdbUtil.c
+55
-36
source/libs/executor/src/executil.c
source/libs/executor/src/executil.c
+0
-3
source/libs/executor/src/executorMain.c
source/libs/executor/src/executorMain.c
+1
-1
tests/script/jenkins/basic.txt
tests/script/jenkins/basic.txt
+2
-2
tests/script/tsim/stream/distributeInterval0.sim
tests/script/tsim/stream/distributeInterval0.sim
+5
-5
未找到文件。
rust
@
7ed7a977
比较
1c8924dc
...
7ed7a977
Subproject commit
1c8924dc668e6aa848214c2fc54e3ace3f5bf8df
Subproject commit
7ed7a97715388fa144718764d6bf20f9bfc29a12
include/util/taoserror.h
浏览文件 @
064b2082
...
...
@@ -72,7 +72,7 @@ int32_t* taosGetErrno();
#define TSDB_CODE_INVALID_TIMESTAMP TAOS_DEF_ERROR_CODE(0, 0x0030)
#define TSDB_CODE_MSG_DECODE_ERROR TAOS_DEF_ERROR_CODE(0, 0x0031)
#define TSDB_CODE_NO_AVAIL_DISK TAOS_DEF_ERROR_CODE(0, 0x0032)
#define TSDB_CODE_NOT_FOUND TAOS_DEF_ERROR_CODE(0, 0x003
2
)
#define TSDB_CODE_NOT_FOUND TAOS_DEF_ERROR_CODE(0, 0x003
3
)
#define TSDB_CODE_REF_NO_MEMORY TAOS_DEF_ERROR_CODE(0, 0x0040)
#define TSDB_CODE_REF_FULL TAOS_DEF_ERROR_CODE(0, 0x0041)
...
...
source/common/src/tdatablock.c
浏览文件 @
064b2082
...
...
@@ -1831,6 +1831,7 @@ int32_t buildSubmitReqFromDataBlock(SSubmitReq** pReq, const SArray* pDataBlocks
pSubmitBlk
->
suid
=
suid
;
pSubmitBlk
->
uid
=
pDataBlock
->
info
.
groupId
;
pSubmitBlk
->
numOfRows
=
rows
;
pSubmitBlk
->
sversion
=
pTSchema
->
version
;
msgLen
+=
sizeof
(
SSubmitBlk
);
int32_t
dataLen
=
0
;
...
...
source/dnode/vnode/src/inc/tsdb.h
浏览文件 @
064b2082
...
...
@@ -131,16 +131,17 @@ int32_t tColDataCopy(SColData *pColDataSrc, SColData *pColDataDest);
#define tBlockDataLastRow(PBLOCKDATA) tsdbRowFromBlockData(PBLOCKDATA, (PBLOCKDATA)->nRow - 1)
#define tBlockDataFirstKey(PBLOCKDATA) TSDBROW_KEY(&tBlockDataFirstRow(PBLOCKDATA))
#define tBlockDataLastKey(PBLOCKDATA) TSDBROW_KEY(&tBlockDataLastRow(PBLOCKDATA))
int32_t
tBlockDataInit
(
SBlockData
*
pBlockData
);
void
tBlockDataReset
(
SBlockData
*
pBlockData
);
int32_t
tBlockDataSetSchema
(
SBlockData
*
pBlockData
,
STSchema
*
pTSchema
);
void
tBlockDataClearData
(
SBlockData
*
pBlockData
);
void
tBlockDataClear
(
SBlockData
*
pBlockData
);
int32_t
tBlockDataAddColData
(
SBlockData
*
pBlockData
,
int32_t
iColData
,
SColData
**
ppColData
);
int32_t
tBlockDataAppendRow
(
SBlockData
*
pBlockData
,
TSDBROW
*
pRow
,
STSchema
*
pTSchema
);
int32_t
tBlockDataMerge
(
SBlockData
*
pBlockData1
,
SBlockData
*
pBlockData2
,
SBlockData
*
pBlockData
);
int32_t
tBlockDataCopy
(
SBlockData
*
pBlockDataSrc
,
SBlockData
*
pBlockDataDest
);
void
tBlockDataGetColData
(
SBlockData
*
pBlockData
,
int16_t
cid
,
SColData
**
ppColData
);
int32_t
tBlockDataInit
(
SBlockData
*
pBlockData
);
void
tBlockDataReset
(
SBlockData
*
pBlockData
);
int32_t
tBlockDataSetSchema
(
SBlockData
*
pBlockData
,
STSchema
*
pTSchema
);
void
tBlockDataClearData
(
SBlockData
*
pBlockData
);
void
tBlockDataClear
(
SBlockData
*
pBlockData
);
int32_t
tBlockDataAddColData
(
SBlockData
*
pBlockData
,
int32_t
iColData
,
SColData
**
ppColData
);
int32_t
tBlockDataAppendRow
(
SBlockData
*
pBlockData
,
TSDBROW
*
pRow
,
STSchema
*
pTSchema
);
int32_t
tBlockDataMerge
(
SBlockData
*
pBlockData1
,
SBlockData
*
pBlockData2
,
SBlockData
*
pBlockData
);
int32_t
tBlockDataCopy
(
SBlockData
*
pBlockDataSrc
,
SBlockData
*
pBlockDataDest
);
SColData
*
tBlockDataGetColDataByIdx
(
SBlockData
*
pBlockData
,
int32_t
idx
);
void
tBlockDataGetColData
(
SBlockData
*
pBlockData
,
int16_t
cid
,
SColData
**
ppColData
);
// SDelIdx
int32_t
tPutDelIdx
(
uint8_t
*
p
,
void
*
ph
);
int32_t
tGetDelIdx
(
uint8_t
*
p
,
void
*
ph
);
...
...
@@ -419,8 +420,8 @@ struct SBlockData {
int32_t
nRow
;
int64_t
*
aVersion
;
TSKEY
*
aTSKEY
;
SArray
*
a
ColDataP
;
// SArray<SColData *
>
SArray
*
aColData
;
// SArray<SColData>
SArray
*
a
Idx
;
// SArray<int32_t
>
SArray
*
aColData
;
// SArray<SColData>
};
// ================== TSDB global config
...
...
source/dnode/vnode/src/sma/smaRollup.c
浏览文件 @
064b2082
...
...
@@ -562,7 +562,7 @@ static int32_t tdFetchAndSubmitRSmaResult(SRSmaInfoItem *pItem, int8_t blkType)
goto
_err
;
}
if
(
pReq
&&
tdProcessSubmitReq
(
sinkTsdb
,
INT64_MAX
,
pReq
)
<
0
)
{
if
(
pReq
&&
tdProcessSubmitReq
(
sinkTsdb
,
1
,
pReq
)
<
0
)
{
taosMemoryFreeClear
(
pReq
);
goto
_err
;
}
...
...
source/dnode/vnode/src/tq/tqMeta.c
浏览文件 @
064b2082
...
...
@@ -87,6 +87,7 @@ int32_t tqMetaOpen(STQ* pTq) {
.
reader
=
handle
.
execHandle
.
pExecReader
[
i
],
.
meta
=
pTq
->
pVnode
->
pMeta
,
.
pMsgCb
=
&
pTq
->
pVnode
->
msgCb
,
.
vnode
=
pTq
->
pVnode
,
};
handle
.
execHandle
.
execCol
.
task
[
i
]
=
qCreateStreamExecTaskInfo
(
handle
.
execHandle
.
execCol
.
qmsg
,
&
reader
);
ASSERT
(
handle
.
execHandle
.
execCol
.
task
[
i
]);
...
...
source/dnode/vnode/src/tsdb/tsdbRead.c
浏览文件 @
064b2082
...
...
@@ -154,6 +154,7 @@ static void doMergeMultiRows(TSDBROW* pRow, uint64_t uid, SIterInfo *pIter, SArr
static
void
doMergeMemIMemRows
(
TSDBROW
*
pRow
,
TSDBROW
*
piRow
,
STableBlockScanInfo
*
pBlockScanInfo
,
STsdbReader
*
pReader
,
STSRow
**
pTSRow
);
static
int32_t
initDelSkylineIterator
(
STableBlockScanInfo
*
pBlockScanInfo
,
STsdbReader
*
pReader
,
STbData
*
pMemTbData
,
STbData
*
piMemTbData
);
static
STsdb
*
getTsdbByRetentions
(
SVnode
*
pVnode
,
TSKEY
winSKey
,
SRetention
*
retentions
,
const
char
*
idstr
);
static
int32_t
setColumnIdSlotList
(
STsdbReader
*
pReader
,
SSDataBlock
*
pBlock
)
{
SBlockLoadSuppInfo
*
pSupInfo
=
&
pReader
->
suppInfo
;
...
...
@@ -373,7 +374,7 @@ static int32_t tsdbReaderCreate(SVnode* pVnode, SQueryTableDataCond* pCond, STsd
initReaderStatus
(
&
pReader
->
status
);
pReader
->
pTsdb
=
pVnode
->
pTsdb
;
pReader
->
pTsdb
=
getTsdbByRetentions
(
pVnode
,
pCond
->
twindows
[
0
].
skey
,
pVnode
->
config
.
tsdbCfg
.
retentions
,
idstr
)
;
pReader
->
suid
=
pCond
->
suid
;
pReader
->
order
=
pCond
->
order
;
pReader
->
capacity
=
4096
;
...
...
@@ -755,11 +756,11 @@ static int32_t copyBlockDataToSDataBlock(STsdbReader* pReader, STableBlockScanIn
i
+=
1
;
}
while
(
i
<
numOfCols
&&
colIndex
<
taosArrayGetSize
(
pBlockData
->
a
ColDataP
))
{
while
(
i
<
numOfCols
&&
colIndex
<
taosArrayGetSize
(
pBlockData
->
a
Idx
))
{
rowIndex
=
0
;
pColData
=
taosArrayGet
(
pResBlock
->
pDataBlock
,
i
);
SColData
*
pData
=
(
SColData
*
)
taosArrayGetP
(
pBlockData
->
aColDataP
,
colIndex
);
SColData
*
pData
=
tBlockDataGetColDataByIdx
(
pBlockData
,
colIndex
);
if
(
pData
->
cid
==
pColData
->
info
.
colId
)
{
for
(
int32_t
j
=
pDumpInfo
->
rowIndex
;
j
<
endIndex
&&
j
>=
0
;
j
+=
step
)
{
...
...
@@ -1722,13 +1723,16 @@ static int32_t buildDataBlockFromBuf(STsdbReader* pReader, STableBlockScanInfo*
int64_t
st
=
taosGetTimestampUs
();
int32_t
code
=
buildDataBlockFromBufImpl
(
pBlockScanInfo
,
endKey
,
pReader
->
capacity
,
pReader
);
int64_t
elapsedTime
=
taosGetTimestampUs
()
-
st
;
tsdbDebug
(
"%p build data block from cache completed, elapsed time:%"
PRId64
" us, numOfRows:%d, numOfCols:%d, %s"
,
pReader
,
elapsedTime
,
pBlock
->
info
.
rows
,
(
int32_t
)
blockDataGetNumOfCols
(
pBlock
),
pReader
->
idStr
);
blockDataUpdateTsWindow
(
pBlock
,
0
);
pBlock
->
info
.
uid
=
pBlockScanInfo
->
uid
;
setComposedBlockFlag
(
pReader
,
true
);
int64_t
elapsedTime
=
taosGetTimestampUs
()
-
st
;
tsdbDebug
(
"%p build data block from cache completed, elapsed time:%"
PRId64
" us, numOfRows:%d, numOfCols:%d, brange: %"
PRId64
" - %"
PRId64
" %s"
,
pReader
,
elapsedTime
,
pBlock
->
info
.
rows
,
(
int32_t
)
blockDataGetNumOfCols
(
pBlock
),
pBlock
->
info
.
window
.
skey
,
pBlock
->
info
.
window
.
ekey
,
pReader
->
idStr
);
return
code
;
}
...
...
@@ -2375,6 +2379,43 @@ static int32_t buildBlockFromFiles(STsdbReader* pReader) {
}
}
STsdb
*
getTsdbByRetentions
(
SVnode
*
pVnode
,
TSKEY
winSKey
,
SRetention
*
retentions
,
const
char
*
idStr
)
{
if
(
VND_IS_RSMA
(
pVnode
))
{
int
level
=
0
;
int64_t
now
=
taosGetTimestamp
(
pVnode
->
config
.
tsdbCfg
.
precision
);
for
(
int
i
=
0
;
i
<
TSDB_RETENTION_MAX
;
++
i
)
{
SRetention
*
pRetention
=
retentions
+
level
;
if
(
pRetention
->
keep
<=
0
)
{
if
(
level
>
0
)
{
--
level
;
}
break
;
}
if
((
now
-
pRetention
->
keep
)
<=
winSKey
)
{
break
;
}
++
level
;
}
int32_t
vgId
=
TD_VID
(
pVnode
);
const
char
*
str
=
(
idStr
!=
NULL
)
?
idStr
:
""
;
if
(
level
==
TSDB_RETENTION_L0
)
{
tsdbDebug
(
"vgId:%d, read handle %p rsma level %d is selected to query %s"
,
vgId
,
TSDB_RETENTION_L0
,
str
);
return
VND_RSMA0
(
pVnode
);
}
else
if
(
level
==
TSDB_RETENTION_L1
)
{
tsdbDebug
(
"vgId:%d, read handle %p rsma level %d is selected to query %s"
,
vgId
,
TSDB_RETENTION_L1
,
str
);
return
VND_RSMA1
(
pVnode
);
}
else
{
tsdbDebug
(
"vgId:%d, read handle %p rsma level %d is selected to query %s"
,
vgId
,
TSDB_RETENTION_L2
,
str
);
return
VND_RSMA2
(
pVnode
);
}
}
return
VND_TSDB
(
pVnode
);
}
// // todo not unref yet, since it is not support multi-group interpolation query
// static UNUSED_FUNC void changeQueryHandleForInterpQuery(STsdbReader* pHandle) {
// // filter the queried time stamp in the first place
...
...
@@ -2533,12 +2574,12 @@ static int32_t checkForNeighborFileBlock(STsdbReader* pReader, STableBlockScanIn
SFileBlockDumpInfo
*
pDumpInfo
=
&
pReader
->
status
.
fBlockDumpInfo
;
SBlockData
*
pBlockData
=
&
pReader
->
status
.
fileBlockData
;
*
state
=
CHECK_FILEBLOCK_QUIT
;
int32_t
step
=
ASCENDING_TRAVERSE
(
pReader
->
order
)
?
1
:
-
1
;
int32_t
nextIndex
=
-
1
;
SBlock
*
pNeighborBlock
=
getNeighborBlockOfSameTable
(
pFBlock
,
pScanInfo
,
&
nextIndex
,
pReader
->
order
);
if
(
pNeighborBlock
==
NULL
)
{
// do nothing
*
state
=
CHECK_FILEBLOCK_QUIT
;
return
0
;
}
...
...
@@ -3280,8 +3321,8 @@ int32_t tsdbReaderReset(STsdbReader* pReader, SQueryTableDataCond* pCond, int32_
}
}
ASSERT
(
0
);
tsdbDebug
(
"%p reset tsdbreader in query %s"
,
pReader
,
numOfTables
,
pReader
->
idStr
);
tsdbDebug
(
"%p reset reader, suid:%"
PRIu64
", numOfTables:%d, query range:%"
PRId64
" - %"
PRId64
" in query %s"
,
pReader
,
pReader
->
suid
,
numOfTables
,
pReader
->
window
.
skey
,
pReader
->
window
.
ekey
,
pReader
->
idStr
);
return
code
;
}
...
...
source/dnode/vnode/src/tsdb/tsdbReaderWriter.c
浏览文件 @
064b2082
...
...
@@ -902,7 +902,7 @@ static int32_t tsdbReadSubColData(SDataFReader *pReader, SBlockIdx *pBlockIdx, S
ASSERT
(
pBlockCol
->
flag
&&
pBlockCol
->
flag
!=
HAS_NONE
);
code
=
tBlockDataAddColData
(
pBlockData
,
taosArrayGetSize
(
pBlockData
->
a
ColDataP
),
&
pColData
);
code
=
tBlockDataAddColData
(
pBlockData
,
taosArrayGetSize
(
pBlockData
->
a
Idx
),
&
pColData
);
if
(
code
)
goto
_err
;
tColDataInit
(
pColData
,
pBlockCol
->
cid
,
pBlockCol
->
type
,
pBlockCol
->
smaOn
);
...
...
@@ -1762,8 +1762,8 @@ static int32_t tsdbWriteBlockSma(TdFilePtr pFD, SBlockData *pBlockData, SSubBloc
// prepare
pSubBlock
->
nSma
=
0
;
for
(
int32_t
iColData
=
0
;
iColData
<
taosArrayGetSize
(
pBlockData
->
a
ColDataP
);
iColData
++
)
{
pColData
=
(
SColData
*
)
taosArrayGetP
(
pBlockData
->
aColDataP
,
iColData
);
for
(
int32_t
iColData
=
0
;
iColData
<
taosArrayGetSize
(
pBlockData
->
a
Idx
);
iColData
++
)
{
pColData
=
tBlockDataGetColDataByIdx
(
pBlockData
,
iColData
);
if
(
IS_VAR_DATA_TYPE
(
pColData
->
type
)
||
(
!
pColData
->
smaOn
))
continue
;
...
...
@@ -1775,8 +1775,8 @@ static int32_t tsdbWriteBlockSma(TdFilePtr pFD, SBlockData *pBlockData, SSubBloc
code
=
tRealloc
(
ppBuf
,
sizeof
(
SColumnDataAgg
)
*
pSubBlock
->
nSma
+
sizeof
(
TSCKSUM
));
if
(
code
)
goto
_err
;
n
=
0
;
for
(
int32_t
iColData
=
0
;
iColData
<
taosArrayGetSize
(
pBlockData
->
a
ColDataP
);
iColData
++
)
{
pColData
=
(
SColData
*
)
taosArrayGetP
(
pBlockData
->
aColDataP
,
iColData
);
for
(
int32_t
iColData
=
0
;
iColData
<
taosArrayGetSize
(
pBlockData
->
a
Idx
);
iColData
++
)
{
pColData
=
tBlockDataGetColDataByIdx
(
pBlockData
,
iColData
);
if
(
IS_VAR_DATA_TYPE
(
pColData
->
type
)
||
(
!
pColData
->
smaOn
))
continue
;
...
...
@@ -1834,14 +1834,14 @@ int32_t tsdbWriteBlockData(SDataFWriter *pWriter, SBlockData *pBlockData, uint8_
if
(
code
)
goto
_err
;
// COLUMNS
aBlockCol
=
taosArrayInit
(
taosArrayGetSize
(
pBlockData
->
a
ColDataP
),
sizeof
(
SBlockCol
));
aBlockCol
=
taosArrayInit
(
taosArrayGetSize
(
pBlockData
->
a
Idx
),
sizeof
(
SBlockCol
));
if
(
aBlockCol
==
NULL
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_err
;
}
int32_t
offset
=
0
;
for
(
int32_t
iCol
=
0
;
iCol
<
taosArrayGetSize
(
pBlockData
->
a
ColDataP
);
iCol
++
)
{
SColData
*
pColData
=
(
SColData
*
)
taosArrayGetP
(
pBlockData
->
aColDataP
,
iCol
);
for
(
int32_t
iCol
=
0
;
iCol
<
taosArrayGetSize
(
pBlockData
->
a
Idx
);
iCol
++
)
{
SColData
*
pColData
=
tBlockDataGetColDataByIdx
(
pBlockData
,
iCol
);
ASSERT
(
pColData
->
flag
);
...
...
source/dnode/vnode/src/tsdb/tsdbUtil.c
浏览文件 @
064b2082
...
...
@@ -544,8 +544,8 @@ SColVal *tRowIterNext(SRowIter *pIter) {
return
&
pIter
->
colVal
;
}
}
else
{
if
(
pIter
->
i
<
taosArrayGetSize
(
pIter
->
pRow
->
pBlockData
->
a
ColDataP
))
{
SColData
*
pColData
=
(
SColData
*
)
taosArrayGetP
(
pIter
->
pRow
->
pBlockData
->
aColDataP
,
pIter
->
i
);
if
(
pIter
->
i
<
taosArrayGetSize
(
pIter
->
pRow
->
pBlockData
->
a
Idx
))
{
SColData
*
pColData
=
tBlockDataGetColDataByIdx
(
pIter
->
pRow
->
pBlockData
,
pIter
->
i
);
tColDataGetValue
(
pColData
,
pIter
->
pRow
->
iRow
,
&
pIter
->
colVal
);
pIter
->
i
++
;
...
...
@@ -892,9 +892,9 @@ _exit:
return
code
;
}
static
FORCE_INLINE
int32_t
tColData
P
CmprFn
(
const
void
*
p1
,
const
void
*
p2
)
{
SColData
*
pColData1
=
*
(
SColData
*
*
)
p1
;
SColData
*
pColData2
=
*
(
SColData
*
*
)
p2
;
static
FORCE_INLINE
int32_t
tColDataCmprFn
(
const
void
*
p1
,
const
void
*
p2
)
{
SColData
*
pColData1
=
(
SColData
*
)
p1
;
SColData
*
pColData2
=
(
SColData
*
)
p2
;
if
(
pColData1
->
cid
<
pColData2
->
cid
)
{
return
-
1
;
...
...
@@ -912,14 +912,14 @@ int32_t tBlockDataInit(SBlockData *pBlockData) {
pBlockData
->
nRow
=
0
;
pBlockData
->
aVersion
=
NULL
;
pBlockData
->
aTSKEY
=
NULL
;
pBlockData
->
a
ColDataP
=
taosArrayInit
(
0
,
sizeof
(
SColData
*
));
if
(
pBlockData
->
a
ColDataP
==
NULL
)
{
pBlockData
->
a
Idx
=
taosArrayInit
(
0
,
sizeof
(
int32_t
));
if
(
pBlockData
->
a
Idx
==
NULL
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_exit
;
}
pBlockData
->
aColData
=
taosArrayInit
(
0
,
sizeof
(
SColData
));
if
(
pBlockData
->
aColData
==
NULL
)
{
taosArrayDestroy
(
pBlockData
->
a
ColDataP
);
taosArrayDestroy
(
pBlockData
->
a
Idx
);
code
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_exit
;
}
...
...
@@ -930,13 +930,13 @@ _exit:
void
tBlockDataReset
(
SBlockData
*
pBlockData
)
{
pBlockData
->
nRow
=
0
;
taosArrayClear
(
pBlockData
->
a
ColDataP
);
taosArrayClear
(
pBlockData
->
a
Idx
);
}
void
tBlockDataClear
(
SBlockData
*
pBlockData
)
{
tFree
((
uint8_t
*
)
pBlockData
->
aVersion
);
tFree
((
uint8_t
*
)
pBlockData
->
aTSKEY
);
taosArrayDestroy
(
pBlockData
->
a
ColDataP
);
taosArrayDestroy
(
pBlockData
->
a
Idx
);
taosArrayDestroyEx
(
pBlockData
->
aColData
,
tColDataClear
);
}
...
...
@@ -961,8 +961,8 @@ _exit:
void
tBlockDataClearData
(
SBlockData
*
pBlockData
)
{
pBlockData
->
nRow
=
0
;
for
(
int32_t
iColData
=
0
;
iColData
<
taosArrayGetSize
(
pBlockData
->
a
ColDataP
);
iColData
++
)
{
SColData
*
pColData
=
(
SColData
*
)
taosArrayGetP
(
pBlockData
->
aColDataP
,
iColData
);
for
(
int32_t
iColData
=
0
;
iColData
<
taosArrayGetSize
(
pBlockData
->
a
Idx
);
iColData
++
)
{
SColData
*
pColData
=
tBlockDataGetColDataByIdx
(
pBlockData
,
iColData
);
tColDataReset
(
pColData
);
}
}
...
...
@@ -970,7 +970,7 @@ void tBlockDataClearData(SBlockData *pBlockData) {
int32_t
tBlockDataAddColData
(
SBlockData
*
pBlockData
,
int32_t
iColData
,
SColData
**
ppColData
)
{
int32_t
code
=
0
;
SColData
*
pColData
=
NULL
;
int32_t
idx
=
taosArrayGetSize
(
pBlockData
->
a
ColDataP
);
int32_t
idx
=
taosArrayGetSize
(
pBlockData
->
a
Idx
);
if
(
idx
>=
taosArrayGetSize
(
pBlockData
->
aColData
))
{
if
(
taosArrayPush
(
pBlockData
->
aColData
,
&
((
SColData
){
0
}))
==
NULL
)
{
...
...
@@ -980,7 +980,7 @@ int32_t tBlockDataAddColData(SBlockData *pBlockData, int32_t iColData, SColData
}
pColData
=
(
SColData
*
)
taosArrayGet
(
pBlockData
->
aColData
,
idx
);
if
(
taosArrayInsert
(
pBlockData
->
a
ColDataP
,
iColData
,
&
pColData
)
==
NULL
)
{
if
(
taosArrayInsert
(
pBlockData
->
a
Idx
,
iColData
,
&
idx
)
==
NULL
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_err
;
}
...
...
@@ -1006,7 +1006,7 @@ int32_t tBlockDataAppendRow(SBlockData *pBlockData, TSDBROW *pRow, STSchema *pTS
// OTHER
int32_t
iColData
=
0
;
int32_t
nColData
=
taosArrayGetSize
(
pBlockData
->
a
ColDataP
);
int32_t
nColData
=
taosArrayGetSize
(
pBlockData
->
a
Idx
);
SRowIter
iter
=
{
0
};
SRowIter
*
pIter
=
&
iter
;
SColData
*
pColData
;
...
...
@@ -1015,7 +1015,7 @@ int32_t tBlockDataAppendRow(SBlockData *pBlockData, TSDBROW *pRow, STSchema *pTS
ASSERT
(
nColData
>
0
);
tRowIterInit
(
pIter
,
pRow
,
pTSchema
);
pColData
=
(
SColData
*
)
taosArrayGetP
(
pBlockData
->
aColDataP
,
iColData
);
pColData
=
tBlockDataGetColDataByIdx
(
pBlockData
,
iColData
);
pColVal
=
tRowIterNext
(
pIter
);
while
(
pColData
)
{
...
...
@@ -1025,12 +1025,12 @@ int32_t tBlockDataAppendRow(SBlockData *pBlockData, TSDBROW *pRow, STSchema *pTS
if
(
code
)
goto
_err
;
pColVal
=
tRowIterNext
(
pIter
);
pColData
=
((
++
iColData
)
<
nColData
)
?
(
SColData
*
)
taosArrayGetP
(
pBlockData
->
aColDataP
,
iColData
)
:
NULL
;
pColData
=
((
++
iColData
)
<
nColData
)
?
tBlockDataGetColDataByIdx
(
pBlockData
,
iColData
)
:
NULL
;
}
else
if
(
pColData
->
cid
<
pColVal
->
cid
)
{
code
=
tColDataAppendValue
(
pColData
,
&
COL_VAL_NONE
(
pColData
->
cid
,
pColData
->
type
));
if
(
code
)
goto
_err
;
pColData
=
((
++
iColData
)
<
nColData
)
?
(
SColData
*
)
taosArrayGetP
(
pBlockData
->
aColDataP
,
iColData
)
:
NULL
;
pColData
=
((
++
iColData
)
<
nColData
)
?
tBlockDataGetColDataByIdx
(
pBlockData
,
iColData
)
:
NULL
;
}
else
{
pColVal
=
tRowIterNext
(
pIter
);
}
...
...
@@ -1038,7 +1038,7 @@ int32_t tBlockDataAppendRow(SBlockData *pBlockData, TSDBROW *pRow, STSchema *pTS
code
=
tColDataAppendValue
(
pColData
,
&
COL_VAL_NONE
(
pColData
->
cid
,
pColData
->
type
));
if
(
code
)
goto
_err
;
pColData
=
((
++
iColData
)
<
nColData
)
?
(
SColData
*
)
taosArrayGetP
(
pBlockData
->
aColDataP
,
iColData
)
:
NULL
;
pColData
=
((
++
iColData
)
<
nColData
)
?
tBlockDataGetColDataByIdx
(
pBlockData
,
iColData
)
:
NULL
;
}
}
...
...
@@ -1054,33 +1054,33 @@ int32_t tBlockDataMerge(SBlockData *pBlockData1, SBlockData *pBlockData2, SBlock
// set target
int32_t
iColData1
=
0
;
int32_t
nColData1
=
taosArrayGetSize
(
pBlockData1
->
a
ColDataP
);
int32_t
nColData1
=
taosArrayGetSize
(
pBlockData1
->
a
Idx
);
int32_t
iColData2
=
0
;
int32_t
nColData2
=
taosArrayGetSize
(
pBlockData2
->
a
ColDataP
);
int32_t
nColData2
=
taosArrayGetSize
(
pBlockData2
->
a
Idx
);
SColData
*
pColData1
;
SColData
*
pColData2
;
SColData
*
pColData
;
tBlockDataReset
(
pBlockData
);
while
(
iColData1
<
nColData1
&&
iColData2
<
nColData2
)
{
pColData1
=
(
SColData
*
)
taosArrayGetP
(
pBlockData1
->
aColDataP
,
iColData1
);
pColData2
=
(
SColData
*
)
taosArrayGetP
(
pBlockData2
->
aColDataP
,
iColData2
);
pColData1
=
tBlockDataGetColDataByIdx
(
pBlockData1
,
iColData1
);
pColData2
=
tBlockDataGetColDataByIdx
(
pBlockData2
,
iColData2
);
if
(
pColData1
->
cid
==
pColData2
->
cid
)
{
code
=
tBlockDataAddColData
(
pBlockData
,
taosArrayGetSize
(
pBlockData
->
a
ColDataP
),
&
pColData
);
code
=
tBlockDataAddColData
(
pBlockData
,
taosArrayGetSize
(
pBlockData
->
a
Idx
),
&
pColData
);
if
(
code
)
goto
_exit
;
tColDataInit
(
pColData
,
pColData2
->
cid
,
pColData2
->
type
,
pColData2
->
smaOn
);
iColData1
++
;
iColData2
++
;
}
else
if
(
pColData1
->
cid
<
pColData2
->
cid
)
{
code
=
tBlockDataAddColData
(
pBlockData
,
taosArrayGetSize
(
pBlockData
->
a
ColDataP
),
&
pColData
);
code
=
tBlockDataAddColData
(
pBlockData
,
taosArrayGetSize
(
pBlockData
->
a
Idx
),
&
pColData
);
if
(
code
)
goto
_exit
;
tColDataInit
(
pColData
,
pColData1
->
cid
,
pColData1
->
type
,
pColData1
->
smaOn
);
iColData1
++
;
}
else
{
code
=
tBlockDataAddColData
(
pBlockData
,
taosArrayGetSize
(
pBlockData
->
a
ColDataP
),
&
pColData
);
code
=
tBlockDataAddColData
(
pBlockData
,
taosArrayGetSize
(
pBlockData
->
a
Idx
),
&
pColData
);
if
(
code
)
goto
_exit
;
tColDataInit
(
pColData
,
pColData2
->
cid
,
pColData2
->
type
,
pColData2
->
smaOn
);
...
...
@@ -1089,7 +1089,7 @@ int32_t tBlockDataMerge(SBlockData *pBlockData1, SBlockData *pBlockData2, SBlock
}
while
(
iColData1
<
nColData1
)
{
code
=
tBlockDataAddColData
(
pBlockData
,
taosArrayGetSize
(
pBlockData
->
a
ColDataP
),
&
pColData
);
code
=
tBlockDataAddColData
(
pBlockData
,
taosArrayGetSize
(
pBlockData
->
a
Idx
),
&
pColData
);
if
(
code
)
goto
_exit
;
tColDataInit
(
pColData
,
pColData1
->
cid
,
pColData1
->
type
,
pColData1
->
smaOn
);
...
...
@@ -1097,7 +1097,7 @@ int32_t tBlockDataMerge(SBlockData *pBlockData1, SBlockData *pBlockData2, SBlock
}
while
(
iColData2
<
nColData2
)
{
code
=
tBlockDataAddColData
(
pBlockData
,
taosArrayGetSize
(
pBlockData
->
a
ColDataP
),
&
pColData
);
code
=
tBlockDataAddColData
(
pBlockData
,
taosArrayGetSize
(
pBlockData
->
a
Idx
),
&
pColData
);
if
(
code
)
goto
_exit
;
tColDataInit
(
pColData
,
pColData2
->
cid
,
pColData2
->
type
,
pColData2
->
smaOn
);
...
...
@@ -1168,8 +1168,8 @@ int32_t tBlockDataCopy(SBlockData *pBlockDataSrc, SBlockData *pBlockDataDest) {
memcpy
(
pBlockDataDest
->
aTSKEY
,
pBlockDataSrc
->
aTSKEY
,
sizeof
(
TSKEY
)
*
pBlockDataSrc
->
nRow
);
// other
for
(
size_t
iColData
=
0
;
iColData
<
taosArrayGetSize
(
pBlockDataSrc
->
a
ColDataP
);
iColData
++
)
{
pColDataSrc
=
(
SColData
*
)
taosArrayGetP
(
pBlockDataSrc
->
aColDataP
,
iColData
);
for
(
size_t
iColData
=
0
;
iColData
<
taosArrayGetSize
(
pBlockDataSrc
->
a
Idx
);
iColData
++
)
{
pColDataSrc
=
tBlockDataGetColDataByIdx
(
pBlockDataSrc
,
iColData
);
code
=
tBlockDataAddColData
(
pBlockDataDest
,
iColData
,
&
pColDataDest
);
if
(
code
)
goto
_exit
;
...
...
@@ -1181,17 +1181,36 @@ _exit:
return
code
;
}
SColData
*
tBlockDataGetColDataByIdx
(
SBlockData
*
pBlockData
,
int32_t
idx
)
{
ASSERT
(
idx
>=
0
&&
idx
<
taosArrayGetSize
(
pBlockData
->
aIdx
));
return
(
SColData
*
)
taosArrayGet
(
pBlockData
->
aColData
,
*
(
int32_t
*
)
taosArrayGet
(
pBlockData
->
aIdx
,
idx
));
}
void
tBlockDataGetColData
(
SBlockData
*
pBlockData
,
int16_t
cid
,
SColData
**
ppColData
)
{
ASSERT
(
cid
!=
PRIMARYKEY_TIMESTAMP_COL_ID
);
int32_t
lidx
=
0
;
int32_t
ridx
=
taosArrayGetSize
(
pBlockData
->
aIdx
)
-
1
;
int32_t
midx
;
SColData
*
pColData
=
&
(
SColData
){.
cid
=
cid
};
while
(
lidx
<=
ridx
)
{
SColData
*
pColData
;
int32_t
c
;
void
*
p
=
taosArraySearch
(
pBlockData
->
aColDataP
,
&
pColData
,
tColDataPCmprFn
,
TD_EQ
);
if
(
p
==
NULL
)
{
*
ppColData
=
NULL
;
}
else
{
*
ppColData
=
*
(
SColData
**
)
p
;
midx
=
(
lidx
+
midx
)
/
2
;
pColData
=
tBlockDataGetColDataByIdx
(
pBlockData
,
midx
);
c
=
tColDataCmprFn
(
pColData
,
&
(
SColData
){.
cid
=
cid
});
if
(
c
==
0
)
{
*
ppColData
=
pColData
;
return
;
}
else
if
(
c
<
0
)
{
lidx
=
midx
+
1
;
}
else
{
ridx
=
midx
-
1
;
}
}
*
ppColData
=
NULL
;
}
// ALGORITHM ==============================
...
...
source/libs/executor/src/executil.c
浏览文件 @
064b2082
...
...
@@ -305,9 +305,6 @@ int32_t getTableList(void* metaHandle, void* pVnode, SScanPhysiNode* pScanNode,
SNode
*
pTagIndexCond
=
(
SNode
*
)
pListInfo
->
pTagIndexCond
;
if
(
pScanNode
->
tableType
==
TSDB_SUPER_TABLE
)
{
if
(
pTagIndexCond
)
{
SIndexMetaArg
metaArg
=
{
.
metaEx
=
metaHandle
,
.
idx
=
vnodeGetIdx
(
metaHandle
),
.
ivtIdx
=
vnodeGetIvtIdx
(
metaHandle
),
.
suid
=
tableUid
};
SArray
*
res
=
taosArrayInit
(
8
,
sizeof
(
uint64_t
));
// code = doFilterTag(pTagIndexCond, &metaArg, res);
code
=
TSDB_CODE_INDEX_REBUILDING
;
...
...
source/libs/executor/src/executorMain.c
浏览文件 @
064b2082
...
...
@@ -138,7 +138,7 @@ int32_t qExecTask(qTaskInfo_t tinfo, SSDataBlock** pRes, uint64_t* useconds) {
qDebug
(
"%s execTask is launched"
,
GET_TASKID
(
pTaskInfo
));
int64_t
st
=
taosGetTimestampUs
();
int64_t
st
=
taosGetTimestampUs
();
*
pRes
=
pTaskInfo
->
pRoot
->
fpSet
.
getNextFn
(
pTaskInfo
->
pRoot
);
uint64_t
el
=
(
taosGetTimestampUs
()
-
st
);
...
...
tests/script/jenkins/basic.txt
浏览文件 @
064b2082
...
...
@@ -163,8 +163,8 @@
# --- sma
./test.sh -f tsim/sma/drop_sma.sim
./test.sh -f tsim/sma/tsmaCreateInsertQuery.sim
./test.sh -f tsim/sma/rsmaCreateInsertQuery.sim
./test.sh -f tsim/sma/rsmaPersistenceRecovery.sim
#
./test.sh -f tsim/sma/rsmaCreateInsertQuery.sim
#
./test.sh -f tsim/sma/rsmaPersistenceRecovery.sim
# --- valgrind
./test.sh -f tsim/valgrind/checkError.sim -v
...
...
tests/script/tsim/stream/distributeInterval0.sim
浏览文件 @
064b2082
...
...
@@ -97,23 +97,23 @@ if $data01 != 8 then
goto loop1
endi
if $data02 !=
4
then
if $data02 !=
6
then
print =====data02=$data02
goto loop1
endi
if $data03 !=
4
then
print ======$data03
if $data03 !=
52
then
print ======
data03=
$data03
goto loop1
endi
if $data04 != 52 then
print ======$data04
print ======
data04=
$data04
goto loop1
endi
if $data05 != 13 then
print ======$data05
print ======
data05=
$data05
goto loop1
endi
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录