Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
2cc2e5d5
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,发现更多精彩内容 >>
提交
2cc2e5d5
编写于
3月 27, 2023
作者:
dengyihao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add backend
上级
874b6916
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
60 addition
and
76 deletion
+60
-76
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+0
-3
source/libs/executor/src/timewindowoperator.c
source/libs/executor/src/timewindowoperator.c
+0
-15
source/libs/stream/src/streamStateRocksdb.c
source/libs/stream/src/streamStateRocksdb.c
+60
-58
未找到文件。
source/libs/executor/src/executorimpl.c
浏览文件 @
2cc2e5d5
...
...
@@ -1065,12 +1065,9 @@ void doUpdateNumOfRows(SqlFunctionCtx* pCtx, SResultRow* pRow, int32_t numOfExpr
bool
returnNotNull
=
false
;
for
(
int32_t
j
=
0
;
j
<
numOfExprs
;
++
j
)
{
SResultRowEntryInfo
*
pResInfo
=
getResultEntryInfo
(
pRow
,
j
,
rowEntryOffset
);
qWarn
(
"offset: idx: %d, val: %d"
,
j
,
rowEntryOffset
[
j
]);
if
(
!
isRowEntryInitialized
(
pResInfo
))
{
qWarn
(
"no result"
);
continue
;
}
else
{
qWarn
(
"has result"
);
}
if
(
pRow
->
numOfRows
<
pResInfo
->
numOfRes
)
{
...
...
source/libs/executor/src/timewindowoperator.c
浏览文件 @
2cc2e5d5
...
...
@@ -2352,8 +2352,6 @@ static void doStreamIntervalAggImpl(SOperatorInfo* pOperatorInfo, SSDataBlock* p
SResultRow
*
pResult
=
NULL
;
int32_t
forwardRows
=
0
;
int
stepTrace
=
0
;
qWarn
(
"step1 %d"
,
stepTrace
++
);
SColumnInfoData
*
pColDataInfo
=
taosArrayGet
(
pSDataBlock
->
pDataBlock
,
pInfo
->
primaryTsIndex
);
tsCols
=
(
int64_t
*
)
pColDataInfo
->
pData
;
...
...
@@ -2366,17 +2364,14 @@ static void doStreamIntervalAggImpl(SOperatorInfo* pOperatorInfo, SSDataBlock* p
nextWin
=
getActiveTimeWindow
(
pInfo
->
aggSup
.
pResultBuf
,
pResultRowInfo
,
ts
,
&
pInfo
->
interval
,
TSDB_ORDER_ASC
);
}
while
(
1
)
{
qWarn
(
"step1 %d"
,
stepTrace
++
);
bool
isClosed
=
isCloseWindow
(
&
nextWin
,
&
pInfo
->
twAggSup
);
if
((
pInfo
->
ignoreExpiredData
&&
isClosed
)
||
!
inSlidingWindow
(
&
pInfo
->
interval
,
&
nextWin
,
&
pSDataBlock
->
info
))
{
startPos
=
getNexWindowPos
(
&
pInfo
->
interval
,
&
pSDataBlock
->
info
,
tsCols
,
startPos
,
nextWin
.
ekey
,
&
nextWin
);
if
(
startPos
<
0
)
{
qWarn
(
"step1 %d"
,
stepTrace
++
);
break
;
}
continue
;
}
qWarn
(
"step1 %d"
,
stepTrace
++
);
if
(
IS_FINAL_OP
(
pInfo
)
&&
isClosed
&&
pInfo
->
pChildren
)
{
bool
ignore
=
true
;
...
...
@@ -2407,7 +2402,6 @@ static void doStreamIntervalAggImpl(SOperatorInfo* pOperatorInfo, SSDataBlock* p
ignore
=
false
;
}
}
qWarn
(
"step1 %d"
,
stepTrace
++
);
if
(
ignore
)
{
startPos
=
getNexWindowPos
(
&
pInfo
->
interval
,
&
pSDataBlock
->
info
,
tsCols
,
startPos
,
nextWin
.
ekey
,
&
nextWin
);
...
...
@@ -2417,27 +2411,22 @@ static void doStreamIntervalAggImpl(SOperatorInfo* pOperatorInfo, SSDataBlock* p
continue
;
}
}
qWarn
(
"step1 %d"
,
stepTrace
++
);
int32_t
code
=
setOutputBuf
(
pInfo
->
pState
,
&
nextWin
,
&
pResult
,
groupId
,
pSup
->
pCtx
,
numOfOutput
,
pSup
->
rowEntryInfoOffset
,
&
pInfo
->
aggSup
);
if
(
code
!=
TSDB_CODE_SUCCESS
||
pResult
==
NULL
)
{
qWarn
(
"step1 %d"
,
stepTrace
++
);
T_LONG_JMP
(
pTaskInfo
->
env
,
TSDB_CODE_OUT_OF_MEMORY
);
}
qWarn
(
"step1 %d"
,
stepTrace
++
);
if
(
IS_FINAL_OP
(
pInfo
))
{
forwardRows
=
1
;
}
else
{
forwardRows
=
getNumOfRowsInTimeWindow
(
&
pSDataBlock
->
info
,
tsCols
,
startPos
,
nextWin
.
ekey
,
binarySearchForKey
,
NULL
,
TSDB_ORDER_ASC
);
}
qWarn
(
"step1 %d"
,
stepTrace
++
);
if
(
pInfo
->
twAggSup
.
calTrigger
==
STREAM_TRIGGER_AT_ONCE
&&
pUpdatedMap
)
{
saveWinResultInfo
(
pResult
->
win
.
skey
,
groupId
,
pUpdatedMap
);
}
qWarn
(
"step1 %d"
,
stepTrace
++
);
if
(
pInfo
->
twAggSup
.
calTrigger
==
STREAM_TRIGGER_WINDOW_CLOSE
)
{
SWinKey
key
=
{
.
ts
=
pResult
->
win
.
skey
,
...
...
@@ -2446,7 +2435,6 @@ static void doStreamIntervalAggImpl(SOperatorInfo* pOperatorInfo, SSDataBlock* p
tSimpleHashPut
(
pInfo
->
aggSup
.
pResultRowHashTable
,
&
key
,
sizeof
(
SWinKey
),
NULL
,
0
);
}
qWarn
(
"step1 %d"
,
stepTrace
++
);
updateTimeWindowInfo
(
&
pInfo
->
twAggSup
.
timeWindowData
,
&
nextWin
,
true
);
applyAggFunctionOnPartialTuples
(
pTaskInfo
,
pSup
->
pCtx
,
&
pInfo
->
twAggSup
.
timeWindowData
,
startPos
,
forwardRows
,
pSDataBlock
->
info
.
rows
,
numOfOutput
);
...
...
@@ -2455,7 +2443,6 @@ static void doStreamIntervalAggImpl(SOperatorInfo* pOperatorInfo, SSDataBlock* p
.
groupId
=
groupId
,
};
qWarn
(
"step1 %d"
,
stepTrace
++
);
saveOutputBuf
(
pInfo
->
pState
,
&
key
,
pResult
,
pInfo
->
aggSup
.
resultRowSize
);
releaseOutputBuf
(
pInfo
->
pState
,
&
key
,
pResult
);
if
(
pInfo
->
delKey
.
ts
>
key
.
ts
)
{
...
...
@@ -2474,7 +2461,6 @@ static void doStreamIntervalAggImpl(SOperatorInfo* pOperatorInfo, SSDataBlock* p
pSDataBlock
->
info
.
id
.
uid
,
pSDataBlock
->
info
.
window
.
skey
,
pSDataBlock
->
info
.
window
.
ekey
);
}
}
qWarn
(
"step1 %d"
,
stepTrace
++
);
if
(
IS_FINAL_OP
(
pInfo
))
{
startPos
=
getNextQualifiedFinalWindow
(
&
pInfo
->
interval
,
&
nextWin
,
&
pSDataBlock
->
info
,
tsCols
,
prevEndPos
);
...
...
@@ -2483,7 +2469,6 @@ static void doStreamIntervalAggImpl(SOperatorInfo* pOperatorInfo, SSDataBlock* p
getNextQualifiedWindow
(
&
pInfo
->
interval
,
&
nextWin
,
&
pSDataBlock
->
info
,
tsCols
,
prevEndPos
,
TSDB_ORDER_ASC
);
}
if
(
startPos
<
0
)
{
qWarn
(
"step1 %d"
,
stepTrace
++
);
break
;
}
}
...
...
source/libs/stream/src/streamStateRocksdb.c
浏览文件 @
2cc2e5d5
...
...
@@ -333,6 +333,8 @@ int streamInitBackend(SStreamState* pState, char* path) {
pState
->
pTdbState
->
rocksdb
=
db
;
pState
->
pTdbState
->
pHandle
=
cfHandle
;
pState
->
pTdbState
->
wopts
=
rocksdb_writeoptions_create
();
// rocksdb_writeoptions_
rocksdb_writeoptions_set_no_slowdown
(
pState
->
pTdbState
->
wopts
,
1
);
pState
->
pTdbState
->
ropts
=
rocksdb_readoptions_create
();
return
0
;
}
...
...
@@ -341,6 +343,8 @@ void streamCleanBackend(SStreamState* pState) {
for
(
int
i
=
0
;
i
<
cfLen
;
i
++
)
{
rocksdb_column_family_handle_destroy
(
pState
->
pTdbState
->
pHandle
[
i
]);
}
rocksdb_writeoptions_destroy
(
pState
->
pTdbState
->
wopts
);
rocksdb_readoptions_destroy
(
pState
->
pTdbState
->
ropts
);
rocksdb_close
(
pState
->
pTdbState
->
rocksdb
);
}
...
...
@@ -352,7 +356,18 @@ int streamGetInit(const char* funcName) {
}
return
-
1
;
}
bool
streamStateIterSeekAndValid
(
rocksdb_iterator_t
*
iter
,
char
*
buf
,
size_t
len
)
{
bool
valid
=
false
;
rocksdb_iter_seek
(
iter
,
buf
,
len
);
if
(
!
rocksdb_iter_valid
(
iter
))
{
rocksdb_iter_seek_for_prev
(
iter
,
buf
,
len
);
if
(
!
rocksdb_iter_valid
(
iter
))
{
return
valid
;
}
}
valid
=
true
;
return
valid
;
}
#define STREAM_STATE_PUT_ROCKSDB(pState, funcname, key, value, vLen) \
do { \
code = 0; \
...
...
@@ -542,14 +557,10 @@ SStreamStateCur* streamStateSessionSeekKeyCurrentPrev_rocksdb(SStreamState* pSta
// char toString[128] = {0};
// stateSessionKeyToString(&sKey, toString);
// qWarn("streamState seek key %s", toString);
rocksdb_iter_seek
(
pCur
->
iter
,
buf
,
len
);
if
(
!
rocksdb_iter_valid
(
pCur
->
iter
))
{
rocksdb_iter_seek_for_prev
(
pCur
->
iter
,
buf
,
len
);
if
(
!
rocksdb_iter_valid
(
pCur
->
iter
))
{
streamStateFreeCur
(
pCur
);
return
NULL
;
}
bool
valid
=
streamStateIterSeekAndValid
(
pCur
->
iter
,
buf
,
len
);
if
(
valid
==
false
)
{
streamStateFreeCur
(
pCur
);
return
NULL
;
}
int32_t
c
=
0
;
...
...
@@ -582,13 +593,18 @@ SStreamStateCur* streamStateSessionSeekKeyCurrentNext_rocksdb(SStreamState* pSta
SStateSessionKey
sKey
=
{.
key
=
*
key
,
.
opNum
=
pState
->
number
};
int
len
=
stateSessionKeyEncode
(
&
sKey
,
buf
);
rocksdb_iter_seek
(
pCur
->
iter
,
(
const
char
*
)
buf
,
len
);
if
(
!
rocksdb_iter_valid
(
pCur
->
iter
))
{
rocksdb_iter_seek_for_prev
(
pCur
->
iter
,
buf
,
len
);
if
(
!
rocksdb_iter_valid
(
pCur
->
iter
))
{
streamStateFreeCur
(
pCur
);
return
NULL
;
}
// rocksdb_iter_seek(pCur->iter, (const char*)buf, len);
// if (!rocksdb_iter_valid(pCur->iter)) {
// rocksdb_iter_seek_for_prev(pCur->iter, buf, len);
// if (!rocksdb_iter_valid(pCur->iter)) {
// streamStateFreeCur(pCur);
// return NULL;
// }
// }
bool
valid
=
streamStateIterSeekAndValid
(
pCur
->
iter
,
buf
,
len
);
if
(
valid
==
false
)
{
streamStateFreeCur
(
pCur
);
return
NULL
;
}
size_t
klen
;
const
char
*
iKey
=
rocksdb_iter_key
(
pCur
->
iter
,
&
klen
);
...
...
@@ -617,14 +633,13 @@ SStreamStateCur* streamStateSessionSeekKeyNext_rocksdb(SStreamState* pState, con
char
buf
[
128
]
=
{
0
};
int
len
=
stateSessionKeyEncode
(
&
sKey
,
buf
);
rocksdb_iter_seek
(
pCur
->
iter
,
(
const
char
*
)
buf
,
len
);
if
(
!
rocksdb_iter_valid
(
pCur
->
iter
))
{
rocksdb_iter_seek_for_prev
(
pCur
->
iter
,
buf
,
len
);
if
(
!
rocksdb_iter_valid
(
pCur
->
iter
))
{
streamStateFreeCur
(
pCur
);
return
NULL
;
}
bool
valid
=
streamStateIterSeekAndValid
(
pCur
->
iter
,
buf
,
len
);
if
(
valid
==
false
)
{
streamStateFreeCur
(
pCur
);
return
NULL
;
}
size_t
klen
;
const
char
*
iKey
=
rocksdb_iter_key
(
pCur
->
iter
,
&
klen
);
SStateSessionKey
curKey
=
{
0
};
...
...
@@ -721,14 +736,13 @@ SStreamStateCur* streamStateFillGetCur_rocksdb(SStreamState* pState, const SWinK
rocksdb_create_iterator_cf
(
pState
->
pTdbState
->
rocksdb
,
pState
->
pTdbState
->
ropts
,
pState
->
pTdbState
->
pHandle
[
1
]);
char
buf
[
128
]
=
{
0
};
int
len
=
winKeyEncode
((
void
*
)
key
,
buf
);
rocksdb_iter_seek
(
pCur
->
iter
,
buf
,
len
);
if
(
!
rocksdb_iter_valid
(
pCur
->
iter
))
{
rocksdb_iter_seek_for_prev
(
pCur
->
iter
,
buf
,
len
);
if
(
!
rocksdb_iter_valid
(
pCur
->
iter
))
{
streamStateFreeCur
(
pCur
);
return
NULL
;
}
bool
valid
=
streamStateIterSeekAndValid
(
pCur
->
iter
,
buf
,
len
);
if
(
valid
==
false
)
{
streamStateFreeCur
(
pCur
);
return
NULL
;
}
if
(
rocksdb_iter_valid
(
pCur
->
iter
))
{
size_t
kLen
;
SWinKey
curKey
;
...
...
@@ -837,13 +851,10 @@ SStreamStateCur* streamStateSeekKeyNext_rocksdb(SStreamState* pState, const SWin
SStateKey
sKey
=
{.
key
=
*
key
,
.
opNum
=
pState
->
number
};
char
buf
[
128
]
=
{
0
};
int
len
=
stateKeyEncode
((
void
*
)
&
sKey
,
buf
);
rocksdb_iter_seek
(
pCur
->
iter
,
buf
,
len
);
if
(
!
rocksdb_iter_valid
(
pCur
->
iter
))
{
rocksdb_iter_seek_for_prev
(
pCur
->
iter
,
buf
,
len
);
if
(
!
rocksdb_iter_valid
(
pCur
->
iter
))
{
streamStateFreeCur
(
pCur
);
return
NULL
;
}
if
(
!
streamStateIterSeekAndValid
(
pCur
->
iter
,
buf
,
len
))
{
streamStateFreeCur
(
pCur
);
return
NULL
;
}
if
(
rocksdb_iter_valid
(
pCur
->
iter
))
{
...
...
@@ -871,14 +882,12 @@ SStreamStateCur* streamStateFillSeekKeyNext_rocksdb(SStreamState* pState, const
char
buf
[
128
]
=
{
0
};
int
len
=
winKeyEncode
((
void
*
)
key
,
buf
);
rocksdb_iter_seek
(
pCur
->
iter
,
buf
,
len
);
if
(
!
rocksdb_iter_valid
(
pCur
->
iter
))
{
rocksdb_iter_seek_for_prev
(
pCur
->
iter
,
buf
,
len
);
if
(
!
rocksdb_iter_valid
(
pCur
->
iter
))
{
streamStateFreeCur
(
pCur
);
return
NULL
;
}
if
(
!
streamStateIterSeekAndValid
(
pCur
->
iter
,
buf
,
len
))
{
streamStateFreeCur
(
pCur
);
return
NULL
;
}
{
SWinKey
curKey
;
size_t
kLen
=
0
;
...
...
@@ -905,13 +914,9 @@ SStreamStateCur* streamStateFillSeekKeyPrev_rocksdb(SStreamState* pState, const
char
buf
[
128
]
=
{
0
};
int
len
=
winKeyEncode
((
void
*
)
key
,
buf
);
rocksdb_iter_seek
(
pCur
->
iter
,
buf
,
len
);
if
(
!
rocksdb_iter_valid
(
pCur
->
iter
))
{
rocksdb_iter_seek_for_prev
(
pCur
->
iter
,
buf
,
len
);
if
(
!
rocksdb_iter_valid
(
pCur
->
iter
))
{
streamStateFreeCur
(
pCur
);
return
NULL
;
}
if
(
!
streamStateIterSeekAndValid
(
pCur
->
iter
,
buf
,
len
))
{
streamStateFreeCur
(
pCur
);
return
NULL
;
}
{
...
...
@@ -956,13 +961,10 @@ int32_t streamStateSessionGetKeyByRange_rocksdb(SStreamState* pState, const SSes
int32_t
c
=
0
;
char
buf
[
128
]
=
{
0
};
int
len
=
stateSessionKeyEncode
(
&
sKey
,
buf
);
rocksdb_iter_seek
(
pCur
->
iter
,
buf
,
len
);
if
(
!
rocksdb_iter_valid
(
pCur
->
iter
))
{
rocksdb_iter_seek_for_prev
(
pCur
->
iter
,
buf
,
len
);
if
(
!
rocksdb_iter_valid
(
pCur
->
iter
))
{
streamStateFreeCur
(
pCur
);
return
-
1
;
}
if
(
!
streamStateIterSeekAndValid
(
pCur
->
iter
,
buf
,
len
))
{
streamStateFreeCur
(
pCur
);
return
-
1
;
}
int32_t
kLen
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录