Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Metz
oceanbase
提交
46a5748a
O
oceanbase
项目概览
Metz
/
oceanbase
与 Fork 源项目一致
Fork自
oceanbase / oceanbase
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
oceanbase
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
46a5748a
编写于
9月 16, 2022
作者:
O
obdev
提交者:
wangzelin.wzl
9月 16, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[CP] Fix ObBlockAlloc double free.
上级
e3f31ef1
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
16 addition
and
11 deletion
+16
-11
src/storage/blocksstable/ob_tmp_file_store.cpp
src/storage/blocksstable/ob_tmp_file_store.cpp
+13
-9
src/storage/blocksstable/ob_tmp_file_store.h
src/storage/blocksstable/ob_tmp_file_store.h
+3
-2
未找到文件。
src/storage/blocksstable/ob_tmp_file_store.cpp
浏览文件 @
46a5748a
...
@@ -728,7 +728,7 @@ void ObTmpTenantFileStore::inc_ref()
...
@@ -728,7 +728,7 @@ void ObTmpTenantFileStore::inc_ref()
ATOMIC_INC
(
&
ref_cnt_
);
ATOMIC_INC
(
&
ref_cnt_
);
}
}
void
ObTmpTenantFileStore
::
dec_ref
()
int64_t
ObTmpTenantFileStore
::
dec_ref
()
{
{
int
ret
=
OB_SUCCESS
;
int
ret
=
OB_SUCCESS
;
const
int64_t
tmp_ref
=
ATOMIC_SAF
(
&
ref_cnt_
,
1
);
const
int64_t
tmp_ref
=
ATOMIC_SAF
(
&
ref_cnt_
,
1
);
...
@@ -736,10 +736,8 @@ void ObTmpTenantFileStore::dec_ref()
...
@@ -736,10 +736,8 @@ void ObTmpTenantFileStore::dec_ref()
ret
=
OB_ERR_UNEXPECTED
;
ret
=
OB_ERR_UNEXPECTED
;
STORAGE_LOG
(
ERROR
,
"bug: ref_cnt < 0"
,
K
(
ret
),
K
(
tmp_ref
),
K
(
lbt
()));
STORAGE_LOG
(
ERROR
,
"bug: ref_cnt < 0"
,
K
(
ret
),
K
(
tmp_ref
),
K
(
lbt
()));
ob_abort
();
ob_abort
();
}
else
if
(
0
==
tmp_ref
)
{
this
->~
ObTmpTenantFileStore
();
allocator_
.
free
(
this
);
}
}
return
tmp_ref
;
}
}
int
ObTmpTenantFileStore
::
init
(
const
uint64_t
tenant_id
,
const
ObStorageFileHandle
&
file_handle
)
int
ObTmpTenantFileStore
::
init
(
const
uint64_t
tenant_id
,
const
ObStorageFileHandle
&
file_handle
)
...
@@ -1210,19 +1208,21 @@ ObTmpTenantFileStoreHandle::~ObTmpTenantFileStoreHandle()
...
@@ -1210,19 +1208,21 @@ ObTmpTenantFileStoreHandle::~ObTmpTenantFileStoreHandle()
{
{
reset
();
reset
();
}
}
void
ObTmpTenantFileStoreHandle
::
set_tenant_store
(
ObTmpTenantFileStore
*
tenant_store
)
void
ObTmpTenantFileStoreHandle
::
set_tenant_store
(
ObTmpTenantFileStore
*
tenant_store
,
common
::
ObConcurrentFIFOAllocator
*
allocator
)
{
{
if
(
OB_NOT_NULL
(
tenant_store
))
{
if
(
OB_NOT_NULL
(
tenant_store
))
{
reset
();
reset
();
tenant_store
->
inc_ref
();
// ref for handle
tenant_store
->
inc_ref
();
tenant_store_
=
tenant_store
;
tenant_store_
=
tenant_store
;
allocator_
=
allocator
;
}
}
}
}
ObTmpTenantFileStoreHandle
&
ObTmpTenantFileStoreHandle
::
operator
=
(
const
ObTmpTenantFileStoreHandle
&
other
)
ObTmpTenantFileStoreHandle
&
ObTmpTenantFileStoreHandle
::
operator
=
(
const
ObTmpTenantFileStoreHandle
&
other
)
{
{
if
(
&
other
!=
this
)
{
if
(
&
other
!=
this
)
{
set_tenant_store
(
other
.
tenant_store_
);
set_tenant_store
(
other
.
tenant_store_
,
other
.
allocator_
);
}
}
return
*
this
;
return
*
this
;
}
}
...
@@ -1240,7 +1240,11 @@ bool ObTmpTenantFileStoreHandle::is_valid() const
...
@@ -1240,7 +1240,11 @@ bool ObTmpTenantFileStoreHandle::is_valid() const
void
ObTmpTenantFileStoreHandle
::
reset
()
void
ObTmpTenantFileStoreHandle
::
reset
()
{
{
if
(
OB_NOT_NULL
(
tenant_store_
))
{
if
(
OB_NOT_NULL
(
tenant_store_
))
{
tenant_store_
->
dec_ref
();
// ref for handle
int64_t
tmp_ref
=
tenant_store_
->
dec_ref
();
if
(
0
==
tmp_ref
)
{
tenant_store_
->~
ObTmpTenantFileStore
();
allocator_
->
free
(
tenant_store_
);
}
tenant_store_
=
NULL
;
tenant_store_
=
NULL
;
}
}
}
}
...
@@ -1461,7 +1465,7 @@ int ObTmpFileStore::get_store(const uint64_t tenant_id, ObTmpTenantFileStoreHand
...
@@ -1461,7 +1465,7 @@ int ObTmpFileStore::get_store(const uint64_t tenant_id, ObTmpTenantFileStoreHand
allocator_
.
free
(
store
);
allocator_
.
free
(
store
);
store
=
NULL
;
store
=
NULL
;
STORAGE_LOG
(
WARN
,
"fail to init ObTmpTenantFileStore"
,
K
(
ret
),
K
(
tenant_id
));
STORAGE_LOG
(
WARN
,
"fail to init ObTmpTenantFileStore"
,
K
(
ret
),
K
(
tenant_id
));
}
else
if
(
FALSE_IT
(
handle
.
set_tenant_store
(
store
)))
{
}
else
if
(
FALSE_IT
(
handle
.
set_tenant_store
(
store
,
&
allocator_
)))
{
}
else
if
(
OB_FAIL
(
tenant_file_stores_
.
set_refactored
(
tenant_id
,
handle
)))
{
}
else
if
(
OB_FAIL
(
tenant_file_stores_
.
set_refactored
(
tenant_id
,
handle
)))
{
STORAGE_LOG
(
WARN
,
"fail to set tenant_file_stores_"
,
K
(
ret
),
K
(
tenant_id
));
STORAGE_LOG
(
WARN
,
"fail to set tenant_file_stores_"
,
K
(
ret
),
K
(
tenant_id
));
}
}
...
...
src/storage/blocksstable/ob_tmp_file_store.h
浏览文件 @
46a5748a
...
@@ -276,7 +276,7 @@ public:
...
@@ -276,7 +276,7 @@ public:
return
tmp_block_manager_
.
get_block_size
();
return
tmp_block_manager_
.
get_block_size
();
}
}
void
inc_ref
();
void
inc_ref
();
void
dec_ref
();
int64_t
dec_ref
();
private:
private:
int
read_page
(
ObTmpMacroBlock
*
block
,
ObTmpBlockIOInfo
&
io_info
,
ObTmpFileIOHandle
&
handle
);
int
read_page
(
ObTmpMacroBlock
*
block
,
ObTmpBlockIOInfo
&
io_info
,
ObTmpFileIOHandle
&
handle
);
...
@@ -310,7 +310,7 @@ public:
...
@@ -310,7 +310,7 @@ public:
~
ObTmpTenantFileStoreHandle
();
~
ObTmpTenantFileStoreHandle
();
ObTmpTenantFileStoreHandle
(
const
ObTmpTenantFileStoreHandle
&
other
);
ObTmpTenantFileStoreHandle
(
const
ObTmpTenantFileStoreHandle
&
other
);
ObTmpTenantFileStoreHandle
&
operator
=
(
const
ObTmpTenantFileStoreHandle
&
other
);
ObTmpTenantFileStoreHandle
&
operator
=
(
const
ObTmpTenantFileStoreHandle
&
other
);
void
set_tenant_store
(
ObTmpTenantFileStore
*
store
);
void
set_tenant_store
(
ObTmpTenantFileStore
*
store
,
common
::
ObConcurrentFIFOAllocator
*
allocator
);
bool
is_empty
()
const
;
bool
is_empty
()
const
;
bool
is_valid
()
const
;
bool
is_valid
()
const
;
void
reset
();
void
reset
();
...
@@ -321,6 +321,7 @@ public:
...
@@ -321,6 +321,7 @@ public:
private:
private:
ObTmpTenantFileStore
*
tenant_store_
;
ObTmpTenantFileStore
*
tenant_store_
;
common
::
ObConcurrentFIFOAllocator
*
allocator_
;
};
};
class
ObTmpFileStore
{
class
ObTmpFileStore
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录