Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
cecec01b
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看板
提交
cecec01b
编写于
8月 02, 2022
作者:
C
Cary Xu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: handle rsma resource leak
上级
602d2aa3
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
35 addition
and
15 deletion
+35
-15
source/common/src/tdatablock.c
source/common/src/tdatablock.c
+7
-5
source/dnode/vnode/src/sma/smaEnv.c
source/dnode/vnode/src/sma/smaEnv.c
+8
-4
source/dnode/vnode/src/sma/smaRollup.c
source/dnode/vnode/src/sma/smaRollup.c
+3
-3
tests/script/tsim/sync/vnodesnapshot-rsma-test.sim
tests/script/tsim/sync/vnodesnapshot-rsma-test.sim
+17
-3
未找到文件。
source/common/src/tdatablock.c
浏览文件 @
cecec01b
...
...
@@ -1762,14 +1762,14 @@ void blockDebugShowDataBlocks(const SArray* dataBlocks, const char* flag) {
break
;
case
TSDB_DATA_TYPE_VARCHAR
:
{
char
*
pData
=
colDataGetVarData
(
pColInfoData
,
j
);
int32_t
dataSize
=
TMIN
(
sizeof
(
pBuf
)
,
varDataLen
(
pData
)
+
1
);
memset
(
pBuf
,
0
,
dataSize
);
int32_t
dataSize
=
TMIN
(
sizeof
(
pBuf
)
-
1
,
varDataLen
(
pData
)
);
memset
(
pBuf
,
0
,
dataSize
+
1
);
strncpy
(
pBuf
,
varDataVal
(
pData
),
dataSize
);
printf
(
" %15s |"
,
pBuf
);
}
break
;
case
TSDB_DATA_TYPE_NCHAR
:
{
char
*
pData
=
colDataGetVarData
(
pColInfoData
,
j
);
int32_t
dataSize
=
TMIN
(
sizeof
(
pBuf
),
varDataLen
(
pData
)
+
1
);
int32_t
dataSize
=
TMIN
(
sizeof
(
pBuf
),
varDataLen
(
pData
));
memset
(
pBuf
,
0
,
dataSize
);
taosUcs4ToMbs
((
TdUcs4
*
)
varDataVal
(
pData
),
dataSize
,
pBuf
);
printf
(
" %15s |"
,
pBuf
);
...
...
@@ -1948,12 +1948,14 @@ int32_t buildSubmitReqFromDataBlock(SSubmitReq** pReq, const SArray* pDataBlocks
}
break
;
case
TSDB_DATA_TYPE_NCHAR
:
{
tdAppendColValToRow
(
&
rb
,
PRIMARYKEY_TIMESTAMP_COL_ID
+
k
,
TSDB_DATA_TYPE_NCHAR
,
TD_VTYPE_NORM
,
var
,
true
,
void
*
data
=
colDataGetData
(
pColInfoData
,
j
);
tdAppendColValToRow
(
&
rb
,
PRIMARYKEY_TIMESTAMP_COL_ID
+
k
,
TSDB_DATA_TYPE_NCHAR
,
TD_VTYPE_NORM
,
data
,
true
,
offset
,
k
);
break
;
}
case
TSDB_DATA_TYPE_VARCHAR
:
{
// TSDB_DATA_TYPE_BINARY
tdAppendColValToRow
(
&
rb
,
PRIMARYKEY_TIMESTAMP_COL_ID
+
k
,
TSDB_DATA_TYPE_VARCHAR
,
TD_VTYPE_NORM
,
var
,
true
,
void
*
data
=
colDataGetData
(
pColInfoData
,
j
);
tdAppendColValToRow
(
&
rb
,
PRIMARYKEY_TIMESTAMP_COL_ID
+
k
,
TSDB_DATA_TYPE_VARCHAR
,
TD_VTYPE_NORM
,
data
,
true
,
offset
,
k
);
break
;
}
...
...
source/dnode/vnode/src/sma/smaEnv.c
浏览文件 @
cecec01b
...
...
@@ -295,6 +295,9 @@ static void tdDestroyRSmaStat(void *pRSmaStat) {
nLoops
=
0
;
}
}
// step 4: free pStat
taosMemoryFreeClear
(
pStat
);
}
}
...
...
@@ -321,12 +324,13 @@ int32_t tdDestroySmaState(SSmaStat *pSmaStat, int8_t smaType) {
tdDestroyTSmaStat
(
SMA_TSMA_STAT
(
pSmaStat
));
}
else
if
(
smaType
==
TSDB_SMA_TYPE_ROLLUP
)
{
SRSmaStat
*
pRSmaStat
=
SMA_RSMA_STAT
(
pSmaStat
);
int32_t
vid
=
SMA_VID
(
pRSmaStat
->
pSma
);
int64_t
refId
=
RSMA_REF_ID
(
pRSmaStat
);
if
(
taosRemoveRef
(
smaMgmt
.
rsetId
,
RSMA_REF_ID
(
pRSmaStat
))
<
0
)
{
smaError
(
"vgId:%d, remove refId:%"
PRIi64
" from rsmaRef:%"
PRIi32
" failed since %s"
,
SMA_VID
(
pRSmaStat
->
pSma
)
,
RSMA_REF_ID
(
pRSmaStat
),
smaMgmt
.
rsetId
,
terrstr
());
smaError
(
"vgId:%d, remove refId:%"
PRIi64
" from rsmaRef:%"
PRIi32
" failed since %s"
,
vid
,
refId
,
smaMgmt
.
rsetId
,
terrstr
());
}
else
{
smaDebug
(
"vgId:%d, remove refId:%"
PRIi64
" from rsmaRef:%"
PRIi32
" succeed"
,
SMA_VID
(
pRSmaStat
->
pSma
),
RSMA_REF_ID
(
pRSmaStat
),
smaMgmt
.
rsetId
);
smaDebug
(
"vgId:%d, remove refId:%"
PRIi64
" from rsmaRef:%"
PRIi32
" succeed"
,
vid
,
refId
,
smaMgmt
.
rsetId
);
}
}
else
{
ASSERT
(
0
);
...
...
source/dnode/vnode/src/sma/smaRollup.c
浏览文件 @
cecec01b
...
...
@@ -128,7 +128,7 @@ void *tdFreeRSmaInfo(SSma *pSma, SRSmaInfo *pInfo, bool isDeepFree) {
}
}
if
(
isDeepFree
)
{
taosMemoryFree
(
pInfo
->
pTSchema
);
taosMemoryFree
Clear
(
pInfo
->
pTSchema
);
}
taosMemoryFree
(
pInfo
);
}
...
...
@@ -600,7 +600,7 @@ static int32_t tdRSmaFetchAndSubmitResult(SRSmaInfoItem *pItem, STSchema *pTSche
#endif
STsdb
*
sinkTsdb
=
(
pItem
->
level
==
TSDB_RETENTION_L1
?
pSma
->
pRSmaTsdb
[
0
]
:
pSma
->
pRSmaTsdb
[
1
]);
SSubmitReq
*
pReq
=
NULL
;
// TODO: the schema update should be handled
// TODO: the schema update should be handled
later(TD-17965)
if
(
buildSubmitReqFromDataBlock
(
&
pReq
,
pResult
,
pTSchema
,
SMA_VID
(
pSma
),
suid
)
<
0
)
{
smaError
(
"vgId:%d, build submit req for rsma stable %"
PRIi64
" level %"
PRIi8
" failed since %s"
,
SMA_VID
(
pSma
),
suid
,
pItem
->
level
,
terrstr
());
...
...
@@ -622,7 +622,7 @@ static int32_t tdRSmaFetchAndSubmitResult(SRSmaInfoItem *pItem, STSchema *pTSche
}
else
if
(
terrno
==
0
)
{
smaDebug
(
"vgId:%d, no rsma %"
PRIi8
" data fetched yet"
,
SMA_VID
(
pSma
),
pItem
->
level
);
}
else
{
smaDebug
(
"vgId:%d, no rsma %"
PRIi8
" data fetched since %s"
,
SMA_VID
(
pSma
),
pItem
->
level
,
t
strerror
(
terrno
));
smaDebug
(
"vgId:%d, no rsma %"
PRIi8
" data fetched since %s"
,
SMA_VID
(
pSma
),
pItem
->
level
,
t
errstr
(
));
}
}
...
...
tests/script/tsim/sync/vnodesnapshot-rsma-test.sim
浏览文件 @
cecec01b
...
...
@@ -167,12 +167,26 @@ system sh/exec.sh -n dnode4 -s start
sleep 3000
print =============== query data
print =============== query data of level 1
sql connect
sql use db
sql select * from ct1 where ts > now - 1d
print rows: $rows
print rows
of level 1
: $rows
print $data00 $data01 $data02
if $rows != 100 then
return -1
endi
\ No newline at end of file
endi
print =============== query data of level 2
sql select * from ct1 where ts > now - 10d
print rows of level 2: $rows
print $data00 $data01 $data02
print =============== query data of level 3
sql select * from ct1
print rows of level 3: $rows
print $data00 $data01 $data02
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录