Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add request follower config #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/obproxy/obutils/ob_proxy_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ class ObProxyConfig : public common::ObCommonConfig
DEF_BOOL(enable_cluster_checkout, "true", "if enable cluster checkout, proxy will send cluster name when login and server will check it", CFG_NO_NEED_REBOOT, CFG_SECTION_OBPROXY, CFG_VISIBLE_LEVEL_USER);
DEF_BOOL(enable_proxy_scramble, "false", "if enable proxy scramble, proxy will send client its variable scramble num, not support old observer", CFG_NO_NEED_REBOOT, CFG_SECTION_OBPROXY, CFG_VISIBLE_LEVEL_SYS);
DEF_BOOL(enable_client_ip_checkout, "true", "if enabled, proxy send client ip when login", CFG_NO_NEED_REBOOT, CFG_SECTION_OBPROXY, CFG_VISIBLE_LEVEL_USER);
DEF_BOOL(enable_force_request_follower, "false", "force request follower ", CFG_NO_NEED_REBOOT, CFG_SECTION_OBPROXY, CFG_VISIBLE_LEVEL_SYS);

//connection related
DEF_INT(connect_observer_max_retries, "3", "[2,5]", "max retries to do connect", CFG_NO_NEED_REBOOT, CFG_SECTION_OBPROXY, CFG_VISIBLE_LEVEL_USER);
Expand Down
5 changes: 5 additions & 0 deletions src/obproxy/proxy/mysql/ob_mysql_client_session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,11 @@ int ObMysqlClientSession::new_connection(
}
}

// set weak read flag global
if (obutils::get_global_proxy_config().enable_force_request_follower) {
session_info_.set_is_request_follower_user(true);
}

// 2. handle_new_connection no matter convert vip to tenant result.
handle_new_connection();
}
Expand Down
5 changes: 4 additions & 1 deletion src/obproxy/proxy/mysqllib/ob_mysql_config_processor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ ObMysqlConfigParams::ObMysqlConfigParams()
enable_bad_route_reject_(false),
enable_cluster_checkout_(true),
enable_client_ip_checkout_(true),
enable_force_request_follower_(false),
enable_proxy_scramble_(false),
enable_compression_protocol_(false),
enable_ob_protocol_v2_(false),
Expand Down Expand Up @@ -172,6 +173,7 @@ int ObMysqlConfigParams::assign_config(const ObProxyConfig &proxy_config)
CONFIG_ITEM_ASSIGN(enable_bad_route_reject);
CONFIG_ITEM_ASSIGN(enable_cluster_checkout);
CONFIG_ITEM_ASSIGN(enable_client_ip_checkout);
CONFIG_ITEM_ASSIGN(enable_force_request_follower);
CONFIG_ITEM_ASSIGN(enable_proxy_scramble);
CONFIG_ITEM_ASSIGN(enable_compression_protocol);
CONFIG_ITEM_ASSIGN(enable_ob_protocol_v2);
Expand Down Expand Up @@ -317,7 +319,8 @@ DEF_TO_STRING(ObMysqlConfigParams)
K_(proxy_service_mode), K_(server_routing_mode), K_(proxy_id), K_(proxy_idc_name),
K_(client_max_memory_size),
K_(default_inactivity_timeout), K_(enable_partition_table_route), K_(enable_pl_route),
K_(enable_cluster_checkout), K_(enable_client_ip_checkout), K_(enable_proxy_scramble),
K_(enable_cluster_checkout), K_(enable_client_ip_checkout), K_(enable_force_request_follower),
K_(enable_proxy_scramble),
K_(enable_compression_protocol), K_(enable_ob_protocol_v2), K_(enable_reroute), K_(enable_index_route),
K_(enable_causal_order_read));
J_OBJ_END();
Expand Down
1 change: 1 addition & 0 deletions src/obproxy/proxy/mysqllib/ob_mysql_config_processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ struct ObMysqlConfigParams : public ObConfigInfo
CfgBool enable_bad_route_reject_;
CfgBool enable_cluster_checkout_;
CfgBool enable_client_ip_checkout_;
CfgBool enable_force_request_follower_;
CfgBool enable_proxy_scramble_;
CfgBool enable_compression_protocol_;
CfgBool enable_ob_protocol_v2_;
Expand Down