Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Metz
oceanbase
提交
c392189b
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,发现更多精彩内容 >>
提交
c392189b
编写于
9月 10, 2021
作者:
C
chinaxing
提交者:
wangzelin.wzl
9月 10, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[FIX] pg partition map handle pg remove corrupted after globalize
上级
c29d0907
变更
4
展开全部
隐藏空白更改
内联
并排
Showing
4 changed file
with
388 addition
and
254 deletion
+388
-254
src/storage/ob_partition_service.cpp
src/storage/ob_partition_service.cpp
+2
-0
src/storage/ob_pg_partition.h
src/storage/ob_pg_partition.h
+77
-11
src/storage/ob_pg_storage.cpp
src/storage/ob_pg_storage.cpp
+262
-229
src/storage/ob_pg_storage.h
src/storage/ob_pg_storage.h
+47
-14
未找到文件。
src/storage/ob_partition_service.cpp
浏览文件 @
c392189b
...
...
@@ -4249,6 +4249,8 @@ int ObPartitionService::inner_del_partition_impl(const ObPartitionKey& pkey, con
STORAGE_LOG(WARN, "remove election from election mgr error", K(ret), K(pkey));
} else if (OB_FAIL(pg_mgr_.del_pg(pkey, file_id))) {
STORAGE_LOG(WARN, "pg mgr remove partition group error", K(ret), K(pkey));
} else if (OB_FAIL(pg->get_pg_storage().post_del_pg())) {
STORAGE_LOG(WARN, "failed to call post del_pg", K(ret), K(pkey));
} else if (OB_FAIL(pg->get_pg_storage().remove_all_pg_index())) {
STORAGE_LOG(WARN, "failed to remove all pg index", K(ret), K(pkey));
} else {
...
...
src/storage/ob_pg_partition.h
浏览文件 @
c392189b
...
...
@@ -181,21 +181,31 @@ static const int64_t SHRINK_THRESHOLD = 128;
typedef
common
::
ObLinkHashMap
<
common
::
ObPartitionKey
,
ObPGPartition
,
PGPartitionInfoAlloc
>
ObPGPartitionMap
;
// thread safe
class
ObP
artitionKey
List
{
class
ObP
GPartition
List
{
private:
class
Node
:
public
ObDLinkBase
<
Node
>
{
public:
Node
(
const
common
::
ObPartitionKey
&
key
)
:
key_
(
key
)
Node
(
const
common
::
ObPartitionKey
&
key
)
:
key_
(
key
),
part_
(
NULL
)
{}
const
common
::
ObPartitionKey
key_
;
// no-NULL when PartitionGroup removed
ObPGPartition
*
part_
;
TO_STRING_KV
(
K
(
key_
),
KP
(
part_
));
};
typedef
common
::
ObDList
<
Node
>
List
;
public:
ObP
artitionKeyList
()
:
lock_
(),
list_
(
)
ObP
GPartitionList
()
:
lock_
(),
list_
(),
contains_part_info_
(
false
)
{}
void
reset
()
{
TCWLockGuard
guard
(
lock_
);
STORAGE_LOG
(
INFO
,
"reset partition list"
,
K
(
this
),
K_
(
list
),
K_
(
contains_part_info
),
K
(
lbt
()));
list_
.
reset
();
contains_part_info_
=
false
;
}
inline
int
size
()
inline
int
size
()
const
{
return
list_
.
get_size
();
}
...
...
@@ -224,8 +234,7 @@ public:
// NOTICE : _assumption_ : no concurrent remove of same `pkey`
bool
remove_latest
(
const
common
::
ObPartitionKey
&
pkey
)
{
Node
*
n
=
NULL
;
Node
*
n
=
NULL
;
{
TCRLockGuard
guard
(
lock_
);
DLIST_FOREACH_BACKWARD_X
(
curr
,
list_
,
NULL
==
n
)
...
...
@@ -235,7 +244,6 @@ public:
}
}
}
if
(
NULL
!=
n
)
{
{
TCWLockGuard
guard
(
lock_
);
...
...
@@ -243,7 +251,6 @@ public:
}
ob_free
(
n
);
}
return
NULL
!=
n
;
}
...
...
@@ -266,14 +273,54 @@ public:
DLIST_REMOVE_ALL_NORET
(
cur
,
list_
)
{
cur
->
unlink
();
fn
(
cur
->
key_
);
fn
(
cur
->
key_
,
cur
->
part_
);
ob_free
(
cur
);
}
}
template
<
typename
Fn
>
int
set_partition_info
(
Fn
&
fn
)
{
int
ret
=
OB_SUCCESS
;
TCWLockGuard
guard
(
lock_
);
DLIST_FOREACH
(
cur
,
list_
)
{
ret
=
fn
(
cur
->
key_
,
cur
->
part_
);
}
if
(
OB_SUCC
(
ret
))
{
contains_part_info_
=
true
;
}
STORAGE_LOG
(
INFO
,
"set_partition_info OK"
,
K
(
this
),
K_
(
list
),
K_
(
contains_part_info
));
return
ret
;
}
int
get_part_info
(
const
ObPartitionKey
&
pkey
,
ObPGPartition
*&
part
)
const
{
int
ret
=
OB_ENTRY_NOT_EXIST
;
bool
found_pkey
=
false
;
TCRLockGuard
guard
(
lock_
);
if
(
contains_part_info_
)
{
DLIST_FOREACH_NORET
(
cur
,
list_
)
{
if
(
pkey
==
cur
->
key_
)
{
found_pkey
=
true
;
part
=
cur
->
part_
;
if
(
OB_NOT_NULL
(
part
))
{
ret
=
OB_SUCCESS
;
}
break
;
}
}
}
if
(
OB_SUCCESS
!=
ret
)
{
STORAGE_LOG
(
WARN
,
"get_part_info fail"
,
K
(
ret
),
K
(
pkey
),
K
(
found_pkey
),
K
(
this
),
K_
(
list
),
K_
(
contains_part_info
));
}
return
ret
;
}
private:
TCRWLock
lock_
;
List
list_
;
bool
contains_part_info_
;
};
class
ObPGPartitionGuard
{
...
...
@@ -285,10 +332,30 @@ public:
(
void
)
set_pg_partition
(
pkey
,
map
);
}
int
set_pg_partition
(
const
common
::
ObPartitionKey
&
pkey
,
const
ObPGPartitionMap
&
map
)
ObPGPartitionGuard
(
const
common
::
ObPartitionKey
&
pkey
,
const
ObPGPartitionList
&
part_list
)
:
pg_partition_
(
NULL
),
map_
(
NULL
)
{
(
void
)
set_pg_partition
(
pkey
,
part_list
);
}
int
set_pg_partition
(
const
common
::
ObPartitionKey
&
pkey
,
const
ObPGPartitionList
&
part_list
)
{
int
ret
=
OB_SUCCESS
;
if
(
!
pkey
.
is_valid
())
{
ret
=
OB_INVALID_ARGUMENT
;
STORAGE_LOG
(
WARN
,
"invalid argument"
,
K
(
ret
),
K
(
pkey
));
}
else
if
(
OB_FAIL
(
part_list
.
get_part_info
(
pkey
,
pg_partition_
)))
{
STORAGE_LOG
(
WARN
,
"get pg part from partition list fail"
,
K
(
ret
),
K
(
pkey
),
KP
(
&
part_list
));
}
else
{
pkey_
=
pkey
;
map_
=
NULL
;
}
return
ret
;
}
int
set_pg_partition
(
const
common
::
ObPartitionKey
&
pkey
,
const
ObPGPartitionMap
&
map
)
{
int
ret
=
OB_SUCCESS
;
if
(
!
pkey
.
is_valid
())
{
ret
=
OB_INVALID_ARGUMENT
;
STORAGE_LOG
(
WARN
,
"invalid argument"
,
K
(
ret
),
K
(
pkey
));
...
...
@@ -298,7 +365,6 @@ public:
pkey_
=
pkey
;
map_
=
&
const_cast
<
ObPGPartitionMap
&>
(
map
);
}
return
ret
;
}
...
...
src/storage/ob_pg_storage.cpp
浏览文件 @
c392189b
此差异已折叠。
点击以展开。
src/storage/ob_pg_storage.h
浏览文件 @
c392189b
...
...
@@ -168,9 +168,8 @@ public:
int
set_emergency_release
();
int
get_active_memtable
(
ObTableHandle
&
handle
);
// PG, pg partition
int
get_pg_partition
(
const
common
::
ObPartitionKey
&
pkey
,
ObPGPartitionGuard
&
guard
);
const
common
::
ObPartitionKey
&
get_partition_key
()
const
int
get_pg_partition
(
const
common
::
ObPartitionKey
&
pkey
,
ObPGPartitionGuard
&
guard
)
const
;
const
common
::
ObPartitionKey
&
get_partition_key
()
const
{
return
pkey_
;
}
...
...
@@ -308,8 +307,9 @@ public:
{
return
pg_memtable_mgr_
.
get_readable_info
();
}
int
get_pkey_for_table
(
const
int64_t
table_id
,
ObPartitionKey
&
pkey
);
int
update_split_state_after_merge
(
int64_t
&
split_state
);
int
get_pkey_for_table
(
const
int64_t
table_id
,
ObPartitionKey
&
pkey
);
int
update_split_state_after_merge
(
int64_t
&
split_state
);
int
post_del_pg
();
int
remove_all_pg_index
();
int
update_split_table_store
(
const
common
::
ObPartitionKey
&
pkey
,
int64_t
table_id
,
bool
is_major_split
,
ObTablesHandle
&
handle
);
...
...
@@ -448,6 +448,29 @@ private:
private:
ObPartitionArray
&
pkeys_
;
};
class
LocalizePGPartitionFunctor
{
public:
explicit
LocalizePGPartitionFunctor
(
ObPGPartitionMap
&
map
)
:
map_
(
map
)
{}
~
LocalizePGPartitionFunctor
()
{}
int
operator
()(
const
common
::
ObPartitionKey
&
pkey
,
ObPGPartition
*&
part
)
{
int
ret
=
OB_SUCCESS
;
if
(
!
pkey
.
is_valid
())
{
ret
=
OB_INVALID_ARGUMENT
;
STORAGE_LOG
(
ERROR
,
"invalid pkey"
,
K
(
pkey
));
}
else
if
(
OB_FAIL
(
map_
.
get
(
pkey
,
part
)))
{
STORAGE_LOG
(
ERROR
,
"fail to get part"
,
K
(
ret
),
K
(
pkey
));
}
else
{
STORAGE_LOG
(
INFO
,
"localize part OK"
,
K
(
pkey
),
K
(
*
part
));
}
return
ret
;
}
private:
ObPGPartitionMap
&
map_
;
};
class
RemovePGIndexFunctor
{
public:
explicit
RemovePGIndexFunctor
(
ObPartitionGroupIndex
&
pg_index
)
:
pg_index_
(
pg_index
)
...
...
@@ -462,6 +485,8 @@ private:
STORAGE_LOG
(
ERROR
,
"invalid pkey"
,
K
(
pkey
));
}
else
if
(
OB_FAIL
(
pg_index_
.
remove_partition
(
pkey
)))
{
STORAGE_LOG
(
ERROR
,
"failed to remove pg index"
,
K
(
ret
),
K
(
pkey
));
}
else
{
STORAGE_LOG
(
INFO
,
"remove part from index OK"
,
K
(
pkey
));
}
return
ret
;
}
...
...
@@ -503,13 +528,20 @@ private:
public:
RemovePGPartitionFunctor
(
ObPGPartitionMap
&
map
)
:
map_
(
map
)
{}
void
operator
()(
const
common
::
ObPartitionKey
&
pkey
)
int
operator
()(
const
common
::
ObPartitionKey
&
pkey
,
ObPGPartition
*
part
=
NULL
)
{
int
ret
=
OB_SUCCESS
;
if
(
!
pkey
.
is_valid
())
{
ret
=
OB_INVALID_ARGUMENT
;
STORAGE_LOG
(
WARN
,
"invalid pkey"
,
K
(
pkey
));
}
else
{
map_
.
del
(
pkey
);
if
(
part
!=
NULL
)
{
map_
.
revert
(
part
);
}
else
if
(
OB_FAIL
(
map_
.
del
(
pkey
)))
{
STORAGE_LOG
(
WARN
,
"del pg partition from map fail"
,
K
(
pkey
));
}
}
return
ret
;
}
private:
...
...
@@ -634,13 +666,14 @@ private:
bool
is_inited_
;
bool
is_removed_
;
common
::
ObPartitionKey
pkey_
;
ObIPartitionComponentFactory
*
cp_fty_
;
transaction
::
ObTransService
*
txs_
;
clog
::
ObIPartitionLogService
*
pls_
;
ObIPartitionGroup
*
pg_
;
ObPGPartition
*
pg_partition_
;
share
::
schema
::
ObMultiVersionSchemaService
*
schema_service_
;
ObPartitionKeyList
partition_list_
;
ObIPartitionComponentFactory
*
cp_fty_
;
transaction
::
ObTransService
*
txs_
;
clog
::
ObIPartitionLogService
*
pls_
;
ObIPartitionGroup
*
pg_
;
ObPGPartition
*
pg_partition_
;
share
::
schema
::
ObMultiVersionSchemaService
*
schema_service_
;
ObPGPartitionList
partition_list_
;
bool
part_list_contains_part_info_
;
// true when pg removed
// pg meta and memstore
common
::
ObBucketLock
bucket_lock_
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录