diff --git a/src/share/inner_table/ob_inner_table_schema.101_150.cpp b/src/share/inner_table/ob_inner_table_schema.101_150.cpp index f2efdbc08f..d764b7e80e 100644 --- a/src/share/inner_table/ob_inner_table_schema.101_150.cpp +++ b/src/share/inner_table/ob_inner_table_schema.101_150.cpp @@ -6886,6 +6886,21 @@ int ObInnerTableSchema::all_table_history_schema(ObTableSchema &table_schema) auto_increment_cache_size_default, auto_increment_cache_size_default); //default_value } + + if (OB_SUCC(ret)) { + ADD_COLUMN_SCHEMA("local_session_vars", //column_name + ++column_id, //column_id + 0, //rowkey_id + 0, //index_id + 0, //part_key_pos + ObLongTextType, //column_type + CS_TYPE_INVALID, //column_collation_type + 0, //column_length + -1, //column_precision + -1, //column_scale + true, //is_nullable + false); //is_autoincrement + } table_schema.set_index_using_type(USING_BTREE); table_schema.set_row_store_type(ENCODING_ROW_STORE); table_schema.set_store_format(OB_STORE_FORMAT_DYNAMIC_MYSQL); diff --git a/src/share/inner_table/ob_inner_table_schema.11001_11050.cpp b/src/share/inner_table/ob_inner_table_schema.11001_11050.cpp index d1d46ff82b..25441592a3 100644 --- a/src/share/inner_table/ob_inner_table_schema.11001_11050.cpp +++ b/src/share/inner_table/ob_inner_table_schema.11001_11050.cpp @@ -14521,6 +14521,21 @@ int ObInnerTableSchema::all_virtual_core_all_table_schema(ObTableSchema &table_s auto_increment_cache_size_default, auto_increment_cache_size_default); //default_value } + + if (OB_SUCC(ret)) { + ADD_COLUMN_SCHEMA("local_session_vars", //column_name + ++column_id, //column_id + 0, //rowkey_id + 0, //index_id + 0, //part_key_pos + ObLongTextType, //column_type + CS_TYPE_INVALID, //column_collation_type + 0, //column_length + -1, //column_precision + -1, //column_scale + true, //is_nullable + false); //is_autoincrement + } table_schema.set_index_using_type(USING_HASH); table_schema.set_row_store_type(ENCODING_ROW_STORE); table_schema.set_store_format(OB_STORE_FORMAT_DYNAMIC_MYSQL); diff --git a/src/share/inner_table/ob_inner_table_schema.12051_12100.cpp b/src/share/inner_table/ob_inner_table_schema.12051_12100.cpp index 8b5117a79a..b3d2be7171 100644 --- a/src/share/inner_table/ob_inner_table_schema.12051_12100.cpp +++ b/src/share/inner_table/ob_inner_table_schema.12051_12100.cpp @@ -6796,6 +6796,21 @@ int ObInnerTableSchema::all_virtual_table_schema(ObTableSchema &table_schema) auto_increment_cache_size_default, auto_increment_cache_size_default); //default_value } + + if (OB_SUCC(ret)) { + ADD_COLUMN_SCHEMA("local_session_vars", //column_name + ++column_id, //column_id + 0, //rowkey_id + 0, //index_id + 0, //part_key_pos + ObLongTextType, //column_type + CS_TYPE_INVALID, //column_collation_type + 0, //column_length + -1, //column_precision + -1, //column_scale + true, //is_nullable + false); //is_autoincrement + } table_schema.set_index_using_type(USING_BTREE); table_schema.set_row_store_type(ENCODING_ROW_STORE); table_schema.set_store_format(OB_STORE_FORMAT_DYNAMIC_MYSQL); @@ -8277,6 +8292,21 @@ int ObInnerTableSchema::all_virtual_table_history_schema(ObTableSchema &table_sc auto_increment_cache_size_default, auto_increment_cache_size_default); //default_value } + + if (OB_SUCC(ret)) { + ADD_COLUMN_SCHEMA("local_session_vars", //column_name + ++column_id, //column_id + 0, //rowkey_id + 0, //index_id + 0, //part_key_pos + ObLongTextType, //column_type + CS_TYPE_INVALID, //column_collation_type + 0, //column_length + -1, //column_precision + -1, //column_scale + true, //is_nullable + false); //is_autoincrement + } table_schema.set_index_using_type(USING_BTREE); table_schema.set_row_store_type(ENCODING_ROW_STORE); table_schema.set_store_format(OB_STORE_FORMAT_DYNAMIC_MYSQL); diff --git a/src/share/inner_table/ob_inner_table_schema.15101_15150.cpp b/src/share/inner_table/ob_inner_table_schema.15101_15150.cpp index afdba03eba..f83badf615 100644 --- a/src/share/inner_table/ob_inner_table_schema.15101_15150.cpp +++ b/src/share/inner_table/ob_inner_table_schema.15101_15150.cpp @@ -6556,6 +6556,21 @@ int ObInnerTableSchema::all_virtual_table_real_agent_ora_schema(ObTableSchema &t false); //is_autoincrement } + if (OB_SUCC(ret)) { + ADD_COLUMN_SCHEMA("LOCAL_SESSION_VARS", //column_name + ++column_id, //column_id + 0, //rowkey_id + 0, //index_id + 0, //part_key_pos + ObLongTextType, //column_type + CS_TYPE_INVALID, //column_collation_type + 0, //column_length + -1, //column_precision + -1, //column_scale + true, //is_nullable + false); //is_autoincrement + } + if (OB_SUCC(ret)) { ADD_COLUMN_SCHEMA("GMT_CREATE", //column_name ++column_id, //column_id diff --git a/src/share/inner_table/ob_inner_table_schema.15201_15250.cpp b/src/share/inner_table/ob_inner_table_schema.15201_15250.cpp index 2532403492..2b5d3f5abd 100644 --- a/src/share/inner_table/ob_inner_table_schema.15201_15250.cpp +++ b/src/share/inner_table/ob_inner_table_schema.15201_15250.cpp @@ -6481,6 +6481,21 @@ int ObInnerTableSchema::all_virtual_core_all_table_ora_schema(ObTableSchema &tab false, //is_nullable false); //is_autoincrement } + + if (OB_SUCC(ret)) { + ADD_COLUMN_SCHEMA("LOCAL_SESSION_VARS", //column_name + ++column_id, //column_id + 0, //rowkey_id + 0, //index_id + 0, //part_key_pos + ObLongTextType, //column_type + CS_TYPE_INVALID, //column_collation_type + 0, //column_length + -1, //column_precision + -1, //column_scale + true, //is_nullable + false); //is_autoincrement + } table_schema.set_index_using_type(USING_HASH); table_schema.set_row_store_type(ENCODING_ROW_STORE); table_schema.set_store_format(OB_STORE_FORMAT_DYNAMIC_MYSQL); diff --git a/src/share/inner_table/ob_inner_table_schema.1_50.cpp b/src/share/inner_table/ob_inner_table_schema.1_50.cpp index 982ab1a6f3..4749571a2f 100644 --- a/src/share/inner_table/ob_inner_table_schema.1_50.cpp +++ b/src/share/inner_table/ob_inner_table_schema.1_50.cpp @@ -1644,6 +1644,21 @@ int ObInnerTableSchema::all_table_schema(ObTableSchema &table_schema) auto_increment_cache_size_default, auto_increment_cache_size_default); //default_value } + + if (OB_SUCC(ret)) { + ADD_COLUMN_SCHEMA("local_session_vars", //column_name + ++column_id, //column_id + 0, //rowkey_id + 0, //index_id + 0, //part_key_pos + ObLongTextType, //column_type + CS_TYPE_INVALID, //column_collation_type + 0, //column_length + -1, //column_precision + -1, //column_scale + true, //is_nullable + false); //is_autoincrement + } table_schema.set_index_using_type(USING_BTREE); table_schema.set_row_store_type(ENCODING_ROW_STORE); table_schema.set_store_format(OB_STORE_FORMAT_DYNAMIC_MYSQL); diff --git a/src/share/inner_table/ob_inner_table_schema_def.py b/src/share/inner_table/ob_inner_table_schema_def.py index cd0cbe3d63..d296d9b60f 100644 --- a/src/share/inner_table/ob_inner_table_schema_def.py +++ b/src/share/inner_table/ob_inner_table_schema_def.py @@ -312,7 +312,8 @@ all_table_def = dict( ('lob_inrow_threshold', 'int', 'false', 'OB_DEFAULT_LOB_INROW_THRESHOLD'), ('max_used_column_group_id', 'int', 'false', '1000'), ('column_store', 'int', 'false', '0'), - ('auto_increment_cache_size', 'int', 'false', '0') + ('auto_increment_cache_size', 'int', 'false', '0'), + ('local_session_vars', 'longtext', 'true'), ], ) diff --git a/src/share/schema/ob_table_schema.cpp b/src/share/schema/ob_table_schema.cpp index 0396440ec0..0f5c5b28bb 100644 --- a/src/share/schema/ob_table_schema.cpp +++ b/src/share/schema/ob_table_schema.cpp @@ -1445,7 +1445,8 @@ int ObSimpleTableSchemaV2::check_if_tablet_exists(const ObTabletID &tablet_id, b } ObTableSchema::ObTableSchema() - : ObSimpleTableSchemaV2() + : ObSimpleTableSchemaV2(), + local_session_vars_(get_allocator()) { reset(); } @@ -1470,7 +1471,8 @@ ObTableSchema::ObTableSchema(ObIAllocator *allocator) rls_group_ids_(SCHEMA_SMALL_MALLOC_BLOCK_SIZE, ModulePageAllocator(*allocator)), rls_context_ids_(SCHEMA_SMALL_MALLOC_BLOCK_SIZE, ModulePageAllocator(*allocator)), name_generated_type_(GENERATED_TYPE_UNKNOWN), - lob_inrow_threshold_(OB_DEFAULT_LOB_INROW_THRESHOLD) + lob_inrow_threshold_(OB_DEFAULT_LOB_INROW_THRESHOLD), + local_session_vars_(allocator) { reset(); } @@ -1576,6 +1578,8 @@ int ObTableSchema::assign(const ObTableSchema &src_schema) view_schema_ = src_schema.view_schema_; if (OB_FAIL(view_schema_.get_err_ret())) { LOG_WARN("fail to assign view schema", K(ret), K_(view_schema), K(src_schema.view_schema_)); + } else if (OB_FAIL(local_session_vars_.deep_copy(src_schema.local_session_vars_))) { + LOG_WARN("fail to deep copy sys var info", K(ret)); } } @@ -3391,6 +3395,7 @@ int64_t ObTableSchema::get_convert_size() const for (int64_t i = 0; (i < column_group_cnt_) && OB_NOT_NULL(column_group_arr_[i]); ++i) { convert_size += column_group_arr_[i]->get_convert_size(); } + convert_size += local_session_vars_.get_deep_copy_size(); return convert_size; } @@ -3486,6 +3491,7 @@ void ObTableSchema::reset() cg_id_hash_arr_ = NULL; cg_name_hash_arr_ = NULL; mlog_tid_ = OB_INVALID_ID; + local_session_vars_.reset(); ObSimpleTableSchemaV2::reset(); } @@ -6539,7 +6545,8 @@ int64_t ObTableSchema::to_string(char *buf, const int64_t buf_len) const K_(column_group_cnt), "column_group_array", ObArrayWrap(column_group_arr_, column_group_cnt_), K_(mlog_tid), - K_(auto_increment_cache_size)); + K_(auto_increment_cache_size), + K_(local_session_vars)); J_OBJ_END(); return pos; @@ -6820,6 +6827,7 @@ OB_DEF_SERIALIZE(ObTableSchema) OB_UNIS_ENCODE(mlog_tid_); OB_UNIS_ENCODE(auto_increment_cache_size_); + OB_UNIS_ENCODE(local_session_vars_); return ret; } @@ -7249,6 +7257,7 @@ OB_DEF_DESERIALIZE(ObTableSchema) OB_UNIS_DECODE(mlog_tid_); OB_UNIS_DECODE(auto_increment_cache_size_); + OB_UNIS_DECODE(local_session_vars_); return ret; } @@ -7399,6 +7408,7 @@ OB_DEF_SERIALIZE_SIZE(ObTableSchema) OB_UNIS_ADD_LEN(max_used_column_group_id_); OB_UNIS_ADD_LEN(mlog_tid_); OB_UNIS_ADD_LEN(auto_increment_cache_size_); + OB_UNIS_ADD_LEN(local_session_vars_); return len; } diff --git a/src/share/schema/ob_table_schema.h b/src/share/schema/ob_table_schema.h index 6ef57e48e8..8a87182cd2 100644 --- a/src/share/schema/ob_table_schema.h +++ b/src/share/schema/ob_table_schema.h @@ -1789,6 +1789,8 @@ public: } void set_mlog_tid(const uint64_t& table_id) { mlog_tid_ = table_id; } uint64_t get_mlog_tid() const { return mlog_tid_; } + inline ObLocalSessionVar &get_local_session_var() { return local_session_vars_; } + inline const ObLocalSessionVar &get_local_session_var() const { return local_session_vars_; } DECLARE_VIRTUAL_TO_STRING; protected: @@ -1989,6 +1991,7 @@ protected: CgIdHashArray *cg_id_hash_arr_; CgNameHashArray *cg_name_hash_arr_; uint64_t mlog_tid_; + ObLocalSessionVar local_session_vars_; }; class ObPrintableTableSchema final : public ObTableSchema diff --git a/tools/deploy/mysql_test/test_suite/inner_table/r/mysql/desc_virtual_table_in_mysql.result b/tools/deploy/mysql_test/test_suite/inner_table/r/mysql/desc_virtual_table_in_mysql.result index 1167cec31f..15820af4fe 100644 --- a/tools/deploy/mysql_test/test_suite/inner_table/r/mysql/desc_virtual_table_in_mysql.result +++ b/tools/deploy/mysql_test/test_suite/inner_table/r/mysql/desc_virtual_table_in_mysql.result @@ -882,6 +882,7 @@ lob_inrow_threshold bigint(20) NO 4096 max_used_column_group_id bigint(20) NO 1000 column_store bigint(20) NO 0 auto_increment_cache_size bigint(20) NO 0 +local_session_vars longtext YES NULL select /*+QUERY_TIMEOUT(60000000)*/ IF(count(*) >= 0, 1, 0) from oceanbase.__all_virtual_core_all_table; IF(count(*) >= 0, 1, 0) 1 @@ -1799,6 +1800,7 @@ lob_inrow_threshold bigint(20) NO 4096 max_used_column_group_id bigint(20) NO 1000 column_store bigint(20) NO 0 auto_increment_cache_size bigint(20) NO 0 +local_session_vars longtext YES NULL select /*+QUERY_TIMEOUT(60000000)*/ IF(count(*) >= 0, 1, 0) from oceanbase.__all_virtual_table; IF(count(*) >= 0, 1, 0) 1 diff --git a/tools/deploy/mysql_test/test_suite/inner_table/r/mysql/desc_virtual_table_in_sys.result b/tools/deploy/mysql_test/test_suite/inner_table/r/mysql/desc_virtual_table_in_sys.result index 5280292424..a917bde761 100644 --- a/tools/deploy/mysql_test/test_suite/inner_table/r/mysql/desc_virtual_table_in_sys.result +++ b/tools/deploy/mysql_test/test_suite/inner_table/r/mysql/desc_virtual_table_in_sys.result @@ -955,6 +955,7 @@ lob_inrow_threshold bigint(20) NO 4096 max_used_column_group_id bigint(20) NO 1000 column_store bigint(20) NO 0 auto_increment_cache_size bigint(20) NO 0 +local_session_vars longtext YES NULL select /*+QUERY_TIMEOUT(60000000)*/ IF(count(*) >= 0, 1, 0) from oceanbase.__all_virtual_core_all_table; IF(count(*) >= 0, 1, 0) 1 @@ -2691,6 +2692,7 @@ lob_inrow_threshold bigint(20) NO 4096 max_used_column_group_id bigint(20) NO 1000 column_store bigint(20) NO 0 auto_increment_cache_size bigint(20) NO 0 +local_session_vars longtext YES NULL select /*+QUERY_TIMEOUT(60000000)*/ IF(count(*) >= 0, 1, 0) from oceanbase.__all_virtual_table; IF(count(*) >= 0, 1, 0) 1 @@ -2781,6 +2783,7 @@ lob_inrow_threshold bigint(20) YES 4096 max_used_column_group_id bigint(20) YES 1000 column_store bigint(20) YES 0 auto_increment_cache_size bigint(20) YES 0 +local_session_vars longtext YES NULL select /*+QUERY_TIMEOUT(60000000)*/ IF(count(*) >= 0, 1, 0) from oceanbase.__all_virtual_table_history; IF(count(*) >= 0, 1, 0) 1