Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
oceanbase
obproxy
提交
4e8dbd5f
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看板
提交
4e8dbd5f
编写于
3月 29, 2021
作者:
W
wgs13579
提交者:
guangshu.wgs
6月 07, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
support encryption zone and replica
上级
1a623b67
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
27 addition
and
8 deletion
+27
-8
src/common/ob_zone_type.cpp
src/common/ob_zone_type.cpp
+1
-1
src/common/ob_zone_type.h
src/common/ob_zone_type.h
+2
-1
src/lib/ob_define.h
src/lib/ob_define.h
+10
-3
src/obproxy/obutils/ob_server_state_processor.cpp
src/obproxy/obutils/ob_server_state_processor.cpp
+2
-0
src/obproxy/obutils/ob_state_info.h
src/obproxy/obutils/ob_state_info.h
+1
-0
src/obproxy/proxy/mysql/ob_mysql_transact.cpp
src/obproxy/proxy/mysql/ob_mysql_transact.cpp
+2
-1
src/obproxy/proxy/route/ob_ldc_location.cpp
src/obproxy/proxy/route/ob_ldc_location.cpp
+5
-2
src/obproxy/proxy/route/ob_route_struct.cpp
src/obproxy/proxy/route/ob_route_struct.cpp
+4
-0
未找到文件。
src/common/ob_zone_type.cpp
浏览文件 @
4e8dbd5f
...
...
@@ -20,7 +20,7 @@ namespace oceanbase
namespace
common
{
static
const
char
*
zone_type_strs
[]
=
{
"ReadWrite"
,
"ReadOnly"
,
"Invalid"
};
static
const
char
*
zone_type_strs
[]
=
{
"ReadWrite"
,
"ReadOnly"
,
"
Encryption"
,
"
Invalid"
};
const
char
*
zone_type_to_str
(
ObZoneType
zone_type
)
{
const
char
*
zone_type_str
=
NULL
;
...
...
src/common/ob_zone_type.h
浏览文件 @
4e8dbd5f
...
...
@@ -21,7 +21,8 @@ enum ObZoneType
{
ZONE_TYPE_READWRITE
=
0
,
ZONE_TYPE_READONLY
=
1
,
ZONE_TYPE_INVALID
=
2
,
ZONE_TYPE_ENCRYPTION
=
2
,
ZONE_TYPE_INVALID
=
3
,
};
const
char
*
zone_type_to_str
(
ObZoneType
zone_type
);
...
...
src/lib/ob_define.h
浏览文件 @
4e8dbd5f
...
...
@@ -946,8 +946,9 @@ inline bool is_not_supported_err(int err)
* |--- 4 bits ---|--- 2 bits ---|--- 2 bits ---| LSB
* |--- clog ---|-- SSStore ---|--- MemStore--| LSB
*/
static
const
int64_t
SSSTORE_BITS_SHIFT
=
2
;
static
const
int64_t
CLOG_BITS_SHIFT
=
4
;
static
const
int64_t
SSSTORE_BITS_SHIFT
=
2
;
static
const
int64_t
CLOG_BITS_SHIFT
=
4
;
static
const
int64_t
ENCRYPTION_BITS_SHIFT
=
8
;
// replica type associated with memstore
static
const
int64_t
WITH_MEMSTORE
=
0
;
static
const
int64_t
WITHOUT_MEMSTORE
=
1
;
...
...
@@ -957,6 +958,9 @@ static const int64_t WITHOUT_SSSTORE = 1 << SSSTORE_BITS_SHIFT;
// replica type associated with clog
static
const
int64_t
SYNC_CLOG
=
0
<<
CLOG_BITS_SHIFT
;
static
const
int64_t
ASYNC_CLOG
=
1
<<
CLOG_BITS_SHIFT
;
// replica type associated with encryption
const
int64_t
WITHOUT_ENCRYPTION
=
0
<<
ENCRYPTION_BITS_SHIFT
;
const
int64_t
WITH_ENCRYPTION
=
1
<<
ENCRYPTION_BITS_SHIFT
;
// Need to manually maintain the replica_type_to_str function in utility.cpp,
// Currently there are only three types: REPLICA_TYPE_FULL, REPLICA_TYPE_READONLY, and REPLICA_TYPE_LOGONLY
...
...
@@ -974,6 +978,8 @@ enum ObReplicaType
REPLICA_TYPE_READONLY
=
(
ASYNC_CLOG
|
WITH_SSSTORE
|
WITH_MEMSTORE
),
// 16
// Incremental copy: not a member of paxos; no ssstore; memstore
REPLICA_TYPE_MEMONLY
=
(
ASYNC_CLOG
|
WITHOUT_SSSTORE
|
WITH_MEMSTORE
),
// 20
// Encrypted log copy: encrypted; paxos member; no sstore; no memstore
REPLICA_TYPE_ENCRYPTION_LOGONLY
=
(
WITH_ENCRYPTION
|
SYNC_CLOG
|
WITHOUT_SSSTORE
|
WITHOUT_MEMSTORE
),
// 261
// invalid value
REPLICA_TYPE_MAX
,
};
...
...
@@ -995,7 +1001,8 @@ public:
}
static
bool
is_paxos_replica
(
const
int32_t
replica_type
)
{
return
(
replica_type
>=
REPLICA_TYPE_FULL
&&
replica_type
<=
REPLICA_TYPE_LOGONLY
);
return
(
replica_type
>=
REPLICA_TYPE_FULL
&&
replica_type
<=
REPLICA_TYPE_LOGONLY
)
||
(
REPLICA_TYPE_ENCRYPTION_LOGONLY
==
replica_type
);
}
static
bool
is_writable_replica
(
const
int32_t
replica_type
)
{
...
...
src/obproxy/obutils/ob_server_state_processor.cpp
浏览文件 @
4e8dbd5f
...
...
@@ -1658,6 +1658,8 @@ int ObServerStateRefreshUtils::get_server_state_info(
}
else
{
if
(
server_state
.
zone_state_
->
is_readonly_zone
())
{
server_state
.
replica_
.
replica_type_
=
REPLICA_TYPE_READONLY
;
}
else
if
(
server_state
.
zone_state_
->
is_encryption_zone
())
{
server_state
.
replica_
.
replica_type_
=
REPLICA_TYPE_ENCRYPTION_LOGONLY
;
}
else
{
server_state
.
replica_
.
replica_type_
=
REPLICA_TYPE_FULL
;
}
...
...
src/obproxy/obutils/ob_state_info.h
浏览文件 @
4e8dbd5f
...
...
@@ -36,6 +36,7 @@ struct ObZoneStateInfo
int
set_idc_name
(
const
common
::
ObString
&
idc_name
);
int64_t
to_string
(
char
*
buffer
,
const
int64_t
size
)
const
;
bool
is_readonly_zone
()
{
return
common
::
ZONE_TYPE_READONLY
==
zone_type_
;
}
bool
is_encryption_zone
()
{
return
common
::
ZONE_TYPE_ENCRYPTION
==
zone_type_
;
}
ObZoneStateInfo
&
operator
=
(
const
ObZoneStateInfo
&
other
);
common
::
ObString
zone_name_
;
...
...
src/obproxy/proxy/mysql/ob_mysql_transact.cpp
浏览文件 @
4e8dbd5f
...
...
@@ -4275,7 +4275,8 @@ inline void ObMysqlTransact::handle_server_failed(ObTransState &s)
break
;
}
case
-
OB_ERR_READ_ONLY
:
{
if
(
ZONE_TYPE_READONLY
==
s
.
pll_info_
.
route_
.
cur_chosen_server_
.
zone_type_
)
{
if
(
ZONE_TYPE_READONLY
==
s
.
pll_info_
.
route_
.
cur_chosen_server_
.
zone_type_
||
ZONE_TYPE_ENCRYPTION
==
s
.
pll_info_
.
route_
.
cur_chosen_server_
.
zone_type_
)
{
LOG_WARN
(
"zone is readonly, but server tell error response, "
"maybe this new server do not support old agreement, try next server"
,
"origin_name"
,
s
.
pll_info_
.
te_name_
,
...
...
src/obproxy/proxy/route/ob_ldc_location.cpp
浏览文件 @
4e8dbd5f
...
...
@@ -399,7 +399,8 @@ int ObLDCLocation::fill_strong_read_location(const ObProxyPartitionLocation *pl,
&&
!
replica
.
is_leader
())
{
//do not use it
need_use_it
=
false
;
}
else
if
(
REPLICA_TYPE_LOGONLY
==
replica
.
get_replica_type
())
{
}
else
if
(
REPLICA_TYPE_LOGONLY
==
replica
.
get_replica_type
()
||
REPLICA_TYPE_ENCRYPTION_LOGONLY
==
replica
.
get_replica_type
())
{
// log relica, skip
need_use_it
=
false
;
}
else
{
...
...
@@ -457,7 +458,9 @@ int ObLDCLocation::fill_strong_read_location(const ObProxyPartitionLocation *pl,
for
(
int64_t
j
=
0
;
OB_SUCC
(
ret
)
&&
j
<
dummy_ldc
.
item_count_
;
++
j
)
{
const
ObLDCItem
&
dummy_item
=
dummy_ldc
.
item_array_
[
j
];
// skip log relica
if
(
dummy_item
.
is_used_
||
REPLICA_TYPE_LOGONLY
==
dummy_item
.
replica_
->
get_replica_type
())
{
if
(
dummy_item
.
is_used_
||
REPLICA_TYPE_LOGONLY
==
dummy_item
.
replica_
->
get_replica_type
()
||
REPLICA_TYPE_ENCRYPTION_LOGONLY
==
dummy_item
.
replica_
->
get_replica_type
())
{
//continue
}
else
if
(
is_only_readwrite_zone
&&
common
::
ZONE_TYPE_READWRITE
!=
dummy_item
.
zone_type_
)
{
//do not use id
...
...
src/obproxy/proxy/route/ob_route_struct.cpp
浏览文件 @
4e8dbd5f
...
...
@@ -65,6 +65,10 @@ ObString ObProxyReplicaLocation::get_replica_type_string(const ObReplicaType typ
string
=
ObString
::
make_string
(
"MEMONLY"
);
break
;
}
case
REPLICA_TYPE_ENCRYPTION_LOGONLY
:
{
string
=
ObString
::
make_string
(
"ENCRYPTION_LOGONLY"
);
break
;
}
case
REPLICA_TYPE_MAX
:
{
string
=
ObString
::
make_string
(
"MAX"
);
break
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录