diff --git a/src/rootserver/ob_balance_info.h b/src/rootserver/ob_balance_info.h index ae0d6e22e66487365f499d4283eb7b672402f294..db110b85c820b59c0d3f78326aeb75609ec505ac 100644 --- a/src/rootserver/ob_balance_info.h +++ b/src/rootserver/ob_balance_info.h @@ -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; diff --git a/src/share/schema/ob_schema_struct.cpp b/src/share/schema/ob_schema_struct.cpp index 50d095cc8bdd166e1e3e844ec4ff8b6a7b87213e..6c01f01a7a088a91861b611616d0a0a4ae6566c7 100644 --- a/src/share/schema/ob_schema_struct.cpp +++ b/src/share/schema/ob_schema_struct.cpp @@ -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"; diff --git a/src/share/schema/ob_schema_struct.h b/src/share/schema/ob_schema_struct.h index f477d8202ca6ad9b67923c24e28187db9c3b018d..329b057d15bd5da02f9e05bdc7abf1522c6601c6 100644 --- a/src/share/schema/ob_schema_struct.h +++ b/src/share/schema/ob_schema_struct.h @@ -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; diff --git a/src/share/schema/ob_table_schema.h b/src/share/schema/ob_table_schema.h index a4f8e5ddf7f90397cb498f3dac2aa2522c45c90f..ed5909638577ad949d022dcad32475bb6fdcb3b4 100644 --- a/src/share/schema/ob_table_schema.h +++ b/src/share/schema/ob_table_schema.h @@ -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) {