提交 3ff5fb98 编写于 作者: W wanhong.wwh 提交者: wangzelin.wzl

[CP] Fix global index issues: after drop/truncate partition, global index can not rereplicate

上级 3156d1bf
......@@ -1229,9 +1229,7 @@ int TenantBalanceStat::fill_partition_entity(const uint64_t schema_id, const SCH
} else if (OB_FAIL(build_readonly_at_all_info(schema_id, schema))) {
RS_LOG(WARN, "fail to build readonly at all info", K(ret), K(schema_id));
} else {
bool can_do_rereplicate =
!schema.is_global_index_table() || (schema.is_global_index_table() && schema.can_read_index()) ||
(schema.is_global_index_table() && schema.is_mock_global_index_invalid() && !schema.can_read_index());
bool can_do_rereplicate = !schema.is_global_index_table() || schema.can_rereplicate_global_index_table();
share::ObPartitionInfo info;
int64_t partition_idx = OB_INVALID_INDEX;
bool check_dropped_partition = true;
......
......@@ -7743,6 +7743,12 @@ const char* ob_view_check_option_str(const ViewCheckOption option)
return ret;
}
bool can_rereplicate_index_status(const ObIndexStatus &idst)
{
// unusable index can also rereplicate
return INDEX_STATUS_AVAILABLE == idst || INDEX_STATUS_UNUSABLE == idst;
}
const char* ob_index_status_str(ObIndexStatus status)
{
const char* ret = "invalid";
......
......@@ -247,6 +247,8 @@ enum ObIndexStatus {
INDEX_STATUS_MAX = 8,
};
bool can_rereplicate_index_status(const ObIndexStatus &idst);
enum ObPartitionStatus {
PARTITION_STATUS_INVALID = -1,
PARTITION_STATUS_ACTIVE = 0,
......@@ -3267,6 +3269,10 @@ public:
{
return true;
}
inline bool can_rereplicate_global_index_table() const
{
return true;
}
DECLARE_VIRTUAL_TO_STRING;
......
......@@ -639,6 +639,13 @@ public:
{
return INDEX_STATUS_AVAILABLE == index_status && !is_dropped_schema;
}
inline bool can_rereplicate_global_index_table() const
{
// 1. index which can rereplicate
// 2. is mocked invalid for standby cluster
return is_global_index_table() && !is_dropped_schema() &&
(can_rereplicate_index_status(index_status_) || is_mock_global_index_invalid());
}
inline bool is_final_invalid_index() const;
inline void set_index_status(const ObIndexStatus index_status)
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册