Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
eab6f84b
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
eab6f84b
编写于
4月 10, 2023
作者:
dengyihao
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'enh/rocksRevert' of
https://github.com/taosdata/TDengine
into enh/rocksRevert
上级
1416da19
fe9ca49d
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
37 addition
and
39 deletion
+37
-39
include/libs/stream/streamState.h
include/libs/stream/streamState.h
+2
-0
source/libs/executor/inc/executorimpl.h
source/libs/executor/inc/executorimpl.h
+0
-3
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+0
-27
source/libs/executor/src/scanoperator.c
source/libs/executor/src/scanoperator.c
+1
-0
source/libs/executor/src/timewindowoperator.c
source/libs/executor/src/timewindowoperator.c
+4
-4
source/libs/stream/src/streamExec.c
source/libs/stream/src/streamExec.c
+1
-1
source/libs/stream/src/streamState.c
source/libs/stream/src/streamState.c
+22
-2
source/libs/stream/src/tstreamFileState.c
source/libs/stream/src/tstreamFileState.c
+7
-2
未找到文件。
include/libs/stream/streamState.h
浏览文件 @
eab6f84b
...
@@ -17,6 +17,7 @@
...
@@ -17,6 +17,7 @@
#include "rocksdb/c.h"
#include "rocksdb/c.h"
#include "tdbInt.h"
#include "tdbInt.h"
#include "tsimplehash.h"
#include "tstreamFileState.h"
#include "tstreamFileState.h"
#ifdef __cplusplus
#ifdef __cplusplus
...
@@ -57,6 +58,7 @@ typedef struct {
...
@@ -57,6 +58,7 @@ typedef struct {
STdbState
*
pTdbState
;
STdbState
*
pTdbState
;
SStreamFileState
*
pFileState
;
SStreamFileState
*
pFileState
;
int32_t
number
;
int32_t
number
;
SSHashObj
*
parNameMap
;
}
SStreamState
;
}
SStreamState
;
SStreamState
*
streamStateOpen
(
char
*
path
,
SStreamTask
*
pTask
,
bool
specPath
,
int32_t
szPage
,
int32_t
pages
);
SStreamState
*
streamStateOpen
(
char
*
path
,
SStreamTask
*
pTask
,
bool
specPath
,
int32_t
szPage
,
int32_t
pages
);
...
...
source/libs/executor/inc/executorimpl.h
浏览文件 @
eab6f84b
...
@@ -714,9 +714,6 @@ int32_t initAggSup(SExprSupp* pSup, SAggSupporter* pAggSup, SExprInfo* pExprInfo
...
@@ -714,9 +714,6 @@ int32_t initAggSup(SExprSupp* pSup, SAggSupporter* pAggSup, SExprInfo* pExprInfo
void
cleanupAggSup
(
SAggSupporter
*
pAggSup
);
void
cleanupAggSup
(
SAggSupporter
*
pAggSup
);
void
initResultSizeInfo
(
SResultInfo
*
pResultInfo
,
int32_t
numOfRows
);
void
initResultSizeInfo
(
SResultInfo
*
pResultInfo
,
int32_t
numOfRows
);
void
doBuildStreamResBlock
(
SOperatorInfo
*
pOperator
,
SOptrBasicInfo
*
pbInfo
,
SGroupResInfo
*
pGroupResInfo
,
SDiskbasedBuf
*
pBuf
);
void
doBuildResultDatablock
(
SOperatorInfo
*
pOperator
,
SOptrBasicInfo
*
pbInfo
,
SGroupResInfo
*
pGroupResInfo
,
void
doBuildResultDatablock
(
SOperatorInfo
*
pOperator
,
SOptrBasicInfo
*
pbInfo
,
SGroupResInfo
*
pGroupResInfo
,
SDiskbasedBuf
*
pBuf
);
SDiskbasedBuf
*
pBuf
);
...
...
source/libs/executor/src/executorimpl.c
浏览文件 @
eab6f84b
...
@@ -1218,33 +1218,6 @@ int32_t doCopyToSDataBlock(SExecTaskInfo* pTaskInfo, SSDataBlock* pBlock, SExprS
...
@@ -1218,33 +1218,6 @@ int32_t doCopyToSDataBlock(SExecTaskInfo* pTaskInfo, SSDataBlock* pBlock, SExprS
return
0
;
return
0
;
}
}
void
doBuildStreamResBlock
(
SOperatorInfo
*
pOperator
,
SOptrBasicInfo
*
pbInfo
,
SGroupResInfo
*
pGroupResInfo
,
SDiskbasedBuf
*
pBuf
)
{
SExecTaskInfo
*
pTaskInfo
=
pOperator
->
pTaskInfo
;
SSDataBlock
*
pBlock
=
pbInfo
->
pRes
;
// set output datablock version
pBlock
->
info
.
version
=
pTaskInfo
->
version
;
blockDataCleanup
(
pBlock
);
if
(
!
hasRemainResults
(
pGroupResInfo
))
{
return
;
}
// clear the existed group id
pBlock
->
info
.
id
.
groupId
=
0
;
ASSERT
(
!
pbInfo
->
mergeResultBlock
);
doCopyToSDataBlock
(
pTaskInfo
,
pBlock
,
&
pOperator
->
exprSupp
,
pBuf
,
pGroupResInfo
);
void
*
tbname
=
NULL
;
if
(
streamStateGetParName
(
pTaskInfo
->
streamInfo
.
pState
,
pBlock
->
info
.
id
.
groupId
,
&
tbname
)
<
0
)
{
pBlock
->
info
.
parTbName
[
0
]
=
0
;
}
else
{
memcpy
(
pBlock
->
info
.
parTbName
,
tbname
,
TSDB_TABLE_NAME_LEN
);
}
streamFreeVal
(
tbname
);
}
void
doBuildResultDatablock
(
SOperatorInfo
*
pOperator
,
SOptrBasicInfo
*
pbInfo
,
SGroupResInfo
*
pGroupResInfo
,
void
doBuildResultDatablock
(
SOperatorInfo
*
pOperator
,
SOptrBasicInfo
*
pbInfo
,
SGroupResInfo
*
pGroupResInfo
,
SDiskbasedBuf
*
pBuf
)
{
SDiskbasedBuf
*
pBuf
)
{
SExecTaskInfo
*
pTaskInfo
=
pOperator
->
pTaskInfo
;
SExecTaskInfo
*
pTaskInfo
=
pOperator
->
pTaskInfo
;
...
...
source/libs/executor/src/scanoperator.c
浏览文件 @
eab6f84b
...
@@ -1130,6 +1130,7 @@ static STimeWindow getSlidingWindow(TSKEY* startTsCol, TSKEY* endTsCol, uint64_t
...
@@ -1130,6 +1130,7 @@ static STimeWindow getSlidingWindow(TSKEY* startTsCol, TSKEY* endTsCol, uint64_t
}
}
static
SSDataBlock
*
doRangeScan
(
SStreamScanInfo
*
pInfo
,
SSDataBlock
*
pSDB
,
int32_t
tsColIndex
,
int32_t
*
pRowIndex
)
{
static
SSDataBlock
*
doRangeScan
(
SStreamScanInfo
*
pInfo
,
SSDataBlock
*
pSDB
,
int32_t
tsColIndex
,
int32_t
*
pRowIndex
)
{
qInfo
(
"do stream range scan. windows index:%d"
,
*
pRowIndex
);
while
(
1
)
{
while
(
1
)
{
SSDataBlock
*
pResult
=
NULL
;
SSDataBlock
*
pResult
=
NULL
;
pResult
=
doTableScan
(
pInfo
->
pTableScanOp
);
pResult
=
doTableScan
(
pInfo
->
pTableScanOp
);
...
...
source/libs/executor/src/timewindowoperator.c
浏览文件 @
eab6f84b
...
@@ -2627,11 +2627,11 @@ static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator) {
...
@@ -2627,11 +2627,11 @@ static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator) {
}
}
if
(
!
pInfo
->
pUpdated
)
{
if
(
!
pInfo
->
pUpdated
)
{
pInfo
->
pUpdated
=
taosArrayInit
(
4
,
POINTER_BYTES
);
pInfo
->
pUpdated
=
taosArrayInit
(
4
096
,
POINTER_BYTES
);
}
}
if
(
!
pInfo
->
pUpdatedMap
)
{
if
(
!
pInfo
->
pUpdatedMap
)
{
_hash_fn_t
hashFn
=
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BINARY
);
_hash_fn_t
hashFn
=
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BINARY
);
pInfo
->
pUpdatedMap
=
tSimpleHashInit
(
1024
,
hashFn
);
pInfo
->
pUpdatedMap
=
tSimpleHashInit
(
4096
,
hashFn
);
}
}
while
(
1
)
{
while
(
1
)
{
...
@@ -4864,11 +4864,11 @@ static SSDataBlock* doStreamIntervalAgg(SOperatorInfo* pOperator) {
...
@@ -4864,11 +4864,11 @@ static SSDataBlock* doStreamIntervalAgg(SOperatorInfo* pOperator) {
SOperatorInfo
*
downstream
=
pOperator
->
pDownstream
[
0
];
SOperatorInfo
*
downstream
=
pOperator
->
pDownstream
[
0
];
if
(
!
pInfo
->
pUpdated
)
{
if
(
!
pInfo
->
pUpdated
)
{
pInfo
->
pUpdated
=
taosArrayInit
(
4
,
POINTER_BYTES
);
pInfo
->
pUpdated
=
taosArrayInit
(
4
096
,
POINTER_BYTES
);
}
}
if
(
!
pInfo
->
pUpdatedMap
)
{
if
(
!
pInfo
->
pUpdatedMap
)
{
_hash_fn_t
hashFn
=
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BINARY
);
_hash_fn_t
hashFn
=
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BINARY
);
pInfo
->
pUpdatedMap
=
tSimpleHashInit
(
1024
,
hashFn
);
pInfo
->
pUpdatedMap
=
tSimpleHashInit
(
4096
,
hashFn
);
}
}
while
(
1
)
{
while
(
1
)
{
...
...
source/libs/stream/src/streamExec.c
浏览文件 @
eab6f84b
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
#include "streamInc.h"
#include "streamInc.h"
#define STREAM_EXEC_MAX_BATCH_NUM 10
0
#define STREAM_EXEC_MAX_BATCH_NUM 10
24
static
int32_t
streamTaskExecImpl
(
SStreamTask
*
pTask
,
const
void
*
data
,
SArray
*
pRes
)
{
static
int32_t
streamTaskExecImpl
(
SStreamTask
*
pTask
,
const
void
*
data
,
SArray
*
pRes
)
{
int32_t
code
;
int32_t
code
;
...
...
source/libs/stream/src/streamState.c
浏览文件 @
eab6f84b
...
@@ -26,6 +26,8 @@
...
@@ -26,6 +26,8 @@
#include "tcompare.h"
#include "tcompare.h"
#include "ttimer.h"
#include "ttimer.h"
#define MAX_TABLE_NAME_NUM 100000
int
sessionRangeKeyCmpr
(
const
SSessionKey
*
pWin1
,
const
SSessionKey
*
pWin2
)
{
int
sessionRangeKeyCmpr
(
const
SSessionKey
*
pWin1
,
const
SSessionKey
*
pWin2
)
{
if
(
pWin1
->
groupId
>
pWin2
->
groupId
)
{
if
(
pWin1
->
groupId
>
pWin2
->
groupId
)
{
return
1
;
return
1
;
...
@@ -133,6 +135,8 @@ SStreamState* streamStateOpen(char* path, SStreamTask* pTask, bool specPath, int
...
@@ -133,6 +135,8 @@ SStreamState* streamStateOpen(char* path, SStreamTask* pTask, bool specPath, int
qWarn
(
"open stream state2, %s"
,
statePath
);
qWarn
(
"open stream state2, %s"
,
statePath
);
pState
->
pTdbState
->
pOwner
=
pTask
;
pState
->
pTdbState
->
pOwner
=
pTask
;
pState
->
pFileState
=
NULL
;
pState
->
pFileState
=
NULL
;
_hash_fn_t
hashFn
=
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BIGINT
);
pState
->
parNameMap
=
tSimpleHashInit
(
1024
,
hashFn
);
return
pState
;
return
pState
;
#else
#else
...
@@ -1020,7 +1024,14 @@ _end:
...
@@ -1020,7 +1024,14 @@ _end:
int32_t
streamStatePutParName
(
SStreamState
*
pState
,
int64_t
groupId
,
const
char
tbname
[
TSDB_TABLE_NAME_LEN
])
{
int32_t
streamStatePutParName
(
SStreamState
*
pState
,
int64_t
groupId
,
const
char
tbname
[
TSDB_TABLE_NAME_LEN
])
{
qWarn
(
"try to write to cf parname"
);
qWarn
(
"try to write to cf parname"
);
#ifdef USE_ROCKSDB
#ifdef USE_ROCKSDB
return
streamStatePutParName_rocksdb
(
pState
,
groupId
,
tbname
);
if
(
tSimpleHashGetSize
(
pState
->
parNameMap
)
>
MAX_TABLE_NAME_NUM
)
{
if
(
tSimpleHashGet
(
pState
->
parNameMap
,
&
groupId
,
sizeof
(
int64_t
))
==
NULL
)
{
streamStatePutParName_rocksdb
(
pState
,
groupId
,
tbname
);
}
return
TSDB_CODE_SUCCESS
;
}
tSimpleHashPut
(
pState
->
parNameMap
,
&
groupId
,
sizeof
(
int64_t
),
tbname
,
TSDB_TABLE_NAME_LEN
);
return
TSDB_CODE_SUCCESS
;
#else
#else
return
tdbTbUpsert
(
pState
->
pTdbState
->
pParNameDb
,
&
groupId
,
sizeof
(
int64_t
),
tbname
,
TSDB_TABLE_NAME_LEN
,
return
tdbTbUpsert
(
pState
->
pTdbState
->
pParNameDb
,
&
groupId
,
sizeof
(
int64_t
),
tbname
,
TSDB_TABLE_NAME_LEN
,
pState
->
pTdbState
->
txn
);
pState
->
pTdbState
->
txn
);
...
@@ -1029,7 +1040,16 @@ int32_t streamStatePutParName(SStreamState* pState, int64_t groupId, const char
...
@@ -1029,7 +1040,16 @@ int32_t streamStatePutParName(SStreamState* pState, int64_t groupId, const char
int32_t
streamStateGetParName
(
SStreamState
*
pState
,
int64_t
groupId
,
void
**
pVal
)
{
int32_t
streamStateGetParName
(
SStreamState
*
pState
,
int64_t
groupId
,
void
**
pVal
)
{
#ifdef USE_ROCKSDB
#ifdef USE_ROCKSDB
return
streamStateGetParName_rocksdb
(
pState
,
groupId
,
pVal
);
void
*
pStr
=
tSimpleHashGet
(
pState
->
parNameMap
,
&
groupId
,
sizeof
(
int64_t
));
if
(
!
pStr
)
{
if
(
tSimpleHashGetSize
(
pState
->
parNameMap
)
>
MAX_TABLE_NAME_NUM
)
{
return
streamStateGetParName_rocksdb
(
pState
,
groupId
,
pVal
);
}
return
TSDB_CODE_FAILED
;
}
*
pVal
=
taosMemoryCalloc
(
1
,
TSDB_TABLE_NAME_LEN
);
memcpy
(
*
pVal
,
pStr
,
TSDB_TABLE_NAME_LEN
);
return
TSDB_CODE_SUCCESS
;
#else
#else
int32_t
len
;
int32_t
len
;
return
tdbTbGet
(
pState
->
pTdbState
->
pParNameDb
,
&
groupId
,
sizeof
(
int64_t
),
pVal
,
&
len
);
return
tdbTbGet
(
pState
->
pTdbState
->
pParNameDb
,
&
groupId
,
sizeof
(
int64_t
),
pVal
,
&
len
);
...
...
source/libs/stream/src/tstreamFileState.c
浏览文件 @
eab6f84b
...
@@ -57,10 +57,12 @@ SStreamFileState* streamFileStateInit(int64_t memSize, uint32_t keySize, uint32_
...
@@ -57,10 +57,12 @@ SStreamFileState* streamFileStateInit(int64_t memSize, uint32_t keySize, uint32_
if
(
!
pFileState
)
{
if
(
!
pFileState
)
{
goto
_error
;
goto
_error
;
}
}
pFileState
->
maxRowCount
=
TMAX
(
(
uint64_t
)
memSize
/
rowSize
,
FLUSH_NUM
*
2
);
pFileState
->
usedBuffs
=
tdListNew
(
POINTER_BYTES
);
pFileState
->
usedBuffs
=
tdListNew
(
POINTER_BYTES
);
pFileState
->
freeBuffs
=
tdListNew
(
POINTER_BYTES
);
pFileState
->
freeBuffs
=
tdListNew
(
POINTER_BYTES
);
_hash_fn_t
hashFn
=
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BINARY
);
_hash_fn_t
hashFn
=
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BINARY
);
pFileState
->
rowBuffMap
=
tSimpleHashInit
(
1024
,
hashFn
);
int32_t
cap
=
TMIN
(
10240
,
pFileState
->
maxRowCount
);
pFileState
->
rowBuffMap
=
tSimpleHashInit
(
cap
,
hashFn
);
if
(
!
pFileState
->
usedBuffs
||
!
pFileState
->
freeBuffs
||
!
pFileState
->
rowBuffMap
)
{
if
(
!
pFileState
->
usedBuffs
||
!
pFileState
->
freeBuffs
||
!
pFileState
->
rowBuffMap
)
{
goto
_error
;
goto
_error
;
}
}
...
@@ -126,7 +128,9 @@ void clearExpiredRowBuff(SStreamFileState* pFileState, TSKEY ts, bool all) {
...
@@ -126,7 +128,9 @@ void clearExpiredRowBuff(SStreamFileState* pFileState, TSKEY ts, bool all) {
ASSERT
(
pPos
->
pRowBuff
!=
NULL
);
ASSERT
(
pPos
->
pRowBuff
!=
NULL
);
tdListAppend
(
pFileState
->
freeBuffs
,
&
(
pPos
->
pRowBuff
));
tdListAppend
(
pFileState
->
freeBuffs
,
&
(
pPos
->
pRowBuff
));
pPos
->
pRowBuff
=
NULL
;
pPos
->
pRowBuff
=
NULL
;
tSimpleHashRemove
(
pFileState
->
rowBuffMap
,
pPos
->
pKey
,
pFileState
->
keyLen
);
if
(
!
all
)
{
tSimpleHashRemove
(
pFileState
->
rowBuffMap
,
pPos
->
pKey
,
pFileState
->
keyLen
);
}
destroyRowBuffPos
(
pPos
);
destroyRowBuffPos
(
pPos
);
tdListPopNode
(
pFileState
->
usedBuffs
,
pNode
);
tdListPopNode
(
pFileState
->
usedBuffs
,
pNode
);
taosMemoryFreeClear
(
pNode
);
taosMemoryFreeClear
(
pNode
);
...
@@ -156,6 +160,7 @@ void popUsedBuffs(SStreamFileState* pFileState, SStreamSnapshot* pFlushList, uin
...
@@ -156,6 +160,7 @@ void popUsedBuffs(SStreamFileState* pFileState, SStreamSnapshot* pFlushList, uin
i
++
;
i
++
;
}
}
}
}
qInfo
(
"do stream state flush %d rows to disck. is used: %d"
,
listNEles
(
pFlushList
),
used
);
}
}
int32_t
flushRowBuff
(
SStreamFileState
*
pFileState
)
{
int32_t
flushRowBuff
(
SStreamFileState
*
pFileState
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录