support oms ncharacter_set_connection

This commit is contained in:
SevenJ-swj
2023-10-10 11:40:07 +00:00
committed by ob-robot
parent 8bb3b902a3
commit c63282a624
19 changed files with 226 additions and 42 deletions

View File

@ -3383,7 +3383,11 @@ int ObBasicSessionInfo::get_charset_sys_var(const ObSysVarClassType sys_var_id,
} else if (OB_FAIL(val->get_value().get_int(coll_int64))) {
LOG_ERROR("fail to get int from value", K(*val), K(ret));
} else if (OB_UNLIKELY(false == ObCharset::is_valid_collation(coll_int64))) {
LOG_ERROR("invalid collation", K(sys_var_id), K(coll_int64), K(*val));
if (SYS_VAR_NCHARACTER_SET_CONNECTION == sys_var_id && coll_int64 == 0) {
//do nothing
} else {
LOG_ERROR("invalid collation", K(sys_var_id), K(coll_int64), K(*val));
}
} else {
cs_type = ObCharset::charset_type_by_coll(static_cast<ObCollationType>(coll_int64));
}
@ -5164,6 +5168,14 @@ int ObBasicSessionInfo::get_character_set_connection(ObCharsetType &character_se
return OB_SUCCESS;
}
int ObBasicSessionInfo::get_ncharacter_set_connection(ObCharsetType &ncharacter_set_connection) const
{
if (CHARSET_INVALID == (ncharacter_set_connection = sys_vars_cache_.get_ncharacter_set_connection())) {
get_charset_sys_var(SYS_VAR_NCHARACTER_SET_CONNECTION, ncharacter_set_connection);
}
return OB_SUCCESS;
}
int ObBasicSessionInfo::get_character_set_database(ObCharsetType &character_set_database) const
{
return get_charset_sys_var(SYS_VAR_CHARACTER_SET_DATABASE, character_set_database);

View File

@ -596,6 +596,7 @@ public:
int get_div_precision_increment(int64_t &div_precision_increment) const;
int get_character_set_client(common::ObCharsetType &character_set_client) const;
int get_character_set_connection(common::ObCharsetType &character_set_connection) const;
int get_ncharacter_set_connection(common::ObCharsetType &ncharacter_set_connection) const;
int get_character_set_database(common::ObCharsetType &character_set_database) const;
int get_character_set_results(common::ObCharsetType &character_set_results) const;
int get_character_set_server(common::ObCharsetType &character_set_server) const;
@ -1533,7 +1534,8 @@ public:
runtime_filter_type_(0),
runtime_filter_wait_time_ms_(0),
runtime_filter_max_in_num_(0),
runtime_bloom_filter_max_size_(INT_MAX32)
runtime_bloom_filter_max_size_(INT_MAX32),
ncharacter_set_connection_(ObCharsetType::CHARSET_INVALID)
{
for (int64_t i = 0; i < ObNLSFormatEnum::NLS_MAX; ++i) {
@ -1593,6 +1595,7 @@ public:
runtime_filter_wait_time_ms_ = 0;
runtime_filter_max_in_num_ = 0;
runtime_bloom_filter_max_size_ = INT32_MAX;
ncharacter_set_connection_ = ObCharsetType::CHARSET_INVALID;
}
inline bool operator==(const SysVarsCacheData &other) const {
@ -1635,7 +1638,8 @@ public:
iso_nls_currency_ == other.iso_nls_currency_ &&
ob_plsql_ccflags_ == other.ob_plsql_ccflags_ &&
log_row_value_option_ == other.log_row_value_option_ &&
ob_max_read_stale_time_ == other.ob_max_read_stale_time_;
ob_max_read_stale_time_ == other.ob_max_read_stale_time_ &&
ncharacter_set_connection_ == other.ncharacter_set_connection_;
bool equal2 = true;
for (int64_t i = 0; i < ObNLSFormatEnum::NLS_MAX; ++i) {
if (nls_formats_[i] != other.nls_formats_[i]) {
@ -1803,6 +1807,8 @@ public:
int64_t runtime_filter_wait_time_ms_;
int64_t runtime_filter_max_in_num_;
int64_t runtime_bloom_filter_max_size_;
ObCharsetType ncharacter_set_connection_;
private:
char nls_formats_buf_[ObNLSFormatEnum::NLS_MAX][MAX_NLS_FORMAT_STR_LEN];
};
@ -1914,6 +1920,7 @@ private:
DEF_SYS_VAR_CACHE_FUNCS(int64_t, runtime_filter_wait_time_ms);
DEF_SYS_VAR_CACHE_FUNCS(int64_t, runtime_filter_max_in_num);
DEF_SYS_VAR_CACHE_FUNCS(int64_t, runtime_bloom_filter_max_size);
DEF_SYS_VAR_CACHE_FUNCS(ObCharsetType, ncharacter_set_connection);
void set_autocommit_info(bool inc_value)
{
inc_data_.autocommit_ = inc_value;
@ -1981,6 +1988,7 @@ private:
bool inc_runtime_filter_wait_time_ms_:1;
bool inc_runtime_filter_max_in_num_:1;
bool inc_runtime_bloom_filter_max_size_:1;
bool inc_ncharacter_set_connection_:1;
};
};
};