Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
661fff69
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看板
提交
661fff69
编写于
8月 23, 2021
作者:
A
AlexDuan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
finished elastic block test
上级
3d79ac34
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
21 addition
and
26 deletion
+21
-26
src/inc/tsdb.h
src/inc/tsdb.h
+0
-1
src/query/src/queryMain.c
src/query/src/queryMain.c
+12
-18
src/tsdb/src/tsdbBuffer.c
src/tsdb/src/tsdbBuffer.c
+4
-1
src/tsdb/src/tsdbCommit.c
src/tsdb/src/tsdbCommit.c
+0
-1
src/tsdb/src/tsdbHealth.c
src/tsdb/src/tsdbHealth.c
+5
-5
未找到文件。
src/inc/tsdb.h
浏览文件 @
661fff69
...
...
@@ -193,7 +193,6 @@ typedef struct {
SList
*
bufBlockList
;
int64_t
pointsAdd
;
// TODO
int64_t
storageAdd
;
// TODO
int64_t
commitedMs
;
// commited ms time , zero is no commit.
}
SMemTable
;
typedef
struct
{
...
...
src/query/src/queryMain.c
浏览文件 @
661fff69
...
...
@@ -249,7 +249,7 @@ int waitMoment(SQInfo* pQInfo){
taosMsleep
(
1000
);
used_ms
+=
1000
;
if
(
isQueryKilled
(
pQInfo
)){
printf
(
" check query is canceled, sleep break...
\n
"
);
printf
(
" check query is canceled, sleep break...
%s
\n
"
,
pQInfo
->
sql
);
break
;
}
}
...
...
@@ -626,7 +626,7 @@ int32_t qKillQueryByQId(void* pMgmt, int64_t qId, int32_t waitMs, int32_t waitCo
if
(
pQInfo
==
NULL
||
!
isValidQInfo
(
pQInfo
))
{
return
TSDB_CODE_QRY_INVALID_QHANDLE
;
}
qWarn
(
"QId:0x%"
PRIx64
"
query killed becase no memory commit
."
,
pQInfo
->
qId
);
qWarn
(
"QId:0x%"
PRIx64
"
be killed(no memory commit)
."
,
pQInfo
->
qId
);
setQueryKilled
(
pQInfo
);
// wait query stop
...
...
@@ -647,20 +647,19 @@ int32_t qKillQueryByQId(void* pMgmt, int64_t qId, int32_t waitMs, int32_t waitCo
typedef
struct
{
int64_t
qId
;
int64_t
startExecTs
;
int64_t
commitedMs
;
}
SLongQuery
;
// callbark for sort compare
static
int
compareLongQuery
(
const
void
*
p1
,
const
void
*
p2
)
{
// sort desc
SLongQuery
*
plq1
=
(
SLongQuery
*
)
p1
;
SLongQuery
*
plq2
=
(
SLongQuery
*
)
p2
;
SLongQuery
*
plq1
=
*
(
SLongQuery
*
*
)
p1
;
SLongQuery
*
plq2
=
*
(
SLongQuery
*
*
)
p2
;
if
(
plq1
->
startExecTs
==
plq2
->
startExecTs
)
{
return
0
;
}
else
if
(
plq1
->
startExecTs
>
plq2
->
startExecTs
)
{
return
-
1
;
}
else
{
return
1
;
}
else
{
return
-
1
;
}
}
...
...
@@ -686,15 +685,7 @@ static void cbFoundItem(void* handle, void* param1) {
// push to qids
SLongQuery
*
plq
=
(
SLongQuery
*
)
malloc
(
sizeof
(
SLongQuery
));
plq
->
qId
=
qInfo
->
qId
;
plq
->
startExecTs
=
qInfo
->
startExecTs
;
// commitedMs
if
(
imem
)
{
plq
->
commitedMs
=
imem
->
commitedMs
;
}
else
{
plq
->
commitedMs
=
0
;
}
plq
->
startExecTs
=
qInfo
->
startExecTs
;
taosArrayPush
(
qids
,
&
plq
);
}
...
...
@@ -735,11 +726,13 @@ bool qFixedNoBlock(void* pRepo, void* pMgmt, int32_t longQueryMs) {
SLongQuery
*
plq
;
for
(
i
=
0
;
i
<
cnt
;
i
++
)
{
plq
=
(
SLongQuery
*
)
taosArrayGetP
(
qids
,
i
);
printf
(
" sort i=%d span=%d qid=0x%"
PRIx64
" exeTime=0x%"
PRIx64
".
\n
"
,(
int
)
i
,
(
int
)(
now
-
plq
->
startExecTs
),
plq
->
qId
,
plq
->
startExecTs
);
if
(
plq
->
startExecTs
>
now
)
continue
;
if
(
now
-
plq
->
startExecTs
>=
longQueryMs
)
{
qKillQueryByQId
(
pMgmt
,
plq
->
qId
,
100
,
3
0
);
// wait 50*100 ms
qKillQueryByQId
(
pMgmt
,
plq
->
qId
,
500
,
1
0
);
// wait 50*100 ms
if
(
tsdbNoProblem
(
pRepo
))
{
fixed
=
true
;
qWarn
(
"QId:0x%"
PRIx64
" fixed problem after kill this query."
,
plq
->
qId
);
break
;
}
}
...
...
@@ -755,8 +748,9 @@ bool qFixedNoBlock(void* pRepo, void* pMgmt, int32_t longQueryMs) {
//solve tsdb no block to commit
bool
qSolveCommitNoBlock
(
void
*
pRepo
,
void
*
pMgmt
)
{
qWarn
(
"start solve no block problem."
);
if
(
qFixedNoBlock
(
pRepo
,
pMgmt
,
20
*
1000
))
{
return
true
;
}
return
qFixedNoBlock
(
pRepo
,
pMgmt
,
5
*
1000
);
}
\ No newline at end of file
}
src/tsdb/src/tsdbBuffer.c
浏览文件 @
661fff69
...
...
@@ -216,7 +216,10 @@ void tsdbRecycleBufferBlock(STsdbBufPool* pPool, SListNode *pNode, bool bELastic
tsdbFreeBufBlock
(
pBufBlock
);
free
(
pNode
);
if
(
bELastic
)
pPool
->
nElasticBlocks
--
;
{
pPool
->
nElasticBlocks
--
;
printf
(
" elastic block reduce one ok. current blocks=%d
\n
"
,
pPool
->
nElasticBlocks
);
}
else
pPool
->
nBufBlocks
--
;
}
\ No newline at end of file
src/tsdb/src/tsdbCommit.c
浏览文件 @
661fff69
...
...
@@ -548,7 +548,6 @@ static void tsdbEndCommit(STsdbRepo *pRepo, int eno) {
pRepo
->
imem
=
NULL
;
(
void
)
tsdbUnlockRepo
(
pRepo
);
//save commited time
pIMem
->
commitedMs
=
taosGetTimestampMs
();
tsdbUnRefMemTable
(
pRepo
,
pIMem
);
tsem_post
(
&
(
pRepo
->
readyToCommit
));
}
...
...
src/tsdb/src/tsdbHealth.c
浏览文件 @
661fff69
...
...
@@ -40,6 +40,7 @@ int32_t tsdbInsertNewBlock(STsdbRepo * pRepo) {
}
else
{
pPool
->
nElasticBlocks
++
;
cnt
++
;
printf
(
" elastic block add one ok. current blocks=%d
\n
"
,
pPool
->
nElasticBlocks
);
}
}
}
...
...
@@ -68,7 +69,7 @@ bool tsdbUrgeQueryFree(STsdbRepo * pRepo) {
bool
tsdbIdleMemEnough
()
{
// TODO config to taos.cfg
int32_t
lowestRate
=
10
;
// below 10% idle memory, return not enough memory
int32_t
lowestRate
=
5
;
// below 10% idle memory, return not enough memory
float
memoryUsedMB
=
0
;
float
memoryAvailMB
;
...
...
@@ -94,8 +95,9 @@ bool tsdbIdleMemEnough() {
bool
tsdbAllowNewBlock
(
STsdbRepo
*
pRepo
)
{
//TODO config to taos.cfg
int32_t
nMaxElastic
=
0
;
int32_t
nMaxElastic
=
1
;
STsdbBufPool
*
pPool
=
pRepo
->
pPool
;
printf
(
"tsdbAllowNewBlock nElasticBlock(%d) MaxElasticBlocks(%d)
\n
"
,
pPool
->
nElasticBlocks
,
nMaxElastic
);
if
(
pPool
->
nElasticBlocks
>=
nMaxElastic
)
{
tsdbWarn
(
"tsdbAllowNewBlock return fasle. nElasticBlock(%d) >= MaxElasticBlocks(%d)"
,
pPool
->
nElasticBlocks
,
nMaxElastic
);
return
false
;
...
...
@@ -106,9 +108,7 @@ bool tsdbAllowNewBlock(STsdbRepo* pRepo) {
bool
tsdbNoProblem
(
STsdbRepo
*
pRepo
)
{
if
(
!
tsdbIdleMemEnough
())
return
false
;
if
(
listNEles
(
pRepo
->
pPool
->
bufBlockList
))
if
(
listNEles
(
pRepo
->
pPool
->
bufBlockList
)
==
0
)
return
false
;
return
true
;
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录