diff --git a/deps/oblib/src/lib/ob_define.h b/deps/oblib/src/lib/ob_define.h index c36b406d4e..cb5c8bd50a 100644 --- a/deps/oblib/src/lib/ob_define.h +++ b/deps/oblib/src/lib/ob_define.h @@ -248,6 +248,9 @@ const int64_t OB_MAX_NODEGROUP_LENGTH = 12; //change from 128 to 64, according to production definition document const int64_t OB_MAX_RESERVED_POINT_TYPE_LENGTH = 32; const int64_t OB_MAX_RESERVED_POINT_NAME_LENGTH = 128; +const int64_t OB_MAX_EXTRA_ROWKEY_COLUMN_NUMBER = 2; //storage extra rowkey column number, it contains trans version column and sql sequence column +const int64_t OB_INNER_MAX_ROWKEY_COLUMN_NUMBER = OB_MAX_ROWKEY_COLUMN_NUMBER + OB_MAX_EXTRA_ROWKEY_COLUMN_NUMBER; + //for recybin const int64_t OB_MAX_OBJECT_NAME_LENGTH = 128; //should include index_name diff --git a/src/observer/virtual_table/ob_all_virtual_tablet_sstable_macro_info.cpp b/src/observer/virtual_table/ob_all_virtual_tablet_sstable_macro_info.cpp index af01306e80..afe4827b2e 100644 --- a/src/observer/virtual_table/ob_all_virtual_tablet_sstable_macro_info.cpp +++ b/src/observer/virtual_table/ob_all_virtual_tablet_sstable_macro_info.cpp @@ -264,11 +264,11 @@ int ObAllVirtualTabletSSTableMacroInfo::get_macro_info( ObStoreRowkey &end_key = info.store_range_.get_end_key(); if (start_key != ObStoreRowkey::MIN_STORE_ROWKEY && OB_FAIL(start_key.assign(start_key.get_obj_ptr(), - start_key.get_obj_cnt() - ObMultiVersionRowkeyHelpper::MAX_EXTRA_ROWKEY_CNT))) { + start_key.get_obj_cnt() - OB_MAX_EXTRA_ROWKEY_COLUMN_NUMBER))) { SERVER_LOG(WARN, "fail to set start key", K(ret), K(start_key)); } else if (end_key != ObStoreRowkey::MAX_STORE_ROWKEY && OB_FAIL(end_key.assign(end_key.get_obj_ptr(), - end_key.get_obj_cnt() - ObMultiVersionRowkeyHelpper::MAX_EXTRA_ROWKEY_CNT))) { + end_key.get_obj_cnt() - OB_MAX_EXTRA_ROWKEY_COLUMN_NUMBER))) { SERVER_LOG(WARN, "fail to set end key", K(ret), K(end_key)); } } diff --git a/src/storage/blocksstable/ob_datum_rowkey.cpp b/src/storage/blocksstable/ob_datum_rowkey.cpp index b8b9a88014..117c933499 100644 --- a/src/storage/blocksstable/ob_datum_rowkey.cpp +++ b/src/storage/blocksstable/ob_datum_rowkey.cpp @@ -144,6 +144,10 @@ OB_DEF_DESERIALIZE(ObDatumRowkey) STORAGE_LOG(WARN, "datum row key is not init", K(ret), KP(datums_)); } else { OB_UNIS_DECODE(datum_cnt_); + if (datum_cnt_ > OB_INNER_MAX_ROWKEY_COLUMN_NUMBER) { + ret = OB_ERR_UNEXPECTED; + STORAGE_LOG(ERROR, "table store inner max rowkey column number exceed the limit, too large", K(ret), K(datum_cnt_)); + } OB_UNIS_DECODE_ARRAY(datums_, datum_cnt_); hash_ = 0; group_idx_ = 0; diff --git a/src/storage/blocksstable/ob_index_block_tree_cursor.h b/src/storage/blocksstable/ob_index_block_tree_cursor.h index 430c0490cd..614ab1cca4 100644 --- a/src/storage/blocksstable/ob_index_block_tree_cursor.h +++ b/src/storage/blocksstable/ob_index_block_tree_cursor.h @@ -209,7 +209,7 @@ private: private: static const int64_t OB_INDEX_BLOCK_MAX_COL_CNT = - common::OB_MAX_ROWKEY_COLUMN_NUMBER+ ObMultiVersionRowkeyHelpper::MAX_EXTRA_ROWKEY_CNT + 1; + common::OB_MAX_ROWKEY_COLUMN_NUMBER + OB_MAX_EXTRA_ROWKEY_COLUMN_NUMBER + 1; ObIndexBlockTreePath cursor_path_; ObIndexMicroBlockCache *index_block_cache_; ObIMicroBlockReader *reader_; diff --git a/src/storage/high_availability/ob_storage_ha_struct.cpp b/src/storage/high_availability/ob_storage_ha_struct.cpp index 9783eeb1d7..9c4f273c9d 100644 --- a/src/storage/high_availability/ob_storage_ha_struct.cpp +++ b/src/storage/high_availability/ob_storage_ha_struct.cpp @@ -653,7 +653,7 @@ ObCopyMacroRangeInfo::ObCopyMacroRangeInfo() end_macro_block_id_(), macro_block_count_(0), is_leader_restore_(false), - start_macro_block_end_key_(datums_, OB_MAX_ROWKEY_COLUMN_NUMBER), + start_macro_block_end_key_(datums_, OB_INNER_MAX_ROWKEY_COLUMN_NUMBER), allocator_("CopyMacroRange") { } @@ -679,7 +679,7 @@ void ObCopyMacroRangeInfo::reuse() macro_block_count_ = 0; is_leader_restore_ = false; start_macro_block_end_key_.datums_ = datums_; - start_macro_block_end_key_.datum_cnt_ = OB_MAX_ROWKEY_COLUMN_NUMBER; + start_macro_block_end_key_.datum_cnt_ = OB_INNER_MAX_ROWKEY_COLUMN_NUMBER; start_macro_block_end_key_.reuse(); allocator_.reuse(); } diff --git a/src/storage/high_availability/ob_storage_ha_struct.h b/src/storage/high_availability/ob_storage_ha_struct.h index 3d5ed873cf..a53095569a 100644 --- a/src/storage/high_availability/ob_storage_ha_struct.h +++ b/src/storage/high_availability/ob_storage_ha_struct.h @@ -13,6 +13,7 @@ #ifndef OCEABASE_STORAGE_HA_STRUCT_ #define OCEABASE_STORAGE_HA_STRUCT_ +#include "lib/ob_define.h" #include "share/ob_ls_id.h" #include "common/ob_member.h" #include "common/ob_tablet_id.h" @@ -22,6 +23,7 @@ #include "storage/blocksstable/ob_datum_rowkey.h" #include "storage/blocksstable/ob_logic_macro_id.h" + namespace oceanbase { namespace storage @@ -258,14 +260,15 @@ public: TO_STRING_KV(K_(start_macro_block_id), K_(end_macro_block_id), K_(macro_block_count), K_(start_macro_block_end_key), K_(is_leader_restore)); - +public: blocksstable::ObLogicMacroBlockId start_macro_block_id_; blocksstable::ObLogicMacroBlockId end_macro_block_id_; int64_t macro_block_count_; bool is_leader_restore_; - blocksstable::ObStorageDatum datums_[OB_MAX_ROWKEY_COLUMN_NUMBER]; + blocksstable::ObStorageDatum datums_[OB_INNER_MAX_ROWKEY_COLUMN_NUMBER]; blocksstable::ObDatumRowkey start_macro_block_end_key_; ObArenaAllocator allocator_; + DISALLOW_COPY_AND_ASSIGN(ObCopyMacroRangeInfo); }; diff --git a/src/storage/ob_i_store.h b/src/storage/ob_i_store.h index 7de384778e..0ed76e95cc 100644 --- a/src/storage/ob_i_store.h +++ b/src/storage/ob_i_store.h @@ -164,7 +164,6 @@ public: MVRC_VERSION_AFTER_3_0 = 2, // TransVersion | SqlSequence[A]:Use After Version3.0 MVRC_VERSION_MAX = 3, }; - static const int64_t MAX_EXTRA_ROWKEY_CNT = 2; static int64_t get_trans_version_col_store_index( const int64_t schema_rowkey_col_cnt, const bool is_multi_version)