Skip to content

Commit

Permalink
add request follower config
Browse files Browse the repository at this point in the history
  • Loading branch information
yu34po committed Feb 16, 2022
1 parent 178a779 commit 5e392ca
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
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

0 comments on commit 5e392ca

Please sign in to comment.