Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
oceanbase
obproxy
提交
93b2e020
O
obproxy
项目概览
oceanbase
/
obproxy
1 年多 前同步成功
通知
11
Star
100
Fork
70
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
obproxy
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
93b2e020
编写于
4月 08, 2021
作者:
W
wgs13579
提交者:
guangshu.wgs
6月 07, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
support client_ip cross obproxy to observer
上级
4e8dbd5f
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
20 addition
and
2 deletion
+20
-2
src/obproxy/proxy/mysql/ob_mysql_sm.cpp
src/obproxy/proxy/mysql/ob_mysql_sm.cpp
+1
-0
src/obproxy/proxy/mysqllib/ob_mysql_packet_rewriter.cpp
src/obproxy/proxy/mysqllib/ob_mysql_packet_rewriter.cpp
+13
-1
src/obproxy/proxy/mysqllib/ob_mysql_packet_rewriter.h
src/obproxy/proxy/mysqllib/ob_mysql_packet_rewriter.h
+1
-1
src/rpc/obmysql/packet/ompk_handshake.h
src/rpc/obmysql/packet/ompk_handshake.h
+5
-0
未找到文件。
src/obproxy/proxy/mysql/ob_mysql_sm.cpp
浏览文件 @
93b2e020
...
@@ -5137,6 +5137,7 @@ void ObMysqlSM::do_internal_request()
...
@@ -5137,6 +5137,7 @@ void ObMysqlSM::do_internal_request()
// current not support compress to client
// current not support compress to client
handshake
.
disable_use_compress
();
handshake
.
disable_use_compress
();
handshake
.
enable_session_track
();
handshake
.
enable_session_track
();
handshake
.
enable_connection_attr
();
// use cs id (proxy connection id)
// use cs id (proxy connection id)
// before receive ok pkt from observer, the conn_id_ is always 0, means has not set
// before receive ok pkt from observer, the conn_id_ is always 0, means has not set
uint32_t
conn_id
=
client_session_
->
get_cs_id
();
uint32_t
conn_id
=
client_session_
->
get_cs_id
();
...
...
src/obproxy/proxy/mysqllib/ob_mysql_packet_rewriter.cpp
浏览文件 @
93b2e020
...
@@ -189,7 +189,7 @@ int ObMysqlPacketRewriter::add_connect_attr(const char *key, const common::ObStr
...
@@ -189,7 +189,7 @@ int ObMysqlPacketRewriter::add_connect_attr(const char *key, const common::ObStr
int
ObMysqlPacketRewriter
::
rewrite_handshake_response_packet
(
int
ObMysqlPacketRewriter
::
rewrite_handshake_response_packet
(
ObMysqlAuthRequest
&
orig_auth_req
,
ObMysqlAuthRequest
&
orig_auth_req
,
const
ObHandshakeResponseParam
&
param
,
ObHandshakeResponseParam
&
param
,
OMPKHandshakeResponse
&
tg_hsr
)
OMPKHandshakeResponse
&
tg_hsr
)
{
{
int
ret
=
OB_SUCCESS
;
int
ret
=
OB_SUCCESS
;
...
@@ -211,6 +211,18 @@ int ObMysqlPacketRewriter::rewrite_handshake_response_packet(
...
@@ -211,6 +211,18 @@ int ObMysqlPacketRewriter::rewrite_handshake_response_packet(
tg_hsr
.
set_database
(
ObString
::
make_empty_string
());
tg_hsr
.
set_database
(
ObString
::
make_empty_string
());
}
}
// find client_ip
ObStringKV
string_kv
;
for
(
int64_t
i
=
0
;
OB_SUCC
(
ret
)
&&
i
<
tg_hsr
.
get_connect_attrs
().
count
();
++
i
)
{
string_kv
=
tg_hsr
.
get_connect_attrs
().
at
(
i
);
if
(
0
==
string_kv
.
key_
.
case_compare
(
OB_MYSQL_CLIENT_IP
))
{
if
(
!
string_kv
.
value_
.
empty
())
{
snprintf
(
param
.
client_ip_buf_
,
ObHandshakeResponseParam
::
OB_MAX_IP_BUF_LEN
,
"%.*s"
,
string_kv
.
value_
.
length
(),
string_kv
.
value_
.
ptr
());
}
break
;
}
}
// reset before add
// reset before add
tg_hsr
.
reset_connect_attr
();
tg_hsr
.
reset_connect_attr
();
// 4. add obproxy specified connect attrs:
// 4. add obproxy specified connect attrs:
...
...
src/obproxy/proxy/mysqllib/ob_mysql_packet_rewriter.h
浏览文件 @
93b2e020
...
@@ -94,7 +94,7 @@ public:
...
@@ -94,7 +94,7 @@ public:
const
bool
need_save_sys_var
);
const
bool
need_save_sys_var
);
static
int
rewrite_handshake_response_packet
(
ObMysqlAuthRequest
&
orig_auth_req
,
static
int
rewrite_handshake_response_packet
(
ObMysqlAuthRequest
&
orig_auth_req
,
const
ObHandshakeResponseParam
&
param
,
ObHandshakeResponseParam
&
param
,
obmysql
::
OMPKHandshakeResponse
&
tg_hsr
);
obmysql
::
OMPKHandshakeResponse
&
tg_hsr
);
static
int
add_connect_attr
(
const
char
*
key
,
static
int
add_connect_attr
(
const
char
*
key
,
...
...
src/rpc/obmysql/packet/ompk_handshake.h
浏览文件 @
93b2e020
...
@@ -55,6 +55,11 @@ public:
...
@@ -55,6 +55,11 @@ public:
server_capabilities_upper_
.
capability_flag_
.
OB_SERVER_SESSION_VARIABLE_TRACK
=
1
;
server_capabilities_upper_
.
capability_flag_
.
OB_SERVER_SESSION_VARIABLE_TRACK
=
1
;
}
}
void
enable_connection_attr
()
{
server_capabilities_upper_
.
capability_flag_
.
OB_SERVER_CONNECT_ATTRS
=
1
;
}
void
disable_ssl
()
void
disable_ssl
()
{
{
server_capabilities_lower_
.
capability_flag_
.
OB_SERVER_SSL
=
0
;
server_capabilities_lower_
.
capability_flag_
.
OB_SERVER_SSL
=
0
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录