From e10d09dfddd43ba786ea77b6e87ed97661bd7764 Mon Sep 17 00:00:00 2001 From: GroundWu <1175416256@qq.com> Date: Fri, 28 Mar 2025 03:46:09 +0000 Subject: [PATCH] [OBKV] add enum placeholder for hbase secondary partition --- src/share/table/ob_table.h | 43 +++++++++++++++--------- src/share/table/ob_table_config_util.cpp | 10 +++--- src/share/table/ob_table_config_util.h | 18 +++++----- 3 files changed, 43 insertions(+), 28 deletions(-) diff --git a/src/share/table/ob_table.h b/src/share/table/ob_table.h index f0cc9e4f58..43e3ce95d3 100644 --- a/src/share/table/ob_table.h +++ b/src/share/table/ob_table.h @@ -1227,18 +1227,18 @@ public: void set_deserialize_allocator(common::ObIAllocator *allocator); void set_entity_factory(ObITableEntityFactory *entity_factory); - bool is_check_and_execute() const override { return is_check_and_execute_; } - bool is_check_exists() const override { return is_check_and_execute_ && !is_check_no_exists_; } - bool rollback_when_check_failed() const override { return is_check_and_execute_ && rollback_when_check_failed_; } + bool is_check_and_execute() const override { return table_flag_.is_check_and_execute_; } + bool is_check_exists() const override { return table_flag_.is_check_and_execute_ && !table_flag_.is_check_no_exists_; } + bool rollback_when_check_failed() const override { return table_flag_.is_check_and_execute_ && table_flag_.rollback_when_check_failed_; } uint64_t get_checksum(); TO_STRING_KV(K_(query), K_(mutations), K_(return_affected_entity), K_(flag), - K_(is_check_and_execute), - K_(is_check_no_exists), - K_(rollback_when_check_failed)); + K_(table_flag_.is_check_and_execute), + K_(table_flag_.is_check_no_exists), + K_(table_flag_.rollback_when_check_failed)); private: ObTableQuery query_; ObTableBatchOperation mutations_; @@ -1251,8 +1251,14 @@ private: bool is_check_and_execute_ : 1; bool is_check_no_exists_ : 1; bool rollback_when_check_failed_ : 1; - int64_t reserved : 61; - }; + uint64_t reserved : 61; // 64 - 3 + } table_flag_; + struct + { + uint64_t reversed_1 : 3; + uint64_t is_user_specific_T_ : 1; + uint64_t reserved : 60; // 64 - 4 + } hbase_flag_; }; }; @@ -1778,8 +1784,8 @@ public: deserialize_alloc_ = allocator; } - OB_INLINE bool is_check_no_exists() const { return is_check_no_exists_; } - OB_INLINE bool rollback_when_check_failed() const { return rollback_when_check_failed_; } + OB_INLINE bool is_check_no_exists() const { return table_flag_.is_check_no_exists_; } + OB_INLINE bool rollback_when_check_failed() const { return table_flag_.rollback_when_check_failed_; } OB_INLINE void set_dictionary(const ObIArray *all_rowkey_names, const ObIArray *all_properties_names) { all_rowkey_names_ = all_rowkey_names; @@ -1798,7 +1804,7 @@ public: TO_STRING_KV(K_(op_type), K_(flag), - K_(is_check_no_exists), + K_(table_flag_.is_check_no_exists), K_(op_query), K_(entities)); private: @@ -1808,10 +1814,17 @@ private: uint64_t flag_; struct { - bool is_check_no_exists_ : 1; - bool rollback_when_check_failed_ : 1; - int64_t reserved : 62; - }; + bool is_check_no_exists_ : 1; + bool rollback_when_check_failed_ : 1; + uint64_t reserved : 62; // 64 - 2 + } table_flag_; + + struct + { + uint64_t reversed_1 : 2; + uint64_t is_user_specific_T_ : 1; + uint64_t reserved : 61; // 64 - 3 + } hbase_flag_; }; // Note: Only the HBase checkAndMutate operation may have multiple entities, // In such cases, we decode the size first and prepare_allocate the entities at once. diff --git a/src/share/table/ob_table_config_util.cpp b/src/share/table/ob_table_config_util.cpp index e9b2848082..7f6a39c3d0 100644 --- a/src/share/table/ob_table_config_util.cpp +++ b/src/share/table/ob_table_config_util.cpp @@ -23,12 +23,12 @@ ObKVFeatureMode::ObKVFeatureMode(const uint8_t *values) value_ = 0; is_valid_ = false; } else { - value_ = values[0]; + value_ = static_cast(values[0]); is_valid_ = true; } } -void ObKVFeatureMode::set_ttl_mode(uint8_t mode) +void ObKVFeatureMode::set_ttl_mode(uint16_t mode) { is_valid_ = check_mode_valid(mode); if (is_valid_) { @@ -36,7 +36,7 @@ void ObKVFeatureMode::set_ttl_mode(uint8_t mode) } } -void ObKVFeatureMode::set_rerouting_mode(uint8_t mode) +void ObKVFeatureMode::set_rerouting_mode(uint16_t mode) { is_valid_ = check_mode_valid(mode); if (is_valid_) { @@ -44,7 +44,7 @@ void ObKVFeatureMode::set_rerouting_mode(uint8_t mode) } } -void ObKVFeatureMode::set_hotkey_mode(uint8_t mode) +void ObKVFeatureMode::set_hotkey_mode(uint16_t mode) { is_valid_ = check_mode_valid(mode); if (is_valid_) { @@ -52,7 +52,7 @@ void ObKVFeatureMode::set_hotkey_mode(uint8_t mode) } } -void ObKVFeatureMode::set_value(uint8_t value) +void ObKVFeatureMode::set_value(uint16_t value) { if ((value & 0b11) == 0b11 || ((value >> 2) & 0b11) == 0b11 || ((value >> 4) & 0b11) == 0b11) { is_valid_ = false; diff --git a/src/share/table/ob_table_config_util.h b/src/share/table/ob_table_config_util.h index 98a89a68bf..8cc4c4fcd9 100644 --- a/src/share/table/ob_table_config_util.h +++ b/src/share/table/ob_table_config_util.h @@ -25,6 +25,7 @@ enum ObKVFeatureType { TTL, REROUTING, HOTKEY, + DISTRIBUTED_EXECUTE, MAXTYPE }; @@ -34,24 +35,25 @@ public: ObKVFeatureMode(): is_valid_(false), value_(0) {} ObKVFeatureMode(const uint8_t *values); bool is_valid() { return is_valid_; } - bool check_mode_valid(uint8_t mode) { return mode > 2 ? false : true; } + bool check_mode_valid(uint16_t mode) { return mode > 2 ? false : true; } bool is_ttl_enable(); bool is_rerouting_enable(); bool is_hotkey_enable(); - void set_ttl_mode(uint8_t mode); - void set_rerouting_mode(uint8_t mode); - void set_hotkey_mode(uint8_t mode); - void set_value(uint8_t value); - int8_t get_value() const { return value_; } + void set_ttl_mode(uint16_t mode); + void set_rerouting_mode(uint16_t mode); + void set_hotkey_mode(uint16_t mode); + void set_value(uint16_t value); + uint16_t get_value() const { return value_; } private: bool is_valid_; union { - uint8_t value_; + uint16_t value_; //FARM COMPAT WHITELIST struct { uint8_t ttl_mode_ : 2; uint8_t rerouting_mode_ : 2; uint8_t hotkey_mode_ : 2; - uint8_t reserver_mode_ :2; + uint8_t distributed_execute_mode_ : 2; + uint8_t reserver_mode_ :8; }; }; private: