Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
oceanbase
obproxy
提交
4f40b15c
O
obproxy
项目概览
oceanbase
/
obproxy
大约 2 年 前同步成功
通知
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看板
提交
4f40b15c
编写于
6月 03, 2021
作者:
W
wgs13579
提交者:
guangshu.wgs
6月 07, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
code format for variable+equal
上级
2d514853
变更
54
展开全部
隐藏空白更改
内联
并排
Showing
54 changed file
with
1860 addition
and
1861 deletion
+1860
-1861
src/common/cache/ob_kv_storecache.h
src/common/cache/ob_kv_storecache.h
+3
-3
src/common/ob_cost_consts_def.h
src/common/ob_cost_consts_def.h
+118
-118
src/common/ob_obj_type.h
src/common/ob_obj_type.h
+15
-15
src/common/ob_string_buf.ipp
src/common/ob_string_buf.ipp
+1
-1
src/lib/alloc/achunk_mgr.h
src/lib/alloc/achunk_mgr.h
+1
-1
src/lib/alloc/alloc_struct.h
src/lib/alloc/alloc_struct.h
+22
-22
src/lib/encrypt/ob_encrypted_helper.cpp
src/lib/encrypt/ob_encrypted_helper.cpp
+1
-1
src/lib/net/tbnetutil.cpp
src/lib/net/tbnetutil.cpp
+0
-3
src/lib/ob_define.h
src/lib/ob_define.h
+505
-505
src/lib/oblog/ob_trace_log.cpp
src/lib/oblog/ob_trace_log.cpp
+1
-1
src/lib/time/ob_time_utility.cpp
src/lib/time/ob_time_utility.cpp
+6
-6
src/lib/timezone/ob_time_convert.cpp
src/lib/timezone/ob_time_convert.cpp
+5
-5
src/lib/utility/serialization.h
src/lib/utility/serialization.h
+61
-61
src/obproxy/cmd/ob_show_config_handler.cpp
src/obproxy/cmd/ob_show_config_handler.cpp
+7
-7
src/obproxy/cmd/ob_show_session_handler.cpp
src/obproxy/cmd/ob_show_session_handler.cpp
+4
-4
src/obproxy/dbconfig/ob_proxy_db_config_info.cpp
src/obproxy/dbconfig/ob_proxy_db_config_info.cpp
+87
-87
src/obproxy/dbconfig/ob_proxy_pb_utils.cpp
src/obproxy/dbconfig/ob_proxy_pb_utils.cpp
+8
-8
src/obproxy/engine/ob_proxy_operator_result.h
src/obproxy/engine/ob_proxy_operator_result.h
+1
-1
src/obproxy/iocore/eventsystem/ob_event.h
src/obproxy/iocore/eventsystem/ob_event.h
+1
-1
src/obproxy/iocore/eventsystem/ob_event_processor.h
src/obproxy/iocore/eventsystem/ob_event_processor.h
+2
-2
src/obproxy/iocore/eventsystem/ob_thread.h
src/obproxy/iocore/eventsystem/ob_thread.h
+1
-1
src/obproxy/iocore/eventsystem/ob_thread_allocator.h
src/obproxy/iocore/eventsystem/ob_thread_allocator.h
+3
-3
src/obproxy/iocore/net/ob_connection.cpp
src/obproxy/iocore/net/ob_connection.cpp
+3
-3
src/obproxy/iocore/net/ob_inet.h
src/obproxy/iocore/net/ob_inet.h
+4
-27
src/obproxy/ob_proxy_main.cpp
src/obproxy/ob_proxy_main.cpp
+3
-3
src/obproxy/obutils/ob_async_common_task.cpp
src/obproxy/obutils/ob_async_common_task.cpp
+1
-1
src/obproxy/obutils/ob_mt_hashtable.h
src/obproxy/obutils/ob_mt_hashtable.h
+3
-3
src/obproxy/obutils/ob_proxy_config_processor.cpp
src/obproxy/obutils/ob_proxy_config_processor.cpp
+35
-35
src/obproxy/obutils/ob_proxy_config_utils.cpp
src/obproxy/obutils/ob_proxy_config_utils.cpp
+4
-4
src/obproxy/obutils/ob_proxy_config_utils.h
src/obproxy/obutils/ob_proxy_config_utils.h
+4
-4
src/obproxy/obutils/ob_proxy_json_config_info.cpp
src/obproxy/obutils/ob_proxy_json_config_info.cpp
+35
-35
src/obproxy/obutils/ob_proxy_sequence_utils.cpp
src/obproxy/obutils/ob_proxy_sequence_utils.cpp
+3
-3
src/obproxy/obutils/ob_proxy_sql_parser.h
src/obproxy/obutils/ob_proxy_sql_parser.h
+6
-6
src/obproxy/obutils/ob_proxy_table_processor.h
src/obproxy/obutils/ob_proxy_table_processor.h
+3
-3
src/obproxy/obutils/ob_proxy_table_processor_utils.cpp
src/obproxy/obutils/ob_proxy_table_processor_utils.cpp
+2
-2
src/obproxy/obutils/ob_resource_pool_processor.cpp
src/obproxy/obutils/ob_resource_pool_processor.cpp
+5
-5
src/obproxy/obutils/ob_server_state_processor.cpp
src/obproxy/obutils/ob_server_state_processor.cpp
+5
-5
src/obproxy/proxy/client/ob_client_vc.cpp
src/obproxy/proxy/client/ob_client_vc.cpp
+2
-2
src/obproxy/proxy/mysql/ob_mysql_sm.h
src/obproxy/proxy/mysql/ob_mysql_sm.h
+2
-2
src/obproxy/proxy/mysqllib/ob_mysql_common_define.h
src/obproxy/proxy/mysqllib/ob_mysql_common_define.h
+22
-22
src/obproxy/proxy/mysqllib/ob_proxy_session_info_handler.cpp
src/obproxy/proxy/mysqllib/ob_proxy_session_info_handler.cpp
+1
-1
src/obproxy/proxy/route/ob_ldc_struct.h
src/obproxy/proxy/route/ob_ldc_struct.h
+73
-73
src/obproxy/proxy/route/ob_route_utils.cpp
src/obproxy/proxy/route/ob_route_utils.cpp
+9
-9
src/obproxy/stat/ob_stat_processor.cpp
src/obproxy/stat/ob_stat_processor.cpp
+5
-5
src/obproxy/utils/ob_proxy_blowfish.cpp
src/obproxy/utils/ob_proxy_blowfish.cpp
+98
-64
src/obproxy/utils/ob_proxy_lib.h
src/obproxy/utils/ob_proxy_lib.h
+158
-158
src/obproxy/utils/ob_proxy_table_define.cpp
src/obproxy/utils/ob_proxy_table_define.cpp
+23
-24
src/obproxy/utils/ob_proxy_table_define.h
src/obproxy/utils/ob_proxy_table_define.h
+0
-1
src/share/inner_table/ob_inner_table_schema.h
src/share/inner_table/ob_inner_table_schema.h
+1
-1
src/share/inner_table/ob_inner_table_schema_constants.h
src/share/inner_table/ob_inner_table_schema_constants.h
+462
-462
src/share/schema/ob_column_schema.h
src/share/schema/ob_column_schema.h
+14
-14
unittest/obproxy/parser/runner.py
unittest/obproxy/parser/runner.py
+1
-1
unittest/obproxy/test_config_server_processor.cpp
unittest/obproxy/test_config_server_processor.cpp
+19
-26
unittest/obproxy/test_proxy_session_info.cpp
unittest/obproxy/test_proxy_session_info.cpp
+1
-1
未找到文件。
src/common/cache/ob_kv_storecache.h
浏览文件 @
4f40b15c
...
...
@@ -45,10 +45,10 @@ namespace oceanbase
{
namespace
common
{
static
const
int64_t
MAX_CACHE_NUM
=
16
;
static
const
int64_t
MAX_CACHE_NUM
=
16
;
static
const
int64_t
MAX_TENANT_NUM_PER_SERVER
=
1024
;
static
const
int32_t
MAX_CACHE_NAME_LENGTH
=
127
;
static
const
double
CACHE_SCORE_DECAY_FACTOR
=
0.9
;
static
const
int32_t
MAX_CACHE_NAME_LENGTH
=
127
;
static
const
double
CACHE_SCORE_DECAY_FACTOR
=
0.9
;
class
ObIKVCacheKey
{
...
...
src/common/ob_cost_consts_def.h
浏览文件 @
4f40b15c
...
...
@@ -21,42 +21,42 @@ namespace common
/**
* Calculate the cpu cost of a basic operator
*/
const
int64_t
CPU_OPERATOR_COST
=
1
;
const
int64_t
CPU_OPERATOR_COST
=
1
;
const
int64_t
NO_ROW_FAKE_COST
=
100
;
const
int64_t
NO_ROW_FAKE_COST
=
100
;
///The basic cost of a rpc
const
int64_t
NET_BASE_COST
=
100
;
const
int64_t
NET_BASE_COST
=
100
;
///The basic cost of rpc sending a row of data
const
double
NET_PER_ROW_COST
=
0.4
;
const
double
NET_PER_ROW_COST
=
0.4
;
///The cost of updating a row of data. Temporarily written
const
int64_t
UPDATE_ONE_ROW_COST
=
1
;
const
int64_t
UPDATE_ONE_ROW_COST
=
1
;
///The cost of DELETE a row of data. Temporarily written
const
int64_t
DELETE_ONE_ROW_COST
=
1
;
const
int64_t
DELETE_ONE_ROW_COST
=
1
;
/**
* The cpu cost of processing a row of data
*/
const
int64_t
CPU_TUPLE_COST
=
1
;
const
int64_t
CPU_TUPLE_COST
=
1
;
/**
* The default selection rate of equivalent expressions such as ("A = b")
*/
const
double
DEFAULT_EQ_SEL
=
0.005
;
const
double
DEFAULT_EQ_SEL
=
0.005
;
/**
* The default selection rate for non-equivalent expressions (such as "A <b")
*/
const
double
DEFAULT_INEQ_SEL
=
1.0
/
3.0
;
const
double
DEFAULT_INEQ_SEL
=
1.0
/
3.0
;
/**
* The default selection rate that can't be guessed: half and half
*/
const
double
DEFAULT_SEL
=
0.5
;
const
double
DEFAULT_SEL
=
0.5
;
/**
* The default distinct number
*/
const
int64_t
DEFAULT_DISTINCT
=
10
;
const
int64_t
DEFAULT_DISTINCT
=
10
;
//Oracle give range that exceeds limit a additional selectivity
...
...
@@ -73,118 +73,118 @@ const int64_t DEFAULT_DISTINCT = 10;
* min - r min max a max + r
* */
//We can control the decreasing range r by changine DEFAULT_RANGE_EXCEED_LIMIT_DECAY_RATIO
// r = (max - min) * DEFAULT_RANGE_EXCEED_LIMIT_DECAY_RATIO
// r
= (max - min) * DEFAULT_RANGE_EXCEED_LIMIT_DECAY_RATIO
//For scan, assuming even distribution, area A represents probability of row falling in range (min,max), which is 1.0
//if we have range i > a, then its probability is area of y
//if we have range i < a, then its probability is A plus x
//the logic is in ObOptimizerCost::do_calc_range_selectivity
const
double
DEFAULT_RANGE_EXCEED_LIMIT_DECAY_RATIO
=
0.5
;
const
double
DEFAULT_RANGE_EXCEED_LIMIT_DECAY_RATIO
=
0.5
;
const
double
DEFAULT_GET_EXIST_RATE
=
1.0
;
const
double
DEFAULT_CACHE_HIT_RATE
=
0.8
;
const
double
DEFAULT_BLOCK_CACHE_HIT_RATE
=
DEFAULT_CACHE_HIT_RATE
;
const
double
DEFAULT_ROW_CACHE_HIT_RATE
=
DEFAULT_CACHE_HIT_RATE
;
const
double
DEFAULT_GET_EXIST_RATE
=
1.0
;
const
double
DEFAULT_CACHE_HIT_RATE
=
0.8
;
const
double
DEFAULT_BLOCK_CACHE_HIT_RATE
=
DEFAULT_CACHE_HIT_RATE
;
const
double
DEFAULT_ROW_CACHE_HIT_RATE
=
DEFAULT_CACHE_HIT_RATE
;
const
double
LN_2
=
0.69314718055994530941723212145818
;
const
double
LN_2
=
0.69314718055994530941723212145818
;
#define LOGN(x) (log(x))
#define LOG2(x) (LOGN(static_cast<double>(x)) / LN_2)
//cost params for table scan
//all one-time cost during a scan process
const
double
SCAN_STARTUP_T
=
10.0
;
const
double
SCAN_STARTUP_T
=
10.0
;
//one-time cost during processing a row
const
double
SCAN_ROW_CONST_T
=
0.186
;
const
double
SCAN_ROW_CONST_T
=
0.186
;
//cost related to processing one obj
const
double
SCAN_ROW_ONE_COLUMN_T
=
0.018
;
const
double
SCAN_ROW_ONE_COLUMN_T
=
0.018
;
//cost related to processing a micro block
const
double
SCAN_MICRO_CONST_T
=
6.95
;
const
double
SCAN_MICRO_CONST_T
=
6.95
;
//additional cost related to processing a micro block if micro block cache miss
const
double
SCAN_MICRO_BLOCK_CACHE_MISS_T
=
20.58
;
const
double
SCAN_MICRO_BLOCK_CACHE_MISS_T
=
20.58
;
//cost related to processing a macro block
const
double
SCAN_MACRO_CONST_T
=
14.0
;
const
double
SCAN_MACRO_CONST_T
=
14.0
;
const
double
SCAN_OPEN_CACHE_HIT_PER_MICRO_T
=
1.0
;
const
double
SCAN_OPEN_CACHE_MISS_PER_MICRO_T
=
8.0
;
const
double
SCAN_OPEN_CACHE_HIT_PER_MICRO_T
=
1.0
;
const
double
SCAN_OPEN_CACHE_MISS_PER_MICRO_T
=
8.0
;
//cost params for table get
const
double
GET_STARTUP_T
=
10.0
;
const
double
GET_ROW_NOT_EXIST_T
=
1.0
;
const
double
GET_ROW_CONST_T
=
7.67
;
const
double
GET_ROW_ONE_COLUMN_T
=
0.037
;
const
double
GET_ROW_CACHE_HIT_T
=
1.85
;
const
double
GET_ROW_CACHE_MISS_T
=
9.56
;
const
double
GET_BLOCK_CACHE_MISS_T
=
15.3
;
const
double
GET_STARTUP_T
=
10.0
;
const
double
GET_ROW_NOT_EXIST_T
=
1.0
;
const
double
GET_ROW_CONST_T
=
7.67
;
const
double
GET_ROW_ONE_COLUMN_T
=
0.037
;
const
double
GET_ROW_CACHE_HIT_T
=
1.85
;
const
double
GET_ROW_CACHE_MISS_T
=
9.56
;
const
double
GET_BLOCK_CACHE_MISS_T
=
15.3
;
const
double
GET_OPEN_ROW_CONST_T
=
5.36
;
const
double
GET_OPEN_BF_NOT_EXIST_T
=
1.0
;
const
double
GET_OPEN_ROW_CACHE_HIT_T
=
3.80
;
const
double
GET_OPEN_ROW_CACHE_MISS_T
=
4.73
;
const
double
GET_OPEN_BLOCK_CACHE_HIT_T
=
0.067
;
const
double
GET_OPEN_BLOCK_CACHE_MISS_T
=
7.76
;
const
double
GET_OPEN_ROW_CONST_T
=
5.36
;
const
double
GET_OPEN_BF_NOT_EXIST_T
=
1.0
;
const
double
GET_OPEN_ROW_CACHE_HIT_T
=
3.80
;
const
double
GET_OPEN_ROW_CACHE_MISS_T
=
4.73
;
const
double
GET_OPEN_BLOCK_CACHE_HIT_T
=
0.067
;
const
double
GET_OPEN_BLOCK_CACHE_MISS_T
=
7.76
;
const
double
DEFAULT_IO_RTT_T
=
2000
;
const
double
DEFAULT_IO_RTT_T
=
2000
;
const
int64_t
MICRO_PER_MACRO_16K_2M
=
115
;
const
int64_t
MICRO_PER_MACRO_16K_2M
=
115
;
//default sizes and counts when stat is not available
const
int64_t
DEFAULT_ROW_SIZE
=
100
;
const
int64_t
DEFAULT_MICRO_BLOCK_SIZE
=
16L
*
1024
;
const
int64_t
DEFAULT_MACRO_BLOCK_SIZE
=
2L
*
1024
*
1024
;
const
int64_t
DEFAULT_ROW_SIZE
=
100
;
const
int64_t
DEFAULT_MICRO_BLOCK_SIZE
=
16L
*
1024
;
const
int64_t
DEFAULT_MACRO_BLOCK_SIZE
=
2L
*
1024
*
1024
;
//if stat is not available, consider relatively small table
//note that default micro block size is 16KB, 128 micros per macro
const
int64_t
DEFAULT_MACRO_COUNT
=
10
;
const
int64_t
DEFAULT_MACRO_COUNT
=
10
;
const
int64_t
DEFAULT_MICRO_COUNT
=
DEFAULT_MACRO_COUNT
*
MICRO_PER_MACRO_16K_2M
;
const
int64_t
DEFAULT_MICRO_COUNT
=
DEFAULT_MACRO_COUNT
*
MICRO_PER_MACRO_16K_2M
;
const
int64_t
OB_EST_DEFAULT_ROW_COUNT
=
1000
;
const
int64_t
OB_EST_DEFAULT_ROW_COUNT
=
1000
;
const
int64_t
EST_DEF_COL_NUM_DISTINCT
=
500
;
const
int64_t
EST_DEF_COL_NUM_DISTINCT
=
500
;
const
double
EST_DEF_COL_NULL_RATIO
=
0.01
;
const
double
EST_DEF_COL_NULL_RATIO
=
0.01
;
const
double
EST_DEF_COL_NOT_NULL_RATIO
=
1
-
EST_DEF_COL_NULL_RATIO
;
const
double
EST_DEF_COL_NOT_NULL_RATIO
=
1
-
EST_DEF_COL_NULL_RATIO
;
const
double
EST_DEF_VAR_EQ_SEL
=
EST_DEF_COL_NOT_NULL_RATIO
/
EST_DEF_COL_NUM_DISTINCT
;
const
double
EST_DEF_VAR_EQ_SEL
=
EST_DEF_COL_NOT_NULL_RATIO
/
EST_DEF_COL_NUM_DISTINCT
;
const
double
OB_COLUMN_DISTINCT_RATIO
=
2.0
/
3.0
;
const
double
OB_COLUMN_DISTINCT_RATIO
=
2.0
/
3.0
;
const
int64_t
OB_EST_DEFAULT_NUM_NULL
=
static_cast
<
int64_t
>
(
static_cast
<
double
>
(
OB_EST_DEFAULT_ROW_COUNT
)
*
EST_DEF_COL_NULL_RATIO
);
const
int64_t
OB_EST_DEFAULT_NUM_NULL
=
static_cast
<
int64_t
>
(
static_cast
<
double
>
(
OB_EST_DEFAULT_ROW_COUNT
)
*
EST_DEF_COL_NULL_RATIO
);
const
int64_t
OB_EST_DEFAULT_DATA_SIZE
=
OB_EST_DEFAULT_ROW_COUNT
*
DEFAULT_ROW_SIZE
;
const
int64_t
OB_EST_DEFAULT_DATA_SIZE
=
OB_EST_DEFAULT_ROW_COUNT
*
DEFAULT_ROW_SIZE
;
const
int64_t
OB_EST_DEFAULT_MACRO_BLOCKS
=
OB_EST_DEFAULT_DATA_SIZE
/
DEFAULT_MACRO_BLOCK_SIZE
;
const
int64_t
OB_EST_DEFAULT_MACRO_BLOCKS
=
OB_EST_DEFAULT_DATA_SIZE
/
DEFAULT_MACRO_BLOCK_SIZE
;
const
int64_t
OB_EST_DEFAULT_MICRO_BLOCKS
=
OB_EST_DEFAULT_DATA_SIZE
/
DEFAULT_MICRO_BLOCK_SIZE
;
const
int64_t
OB_EST_DEFAULT_MICRO_BLOCKS
=
OB_EST_DEFAULT_DATA_SIZE
/
DEFAULT_MICRO_BLOCK_SIZE
;
const
double
OB_DEFAULT_HALF_OPEN_RANGE_SEL
=
0.2
;
const
double
OB_DEFAULT_HALF_OPEN_RANGE_SEL
=
0.2
;
const
double
OB_DEFAULT_CLOSED_RANGE_SEL
=
0.1
;
const
double
OB_DEFAULT_CLOSED_RANGE_SEL
=
0.1
;
const
double
ESTIMATE_UNRELIABLE_RATIO
=
0.25
;
const
double
ESTIMATE_UNRELIABLE_RATIO
=
0.25
;
const
int64_t
OB_DEFAULT_UNEXPECTED_PATH_COST
=
INT32_MAX
;
const
int64_t
OB_DEFAULT_UNEXPECTED_PATH_COST
=
INT32_MAX
;
//these are cost params for operators
//fixed cost for every sort
const
double
SORT_ONCE_T
=
60
;
const
double
SORT_ONCE_T
=
60
;
//fixed cost for comparing one column
const
double
SORT_COMPARE_COL_T
=
0.0047
;
const
double
SORT_COMPARE_COL_T
=
0.0047
;
//fixed cost for every row
const
double
SORT_ROW_ONCE_T
=
1.125
;
const
double
SORT_ROW_ONCE_T
=
1.125
;
//fixed setup time for calc other conds(filters) in join
const
double
JOIN_OTHER_COND_INIT_T
=
0.15
;
const
double
JOIN_OTHER_COND_INIT_T
=
0.15
;
//average cost for calc a filter (sampled with filter t1.a + t2.a < K).
//can be inaccurate
const
double
JOIN_OTHER_COND_SINGLE_T
=
0.17
;
const
double
JOIN_OTHER_COND_SINGLE_T
=
0.17
;
/*
...
...
@@ -193,100 +193,100 @@ const double JOIN_OTHER_COND_SINGLE_T = 0.17;
*/
//fixed setup time for calc equal conds(filters) in join
const
double
JOIN_EQUAL_COND_INIT_T
=
0.054
;
const
double
JOIN_EQUAL_COND_INIT_T
=
0.054
;
//average cost for calc a equal cond
const
double
JOIN_EQUAL_COND_SINGLE_T
=
0.04
;
const
double
JOIN_EQUAL_COND_SINGLE_T
=
0.04
;
//cost params for material
const
double
MATERIAL_ONCE_T
=
38
;
const
double
MATERIAL_ROW_READ_ONCE_T
=
0.15
;
const
double
MATERIAL_ROW_COL_READ_T
=
0.023
;
const
double
MATERIAL_ROW_WRITE_ONCE_T
=
0.15
;
const
double
MATERIAL_ROW_COL_WRITE_T
=
0.023
;
const
double
MATERIAL_ONCE_T
=
38
;
const
double
MATERIAL_ROW_READ_ONCE_T
=
0.15
;
const
double
MATERIAL_ROW_COL_READ_T
=
0.023
;
const
double
MATERIAL_ROW_WRITE_ONCE_T
=
0.15
;
const
double
MATERIAL_ROW_COL_WRITE_T
=
0.023
;
//cost params for nestloop join
const
double
NESTLOOP_ONCE_T
=
25.465184
;
const
double
NESTLOOP_ONCE_T
=
25.465184
;
//each left scan cause a right rescan and etc, so more expensive
const
double
NESTLOOP_ROW_LEFT_T
=
0.186347
;
const
double
NESTLOOP_ROW_RIGHT_T
=
0.033857
;
const
double
NESTLOOP_ROW_OUT_T
=
0.249701
;
const
double
NESTLOOP_ROW_QUAL_FAIL_T
=
0.128629
;
const
double
BLK_NESTLOOP_ONCE_START_T
=
8.030292
;
const
double
BLK_NESTLOOP_ONCE_RES_T
=
0.249750
;
const
double
BLK_NESTLOOP_QUAL_FAIL_T
=
0.129177
;
const
double
BLK_NESTLOOP_ROW_LEFT_T
=
0.19983
;
const
double
BLK_NESTLOOP_ROW_RIGHT_T
=
0.034
;
const
double
BLK_NESTLOOP_CACHE_SCAN_T
=
0.264018
;
const
double
BLK_NESTLOOP_CACHE_COUNT_T
=
54.348476
;
const
double
NESTLOOP_ROW_LEFT_T
=
0.186347
;
const
double
NESTLOOP_ROW_RIGHT_T
=
0.033857
;
const
double
NESTLOOP_ROW_OUT_T
=
0.249701
;
const
double
NESTLOOP_ROW_QUAL_FAIL_T
=
0.128629
;
const
double
BLK_NESTLOOP_ONCE_START_T
=
8.030292
;
const
double
BLK_NESTLOOP_ONCE_RES_T
=
0.249750
;
const
double
BLK_NESTLOOP_QUAL_FAIL_T
=
0.129177
;
const
double
BLK_NESTLOOP_ROW_LEFT_T
=
0.19983
;
const
double
BLK_NESTLOOP_ROW_RIGHT_T
=
0.034
;
const
double
BLK_NESTLOOP_CACHE_SCAN_T
=
0.264018
;
const
double
BLK_NESTLOOP_CACHE_COUNT_T
=
54.348476
;
//cost params for merge join
const
double
MERGE_ONCE_T
=
0.005255
;
const
double
MERGE_ONCE_T
=
0.005255
;
//cost for scan left rows
//for simplicity, dont separate used from unused, fitting result is acceptable
const
double
MERGE_ROW_LEFT_T
=
0.005015
;
const
double
MERGE_ROW_LEFT_T
=
0.005015
;
//cost for right rows.
//unlike NL, this splits into three type
//because right rows can come from "right cache"
const
double
MERGE_ROW_RIGHT_OP_T
=
0.000001
;
const
double
MERGE_ROW_RIGHT_CACHE_T
=
0.000001
;
const
double
MERGE_ROW_RIGHT_UNUSED_T
=
0.006961
;
//very small, can ignore?
const
double
MARGE_ROW_QUAL_FAIL_T
=
0.132598
;
const
double
MERGE_ROW_RIGHT_OP_T
=
0.000001
;
const
double
MERGE_ROW_RIGHT_CACHE_T
=
0.000001
;
const
double
MERGE_ROW_RIGHT_UNUSED_T
=
0.006961
;
//very small, can ignore?
const
double
MARGE_ROW_QUAL_FAIL_T
=
0.132598
;
//there is a cache clear operation each match group
const
double
MERGE_MATCH_GROUP_T
=
0.808002
;
const
double
MERGE_ROW_ONCE_RES_T
=
0.751524
;
const
double
MERGE_MATCH_GROUP_T
=
0.808002
;
const
double
MERGE_ROW_ONCE_RES_T
=
0.751524
;
//cost params for merge group by
const
double
MGB_STARTUP_T
=
177.0
;
const
double
MGB_STARTUP_T
=
177.0
;
//for each input row, there are:
// cost for judging whether it starts a new group(Proportional to Ngroup_col)
// cost for calc each aggr column(Proportional to Naggr_col)
const
double
MGB_INPUT_ONCE_T
=
1.5
;
const
double
MGB_INPUT_AGGR_COL_T
=
0.073
;
const
double
MGB_INPUT_GROUP_COL_T
=
0.011
;
const
double
MGB_INPUT_ONCE_T
=
1.5
;
const
double
MGB_INPUT_AGGR_COL_T
=
0.073
;
const
double
MGB_INPUT_GROUP_COL_T
=
0.011
;
//for each output row(i.e. a group), there are
// cost for deep copy first input row twice(Proportional to Ninput_col)
// cost for calc and copy each aggr column(Proportional to Naggr_col)
//Here, we use AVG aggr func as the sampling target.
const
double
MGB_RES_ONCE_T
=
1.68
;
const
double
MGB_RES_AGGR_COL_T
=
3.66
;
const
double
MGB_RES_INPUT_COL_T
=
0.018
;
const
double
MGB_RES_ONCE_T
=
1.68
;
const
double
MGB_RES_AGGR_COL_T
=
3.66
;
const
double
MGB_RES_INPUT_COL_T
=
0.018
;
const
int64_t
MGB_DEFAULT_GROUP_COL_COUNT
=
1
;
const
int64_t
MGB_DEFAULT_INPUT_COL_COUNT
=
10
;
const
int64_t
MGB_DEFAULT_GROUP_COL_COUNT
=
1
;
const
int64_t
MGB_DEFAULT_INPUT_COL_COUNT
=
10
;
//cost param for distinct.Refering Merge group by
const
double
MERGE_DISTINCT_STARTUP_T
=
50
;
const
double
MERGE_DISTINCT_ONE_T
=
1.5
;
const
double
MERGE_DISTINCT_COL_T
=
0.018
;
const
double
MERGE_DISTINCT_STARTUP_T
=
50
;
const
double
MERGE_DISTINCT_ONE_T
=
1.5
;
const
double
MERGE_DISTINCT_COL_T
=
0.018
;
//cost params for hash group by
const
double
HGB_STARTUP_T
=
979
;
const
double
HGB_STARTUP_T
=
979
;
const
double
HGB_INPUT_ONCE_T
=
0.144
;
const
double
HGB_INPUT_ONCE_T
=
0.144
;
const
double
HGB_INPUT_AGGR_COL_T
=
0.366
;
const
double
HGB_INPUT_AGGR_COL_T
=
0.366
;
const
double
HGB_INPUT_GROUP_COL_T
=
0.0824
;
const
double
HGB_INPUT_GROUP_COL_T
=
0.0824
;
const
double
HGB_RES_ONCE_T
=
0.857
;
const
double
HGB_RES_ONCE_T
=
0.857
;
const
double
HGB_RES_INPUT_COL_T
=
0.043
;
const
double
HGB_RES_INPUT_COL_T
=
0.043
;
const
double
HGB_RES_AGGR_COL_T
=
2.500
;
const
double
HGB_RES_AGGR_COL_T
=
2.500
;
//cost param for virtual table
const
double
VIRTUAL_INDEX_GET_COST
=
20
;
// typical get latency for hash table
const
double
VIRTUAL_INDEX_GET_COST
=
20
;
// typical get latency for hash table
const
double
SCALAR_STARTUP_T
=
177.0
;
const
double
SCALAR_INPUT_ONCE_T
=
0.144
;
const
double
SCALAR_INPUT_AGGR_COL_T
=
0.073
;
const
double
SCALAR_STARTUP_T
=
177.0
;
const
double
SCALAR_INPUT_ONCE_T
=
0.144
;
const
double
SCALAR_INPUT_AGGR_COL_T
=
0.073
;
const
int64_t
HALF_OPEN_RANGE_MIN_ROWS
=
20
;
const
int64_t
CLOSE_RANGE_MIN_ROWS
=
10
;
const
int64_t
HALF_OPEN_RANGE_MIN_ROWS
=
20
;
const
int64_t
CLOSE_RANGE_MIN_ROWS
=
10
;
}
//namespace common
}
//namespace oceanabse
...
...
src/common/ob_obj_type.h
浏览文件 @
4f40b15c
...
...
@@ -22,7 +22,7 @@ namespace common
// modify ObObjTypeClass and ob_obj_type_class when append new object type.
enum
ObObjType
{
ObNullType
=
0
,
ObNullType
=
0
,
ObTinyIntType
=
1
,
// int8, aka mysql boolean type
ObSmallIntType
=
2
,
// int16
...
...
@@ -59,21 +59,21 @@ enum ObObjType
ObExtendType
=
25
,
// Min, Max, NOP etc.
ObUnknownType
=
26
,
// For question mark(?) in prepared statement, no need to serialize
// @note future new types to be defined here !!!
ObTinyTextType
=
27
,
ObTextType
=
28
,
ObMediumTextType
=
29
,
ObLongTextType
=
30
,
ObBitType
=
31
,
ObEnumType
=
32
,
ObSetType
=
33
,
ObEnumInnerType
=
34
,
ObSetInnerType
=
35
,
ObTinyTextType
=
27
,
ObTextType
=
28
,
ObMediumTextType
=
29
,
ObLongTextType
=
30
,
ObBitType
=
31
,
ObEnumType
=
32
,
ObSetType
=
33
,
ObEnumInnerType
=
34
,
ObSetInnerType
=
35
,
/*
ObTinyBlobType = 31,
ObMediumBlobType = 32,
ObBlobType = 33,
ObLongBlobType = 34,
ObTinyBlobType
= 31,
ObMediumBlobType
= 32,
ObBlobType
= 33,
ObLongBlobType
= 34,
ObBitType=35
ObEnumType=36
...
...
@@ -107,7 +107,7 @@ enum ObObjTypeClass
ObStringTC
=
10
,
// varchar, char, varbinary, binary.
ObExtendTC
=
11
,
// extend
ObUnknownTC
=
12
,
// unknown
ObTextTC
=
13
,
//TinyText,MediumText, Text ,LongText
ObTextTC
=
13
,
//TinyText,MediumText, Text ,LongText
ObMaxTC
,
// invalid type classes are below, only used as the result of XXXX_type_promotion()
// to indicate that the two obj can't be promoted to the same type.
...
...
src/common/ob_string_buf.ipp
浏览文件 @
4f40b15c
...
...
@@ -18,7 +18,7 @@ namespace oceanbase
namespace common
{
template <typename PageAllocatorT, typename PageArenaT>
const int64_t ObStringBufT<PageAllocatorT, PageArenaT>::DEF_MEM_BLOCK_SIZE = 64 * 1024L;
const int64_t ObStringBufT<PageAllocatorT, PageArenaT>::DEF_MEM_BLOCK_SIZE
= 64 * 1024L;
template <typename PageAllocatorT, typename PageArenaT>
const int64_t ObStringBufT<PageAllocatorT, PageArenaT>::MIN_DEF_MEM_BLOCK_SIZE =
...
...
src/lib/alloc/achunk_mgr.h
浏览文件 @
4f40b15c
...
...
@@ -28,7 +28,7 @@ namespace lib
class
AChunk
;
static
const
uint64_t
MAXADDR
=
(
1L
<<
52
);
static
const
uint64_t
MAXADDR
=
(
1L
<<
52
);
static
const
uint64_t
CHUNK_BITMAP_SIZE
=
MAXADDR
/
MEMCHK_CHUNK_ALIGN
;
class
AChunkMgr
...
...
src/lib/alloc/alloc_struct.h
浏览文件 @
4f40b15c
...
...
@@ -30,13 +30,13 @@ namespace lib
// allocates because we can only process with memory address past in
// ranged between 0 and this size.
static
const
uint64_t
MEMCHK_CHUNK_ALIGN_BITS
=
20
;
static
const
uint64_t
MEMCHK_CHUNK_ALIGN
=
4UL
<<
MEMCHK_CHUNK_ALIGN_BITS
;
static
const
uint64_t
MEMCHK_CHUNK_ALIGN
=
4UL
<<
MEMCHK_CHUNK_ALIGN_BITS
;
static
const
uint32_t
AOBJECT_TAIL_SIZE
=
8
;
static
const
uint32_t
MIN_AOBJECT_SIZE
=
16
;
// 16 bytes, 2 pointers
static
const
uint32_t
AOBJECT_CELL_BYTES
=
8
;
// 8 bytes
static
const
uint32_t
NORMAL_AOBJECT_SIZE
=
1
<<
13
;
// 8K
static
const
uint32_t
INTACT_ACHUNK_SIZE
=
1
<<
21
;
// 2M
static
const
uint32_t
AOBJECT_TAIL_SIZE
=
8
;
static
const
uint32_t
MIN_AOBJECT_SIZE
=
16
;
// 16 bytes, 2 pointers
static
const
uint32_t
AOBJECT_CELL_BYTES
=
8
;
// 8 bytes
static
const
uint32_t
NORMAL_AOBJECT_SIZE
=
1
<<
13
;
// 8K
static
const
uint32_t
INTACT_ACHUNK_SIZE
=
1
<<
21
;
// 2M
static
const
int64_t
ALLOC_ABLOCK_CONCURRENCY
=
4
;
...
...
@@ -154,26 +154,26 @@ static const uint16_t AOBJECT_MAGIC_CODE = 0XCED1;
static
const
uint16_t
FREE_BIG_AOBJECT_MAGIC_CODE
=
0XCED2
;
static
const
uint16_t
BIG_AOBJECT_MAGIC_CODE
=
0XCED3
;
static
const
uint32_t
AOBJECT_HEADER_SIZE
=
offsetof
(
AObject
,
data_
);
static
const
uint32_t
AOBJECT_META_SIZE
=
AOBJECT_HEADER_SIZE
+
AOBJECT_TAIL_SIZE
;
static
const
uint32_t
INTACT_NORMAL_AOBJECT_SIZE
=
NORMAL_AOBJECT_SIZE
+
AOBJECT_META_SIZE
;
static
const
uint32_t
AOBJECT_HEADER_SIZE
=
offsetof
(
AObject
,
data_
);
static
const
uint32_t
AOBJECT_META_SIZE
=
AOBJECT_HEADER_SIZE
+
AOBJECT_TAIL_SIZE
;
static
const
uint32_t
INTACT_NORMAL_AOBJECT_SIZE
=
NORMAL_AOBJECT_SIZE
+
AOBJECT_META_SIZE
;
static
const
uint32_t
ABLOCK_HEADER_SIZE
=
offsetof
(
ABlock
,
data_
);
static
const
uint32_t
ABLOCK_SIZE
=
INTACT_NORMAL_AOBJECT_SIZE
;
static
const
uint32_t
INTACT_ABLOCK_SIZE
=
ABLOCK_SIZE
+
ABLOCK_HEADER_SIZE
;
static
const
uint32_t
ABLOCK_HEADER_SIZE
=
offsetof
(
ABlock
,
data_
);
static
const
uint32_t
ABLOCK_SIZE
=
INTACT_NORMAL_AOBJECT_SIZE
;
static
const
uint32_t
INTACT_ABLOCK_SIZE
=
ABLOCK_SIZE
+
ABLOCK_HEADER_SIZE
;
static
const
uint32_t
ACHUNK_HEADER_SIZE
=
offsetof
(
AChunk
,
data_
);
static
const
uint32_t
ACHUNK_SIZE
=
INTACT_ACHUNK_SIZE
-
ACHUNK_HEADER_SIZE
;
static
const
uint32_t
INTACT_BIG_ABLOCK_SIZE
=
ACHUNK_SIZE
;
static
const
uint32_t
BIG_ABLOCK_SIZE
=
INTACT_BIG_ABLOCK_SIZE
-
ABLOCK_HEADER_SIZE
;
static
const
uint32_t
INTACT_BIG_AOBJECT_SIZE
=
BIG_ABLOCK_SIZE
;
static
const
uint32_t
BIG_AOBJECT_SIZE
=
INTACT_BIG_AOBJECT_SIZE
-
AOBJECT_META_SIZE
;
static
const
uint32_t
ACHUNK_HEADER_SIZE
=
offsetof
(
AChunk
,
data_
);
static
const
uint32_t
ACHUNK_SIZE
=
INTACT_ACHUNK_SIZE
-
ACHUNK_HEADER_SIZE
;
static
const
uint32_t
INTACT_BIG_ABLOCK_SIZE
=
ACHUNK_SIZE
;
static
const
uint32_t
BIG_ABLOCK_SIZE
=
INTACT_BIG_ABLOCK_SIZE
-
ABLOCK_HEADER_SIZE
;
static
const
uint32_t
INTACT_BIG_AOBJECT_SIZE
=
BIG_ABLOCK_SIZE
;
static
const
uint32_t
BIG_AOBJECT_SIZE
=
INTACT_BIG_AOBJECT_SIZE
-
AOBJECT_META_SIZE
;
static
const
uint32_t
CELLS_PER_BLOCK
=
ABLOCK_SIZE
/
AOBJECT_CELL_BYTES
;
static
const
uint64_t
BLOCKS_PER_CHUNK
=
ACHUNK_SIZE
/
INTACT_ABLOCK_SIZE
;
static
const
uint32_t
CELLS_PER_BLOCK
=
ABLOCK_SIZE
/
AOBJECT_CELL_BYTES
;
static
const
uint64_t
BLOCKS_PER_CHUNK
=
ACHUNK_SIZE
/
INTACT_ABLOCK_SIZE
;
static
const
uint32_t
MAX_ABLOCK_COUNT
=
ACHUNK_SIZE
/
ABLOCK_SIZE
-
1
;
static
const
uint32_t
MAX_ABLOCK_SIZE
=
MAX_ABLOCK_COUNT
*
ABLOCK_SIZE
;
static
const
uint32_t
MAX_ABLOCK_COUNT
=
ACHUNK_SIZE
/
ABLOCK_SIZE
-
1
;
static
const
uint32_t
MAX_ABLOCK_SIZE
=
MAX_ABLOCK_COUNT
*
ABLOCK_SIZE
;
inline
uint64_t
align_up
(
uint64_t
x
,
uint64_t
align
)
{
...
...
src/lib/encrypt/ob_encrypted_helper.cpp
浏览文件 @
4f40b15c
...
...
@@ -31,7 +31,7 @@ const uint32_t ObEncryptedHelper::sha_const_key[5] =
0x10325476
,
0xC3D2E1F0
};
const
uint32_t
ObEncryptedHelper
::
K
[
4
]
=
const
uint32_t
ObEncryptedHelper
::
K
[
4
]
=
{
0x5A827999
,
0x6ED9EBA1
,
...
...
src/lib/net/tbnetutil.cpp
浏览文件 @
4f40b15c
...
...
@@ -81,9 +81,6 @@ bool CNetUtil::isLocalAddr(uint32_t ip, bool loopSkip)
return
false
;
}
/**
* 10.0.100.89 => 1499725834
*/
uint32_t
CNetUtil
::
getAddr
(
const
char
*
ip
)
{
if
(
ip
==
NULL
)
return
0
;
...
...
src/lib/ob_define.h
浏览文件 @
4f40b15c
此差异已折叠。
点击以展开。
src/lib/oblog/ob_trace_log.cpp
浏览文件 @
4f40b15c
...
...
@@ -21,7 +21,7 @@ namespace oceanbase
namespace
common
{
const
char
*
const
TraceLog
::
LOG_LEVEL_ENV_KEY
=
"_OB_TRACE_LOG_LEVEL_"
;
const
char
*
const
TraceLog
::
level_strs_
[]
=
{
"ERROR"
,
"USER_ERR"
,
"WARN"
,
"INFO"
,
"TRACE"
,
"DEBUG"
};
const
char
*
const
TraceLog
::
level_strs_
[]
=
{
"ERROR"
,
"USER_ERR"
,
"WARN"
,
"INFO"
,
"TRACE"
,
"DEBUG"
};
volatile
int
TraceLog
::
log_level_
=
OB_LOG_LEVEL_TRACE
;
bool
TraceLog
::
got_env_
=
false
;
...
...
src/lib/time/ob_time_utility.cpp
浏览文件 @
4f40b15c
...
...
@@ -37,7 +37,7 @@ namespace oceanbase
{
namespace
common
{
const
char
*
ObTimeUtility
::
mday_name_
[
31
]
=
const
char
*
ObTimeUtility
::
mday_name_
[
31
]
=
{
"1st"
,
"2nd"
,
"3rd"
,
"4th"
,
"5th"
,
"6th"
,
"7th"
,
"8th"
,
"9th"
,
"10th"
,
"11th"
,
"12th"
,
"13th"
,
"14th"
,
"15th"
,
"16th"
,
"17th"
,
"18th"
,
"19th"
,
"20th"
,
...
...
@@ -45,28 +45,28 @@ const char *ObTimeUtility::mday_name_[31] =
"31st"
};
const
char
*
ObTimeUtility
::
weekday_name_
[
7
]
=
const
char
*
ObTimeUtility
::
weekday_name_
[
7
]
=
{
"Sunday"
,
"Monday"
,
"Tuesday"
,
"Wednesday"
,
"Thursday"
,
"Friday"
,
"Saturday"
};
const
char
*
ObTimeUtility
::
weekday_abbr_name_
[
7
]
=
const
char
*
ObTimeUtility
::
weekday_abbr_name_
[
7
]
=
{
"Sun"
,
"Mon"
,
"Tue"
,
"Wed"
,
"Thu"
,
"Fri"
,
"Sat"
};
const
char
*
ObTimeUtility
::
month_abbr_name_
[
12
]
=
const
char
*
ObTimeUtility
::
month_abbr_name_
[
12
]
=
{
"Jan"
,
"Feb"
,
"Mar"
,
"Apr"
,
"May"
,
"Jun"
,
"Jul"
,
"Aug"
,
"Sep"
,
"Oct"
,
"Nov"
,
"Dec"
};
const
char
*
ObTimeUtility
::
month_name_
[
12
]
=
const
char
*
ObTimeUtility
::
month_name_
[
12
]
=
{
"January"
,
"February"
,
"March"
,
"April"
,
"May"
,
"June"
,
"July"
,
"August"
,
"September"
,
"October"
,
"November"
,
"December"
};
const
char
*
ObTimeUtility
::
STD_TS_FORMAT_WITH_USEC
=
"%Y-%m-%d %H:%i:%s.%f"
;
const
char
*
ObTimeUtility
::
STD_TS_FORMAT_WITH_USEC
=
"%Y-%m-%d %H:%i:%s.%f"
;
const
char
*
ObTimeUtility
::
STD_TS_FORMAT_WITHOUT_USEC
=
"%Y-%m-%d %H:%i:%s"
;
...
...
src/lib/timezone/ob_time_convert.cpp
浏览文件 @
4f40b15c
...
...
@@ -33,12 +33,12 @@ ObTimeConverter::~ObTimeConverter()
{
}
const
int32_t
DT_PART_BASE
[
DATETIME_PART_CNT
]
=
{
100
,
12
,
-
1
,
24
,
60
,
60
,
1000000
};
const
int32_t
DT_PART_MIN
[
DATETIME_PART_CNT
]
=
{
0
,
1
,
1
,
0
,
0
,
0
,
0
};
const
int32_t
DT_PART_MAX
[
DATETIME_PART_CNT
]
=
{
9999
,
12
,
31
,
23
,
59
,
59
,
1000000
};
const
int32_t
DT_PART_BASE
[
DATETIME_PART_CNT
]
=
{
100
,
12
,
-
1
,
24
,
60
,
60
,
1000000
};
const
int32_t
DT_PART_MIN
[
DATETIME_PART_CNT
]
=
{
0
,
1
,
1
,
0
,
0
,
0
,
0
};
const
int32_t
DT_PART_MAX
[
DATETIME_PART_CNT
]
=
{
9999
,
12
,
31
,
23
,
59
,
59
,
1000000
};
// 1000000 for usecond, because sometimes we round .9999999 to .1000000
static
const
int8_t
DAYS_PER_MON
[
2
][
12
+
1
]
=
{
static
const
int8_t
DAYS_PER_MON
[
2
][
12
+
1
]
=
{
{
0
,
31
,
28
,
31
,
30
,
31
,
30
,
31
,
31
,
30
,
31
,
30
,
31
},
{
0
,
31
,
29
,
31
,
30
,
31
,
30
,
31
,
31
,
30
,
31
,
30
,
31
}
};
...
...
@@ -922,7 +922,7 @@ int ObTimeConverter::int_to_ob_time_without_date(int64_t int64, ObTime &ob_time)
//int ObTimeConverter::uint_to_ob_time_with_date(int64_t int64, ObTime &ob_time)
//int ObTimeConverter::uint_to_ob_time_without_date(int64_t int64, ObTime &ob_time)
static
const
int32_t
DATETIME_PART_LENS_MAX
[]
=
{
static
const
int32_t
DATETIME_PART_LENS_MAX
[]
=
{
INT32_MAX
,
INT32_MAX
,
INT32_MAX
,
INT32_MAX
,
INT32_MAX
,
INT32_MAX
,
INT32_MAX
,
7
};
static
const
int32_t
DATETIME_PART_LENS_YEAR4
[]
=
{
4
,
2
,
2
,
2
,
2
,
2
,
7
};
static
const
int32_t
DATETIME_PART_LENS_YEAR2
[]
=
{
2
,
2
,
2
,
2
,
2
,
2
,
7
};
...
...
src/lib/utility/serialization.h
浏览文件 @
4f40b15c
...
...
@@ -26,69 +26,69 @@ namespace common
{
namespace
serialization
{
const
uint64_t
OB_MAX_V1B
=
(
__UINT64_C
(
1
)
<<
7
)
-
1
;
const
uint64_t
OB_MAX_V2B
=
(
__UINT64_C
(
1
)
<<
14
)
-
1
;
const
uint64_t
OB_MAX_V3B
=
(
__UINT64_C
(
1
)
<<
21
)
-
1
;
const
uint64_t
OB_MAX_V4B
=
(
__UINT64_C
(
1
)
<<
28
)
-
1
;
const
uint64_t
OB_MAX_V5B
=
(
__UINT64_C
(
1
)
<<
35
)
-
1
;
const
uint64_t
OB_MAX_V6B
=
(
__UINT64_C
(
1
)
<<
42
)
-
1
;
const
uint64_t
OB_MAX_V7B
=
(
__UINT64_C
(
1
)
<<
49
)
-
1
;
const
uint64_t
OB_MAX_V8B
=
(
__UINT64_C
(
1
)
<<
56
)
-
1
;
const
uint64_t
OB_MAX_V9B
=
(
__UINT64_C
(
1
)
<<
63
)
-
1
;
const
uint64_t
OB_MAX_1B
=
(
__UINT64_C
(
1
)
<<
8
)
-
1
;
const
uint64_t
OB_MAX_2B
=
(
__UINT64_C
(
1
)
<<
16
)
-
1
;
const
uint64_t
OB_MAX_3B
=
(
__UINT64_C
(
1
)
<<
24
)
-
1
;
const
uint64_t
OB_MAX_4B
=
(
__UINT64_C
(
1
)
<<
32
)
-
1
;
const
uint64_t
OB_MAX_5B
=
(
__UINT64_C
(
1
)
<<
40
)
-
1
;
const
uint64_t
OB_MAX_6B
=
(
__UINT64_C
(
1
)
<<
48
)
-
1
;
const
uint64_t
OB_MAX_7B
=
(
__UINT64_C
(
1
)
<<
56
)
-
1
;
const
uint64_t
OB_MAX_8B
=
UINT64_MAX
;
const
uint64_t
OB_MAX_INT_1B
=
(
__UINT64_C
(
23
));
const
uint64_t
OB_MAX_INT_2B
=
(
__UINT64_C
(
1
)
<<
8
)
-
1
;
const
uint64_t
OB_MAX_INT_3B
=
(
__UINT64_C
(
1
)
<<
16
)
-
1
;
const
uint64_t
OB_MAX_INT_4B
=
(
__UINT64_C
(
1
)
<<
24
)
-
1
;
const
uint64_t
OB_MAX_INT_5B
=
(
__UINT64_C
(
1
)
<<
32
)
-
1
;
const
uint64_t
OB_MAX_INT_7B
=
(
__UINT64_C
(
1
)
<<
48
)
-
1
;
const
uint64_t
OB_MAX_INT_9B
=
UINT64_MAX
;
const
int64_t
OB_MAX_1B_STR_LEN
=
(
__INT64_C
(
55
));
const
int64_t
OB_MAX_2B_STR_LEN
=
(
__INT64_C
(
1
)
<<
8
)
-
1
;
const
int64_t
OB_MAX_3B_STR_LEN
=
(
__INT64_C
(
1
)
<<
16
)
-
1
;
const
int64_t
OB_MAX_4B_STR_LEN
=
(
__INT64_C
(
1
)
<<
24
)
-
1
;
const
int64_t
OB_MAX_5B_STR_LEN
=
(
__INT64_C
(
1
)
<<
32
)
-
1
;
const
int8_t
OB_INT_TYPE_BIT_POS
=
7
;
const
int8_t
OB_INT_OPERATION_BIT_POS
=
6
;
const
int8_t
OB_INT_SIGN_BIT_POS
=
5
;
const
int8_t
OB_DATETIME_OPERATION_BIT
=
3
;
const
int8_t
OB_DATETIME_SIGN_BIT
=
2
;
const
int8_t
OB_FLOAT_OPERATION_BIT_POS
=
0
;
const
uint64_t
OB_MAX_V1B
=
(
__UINT64_C
(
1
)
<<
7
)
-
1
;
const
uint64_t
OB_MAX_V2B
=
(
__UINT64_C
(
1
)
<<
14
)
-
1
;
const
uint64_t
OB_MAX_V3B
=
(
__UINT64_C
(
1
)
<<
21
)
-
1
;
const
uint64_t
OB_MAX_V4B
=
(
__UINT64_C
(
1
)
<<
28
)
-
1
;
const
uint64_t
OB_MAX_V5B
=
(
__UINT64_C
(
1
)
<<
35
)
-
1
;
const
uint64_t
OB_MAX_V6B
=
(
__UINT64_C
(
1
)
<<
42
)
-
1
;
const
uint64_t
OB_MAX_V7B
=
(
__UINT64_C
(
1
)
<<
49
)
-
1
;
const
uint64_t
OB_MAX_V8B
=
(
__UINT64_C
(
1
)
<<
56
)
-
1
;
const
uint64_t
OB_MAX_V9B
=
(
__UINT64_C
(
1
)
<<
63
)
-
1
;
const
uint64_t
OB_MAX_1B
=
(
__UINT64_C
(
1
)
<<
8
)
-
1
;
const
uint64_t
OB_MAX_2B
=
(
__UINT64_C
(
1
)
<<
16
)
-
1
;
const
uint64_t
OB_MAX_3B
=
(
__UINT64_C
(
1
)
<<
24
)
-
1
;
const
uint64_t
OB_MAX_4B
=
(
__UINT64_C
(
1
)
<<
32
)
-
1
;
const
uint64_t
OB_MAX_5B
=
(
__UINT64_C
(
1
)
<<
40
)
-
1
;
const
uint64_t
OB_MAX_6B
=
(
__UINT64_C
(
1
)
<<
48
)
-
1
;
const
uint64_t
OB_MAX_7B
=
(
__UINT64_C
(
1
)
<<
56
)
-
1
;
const
uint64_t
OB_MAX_8B
=
UINT64_MAX
;
const
uint64_t
OB_MAX_INT_1B
=
(
__UINT64_C
(
23
));
const
uint64_t
OB_MAX_INT_2B
=
(
__UINT64_C
(
1
)
<<
8
)
-
1
;
const
uint64_t
OB_MAX_INT_3B
=
(
__UINT64_C
(
1
)
<<
16
)
-
1
;
const
uint64_t
OB_MAX_INT_4B
=
(
__UINT64_C
(
1
)
<<
24
)
-
1
;
const
uint64_t
OB_MAX_INT_5B
=
(
__UINT64_C
(
1
)
<<
32
)
-
1
;
const
uint64_t
OB_MAX_INT_7B
=
(
__UINT64_C
(
1
)
<<
48
)
-
1
;
const
uint64_t
OB_MAX_INT_9B
=
UINT64_MAX
;
const
int64_t
OB_MAX_1B_STR_LEN
=
(
__INT64_C
(
55
));
const
int64_t
OB_MAX_2B_STR_LEN
=
(
__INT64_C
(
1
)
<<
8
)
-
1
;
const
int64_t
OB_MAX_3B_STR_LEN
=
(
__INT64_C
(
1
)
<<
16
)
-
1
;
const
int64_t
OB_MAX_4B_STR_LEN
=
(
__INT64_C
(
1
)
<<
24
)
-
1
;
const
int64_t
OB_MAX_5B_STR_LEN
=
(
__INT64_C
(
1
)
<<
32
)
-
1
;
const
int8_t
OB_INT_TYPE_BIT_POS
=
7
;
const
int8_t
OB_INT_OPERATION_BIT_POS
=
6
;
const
int8_t
OB_INT_SIGN_BIT_POS
=
5
;
const
int8_t
OB_DATETIME_OPERATION_BIT
=
3
;
const
int8_t
OB_DATETIME_SIGN_BIT
=
2
;
const
int8_t
OB_FLOAT_OPERATION_BIT_POS
=
0
;
const
int8_t
OB_DECIMAL_OPERATION_BIT_POS
=
7
;
const
int8_t
OB_INT_VALUE_MASK
=
0x1f
;
const
int8_t
OB_VARCHAR_LEN_MASK
=
0x3f
;
const
int8_t
OB_DATETIME_LEN_MASK
=
0x3
;
const
int8_t
OB_VARCHAR_TYPE
=
static_cast
<
int8_t
>
((
0x1
<<
7
));
const
int8_t
OB_SEQ_TYPE
=
static_cast
<
int8_t
>
(
0xc0
);
const
int8_t
OB_DATETIME_TYPE
=
static_cast
<
int8_t
>
(
0xd0
);
const
int8_t
OB_PRECISE_DATETIME_TYPE
=
static_cast
<
int8_t
>
(
0xe0
);
const
int8_t
OB_MODIFYTIME_TYPE
=
static_cast
<
int8_t
>
(
0xf0
);
const
int8_t
OB_CREATETIME_TYPE
=
static_cast
<
int8_t
>
(
0xf4
);
const
int8_t
OB_FLOAT_TYPE
=
static_cast
<
int8_t
>
(
0xf8
);
const
int8_t
OB_DOUBLE_TYPE
=
static_cast
<
int8_t
>
(
0xfa
);
const
int8_t
OB_NULL_TYPE
=
static_cast
<
int8_t
>
(
0xfc
);
const
int8_t
OB_BOOL_TYPE
=
static_cast
<
int8_t
>
(
0xfd
);
const
int8_t
OB_EXTEND_TYPE
=
static_cast
<
int8_t
>
(
0xfe
);
const
int8_t
OB_DECIMAL_TYPE
=
static_cast
<
int8_t
>
(
0xff
);
const
int8_t
OB_NUMBER_TYPE
=
OB_DECIMAL_TYPE
;
// 2014number
const
int8_t
OB_INT_VALUE_MASK
=
0x1f
;
const
int8_t
OB_VARCHAR_LEN_MASK
=
0x3f
;
const
int8_t
OB_DATETIME_LEN_MASK
=
0x3
;
const
int8_t
OB_VARCHAR_TYPE
=
static_cast
<
int8_t
>
((
0x1
<<
7
));
const
int8_t
OB_SEQ_TYPE
=
static_cast
<
int8_t
>
(
0xc0
);
const
int8_t
OB_DATETIME_TYPE
=
static_cast
<
int8_t
>
(
0xd0
);
const
int8_t
OB_PRECISE_DATETIME_TYPE
=
static_cast
<
int8_t
>
(
0xe0
);
const
int8_t
OB_MODIFYTIME_TYPE
=
static_cast
<
int8_t
>
(
0xf0
);
const
int8_t
OB_CREATETIME_TYPE
=
static_cast
<
int8_t
>
(
0xf4
);
const
int8_t
OB_FLOAT_TYPE
=
static_cast
<
int8_t
>
(
0xf8
);
const
int8_t
OB_DOUBLE_TYPE
=
static_cast
<
int8_t
>
(
0xfa
);
const
int8_t
OB_NULL_TYPE
=
static_cast
<
int8_t
>
(
0xfc
);
const
int8_t
OB_BOOL_TYPE
=
static_cast
<
int8_t
>
(
0xfd
);
const
int8_t
OB_EXTEND_TYPE
=
static_cast
<
int8_t
>
(
0xfe
);
const
int8_t
OB_DECIMAL_TYPE
=
static_cast
<
int8_t
>
(
0xff
);
const
int8_t
OB_NUMBER_TYPE
=
OB_DECIMAL_TYPE
;
// 2014number
inline
void
set_bit
(
int8_t
&
v
,
int8_t
pos
)
{
v
|=
static_cast
<
int8_t
>
(
1
<<
pos
);
...
...
src/obproxy/cmd/ob_show_config_handler.cpp
浏览文件 @
4f40b15c
...
...
@@ -30,14 +30,14 @@ namespace obproxy
{
namespace
obutils
{
const
ObString
JSON_CONFIG_VERSION
=
ObString
::
make_string
(
"json_config_version"
);
const
ObString
JSON_CONFIG_BIN_URL
=
ObString
::
make_string
(
"json_config_bin_url"
);
const
ObString
JSON_CONFIG_DB
=
ObString
::
make_string
(
"json_config_meta_table_db"
);
const
ObString
JSON_CONFIG_USER
=
ObString
::
make_string
(
"json_config_meta_table_user"
);
const
ObString
JSON_CONFIG_PASSWORD
=
ObString
::
make_string
(
"json_config_meta_table_password"
);
const
ObString
JSON_CONFIG_VERSION
=
ObString
::
make_string
(
"json_config_version"
);
const
ObString
JSON_CONFIG_BIN_URL
=
ObString
::
make_string
(
"json_config_bin_url"
);
const
ObString
JSON_CONFIG_DB
=
ObString
::
make_string
(
"json_config_meta_table_db"
);
const
ObString
JSON_CONFIG_USER
=
ObString
::
make_string
(
"json_config_meta_table_user"
);
const
ObString
JSON_CONFIG_PASSWORD
=
ObString
::
make_string
(
"json_config_meta_table_password"
);
const
ObString
JSON_CONFIG_REAL_CLUSTER
=
ObString
::
make_string
(
"json_config_real_meta_cluster"
);
const
ObString
JSON_CONFIG_CLUSTER
=
ObString
::
make_string
(
"json_config_cluster_count"
);
const
ObString
JSON_CONFIG_MODIFIED
=
ObString
::
make_string
(
"json_config_modified_time"
);
const
ObString
JSON_CONFIG_CLUSTER
=
ObString
::
make_string
(
"json_config_cluster_count"
);
const
ObString
JSON_CONFIG_MODIFIED
=
ObString
::
make_string
(
"json_config_modified_time"
);
//ConfigColumnID
enum
...
...
src/obproxy/cmd/ob_show_session_handler.cpp
浏览文件 @
4f40b15c
...
...
@@ -88,7 +88,7 @@ enum
OB_SSC_MAX_STAT_COLUMN_ID
,
};
const
ObProxyColumnSchema
LIST_COLUMN_ARRAY
[
OB_SLC_MAX_SLIST_COLUMN_ID
]
=
{
const
ObProxyColumnSchema
LIST_COLUMN_ARRAY
[
OB_SLC_MAX_SLIST_COLUMN_ID
]
=
{
ObProxyColumnSchema
::
make_schema
(
OB_SLC_ID
,
"Id"
,
OB_MYSQL_TYPE_LONGLONG
),
ObProxyColumnSchema
::
make_schema
(
OB_SLC_TENANT
,
"Tenant"
,
OB_MYSQL_TYPE_VARCHAR
),
ObProxyColumnSchema
::
make_schema
(
OB_SLC_USER
,
"User"
,
OB_MYSQL_TYPE_VARCHAR
),
...
...
@@ -116,13 +116,13 @@ const ObProxyColumnSchema INTERNAL_LIST_COLUMN_ARRAY[OB_SILC_MAX_SLIST_COLUMN_ID
ObProxyColumnSchema
::
make_schema
(
OB_SILC_PID
,
"pid"
,
OB_MYSQL_TYPE_LONG
),
};
const
ObProxyColumnSchema
ATTRIBUTE_COLUMN_ARRAY
[
OB_SLC_MAX_SLIST_COLUMN_ID
]
=
{
const
ObProxyColumnSchema
ATTRIBUTE_COLUMN_ARRAY
[
OB_SLC_MAX_SLIST_COLUMN_ID
]
=
{
ObProxyColumnSchema
::
make_schema
(
OB_SAC_NAME
,
"attribute_name"
,
OB_MYSQL_TYPE_VARCHAR
),
ObProxyColumnSchema
::
make_schema
(
OB_SAC_VALUE
,
"value"
,
OB_MYSQL_TYPE_VARCHAR
),
ObProxyColumnSchema
::
make_schema
(
OB_SAC_INFO
,
"info"
,
OB_MYSQL_TYPE_VARCHAR
),
};
const
ObProxyColumnSchema
VARIABLES_COLUMN_ARRAY
[
OB_SVC_MAX_VARIABLES_COLUMN_ID
]
=
{
const
ObProxyColumnSchema
VARIABLES_COLUMN_ARRAY
[
OB_SVC_MAX_VARIABLES_COLUMN_ID
]
=
{
ObProxyColumnSchema
::
make_schema
(
OB_SVC_NAME
,
"variable_name"
,
OB_MYSQL_TYPE_VARCHAR
),
ObProxyColumnSchema
::
make_schema
(
OB_SVC_VALUE
,
"value"
,
OB_MYSQL_TYPE_VARCHAR
),
ObProxyColumnSchema
::
make_schema
(
OB_SVC_INFO
,
"info"
,
OB_MYSQL_TYPE_VARCHAR
),
...
...
@@ -130,7 +130,7 @@ const ObProxyColumnSchema VARIABLES_COLUMN_ARRAY[OB_SVC_MAX_VARIABLES_COLUMN_ID]
ObProxyColumnSchema
::
make_schema
(
OB_SVC_FLAG
,
"sys_variable_flag"
,
OB_MYSQL_TYPE_VARCHAR
),
};
const
ObProxyColumnSchema
STAT_COLUMN_ARRAY
[
OB_SSC_MAX_STAT_COLUMN_ID
]
=
{
const
ObProxyColumnSchema
STAT_COLUMN_ARRAY
[
OB_SSC_MAX_STAT_COLUMN_ID
]
=
{
ObProxyColumnSchema
::
make_schema
(
OB_SSC_NAME
,
"stat_name"
,
OB_MYSQL_TYPE_VARCHAR
),
ObProxyColumnSchema
::
make_schema
(
OB_SSC_VALUE
,
"value"
,
OB_MYSQL_TYPE_LONGLONG
),
};
...
...
src/obproxy/dbconfig/ob_proxy_db_config_info.cpp
浏览文件 @
4f40b15c
...
...
@@ -42,122 +42,122 @@ namespace obproxy
namespace
dbconfig
{
static
const
ObString
LOCAL_DIR
=
ObString
::
make_string
(
"."
);
static
const
ObString
PARENT_DIR
=
ObString
::
make_string
(
".."
);
static
const
ObString
LOCAL_DIR
=
ObString
::
make_string
(
"."
);
static
const
ObString
PARENT_DIR
=
ObString
::
make_string
(
".."
);
// ObDbConfigChild
static
const
char
*
CONFIG_VERSION
=
"version"
;
static
const
char
*
CONFIG_VALUES
=
"variables"
;
static
const
char
*
CONFIG_VERSION
=
"version"
;
static
const
char
*
CONFIG_VALUES
=
"variables"
;
// LogicTenantInfo
static
const
char
*
TENANT_NAME
=
"tenant_name"
;
static
const
char
*
TENANT_DATABASES
=
"databases"
;
static
const
char
*
TENANT_NAME
=
"tenant_name"
;
static
const
char
*
TENANT_DATABASES
=
"databases"
;
// CR Reference
static
const
char
*
REF_KIND
=
"kind"
;
static
const
char
*
REF_NAMESPACE
=
"namespace"
;
static
const
char
*
REF_PARENT
=
"parent"
;
static
const
char
*
REF_VALUE
=
"reference"
;
static
const
char
*
TESTLOAD_REF_VALUE
=
"test_load_reference"
;
static
const
char
*
REF_KIND
=
"kind"
;
static
const
char
*
REF_NAMESPACE
=
"namespace"
;
static
const
char
*
REF_PARENT
=
"parent"
;
static
const
char
*
REF_VALUE
=
"reference"
;
static
const
char
*
TESTLOAD_REF_VALUE
=
"test_load_reference"
;
// DatabaseVariables
static
const
ObString
DATABASE_VARS
=
ObString
::
make_string
(
CONFIG_VALUES
);
static
const
ObString
REMOTE_ACCESS
=
ObString
::
make_string
(
"remoteAccess"
);
static
const
ObString
SEQUENCE_MIN_VALUE
=
ObString
::
make_string
(
"sequenceInitMinValue"
);
static
const
ObString
SEQUENCE_MAX_VALUE
=
ObString
::
make_string
(
"sequenceInitMaxValue"
);
static
const
ObString
SEQUENCE_STEP
=
ObString
::
make_string
(
"sequenceInitStep"
);
static
const
ObString
DATABASE_VARS
=
ObString
::
make_string
(
CONFIG_VALUES
);
static
const
ObString
REMOTE_ACCESS
=
ObString
::
make_string
(
"remoteAccess"
);
static
const
ObString
SEQUENCE_MIN_VALUE
=
ObString
::
make_string
(
"sequenceInitMinValue"
);
static
const
ObString
SEQUENCE_MAX_VALUE
=
ObString
::
make_string
(
"sequenceInitMaxValue"
);
static
const
ObString
SEQUENCE_STEP
=
ObString
::
make_string
(
"sequenceInitStep"
);
static
const
ObString
SEQUENCE_RETRY_COUNT
=
ObString
::
make_string
(
"sequenceRetryCount"
);
static
const
ObString
SEQUENCE_TABLE
=
ObString
::
make_string
(
"sequenceTable"
);
static
const
ObString
SEQUENCE_ENABLE
=
ObString
::
make_string
(
"sequenceEnable"
);
static
const
ObString
SEQUENCE_TNT_ID_COL
=
ObString
::
make_string
(
"sequenceTntId"
);
static
const
ObString
TESTLOAD_TABLE_MAP
=
ObString
::
make_string
(
"testLoadTableMap"
);
//testLoadTableMap
static
const
ObString
SEQUENCE_TABLE
=
ObString
::
make_string
(
"sequenceTable"
);
static
const
ObString
SEQUENCE_ENABLE
=
ObString
::
make_string
(
"sequenceEnable"
);
static
const
ObString
SEQUENCE_TNT_ID_COL
=
ObString
::
make_string
(
"sequenceTntId"
);
static
const
ObString
TESTLOAD_TABLE_MAP
=
ObString
::
make_string
(
"testLoadTableMap"
);
//testLoadTableMap
// LogicDbInfo
static
const
char
*
LOGIC_DB_NAME
=
"database_name"
;
static
const
char
*
LOGIC_DB_CLUSTER
=
"cluster_name"
;
static
const
char
*
LOGIC_DB_MODE
=
"database_mode"
;
static
const
char
*
LOGIC_DB_TYPE
=
"database_type"
;
static
const
char
*
TESTLOAD_PREFIX
=
"test_load_prefix"
;
static
const
char
*
LOGIC_DB_NAME
=
"database_name"
;
static
const
char
*
LOGIC_DB_CLUSTER
=
"cluster_name"
;
static
const
char
*
LOGIC_DB_MODE
=
"database_mode"
;
static
const
char
*
LOGIC_DB_TYPE
=
"database_type"
;
static
const
char
*
TESTLOAD_PREFIX
=
"test_load_prefix"
;
// DatabaseAuth
static
const
char
*
AUTH_HAS_PRIV
=
"Y"
;
static
const
char
*
AUTH_NO_PRIV
=
"N"
;
static
const
char
*
AUTH_USERS
=
"users"
;
static
const
char
*
AUTH_ALTER_PRIV
=
"alter_priv"
;
static
const
char
*
AUTH_CREATE_PRIV
=
"create_priv"
;
static
const
char
*
AUTH_DELETE_PRIV
=
"delete_priv"
;
static
const
char
*
AUTH_DROP_PRIV
=
"drop_priv"
;
static
const
char
*
AUTH_INSERT_PRIV
=
"insert_priv"
;
static
const
char
*
AUTH_UPDATE_PRIV
=
"update_priv"
;
static
const
char
*
AUTH_SELECT_PRIV
=
"select_priv"
;
static
const
char
*
AUTH_INDEX_PRIV
=
"index_priv"
;
static
const
char
*
AUTH_HOST
=
"host"
;
static
const
char
*
AUTH_HAS_PRIV
=
"Y"
;
static
const
char
*
AUTH_NO_PRIV
=
"N"
;
static
const
char
*
AUTH_USERS
=
"users"
;
static
const
char
*
AUTH_ALTER_PRIV
=
"alter_priv"
;
static
const
char
*
AUTH_CREATE_PRIV
=
"create_priv"
;
static
const
char
*
AUTH_DELETE_PRIV
=
"delete_priv"
;
static
const
char
*
AUTH_DROP_PRIV
=
"drop_priv"
;
static
const
char
*
AUTH_INSERT_PRIV
=
"insert_priv"
;
static
const
char
*
AUTH_UPDATE_PRIV
=
"update_priv"
;
static
const
char
*
AUTH_SELECT_PRIV
=
"select_priv"
;
static
const
char
*
AUTH_INDEX_PRIV
=
"index_priv"
;
static
const
char
*
AUTH_HOST
=
"host"
;
// ObDataBaseProp
static
const
char
*
DB_PROP_NAME
=
"properties_name"
;
static
const
char
*
DB_PROP_RULE
=
"properties_rule"
;
static
const
char
*
DB_PROP_TYPE
=
"propsType"
;
static
const
char
*
TESTLOAD_DBKEY_TYPE
=
"testLoadDbKeyType"
;
static
const
char
*
MIRROR_DBKEY_TYPE
=
"mirrorDbKeyType"
;
static
const
char
*
DB_PROP_NAME
=
"properties_name"
;
static
const
char
*
DB_PROP_RULE
=
"properties_rule"
;
static
const
char
*
DB_PROP_TYPE
=
"propsType"
;
static
const
char
*
TESTLOAD_DBKEY_TYPE
=
"testLoadDbKeyType"
;
static
const
char
*
MIRROR_DBKEY_TYPE
=
"mirrorDbKeyType"
;
static
const
char
*
DB_PROP_TESTLOAD
=
"testload"
;
static
const
char
*
DB_PROP_MIRROR
=
"mirror"
;
static
const
char
*
DB_PROP_SELFADJUST
=
"selfadjust"
;
static
const
char
*
DB_PROP_WHITELIST
=
"whitelist"
;
static
const
char
*
DB_PROP_TESTLOAD
=
"testload"
;
static
const
char
*
DB_PROP_MIRROR
=
"mirror"
;
static
const
char
*
DB_PROP_SELFADJUST
=
"selfadjust"
;
static
const
char
*
DB_PROP_WHITELIST
=
"whitelist"
;
// ObShardTpo
static
const
char
*
SHARDS_TPO_NAME
=
"topology_name"
;
static
const
char
*
SHARDS_TPO_ARCH
=
"architecture"
;
static
const
char
*
SHARDS_TPO_GROUPS
=
"specific_layer"
;
static
const
char
*
SHARDS_TPO_SPEC_MODE
=
"specific_mode"
;
static
const
char
*
SHARDS_TPO_SPEC
=
"specification"
;
static
const
char
*
STRICT_SPEC_MODE
=
"strict"
;
static
const
char
*
NORMAL_SPEC_MODE
=
"normal"
;
static
const
char
*
SHARDS_TPO_NAME
=
"topology_name"
;
static
const
char
*
SHARDS_TPO_ARCH
=
"architecture"
;
static
const
char
*
SHARDS_TPO_GROUPS
=
"specific_layer"
;
static
const
char
*
SHARDS_TPO_SPEC_MODE
=
"specific_mode"
;
static
const
char
*
SHARDS_TPO_SPEC
=
"specification"
;
static
const
char
*
STRICT_SPEC_MODE
=
"strict"
;
static
const
char
*
NORMAL_SPEC_MODE
=
"normal"
;
// ObShardRule
static
const
char
*
RULE_TB_NAME
=
"mark"
;
static
const
char
*
ROUTER_SEQUENCE
=
"sequence"
;
static
const
char
*
RULE_ROUTER
=
"router"
;
static
const
char
*
RULE_RULES
=
"rules"
;
static
const
char
*
RULE_TB_NAME_PATTERN
=
"tbNamePattern"
;
static
const
char
*
RULE_DB_NAME_PATTERN
=
"dbNamePattern"
;
static
const
char
*
RULE_TB_SUFFIX_PADDING
=
"tbSuffixPadding"
;
static
const
char
*
RULE_TB_RULES
=
"tbRules"
;
static
const
char
*
RULE_DB_RULES
=
"dbRules"
;
static
const
char
*
RULE_ES_RULES
=
"elasticRules"
;
static
const
char
*
RULE_TB_NAME
=
"mark"
;
static
const
char
*
ROUTER_SEQUENCE
=
"sequence"
;
static
const
char
*
RULE_ROUTER
=
"router"
;
static
const
char
*
RULE_RULES
=
"rules"
;
static
const
char
*
RULE_TB_NAME_PATTERN
=
"tbNamePattern"
;
static
const
char
*
RULE_DB_NAME_PATTERN
=
"dbNamePattern"
;
static
const
char
*
RULE_TB_SUFFIX_PADDING
=
"tbSuffixPadding"
;
static
const
char
*
RULE_TB_RULES
=
"tbRules"
;
static
const
char
*
RULE_DB_RULES
=
"dbRules"
;
static
const
char
*
RULE_ES_RULES
=
"elasticRules"
;
// ObShardRouter
static
const
char
*
ROUTER_RULES
=
"routers"
;
static
const
char
*
ROUTER_RULES
=
"routers"
;
// ObShardConnector
static
const
char
*
SHARDS_NAME
=
"shards_name"
;
static
const
char
*
SHARDS_TYPE
=
"shards_type"
;
static
const
char
*
SHARDS_AUTH
=
"shards_authority"
;
static
const
char
*
SHARDS_ENC_TYPE
=
"encType"
;
static
const
char
*
SHARDS_URL
=
"shards_connector"
;
static
const
char
*
SHARDS_USERNAME
=
"user"
;
static
const
char
*
SHARDS_PASSWORD
=
"password"
;
static
const
char
*
SHARDS_NAME
=
"shards_name"
;
static
const
char
*
SHARDS_TYPE
=
"shards_type"
;
static
const
char
*
SHARDS_AUTH
=
"shards_authority"
;
static
const
char
*
SHARDS_ENC_TYPE
=
"encType"
;
static
const
char
*
SHARDS_URL
=
"shards_connector"
;
static
const
char
*
SHARDS_USERNAME
=
"user"
;
static
const
char
*
SHARDS_PASSWORD
=
"password"
;
// ObShardProp
static
const
char
*
SHARDS_CONN_PROP
=
"connectionProperties"
;
static
const
char
*
SHARDS_CONN_TIMEOUT
=
"connectTimeout"
;
static
const
char
*
SHARDS_SOCK_TIMEOUT
=
"socketTimeout"
;
static
const
char
*
SHARDS_IDLE_TIMEOUT
=
"idleTimeoutMinutes"
;
static
const
char
*
SHARDS_NEED_PREFILL
=
"prefill"
;
static
const
char
*
SHARDS_BLOCKING_TIMEOUT
=
"blockingTimeoutMillis"
;
static
const
char
*
SHARDS_READ_CONSISTENCY
=
"obReadConsistency"
;
static
const
char
*
SHARDS_ZONE_PROPERTIES
=
"zoneProperties"
;
static
const
char
*
SHARDS_ZONE_MIN_CONN_PROP
=
"minConn"
;
static
const
char
*
SHARDS_ZONE_MAX_CONN_PROP
=
"maxConn"
;
static
const
char
*
SHARDS_CONN_PROP
=
"connectionProperties"
;
static
const
char
*
SHARDS_CONN_TIMEOUT
=
"connectTimeout"
;
static
const
char
*
SHARDS_SOCK_TIMEOUT
=
"socketTimeout"
;
static
const
char
*
SHARDS_IDLE_TIMEOUT
=
"idleTimeoutMinutes"
;
static
const
char
*
SHARDS_NEED_PREFILL
=
"prefill"
;
static
const
char
*
SHARDS_BLOCKING_TIMEOUT
=
"blockingTimeoutMillis"
;
static
const
char
*
SHARDS_READ_CONSISTENCY
=
"obReadConsistency"
;
static
const
char
*
SHARDS_ZONE_PROPERTIES
=
"zoneProperties"
;
static
const
char
*
SHARDS_ZONE_MIN_CONN_PROP
=
"minConn"
;
static
const
char
*
SHARDS_ZONE_MAX_CONN_PROP
=
"maxConn"
;
static
const
ObString
SHARDS_ZONE_CURRENT_CONN_PROP
=
ObString
::
make_string
(
"current"
);
static
const
ObString
SHARDS_ZONE_OTHERS_CONN_PROP
=
ObString
::
make_string
(
"others"
);
static
const
ObString
SHARDS_ZONE_OTHERS_CONN_PROP
=
ObString
::
make_string
(
"others"
);
// OBShardDist
static
const
char
*
SHARD_DISTS
=
"distributions"
;
static
const
char
*
SHARD_DISTS_DIST
=
"distribution"
;
static
const
char
*
SHARD_DISTS_MARK
=
"mark"
;
static
const
char
*
SHARD_DISTS
=
"distributions"
;
static
const
char
*
SHARD_DISTS_DIST
=
"distribution"
;
static
const
char
*
SHARD_DISTS_MARK
=
"mark"
;
ObDbConfigCache
&
get_global_dbconfig_cache
()
...
...
src/obproxy/dbconfig/ob_proxy_pb_utils.cpp
浏览文件 @
4f40b15c
...
...
@@ -70,14 +70,14 @@ static const std::regex ELASTIC_PATTERN2("^toint\\(substr\\(\\#(\\w+)\\#,\\s*(\\
const
char
*
OBPROXY_CONFIG_LOG_TIMESTAMP_FORMAT
=
"%Y-%m-%d %H:%i:%s.%f"
;
//static const char *CONFIG_
static
const
char
*
CONFIG_TIMESTAMP
=
"timestamp"
;
static
const
char
*
CONFIG_INSTANCE_IP
=
"instance_ip"
;
static
const
char
*
CONFIG_INSTANCE_ZONE
=
"instance_zone"
;
static
const
char
*
CONFIG_TENANT
=
"tenant"
;
static
const
char
*
CONFIG_LOGICAL_DB
=
"logical_db"
;
static
const
char
*
CONFIG_TYPE
=
"type"
;
static
const
char
*
CONFIG_NAME
=
"name"
;
static
const
char
*
CONFIG_VALUE
=
"value"
;
static
const
char
*
CONFIG_TIMESTAMP
=
"timestamp"
;
static
const
char
*
CONFIG_INSTANCE_IP
=
"instance_ip"
;
static
const
char
*
CONFIG_INSTANCE_ZONE
=
"instance_zone"
;
static
const
char
*
CONFIG_TENANT
=
"tenant"
;
static
const
char
*
CONFIG_LOGICAL_DB
=
"logical_db"
;
static
const
char
*
CONFIG_TYPE
=
"type"
;
static
const
char
*
CONFIG_NAME
=
"name"
;
static
const
char
*
CONFIG_VALUE
=
"value"
;
int
ObProxyPbUtils
::
parse_database_prop_rule
(
const
std
::
string
&
prop_rule
,
ObDataBaseProp
&
child_info
)
{
...
...
src/obproxy/engine/ob_proxy_operator_result.h
浏览文件 @
4f40b15c
...
...
@@ -50,7 +50,7 @@ public:
}
PacketErrorInfo
;
const
int16_t
OP_DEFAULT_ERROR_NO
=
8001
;
const
char
*
OP_DEFAULT_ERROR_MSG
=
"Inner error occured in Operator and not have any other info"
;
const
char
*
OP_DEFAULT_ERROR_MSG
=
"Inner error occured in Operator and not have any other info"
;
int
change_sql_field
(
const
ObMysqlField
*
src_field
,
obmysql
::
ObMySQLField
*&
dst_field
,
common
::
ObIAllocator
&
allocator
)
...
...
src/obproxy/iocore/eventsystem/ob_event.h
浏览文件 @
4f40b15c
...
...
@@ -86,7 +86,7 @@ namespace event
#define API_EVENT_EVENTS_START 60000
typedef
int32_t
ObEventThreadType
;
const
int32_t
ET_CALL
=
0
;
const
int32_t
ET_CALL
=
0
;
const
int32_t
MAX_EVENT_TYPES
=
6
;
// conservative, these are dynamically allocated
class
ObEThread
;
...
...
src/obproxy/iocore/eventsystem/ob_event_processor.h
浏览文件 @
4f40b15c
...
...
@@ -50,9 +50,9 @@ const int64_t MAX_THREADS_IN_EACH_TYPE = 256;
#endif
#ifdef OB_MAX_NUMBER_EVENT_THREADS
const
int64_t
MAX_EVENT_THREADS
=
OB_MAX_NUMBER_EVENT_THREADS
;
const
int64_t
MAX_EVENT_THREADS
=
OB_MAX_NUMBER_EVENT_THREADS
;
#else
const
int64_t
MAX_EVENT_THREADS
=
512
;
const
int64_t
MAX_EVENT_THREADS
=
512
;
#endif
#ifndef offsetof
...
...
src/obproxy/iocore/eventsystem/ob_thread.h
浏览文件 @
4f40b15c
...
...
@@ -48,7 +48,7 @@ typedef void *(*ThreadFunction)(void *arg);
extern
ObProxyMutex
*
global_mutex
;
static
const
int
MAX_THREAD_NAME_LENGTH
=
32
;
static
const
int
DEFAULT_STACKSIZE
=
1048576
;
// 1MB
static
const
int
DEFAULT_STACKSIZE
=
1048576
;
// 1MB
/**
* Base class for the threads in the ObEvent System. ObThread is the base
...
...
src/obproxy/iocore/eventsystem/ob_thread_allocator.h
浏览文件 @
4f40b15c
...
...
@@ -22,10 +22,10 @@ namespace obproxy
namespace
event
{
static
const
int64_t
g_thread_freelist_high_watermark
=
512
;
static
const
int64_t
g_thread_freelist_low_watermark
=
32
;
static
const
int64_t
g_thread_freelist_high_watermark
=
512
;
static
const
int64_t
g_thread_freelist_low_watermark
=
32
;
static
const
int64_t
g_thread_freelist_low_watermark_for_8k
=
0
;
static
const
int64_t
size_8k
=
8
*
1024
;
static
const
int64_t
size_8k
=
8
*
1024
;
struct
ObProxyThreadAllocator
{
...
...
src/obproxy/iocore/net/ob_connection.cpp
浏览文件 @
4f40b15c
...
...
@@ -111,11 +111,11 @@ ObConnection::~ObConnection()
* order to tweak options.
*/
const
ObNetVCOptions
ObConnection
::
DEFAULT_OPTIONS
;
const
int32_t
ObConnection
::
SOCKOPT_ON
=
1
;
const
int32_t
ObConnection
::
SOCKOPT_OFF
=
0
;
const
int32_t
ObConnection
::
SOCKOPT_ON
=
1
;
const
int32_t
ObConnection
::
SOCKOPT_OFF
=
0
;
const
int32_t
ObConnection
::
SNDBUF_AND_RCVBUF_PREC
=
1024
;
const
int32_t
ObServerConnection
::
LISTEN_BACKLOG
=
1024
;
const
int32_t
ObServerConnection
::
LISTEN_BACKLOG
=
1024
;
int
ObConnection
::
open
(
const
ObNetVCOptions
&
opt
)
{
...
...
src/obproxy/iocore/net/ob_inet.h
浏览文件 @
4f40b15c
...
...
@@ -56,16 +56,16 @@ static inline bool IN6_IS_ADDR_UNSPECIFIED(const in6_addr *addr)
#endif
// Buffer size sufficient for IPv6 address and port.
static
const
int64_t
INET6_ADDRPORTSTRLEN
=
INET6_ADDRSTRLEN
+
6
;
static
const
int64_t
INET6_ADDRPORTSTRLEN
=
INET6_ADDRSTRLEN
+
6
;
// Convenience type for address formatting.
typedef
char
ip_text_buffer
[
INET6_ADDRSTRLEN
];
typedef
char
ip_port_text_buffer
[
INET6_ADDRPORTSTRLEN
];
static
const
int64_t
MAX_HOST_NAME_LEN
=
256
;
static
const
int64_t
MAX_HOST_NAME_LEN
=
256
;
static
const
int64_t
MAX_LOCAL_ADDR_LIST_COUNT
=
64
;
// Size in bytes of an IPv6 address.
static
const
int64_t
IP6_SIZE
=
sizeof
(
in6_addr
);
static
const
int64_t
IP6_SIZE
=
sizeof
(
in6_addr
);
struct
ObIpAddr
;
...
...
@@ -511,10 +511,7 @@ inline bool ops_is_ip_private(const sockaddr &ip)
bool
zret
=
false
;
if
(
ops_is_ip4
(
ip
))
{
in_addr_t
a
=
ops_ip4_addr_cast
(
ip
);
zret
=
((
a
&
htonl
(
0xFF000000
))
==
htonl
(
0x0A000000
))
// 10.0.0.0/8
||
((
a
&
htonl
(
0xFFC00000
))
==
htonl
(
0x64400000
))
// 100.64.0.0/10
||
((
a
&
htonl
(
0xFFF00000
))
==
htonl
(
0xAC100000
))
// 172.16.0.0/12
||
((
a
&
htonl
(
0xFFFF0000
))
==
htonl
(
0xC0A80000
));
// 192.168.0.0/16
zret
=
((
a
&
htonl
(
0xFFFF0000
))
==
htonl
(
0xC0A80000
));
// 192.168.0.0/16
}
else
if
(
ops_is_ip6
(
ip
))
{
in6_addr
a
=
ops_ip6_addr_cast
(
ip
);
zret
=
((
a
.
s6_addr
[
0
]
&
0xFE
)
==
0xFC
);
// fc00::/7
...
...
@@ -527,26 +524,6 @@ inline bool ops_is_ip_private(const ObIpEndpoint &ip)
return
ops_is_ip_private
(
ip
.
sa_
);
}
// Check for Link Local.
// @return @true if ip is link local.
inline
bool
ops_is_ip_linklocal
(
const
sockaddr
&
ip
)
{
bool
zret
=
false
;
if
(
ops_is_ip4
(
ip
))
{
in_addr_t
a
=
ops_ip4_addr_cast
(
ip
);
zret
=
((
a
&
htonl
(
0xFFFF0000
))
==
htonl
(
0xA9FE0000
));
// 169.254.0.0/16
}
else
if
(
ops_is_ip6
(
ip
))
{
in6_addr
a
=
ops_ip6_addr_cast
(
ip
);
zret
=
((
a
.
s6_addr
[
0
]
==
0xFE
)
&&
((
a
.
s6_addr
[
1
]
&
0xC0
)
==
0x80
));
// fe80::/10
}
return
zret
;
}
inline
bool
ops_is_ip_linklocal
(
const
ObIpEndpoint
&
ip
)
{
return
ops_is_ip_linklocal
(
ip
.
sa_
);
}
// Check for being "any" address.
// @return true if ip is the any / unspecified address.
inline
bool
ops_is_ip_any
(
const
sockaddr
&
ip
)
...
...
src/obproxy/ob_proxy_main.cpp
浏览文件 @
4f40b15c
...
...
@@ -146,8 +146,8 @@ void ObProxyMain::print_usage() const
MPRINT
(
" -t,--regression_test TEST_NAME regression test"
);
MPRINT
(
"example:"
);
MPRINT
(
" run without config server:"
);
MPRINT
(
" ./bin/obproxy -p6789 -r'
10.125.224.11:26506;10.125.224.22:26577
' -n test -o enable_cluster_checkout=false,syslog_level=INFO"
);
MPRINT
(
" OR ./bin/obproxy -p6789 -r'
10.125.224.11:26506;10.125.224.22:26577
' -c 'ob_test' -n test -o syslog_level=INFO
\n
"
);
MPRINT
(
" ./bin/obproxy -p6789 -r'
ip:port;ip:port
' -n test -o enable_cluster_checkout=false,syslog_level=INFO"
);
MPRINT
(
" OR ./bin/obproxy -p6789 -r'
ip:port;ip:port
' -c 'ob_test' -n test -o syslog_level=INFO
\n
"
);
MPRINT
(
" run with config server:"
);
MPRINT
(
" ./bin/obproxy -p6789 -e -n test -o obproxy_config_server_url='your config url',syslog_level=INFO
\n
"
);
MPRINT
(
" Non-first start with local config file:"
);
...
...
@@ -155,7 +155,7 @@ void ObProxyMain::print_usage() const
MPRINT
(
" dump config update sql:"
);
MPRINT
(
" ./bin/obproxy -d
\n
"
);
MPRINT
(
" run regression tests:"
);
MPRINT
(
" ./bin/obproxy -p6789 -r
10.125.224.11:26506
-ntest -o obproxy_config_server_url='' -t ''"
);
MPRINT
(
" ./bin/obproxy -p6789 -r
ip:port
-ntest -o obproxy_config_server_url='' -t ''"
);
MPRINT
(
"----------------------------------------------------------------------------------"
);
}
...
...
src/obproxy/obutils/ob_async_common_task.cpp
浏览文件 @
4f40b15c
...
...
@@ -27,7 +27,7 @@ namespace obproxy
{
namespace
obutils
{
static
const
int
EVENT_COMPLETE
=
CLIENT_TRANSPORT_MYSQL_RESP_EVENT
;
static
const
int
EVENT_COMPLETE
=
CLIENT_TRANSPORT_MYSQL_RESP_EVENT
;
static
const
int
EVENT_INFORM_OUT
=
ASYNC_PROCESS_INFORM_OUT_EVENT
;
int
ObAsyncCommonTask
::
main_handler
(
int
event
,
void
*
data
)
...
...
src/obproxy/obutils/ob_mt_hashtable.h
浏览文件 @
4f40b15c
...
...
@@ -26,9 +26,9 @@ namespace obproxy
namespace
obutils
{
static
const
int64_t
MT_HASHTABLE_PARTITION_BITS
=
6
;
static
const
int64_t
MT_HASHTABLE_PARTITIONS
=
1
<<
MT_HASHTABLE_PARTITION_BITS
;
static
const
uint64_t
MT_HASHTABLE_PARTITION_MASK
=
MT_HASHTABLE_PARTITIONS
-
1
;
static
const
int64_t
MT_HASHTABLE_PARTITION_BITS
=
6
;
static
const
int64_t
MT_HASHTABLE_PARTITIONS
=
1
<<
MT_HASHTABLE_PARTITION_BITS
;
static
const
uint64_t
MT_HASHTABLE_PARTITION_MASK
=
MT_HASHTABLE_PARTITIONS
-
1
;
static
const
int64_t
MT_HASHTABLE_MAX_CHAIN_AVG_LEN
=
4
;
template
<
class
Key
,
class
Value
>
...
...
src/obproxy/obutils/ob_proxy_config_processor.cpp
浏览文件 @
4f40b15c
...
...
@@ -40,54 +40,54 @@ namespace obproxy
namespace
obutils
{
const
static
char
*
CONFIG_META
=
"meta"
;
const
static
char
*
CONFIG_SPEC
=
"spec"
;
const
static
char
*
CONFIG_META
=
"meta"
;
const
static
char
*
CONFIG_SPEC
=
"spec"
;
const
static
char
*
CONFIG_API_VERSION
=
"api_version"
;
const
static
char
*
CONFIG_VERSION
=
"version"
;
const
static
char
*
CONFIG_APP_NAME
=
"app_name"
;
const
static
char
*
CONFIG_TYPE
=
"config_type"
;
const
static
char
*
CONFIG_SYNC
=
"need_sync"
;
const
static
char
*
CONFIG_API_VERSION
=
"api_version"
;
const
static
char
*
CONFIG_VERSION
=
"version"
;
const
static
char
*
CONFIG_APP_NAME
=
"app_name"
;
const
static
char
*
CONFIG_TYPE
=
"config_type"
;
const
static
char
*
CONFIG_SYNC
=
"need_sync"
;
// index config
const
static
char
*
CONFIG_REFERENCE
=
"reference"
;
const
static
char
*
CONFIG_DATAID
=
"data_id"
;
const
static
char
*
CONFIG_REFERENCE
=
"reference"
;
const
static
char
*
CONFIG_DATAID
=
"data_id"
;
// config spec
const
static
char
*
CONFIG_VALUE
=
"value"
;
const
static
char
*
CONFIG_ATTR
=
"category"
;
const
static
char
*
CONFIG_PERSISTENT
=
"persistent"
;
const
static
char
*
CONFIG_VALUE
=
"value"
;
const
static
char
*
CONFIG_ATTR
=
"category"
;
const
static
char
*
CONFIG_PERSISTENT
=
"persistent"
;
// limit config
const
static
char
*
LIMITERS
=
"limiters"
;
const
static
char
*
CLUSTER_NAME
=
"cluster"
;
const
static
char
*
TENANT_NAME
=
"tenant"
;
const
static
char
*
DATABASE_NAME
=
"database"
;
const
static
char
*
USER_NAME
=
"username"
;
const
static
char
*
LIMIT_NAME
=
"limitName"
;
const
static
char
*
LIMIT_MODE
=
"mode"
;
const
static
char
*
LIMIT_RULE
=
"rule"
;
const
static
char
*
LIMIT_PRIORITY
=
"priority"
;
const
static
char
*
LIMIT_STATUS
=
"status"
;
const
static
char
*
LIMITERS
=
"limiters"
;
const
static
char
*
CLUSTER_NAME
=
"cluster"
;
const
static
char
*
TENANT_NAME
=
"tenant"
;
const
static
char
*
DATABASE_NAME
=
"database"
;
const
static
char
*
USER_NAME
=
"username"
;
const
static
char
*
LIMIT_NAME
=
"limitName"
;
const
static
char
*
LIMIT_MODE
=
"mode"
;
const
static
char
*
LIMIT_RULE
=
"rule"
;
const
static
char
*
LIMIT_PRIORITY
=
"priority"
;
const
static
char
*
LIMIT_STATUS
=
"status"
;
// limit rule
const
static
char
*
LIMIT_SQL_TYPE
=
"sqlType"
;
const
static
char
*
LIMIT_KEY_WORDS
=
"keyWords"
;
const
static
char
*
LIMIT_TABLE_NAME
=
"tableName"
;
const
static
char
*
LIMIT_QPS
=
"qps"
;
const
static
char
*
LIMIT_RT
=
"averageRt"
;
const
static
char
*
LIMIT_CONDITION
=
"scene"
;
const
static
char
*
LIMIT_SQL_TYPE
=
"sqlType"
;
const
static
char
*
LIMIT_KEY_WORDS
=
"keyWords"
;
const
static
char
*
LIMIT_TABLE_NAME
=
"tableName"
;
const
static
char
*
LIMIT_QPS
=
"qps"
;
const
static
char
*
LIMIT_RT
=
"averageRt"
;
const
static
char
*
LIMIT_CONDITION
=
"scene"
;
const
static
char
*
LIMIT_CONDITION_USE_LIKE
=
"Uselike"
;
const
static
char
*
LIMIT_CONDITION_NO_WHERE
=
"Nowhere"
;
const
static
char
*
LIMIT_TIME_WINDOW
=
"timeWindow"
;
const
static
char
*
LIMIT_CONN
=
"limitConn"
;
const
static
char
*
LIMIT_FUSE_TIME
=
"fuseTime"
;
const
static
char
*
LIMIT_TIME_WINDOW
=
"timeWindow"
;
const
static
char
*
LIMIT_CONN
=
"limitConn"
;
const
static
char
*
LIMIT_FUSE_TIME
=
"fuseTime"
;
// security
const
static
char
*
SECURITY_SOURCE_TYPE
=
"sourceType"
;
const
static
char
*
SECURITY_CA
=
"CA"
;
const
static
char
*
SECURITY_PUBLIC_KEY
=
"publicKey"
;
const
static
char
*
SECURITY_PRIVATE_KEY
=
"privateKey"
;
const
static
char
*
SECURITY_SOURCE_TYPE
=
"sourceType"
;
const
static
char
*
SECURITY_CA
=
"CA"
;
const
static
char
*
SECURITY_PUBLIC_KEY
=
"publicKey"
;
const
static
char
*
SECURITY_PRIVATE_KEY
=
"privateKey"
;
#define MONITOR_LIMIT_LOG_FORMAT "%s,%s,%s," \
"%s,%.*s:%.*s:%.*s,%s," \
...
...
src/obproxy/obutils/ob_proxy_config_utils.cpp
浏览文件 @
4f40b15c
...
...
@@ -29,10 +29,10 @@ namespace obproxy
{
namespace
obutils
{
static
const
ObString
LOCAL_DIR
=
ObString
::
make_string
(
"."
);
static
const
ObString
PARENT_DIR
=
ObString
::
make_string
(
".."
);
static
const
ObString
LOCAL_DIR
=
ObString
::
make_string
(
"."
);
static
const
ObString
PARENT_DIR
=
ObString
::
make_string
(
".."
);
const
char
*
INSERT_KV_TABLE_VERSION_SQL
=
const
char
*
INSERT_KV_TABLE_VERSION_SQL
=
"INSERT INTO %s "
"(name, datatype, value, info) VALUES ('%s', %d, '%ld', '%s') "
"ON DUPLICATE KEY UPDATE name = VALUES(name);
\n
"
;
...
...
@@ -45,7 +45,7 @@ const char *INSERT_KV_TABLE_ALL_PROXY_UPGRADE_SQL =
"('%.*s%.*s', %d, '%.*s', '%s'), ('%.*s%.*s', %d, '%.*s', '%s'), ('%.*s%.*s', %d, '%.*s', '%s') "
"ON DUPLICATE KEY UPDATE name = VALUES(name);
\n
"
;
const
char
*
INSERT_CONFIG_TABLE_ALL_PROXY_SQL
=
const
char
*
INSERT_CONFIG_TABLE_ALL_PROXY_SQL
=
"INSERT INTO %s "
"(app_name, name, value, need_reboot, info) VALUES "
"('all_proxy', '%s', '%s', '%s', '%s') "
...
...
src/obproxy/obutils/ob_proxy_config_utils.h
浏览文件 @
4f40b15c
...
...
@@ -30,11 +30,11 @@ class ObMysqlProxy;
namespace
obutils
{
static
const
char
*
const
CFG_DUMP_NAME
=
"./obproxy_config.bin"
;
static
const
char
*
const
CFG_SERVER_INFO_DUMP_NAME
=
"./obproxy_config_server_info.json"
;
static
const
char
*
const
CFG_DUMP_NAME
=
"./obproxy_config.bin"
;
static
const
char
*
const
CFG_SERVER_INFO_DUMP_NAME
=
"./obproxy_config_server_info.json"
;
static
const
char
*
const
CFG_SERVER_SHARD_INFO_DUMP_NAME
=
"./obproxy_shard_config_server_info.json"
;
static
const
char
*
const
CFG_RSLIST_INFO_DUMP_NAME
=
"./obproxy_rslist_info.json"
;
static
const
char
*
const
CFG_IDC_LIST_INFO_DUMP_NAME
=
"./obproxy_idc_list_info.json"
;
static
const
char
*
const
CFG_RSLIST_INFO_DUMP_NAME
=
"./obproxy_rslist_info.json"
;
static
const
char
*
const
CFG_IDC_LIST_INFO_DUMP_NAME
=
"./obproxy_idc_list_info.json"
;
class
ObProxyConfig
;
class
ObProxyConfigUtils
...
...
src/obproxy/obutils/ob_proxy_json_config_info.cpp
浏览文件 @
4f40b15c
...
...
@@ -30,43 +30,43 @@ namespace obproxy
namespace
obutils
{
static
const
char
*
JSON_HTTP_MESSAGE
=
"Message"
;
static
const
char
*
HTTP_SUCC_MESSAGE
=
"successful"
;
static
const
char
*
JSON_HTTP_STATUS
=
"Success"
;
static
const
char
*
JSON_HTTP_CODE
=
"Code"
;
static
const
char
*
JSON_CONFIG_DATA
=
"Data"
;
static
const
char
*
JSON_CONFIG_VERSION
=
"Version"
;
static
const
char
*
JSON_CLUSTER_LIST
=
"ObRootServiceInfoUrlList"
;
static
const
char
*
JSON_OB_REGION
=
"ObRegion"
;
static
const
char
*
JSON_OB_CLUSTER
=
"ObCluster"
;
static
const
char
*
JSON_OB_REGION_ID
=
"ObRegionId"
;
static
const
char
*
JSON_OB_CLUSTER_ID
=
"ObClusterId"
;
static
const
char
*
JSON_OB_CLUSTER_TYPE
=
"Type"
;
static
const
char
*
JSON_REAL_META_REGION
=
"ObRealMetaRegion"
;
static
const
char
*
JSON_RS_URL
=
"ObRootServiceInfoUrl"
;
static
const
char
*
JSON_RS_LIST
=
"RsList"
;
static
const
char
*
JSON_ADDRESS
=
"address"
;
static
const
char
*
JSON_SQL_PORT
=
"sql_port"
;
static
const
char
*
JSON_ROLE
=
"role"
;
static
const
char
*
JSON_META_TABLE_INFO
=
"ObProxyDatabaseInfo"
;
static
const
char
*
JSON_META_DATABASE
=
"DataBase"
;
static
const
char
*
JSON_META_USER
=
"User"
;
static
const
char
*
JSON_META_PASSWORD
=
"Password"
;
static
const
char
*
JSON_BIN_URL
=
"ObProxyBinUrl"
;
static
const
char
*
JSON_IDC_LIST
=
"IDCList"
;
static
const
char
*
JSON_REGION
=
"region"
;
static
const
char
*
JSON_IDC
=
"idc"
;
static
const
char
*
JSON_READONLY_RS_LIST
=
"ReadonlyRsList"
;
static
const
char
*
LEADER_ROLE
=
"LEADER"
;
static
const
char
*
FOLLOWER_ROLE
=
"FOLLOWER"
;
static
const
char
*
PRIMARY_ROLE
=
"PRIMARY"
;
static
const
char
*
STANDBY_ROLE
=
"STANDBY"
;
static
const
char
*
JSON_ROOT_SERVICE_INFO_URL_TEMPLATE
=
"ObRootServiceInfoUrlTemplate"
;
static
const
char
*
JSON_HTTP_MESSAGE
=
"Message"
;
static
const
char
*
HTTP_SUCC_MESSAGE
=
"successful"
;
static
const
char
*
JSON_HTTP_STATUS
=
"Success"
;
static
const
char
*
JSON_HTTP_CODE
=
"Code"
;
static
const
char
*
JSON_CONFIG_DATA
=
"Data"
;
static
const
char
*
JSON_CONFIG_VERSION
=
"Version"
;
static
const
char
*
JSON_CLUSTER_LIST
=
"ObRootServiceInfoUrlList"
;
static
const
char
*
JSON_OB_REGION
=
"ObRegion"
;
static
const
char
*
JSON_OB_CLUSTER
=
"ObCluster"
;
static
const
char
*
JSON_OB_REGION_ID
=
"ObRegionId"
;
static
const
char
*
JSON_OB_CLUSTER_ID
=
"ObClusterId"
;
static
const
char
*
JSON_OB_CLUSTER_TYPE
=
"Type"
;
static
const
char
*
JSON_REAL_META_REGION
=
"ObRealMetaRegion"
;
static
const
char
*
JSON_RS_URL
=
"ObRootServiceInfoUrl"
;
static
const
char
*
JSON_RS_LIST
=
"RsList"
;
static
const
char
*
JSON_ADDRESS
=
"address"
;
static
const
char
*
JSON_SQL_PORT
=
"sql_port"
;
static
const
char
*
JSON_ROLE
=
"role"
;
static
const
char
*
JSON_META_TABLE_INFO
=
"ObProxyDatabaseInfo"
;
static
const
char
*
JSON_META_DATABASE
=
"DataBase"
;
static
const
char
*
JSON_META_USER
=
"User"
;
static
const
char
*
JSON_META_PASSWORD
=
"Password"
;
static
const
char
*
JSON_BIN_URL
=
"ObProxyBinUrl"
;
static
const
char
*
JSON_IDC_LIST
=
"IDCList"
;
static
const
char
*
JSON_REGION
=
"region"
;
static
const
char
*
JSON_IDC
=
"idc"
;
static
const
char
*
JSON_READONLY_RS_LIST
=
"ReadonlyRsList"
;
static
const
char
*
LEADER_ROLE
=
"LEADER"
;
static
const
char
*
FOLLOWER_ROLE
=
"FOLLOWER"
;
static
const
char
*
PRIMARY_ROLE
=
"PRIMARY"
;
static
const
char
*
STANDBY_ROLE
=
"STANDBY"
;
static
const
char
*
JSON_ROOT_SERVICE_INFO_URL_TEMPLATE
=
"ObRootServiceInfoUrlTemplate"
;
static
const
char
*
JSON_ROOT_SERVICE_INFO_URL_TEMPLATE_V2
=
"ObRootServiceInfoUrlTemplateV2"
;
static
const
char
*
JSON_DATA_CLUSTER_LIST
=
"ObClusterList"
;
static
const
char
*
JSON_DATA_CLUSTER_LIST
=
"ObClusterList"
;
static
const
char
*
REGION_TEMPLATE
=
"${ObRegion}"
;
static
const
char
*
CLUSTER_TEMPLATE
=
"${ObCluster}"
;
static
const
char
*
REGION_TEMPLATE
=
"${ObRegion}"
;
static
const
char
*
CLUSTER_TEMPLATE
=
"${ObCluster}"
;
const
char
*
cluster_role_to_str
(
ObClusterRole
role
)
{
...
...
src/obproxy/obutils/ob_proxy_sequence_utils.cpp
浏览文件 @
4f40b15c
...
...
@@ -27,15 +27,15 @@ namespace obproxy
{
namespace
proxy
{
static
const
char
*
PROXY_SELECT_SEQUENCE_INFO_SQL
=
static
const
char
*
PROXY_SELECT_SEQUENCE_INFO_SQL
=
"SELECT CURRENT_TIMESTAMP(6) as now, value, min_value, max_value, step, gmt_create, gmt_modified "
"FROM %.*s.%.*s WHERE name = '%.*s' LIMIT 1"
;
static
const
char
*
PROXY_INSERT_SEQUENCE_INFO_SQL
=
static
const
char
*
PROXY_INSERT_SEQUENCE_INFO_SQL
=
"INSERT INTO %.*s.%.*s(name, min_value, max_value, step, value, gmt_create, gmt_modified) "
"VALUES('%.*s', '%ld','%ld', '%ld', '%ld', '%.*s', '%.*s')"
;
static
const
char
*
PROXY_UPDATE_SEQUENCE_INFO_SQL
=
static
const
char
*
PROXY_UPDATE_SEQUENCE_INFO_SQL
=
"UPDATE %.*s.%.*s SET value = '%ld', gmt_modified = now() WHERE name = '%.*s' and value = '%ld'"
;
static
const
char
*
PROXY_SELECT_SEQUENCE_INFO_WITH_TNT_SQL
=
...
...
src/obproxy/obutils/ob_proxy_sql_parser.h
浏览文件 @
4f40b15c
...
...
@@ -868,12 +868,12 @@ private:
ObProxyStmt
*
proxy_stmt_
;
};
const
int
OB_T_IDENT_NUM_CHILD
=
0
;
const
int
OB_T_RELATION_FACTOR_NUM_CHILD
=
2
;
const
int
OB_T_COLUMN_REF_NUM_CHILD
=
3
;
const
int
OB_T_ALIAS_TABLE_NAME_NUM_CHILD
=
5
;
const
int
OB_T_ALIAS_CLUMN_NAME_NUM_CHILD
=
2
;
const
int
OB_T_INDEX_NUM_CHILD
=
3
;
const
int
OB_T_IDENT_NUM_CHILD
=
0
;
const
int
OB_T_RELATION_FACTOR_NUM_CHILD
=
2
;
const
int
OB_T_COLUMN_REF_NUM_CHILD
=
3
;
const
int
OB_T_ALIAS_TABLE_NAME_NUM_CHILD
=
5
;
const
int
OB_T_ALIAS_CLUMN_NAME_NUM_CHILD
=
2
;
const
int
OB_T_INDEX_NUM_CHILD
=
3
;
const
int
OB_T_RELATION_FACTOR_IN_HINT_NUM_CHILD
=
2
;
class
ObProxySqlParser
...
...
src/obproxy/obutils/ob_proxy_table_processor.h
浏览文件 @
4f40b15c
...
...
@@ -43,12 +43,12 @@ enum ObProxyRowStatus
};
//.upgrade_start_time | .upgrade_duration_time
const
int64_t
OB_MAX_PROXY_UPGRADEN_TIME_LEN
=
24
;
const
int64_t
OB_MAX_PROXY_UPGRADEN_TIME_LEN
=
24
;
//upgrade_off | upgrade_part | upgrade_on | upgrade_bin
const
int64_t
OB_MAX_PROXY_UPGRADEN_SWITCH_LEN
=
16
;
//all_proxy
const
int64_t
OB_ALL_PROXY_HEADER_LEN
=
sizeof
(
"all_proxy"
);
const
int64_t
OB_PROXY_CONFIG_VERSION_LEN
=
sizeof
(
".config_version"
);
const
int64_t
OB_ALL_PROXY_HEADER_LEN
=
sizeof
(
"all_proxy"
);
const
int64_t
OB_PROXY_CONFIG_VERSION_LEN
=
sizeof
(
".config_version"
);
class
ObProxyServerInfo
{
...
...
src/obproxy/obutils/ob_proxy_table_processor_utils.cpp
浏览文件 @
4f40b15c
...
...
@@ -36,7 +36,7 @@ namespace obproxy
{
namespace
obutils
{
static
const
char
*
INADDR_ANY_IP
=
"0.0.0.0"
;
static
const
char
*
INADDR_ANY_IP
=
"0.0.0.0"
;
static
const
char
*
INADDR_LOOPBACK_IP
=
"127.0.0.1"
;
static
const
char
*
GET_PROXY_INFO_SQL
=
...
...
@@ -134,7 +134,7 @@ static const char *GET_PROXY_ALL_VIP_TENANT_SQL =
"SELECT /*+READ_CONSISTENCY(WEAK)*/ vid, vip, vport, tenant_name, cluster_name, info FROM %s LIMIT %ld"
;
static
const
char
*
JSON_REQUEST_TARGET
=
"REQUEST_TARGET"
;
static
const
char
*
JSON_RW_TYPE
=
"RW_TYPE"
;
static
const
char
*
JSON_RW_TYPE
=
"RW_TYPE"
;
int
ObProxyTableProcessorUtils
::
get_proxy_info
(
ObMysqlProxy
&
mysql_proxy
,
...
...
src/obproxy/obutils/ob_resource_pool_processor.cpp
浏览文件 @
4f40b15c
...
...
@@ -44,19 +44,19 @@ namespace obutils
{
ObResourcePoolProcessor
g_rp_processor
;
const
static
char
*
CHEK_CLUSTER_NAME_SQL
=
const
static
char
*
CHEK_CLUSTER_NAME_SQL
=
"SELECT /*+READ_CONSISTENCY(WEAK)*/ cluster FROM oceanbase.%s LIMIT 1"
;
const
static
char
*
CHEK_CLUSTER_ROLE_SQL
=
const
static
char
*
CHEK_CLUSTER_ROLE_SQL
=
"SELECT /*+READ_CONSISTENCY(WEAK)*/ cluster_role, cluster_status FROM oceanbase.%s LIMIT 1"
;
const
static
char
*
OBPROXY_V_DATABASE_TNAME
=
"v$ob_cluster"
;
const
static
char
*
INIT_SS_INFO_SQL
=
const
static
char
*
INIT_SS_INFO_SQL
=
"SELECT /*+READ_CONSISTENCY(WEAK)*/ *, zs.status AS zone_status, ss.status AS server_status "
"FROM oceanbase.%s zs, oceanbase.%s ss "
"WHERE zs.zone=ss.zone "
"AND ss.svr_port > 0 LIMIT %ld;"
;
const
static
char
*
PRIMARY_ROLE
=
"PRIMARY"
;
const
static
char
*
ROLE_VALID
=
"VALID"
;
const
static
char
*
PRIMARY_ROLE
=
"PRIMARY"
;
const
static
char
*
ROLE_VALID
=
"VALID"
;
//-------ObClusterInfoKey------
DEF_TO_STRING
(
ObClusterInfoKey
)
...
...
src/obproxy/obutils/ob_server_state_processor.cpp
浏览文件 @
4f40b15c
...
...
@@ -40,7 +40,7 @@ namespace obproxy
namespace
obutils
{
static
const
char
*
SELECT_ZONE_STATE_INFO_SQL
=
static
const
char
*
SELECT_ZONE_STATE_INFO_SQL
=
//zone, is_merging, status, region
"SELECT /*+READ_CONSISTENCY(WEAK)*/ * "
"FROM oceanbase.%s LIMIT %ld"
;
...
...
@@ -48,19 +48,19 @@ static const char *SELECT_ZONE_STATE_INFO_SQL =
//when server fail to start, its status is inactive, but its port == 0.
//it is design defect, but proxy need compatible with it.
//so select svr_port > 0 one
const
static
char
*
SELECT_SERVER_STATE_INFO_SQL
=
const
static
char
*
SELECT_SERVER_STATE_INFO_SQL
=
"SELECT /*+READ_CONSISTENCY(WEAK)*/ svr_ip, svr_port, zone, status, start_service_time, stop_time "
"FROM oceanbase.%s "
"WHERE svr_port > 0 ORDER BY zone LIMIT %ld"
;
const
static
char
*
SELECT_CLUSTER_ROEL_SQL
=
const
static
char
*
SELECT_CLUSTER_ROEL_SQL
=
"SELECT /*+READ_CONSISTENCY(WEAK)*/ cluster_role, cluster_status, primary_cluster_id "
"FROM oceanbase.v$ob_cluster LIMIT 1"
;
const
static
char
*
SYS_LDG_INFO_SQL
=
const
static
char
*
SYS_LDG_INFO_SQL
=
"SELECT TENANT_ID, TENANT_NAME, CLUSTER_ID, CLUSTER_NAME, LDG_ROLE "
"FROM oceanbase.ldg_standby_status"
;
const
static
char
*
SELECT_ALL_TENANT_SQL
=
const
static
char
*
SELECT_ALL_TENANT_SQL
=
"SELECT /*+READ_CONSISTENCY(WEAK)*/ tenant_name, locality FROM oceanbase.__all_tenant "
"where previous_locality = '' and tenant_id != 1"
;
...
...
src/obproxy/proxy/client/ob_client_vc.cpp
浏览文件 @
4f40b15c
...
...
@@ -33,10 +33,10 @@ namespace proxy
enum
{
CLIENT_MAGIC_ALIVE
=
0xAABBCCDD
,
CLIENT_MAGIC_DEAD
=
0xDDCCBBAA
CLIENT_MAGIC_DEAD
=
0xDDCCBBAA
};
static
int64_t
const
MYSQL_BUFFER_SIZE
=
BUFFER_SIZE_FOR_INDEX
(
BUFFER_SIZE_INDEX_8K
);
static
int64_t
const
MYSQL_BUFFER_SIZE
=
BUFFER_SIZE_FOR_INDEX
(
BUFFER_SIZE_INDEX_8K
);
static
int64_t
const
RESCHEDULE_GET_NETHANDLER_LOCK_INTERVAL
=
HRTIME_MSECONDS
(
1
);
// 1ms
ObClientVC
::
ObClientVC
(
ObMysqlClient
&
client_core
)
...
...
src/obproxy/proxy/mysql/ob_mysql_sm.h
浏览文件 @
4f40b15c
...
...
@@ -59,7 +59,7 @@ namespace proxy
// from the observer since we want to get as much of the
// document as possible on the first read Marco benchmarked
// about 3% ops/second improvement using the larger buffer size
static
int64_t
const
MYSQL_BUFFER_SIZE
=
BUFFER_SIZE_FOR_INDEX
(
BUFFER_SIZE_INDEX_8K
);
static
int64_t
const
MYSQL_BUFFER_SIZE
=
BUFFER_SIZE_FOR_INDEX
(
BUFFER_SIZE_INDEX_8K
);
static
const
int64_t
MYSQL_SM_LIST_BUCKETS
=
64
;
class
ObMysqlServerSession
;
...
...
@@ -67,7 +67,7 @@ class ObMysqlServerSession;
enum
ObMysqlSMMagic
{
MYSQL_SM_MAGIC_ALIVE
=
0x0000FEED
,
MYSQL_SM_MAGIC_DEAD
=
0xDEADFEED
MYSQL_SM_MAGIC_DEAD
=
0xDEADFEED
};
struct
ObStreamSizeStat
...
...
src/obproxy/proxy/mysqllib/ob_mysql_common_define.h
浏览文件 @
4f40b15c
...
...
@@ -23,13 +23,13 @@ namespace obproxy
namespace
proxy
{
static
const
uint32_t
MYSQL_NET_HEADER_LENGTH
=
4
;
// standard header size
static
const
uint32_t
MYSQL_PAYLOAD_LENGTH_LENGTH
=
3
;
// standard payload length size
static
const
int64_t
MYSQL_COMP_HEADER_LENGTH
=
3
;
// compression header extra size
static
const
int64_t
MYSQL_NET_TYPE_LENGTH
=
1
;
// packet type size
static
const
int64_t
MYSQL_PS_EXECUTE_HEADER_LENGTH
=
9
;
// ps packet header size: stmt_id + flag + iteration-count
static
const
uint32_t
MYSQL_NET_HEADER_LENGTH
=
4
;
// standard header size
static
const
uint32_t
MYSQL_PAYLOAD_LENGTH_LENGTH
=
3
;
// standard payload length size
static
const
int64_t
MYSQL_COMP_HEADER_LENGTH
=
3
;
// compression header extra size
static
const
int64_t
MYSQL_NET_TYPE_LENGTH
=
1
;
// packet type size
static
const
int64_t
MYSQL_PS_EXECUTE_HEADER_LENGTH
=
9
;
// ps packet header size: stmt_id + flag + iteration-count
// mysql meta info include mysql header and mysql request type
static
const
int64_t
MYSQL_NET_META_LENGTH
=
MYSQL_NET_TYPE_LENGTH
+
MYSQL_NET_HEADER_LENGTH
;
static
const
int64_t
MYSQL_NET_META_LENGTH
=
MYSQL_NET_TYPE_LENGTH
+
MYSQL_NET_HEADER_LENGTH
;
// compressed packet
// The header looks like:
...
...
@@ -37,29 +37,29 @@ static const int64_t MYSQL_NET_META_LENGTH = MYSQL_NET_TYPE_LENGTH + MYSQL_NET_H
// 3 length of compressed payload
// 1 compressed sequence id
// 3 length of payload before compression
static
const
int64_t
MYSQL_COMPRESSED_HEALDER_LENGTH
=
7
;
static
const
int64_t
MYSQL_COMPRESSED_HEALDER_LENGTH
=
7
;
static
const
int64_t
MYSQL_PACKET_MAX_LENGTH
=
0xFFFFFF
;
static
const
int64_t
MYSQL_PAYLOAD_MAX_LENGTH
=
(
MYSQL_PACKET_MAX_LENGTH
-
1
);
static
const
int64_t
MYSQL_SHORT_PACKET_MAX_LENGTH
=
2048
;
//for ok, eof
static
const
int64_t
MYSQL_PACKET_MAX_LENGTH
=
0xFFFFFF
;
static
const
int64_t
MYSQL_PAYLOAD_MAX_LENGTH
=
(
MYSQL_PACKET_MAX_LENGTH
-
1
);
static
const
int64_t
MYSQL_SHORT_PACKET_MAX_LENGTH
=
2048
;
//for ok, eof
//for hello pkt, the first pkt send by observer or mysql
static
const
int64_t
MYSQL_HELLO_PKT_MAX_LEN
=
1024
;
static
const
int64_t
MYSQL_OK_PACKET_TYPE
=
0x00
;
static
const
int64_t
MYSQL_ERR_PACKET_TYPE
=
0xFF
;
static
const
int64_t
MYSQL_HELLO_PKT_MAX_LEN
=
1024
;
static
const
int64_t
MYSQL_OK_PACKET_TYPE
=
0x00
;
static
const
int64_t
MYSQL_ERR_PACKET_TYPE
=
0xFF
;
//the EOF packet may appear in places where a Protocol::LengthEncodedInteger
//may appear. You must check whether the packet length is less than 9 to
//make sure that it is a EOF packet.
static
const
int64_t
MYSQL_EOF_PACKET_TYPE
=
0xFE
;
static
const
int64_t
MYSQL_LOCAL_INFILE_TYPE
=
0xFB
;
static
const
int64_t
MYSQL_HANDSHAKE_PACKET_TYPE
=
0x0A
;
static
const
int64_t
MYSQL_EOF_PACKET_TYPE
=
0xFE
;
static
const
int64_t
MYSQL_LOCAL_INFILE_TYPE
=
0xFB
;
static
const
int64_t
MYSQL_HANDSHAKE_PACKET_TYPE
=
0x0A
;
//-----------------------------------oceanbase 2.0 c/s protocol----------------------//
static
const
uint16_t
OB20_PROTOCOL_MAGIC_NUM
=
0x20AB
;
static
const
int64_t
OB20_PROTOCOL_HEADER_LENGTH
=
24
;
static
const
int32_t
OB20_PROTOCOL_TAILER_LENGTH
=
4
;
// for CRC32
static
const
int64_t
OB20_PROTOCOL_HEADER_TAILER_LENGTH
=
OB20_PROTOCOL_HEADER_LENGTH
+
OB20_PROTOCOL_TAILER_LENGTH
;
static
const
int32_t
OB20_PROTOCOL_EXTRA_INFO_LENGTH
=
4
;
// for the length of extra info
static
const
int16_t
OB20_PROTOCOL_VERSION_VALUE
=
20
;
static
const
uint16_t
OB20_PROTOCOL_MAGIC_NUM
=
0x20AB
;
static
const
int64_t
OB20_PROTOCOL_HEADER_LENGTH
=
24
;
static
const
int32_t
OB20_PROTOCOL_TAILER_LENGTH
=
4
;
// for CRC32
static
const
int64_t
OB20_PROTOCOL_HEADER_TAILER_LENGTH
=
OB20_PROTOCOL_HEADER_LENGTH
+
OB20_PROTOCOL_TAILER_LENGTH
;
static
const
int32_t
OB20_PROTOCOL_EXTRA_INFO_LENGTH
=
4
;
// for the length of extra info
static
const
int16_t
OB20_PROTOCOL_VERSION_VALUE
=
20
;
static
const
int64_t
MYSQL_COMPRESSED_OB20_HEALDER_LENGTH
=
MYSQL_COMPRESSED_HEALDER_LENGTH
+
OB20_PROTOCOL_HEADER_LENGTH
;
// one of those types indicates that one mysql cmd response is finished
...
...
src/obproxy/proxy/mysqllib/ob_proxy_session_info_handler.cpp
浏览文件 @
4f40b15c
...
...
@@ -37,7 +37,7 @@ namespace obproxy
namespace
proxy
{
const
ObString
PROXY_IDC_NAME_USER_SESSION_VAR
=
common
::
ObString
::
make_string
(
"proxy_idc_name"
);
const
ObString
PROXY_IDC_NAME_USER_SESSION_VAR
=
common
::
ObString
::
make_string
(
"proxy_idc_name"
);
const
ObString
PROXY_ROUTE_POLICY_USER_SESSION_VAR
=
common
::
ObString
::
make_string
(
"proxy_route_policy"
);
int
ObProxySessionInfoHandler
::
analyze_extra_ok_packet
(
ObIOBufferReader
&
reader
,
...
...
src/obproxy/proxy/route/ob_ldc_struct.h
浏览文件 @
4f40b15c
...
...
@@ -35,53 +35,53 @@ const common::ObString get_idc_type_string(const ObIDCType type);
* |--- n bits ---|--- 2 bits ---|--- 2 bits ---|--- 2 bits ---|--- 2 bits ---|--- 2 bits ---| LSB
* | new attribute |-- role type --|-- pl status --| zone type | merge status | IDC | LSB
*/
static
const
int64_t
MERGE_BITS_SHIFT
=
2
;
static
const
int64_t
ZONE_TYPE_BITS_SHIFT
=
4
;
static
const
int64_t
PARTITION_BITS_SHIFT
=
6
;
static
const
int64_t
ROLE_TYPE_BITS_SHIFT
=
8
;
static
const
int64_t
MERGE_BITS_SHIFT
=
2
;
static
const
int64_t
ZONE_TYPE_BITS_SHIFT
=
4
;
static
const
int64_t
PARTITION_BITS_SHIFT
=
6
;
static
const
int64_t
ROLE_TYPE_BITS_SHIFT
=
8
;
static
const
int64_t
NEW_ATTRIBUTE_BITS_SHIFT
=
10
;
static
const
int64_t
IN_SAME_IDC
=
static_cast
<
int64_t
>
(
SAME_IDC
);
//LOCAL
static
const
int64_t
IN_SAME_REGION
=
static_cast
<
int64_t
>
(
SAME_REGION
);
//REGION
static
const
int64_t
IN_OTHER_REGION
=
static_cast
<
int64_t
>
(
OTHER_REGION
);
//REMOTE
static
const
int64_t
UNKNOWN_REGION
=
static_cast
<
int64_t
>
(
MAX_IDC_TYPE
);
//UNKNOWN
static
const
int64_t
IN_UNMERGING
=
0
<<
MERGE_BITS_SHIFT
;
//UNMERGE
static
const
int64_t
IN_MERGING
=
1
<<
MERGE_BITS_SHIFT
;
//MERGE
static
const
int64_t
UNKNOWN_MERGE_STATUS
=
3
<<
MERGE_BITS_SHIFT
;
//UNKNOWN
static
const
int64_t
IS_READWRITE_ZONE
=
0
<<
ZONE_TYPE_BITS_SHIFT
;
//READWRITE
static
const
int64_t
IS_READONLY_ZONE
=
1
<<
ZONE_TYPE_BITS_SHIFT
;
//READONLY
static
const
int64_t
UNKNOWN_ZONE_TYPE
=
3
<<
ZONE_TYPE_BITS_SHIFT
;
//UNKNOWN
static
const
int64_t
WITH_PARTITION_TYPE
=
0
<<
PARTITION_BITS_SHIFT
;
//PARTITION
static
const
int64_t
WITHOUT_PARTITION_TYPE
=
1
<<
PARTITION_BITS_SHIFT
;
//NONPARTITION
static
const
int64_t
UNKNOWN_PARTITION_TYPE
=
3
<<
PARTITION_BITS_SHIFT
;
//UNKNOWN
static
const
int64_t
IS_FOLLOWER
=
0
<<
ROLE_TYPE_BITS_SHIFT
;
//FOLLOWER
static
const
int64_t
IS_LEADER
=
1
<<
ROLE_TYPE_BITS_SHIFT
;
//LEADER
static
const
int64_t
UNKNOWN_ROLE
=
3
<<
ROLE_TYPE_BITS_SHIFT
;
//UNKNOWN
static
const
int64_t
MAX_IDC_VALUE
=
((
1
<<
MERGE_BITS_SHIFT
)
-
1
);
//0x0011
static
const
int64_t
MAX_MERGE_VALUE
=
(((
1
<<
(
ZONE_TYPE_BITS_SHIFT
-
MERGE_BITS_SHIFT
))
-
1
)
<<
MERGE_BITS_SHIFT
);
//0x01100
static
const
int64_t
MAX_ZONE_TYPE_VALUE
=
(((
1
<<
(
PARTITION_BITS_SHIFT
-
ZONE_TYPE_BITS_SHIFT
))
-
1
)
<<
ZONE_TYPE_BITS_SHIFT
);
//0x0011 0000
static
const
int64_t
IN_SAME_IDC
=
static_cast
<
int64_t
>
(
SAME_IDC
);
//LOCAL
static
const
int64_t
IN_SAME_REGION
=
static_cast
<
int64_t
>
(
SAME_REGION
);
//REGION
static
const
int64_t
IN_OTHER_REGION
=
static_cast
<
int64_t
>
(
OTHER_REGION
);
//REMOTE
static
const
int64_t
UNKNOWN_REGION
=
static_cast
<
int64_t
>
(
MAX_IDC_TYPE
);
//UNKNOWN
static
const
int64_t
IN_UNMERGING
=
0
<<
MERGE_BITS_SHIFT
;
//UNMERGE
static
const
int64_t
IN_MERGING
=
1
<<
MERGE_BITS_SHIFT
;
//MERGE
static
const
int64_t
UNKNOWN_MERGE_STATUS
=
3
<<
MERGE_BITS_SHIFT
;
//UNKNOWN
static
const
int64_t
IS_READWRITE_ZONE
=
0
<<
ZONE_TYPE_BITS_SHIFT
;
//READWRITE
static
const
int64_t
IS_READONLY_ZONE
=
1
<<
ZONE_TYPE_BITS_SHIFT
;
//READONLY
static
const
int64_t
UNKNOWN_ZONE_TYPE
=
3
<<
ZONE_TYPE_BITS_SHIFT
;
//UNKNOWN
static
const
int64_t
WITH_PARTITION_TYPE
=
0
<<
PARTITION_BITS_SHIFT
;
//PARTITION
static
const
int64_t
WITHOUT_PARTITION_TYPE
=
1
<<
PARTITION_BITS_SHIFT
;
//NONPARTITION
static
const
int64_t
UNKNOWN_PARTITION_TYPE
=
3
<<
PARTITION_BITS_SHIFT
;
//UNKNOWN
static
const
int64_t
IS_FOLLOWER
=
0
<<
ROLE_TYPE_BITS_SHIFT
;
//FOLLOWER
static
const
int64_t
IS_LEADER
=
1
<<
ROLE_TYPE_BITS_SHIFT
;
//LEADER
static
const
int64_t
UNKNOWN_ROLE
=
3
<<
ROLE_TYPE_BITS_SHIFT
;
//UNKNOWN
static
const
int64_t
MAX_IDC_VALUE
=
((
1
<<
MERGE_BITS_SHIFT
)
-
1
);
//0x0011
static
const
int64_t
MAX_MERGE_VALUE
=
(((
1
<<
(
ZONE_TYPE_BITS_SHIFT
-
MERGE_BITS_SHIFT
))
-
1
)
<<
MERGE_BITS_SHIFT
);
//0x01100
static
const
int64_t
MAX_ZONE_TYPE_VALUE
=
(((
1
<<
(
PARTITION_BITS_SHIFT
-
ZONE_TYPE_BITS_SHIFT
))
-
1
)
<<
ZONE_TYPE_BITS_SHIFT
);
//0x0011 0000
static
const
int64_t
MAX_PARTITION_TYPE_VALUE
=
(((
1
<<
(
ROLE_TYPE_BITS_SHIFT
-
PARTITION_BITS_SHIFT
))
-
1
)
<<
PARTITION_BITS_SHIFT
);
//0x1100 0000
static
const
int64_t
MAX_ROLE_TYPE_VALUE
=
(((
1
<<
(
NEW_ATTRIBUTE_BITS_SHIFT
-
ROLE_TYPE_BITS_SHIFT
))
-
1
)
<<
ROLE_TYPE_BITS_SHIFT
);
//0x0011 0000 0000
static
const
int64_t
MAX_ROLE_TYPE_VALUE
=
(((
1
<<
(
NEW_ATTRIBUTE_BITS_SHIFT
-
ROLE_TYPE_BITS_SHIFT
))
-
1
)
<<
ROLE_TYPE_BITS_SHIFT
);
//0x0011 0000 0000
enum
ObRouteType
{
ROUTE_TYPE_PARTITION_READWRITE_UNMERGE_LOCAL
=
(
UNKNOWN_ROLE
|
WITH_PARTITION_TYPE
|
IS_READWRITE_ZONE
|
IN_UNMERGING
|
IN_SAME_IDC
),
// 768
ROUTE_TYPE_PARTITION_READWRITE_UNMERGE_REGION
=
(
UNKNOWN_ROLE
|
WITH_PARTITION_TYPE
|
IS_READWRITE_ZONE
|
IN_UNMERGING
|
IN_SAME_REGION
),
// 769
ROUTE_TYPE_PARTITION_READWRITE_UNMERGE_REMOTE
=
(
UNKNOWN_ROLE
|
WITH_PARTITION_TYPE
|
IS_READWRITE_ZONE
|
IN_UNMERGING
|
IN_OTHER_REGION
),
// 770
ROUTE_TYPE_PARTITION_READWRITE_MERGE_LOCAL
=
(
UNKNOWN_ROLE
|
WITH_PARTITION_TYPE
|
IS_READWRITE_ZONE
|
IN_MERGING
|
IN_SAME_IDC
),
// 772
ROUTE_TYPE_PARTITION_READWRITE_MERGE_REGION
=
(
UNKNOWN_ROLE
|
WITH_PARTITION_TYPE
|
IS_READWRITE_ZONE
|
IN_MERGING
|
IN_SAME_REGION
),
// 723
ROUTE_TYPE_PARTITION_READWRITE_MERGE_REMOTE
=
(
UNKNOWN_ROLE
|
WITH_PARTITION_TYPE
|
IS_READWRITE_ZONE
|
IN_MERGING
|
IN_OTHER_REGION
),
// 724
ROUTE_TYPE_PARTITION_READONLY_UNMERGE_LOCAL
=
(
UNKNOWN_ROLE
|
WITH_PARTITION_TYPE
|
IS_READONLY_ZONE
|
IN_UNMERGING
|
IN_SAME_IDC
),
// 784
ROUTE_TYPE_PARTITION_READONLY_UNMERGE_REGION
=
(
UNKNOWN_ROLE
|
WITH_PARTITION_TYPE
|
IS_READONLY_ZONE
|
IN_UNMERGING
|
IN_SAME_REGION
),
// 785
ROUTE_TYPE_PARTITION_READONLY_UNMERGE_REMOTE
=
(
UNKNOWN_ROLE
|
WITH_PARTITION_TYPE
|
IS_READONLY_ZONE
|
IN_UNMERGING
|
IN_OTHER_REGION
),
// 786
ROUTE_TYPE_PARTITION_READONLY_MERGE_LOCAL
=
(
UNKNOWN_ROLE
|
WITH_PARTITION_TYPE
|
IS_READONLY_ZONE
|
IN_MERGING
|
IN_SAME_IDC
),
// 788
ROUTE_TYPE_PARTITION_READONLY_MERGE_REGION
=
(
UNKNOWN_ROLE
|
WITH_PARTITION_TYPE
|
IS_READONLY_ZONE
|
IN_MERGING
|
IN_SAME_REGION
),
// 789
ROUTE_TYPE_PARTITION_READONLY_MERGE_REMOTE
=
(
UNKNOWN_ROLE
|
WITH_PARTITION_TYPE
|
IS_READONLY_ZONE
|
IN_MERGING
|
IN_OTHER_REGION
),
// 790
ROUTE_TYPE_PARTITION_READWRITE_UNMERGE_LOCAL
=
(
UNKNOWN_ROLE
|
WITH_PARTITION_TYPE
|
IS_READWRITE_ZONE
|
IN_UNMERGING
|
IN_SAME_IDC
),
// 768
ROUTE_TYPE_PARTITION_READWRITE_UNMERGE_REGION
=
(
UNKNOWN_ROLE
|
WITH_PARTITION_TYPE
|
IS_READWRITE_ZONE
|
IN_UNMERGING
|
IN_SAME_REGION
),
// 769
ROUTE_TYPE_PARTITION_READWRITE_UNMERGE_REMOTE
=
(
UNKNOWN_ROLE
|
WITH_PARTITION_TYPE
|
IS_READWRITE_ZONE
|
IN_UNMERGING
|
IN_OTHER_REGION
),
// 770
ROUTE_TYPE_PARTITION_READWRITE_MERGE_LOCAL
=
(
UNKNOWN_ROLE
|
WITH_PARTITION_TYPE
|
IS_READWRITE_ZONE
|
IN_MERGING
|
IN_SAME_IDC
),
// 772
ROUTE_TYPE_PARTITION_READWRITE_MERGE_REGION
=
(
UNKNOWN_ROLE
|
WITH_PARTITION_TYPE
|
IS_READWRITE_ZONE
|
IN_MERGING
|
IN_SAME_REGION
),
// 723
ROUTE_TYPE_PARTITION_READWRITE_MERGE_REMOTE
=
(
UNKNOWN_ROLE
|
WITH_PARTITION_TYPE
|
IS_READWRITE_ZONE
|
IN_MERGING
|
IN_OTHER_REGION
),
// 724
ROUTE_TYPE_PARTITION_READONLY_UNMERGE_LOCAL
=
(
UNKNOWN_ROLE
|
WITH_PARTITION_TYPE
|
IS_READONLY_ZONE
|
IN_UNMERGING
|
IN_SAME_IDC
),
// 784
ROUTE_TYPE_PARTITION_READONLY_UNMERGE_REGION
=
(
UNKNOWN_ROLE
|
WITH_PARTITION_TYPE
|
IS_READONLY_ZONE
|
IN_UNMERGING
|
IN_SAME_REGION
),
// 785
ROUTE_TYPE_PARTITION_READONLY_UNMERGE_REMOTE
=
(
UNKNOWN_ROLE
|
WITH_PARTITION_TYPE
|
IS_READONLY_ZONE
|
IN_UNMERGING
|
IN_OTHER_REGION
),
// 786
ROUTE_TYPE_PARTITION_READONLY_MERGE_LOCAL
=
(
UNKNOWN_ROLE
|
WITH_PARTITION_TYPE
|
IS_READONLY_ZONE
|
IN_MERGING
|
IN_SAME_IDC
),
// 788
ROUTE_TYPE_PARTITION_READONLY_MERGE_REGION
=
(
UNKNOWN_ROLE
|
WITH_PARTITION_TYPE
|
IS_READONLY_ZONE
|
IN_MERGING
|
IN_SAME_REGION
),
// 789
ROUTE_TYPE_PARTITION_READONLY_MERGE_REMOTE
=
(
UNKNOWN_ROLE
|
WITH_PARTITION_TYPE
|
IS_READONLY_ZONE
|
IN_MERGING
|
IN_OTHER_REGION
),
// 790
ROUTE_TYPE_NONPARTITION_READWRITE_UNMERGE_LOCAL
=
(
UNKNOWN_ROLE
|
WITHOUT_PARTITION_TYPE
|
IS_READWRITE_ZONE
|
IN_UNMERGING
|
IN_SAME_IDC
),
// 832
ROUTE_TYPE_NONPARTITION_READWRITE_UNMERGE_REGION
=
(
UNKNOWN_ROLE
|
WITHOUT_PARTITION_TYPE
|
IS_READWRITE_ZONE
|
IN_UNMERGING
|
IN_SAME_REGION
),
// 833
...
...
@@ -97,37 +97,37 @@ enum ObRouteType
ROUTE_TYPE_NONPARTITION_READONLY_MERGE_REGION
=
(
UNKNOWN_ROLE
|
WITHOUT_PARTITION_TYPE
|
IS_READONLY_ZONE
|
IN_MERGING
|
IN_SAME_REGION
),
// 853
ROUTE_TYPE_NONPARTITION_READONLY_MERGE_REMOTE
=
(
UNKNOWN_ROLE
|
WITHOUT_PARTITION_TYPE
|
IS_READONLY_ZONE
|
IN_MERGING
|
IN_OTHER_REGION
),
// 854
ROUTE_TYPE_PARTITION_UNMERGE_LOCAL
=
(
UNKNOWN_ROLE
|
WITH_PARTITION_TYPE
|
UNKNOWN_ZONE_TYPE
|
IN_UNMERGING
|
IN_SAME_IDC
),
// 816
ROUTE_TYPE_PARTITION_UNMERGE_REGION
=
(
UNKNOWN_ROLE
|
WITH_PARTITION_TYPE
|
UNKNOWN_ZONE_TYPE
|
IN_UNMERGING
|
IN_SAME_REGION
),
// 817
ROUTE_TYPE_PARTITION_UNMERGE_REMOTE
=
(
UNKNOWN_ROLE
|
WITH_PARTITION_TYPE
|
UNKNOWN_ZONE_TYPE
|
IN_UNMERGING
|
IN_OTHER_REGION
),
// 818
ROUTE_TYPE_PARTITION_MERGE_LOCAL
=
(
UNKNOWN_ROLE
|
WITH_PARTITION_TYPE
|
UNKNOWN_ZONE_TYPE
|
IN_MERGING
|
IN_SAME_IDC
),
// 820
ROUTE_TYPE_PARTITION_MERGE_REGION
=
(
UNKNOWN_ROLE
|
WITH_PARTITION_TYPE
|
UNKNOWN_ZONE_TYPE
|
IN_MERGING
|
IN_SAME_REGION
),
// 821
ROUTE_TYPE_PARTITION_MERGE_REMOTE
=
(
UNKNOWN_ROLE
|
WITH_PARTITION_TYPE
|
UNKNOWN_ZONE_TYPE
|
IN_MERGING
|
IN_OTHER_REGION
),
// 822
ROUTE_TYPE_NONPARTITION_UNMERGE_LOCAL
=
(
UNKNOWN_ROLE
|
WITHOUT_PARTITION_TYPE
|
UNKNOWN_ZONE_TYPE
|
IN_UNMERGING
|
IN_SAME_IDC
),
// 880
ROUTE_TYPE_NONPARTITION_UNMERGE_REGION
=
(
UNKNOWN_ROLE
|
WITHOUT_PARTITION_TYPE
|
UNKNOWN_ZONE_TYPE
|
IN_UNMERGING
|
IN_SAME_REGION
),
// 881
ROUTE_TYPE_NONPARTITION_UNMERGE_REMOTE
=
(
UNKNOWN_ROLE
|
WITHOUT_PARTITION_TYPE
|
UNKNOWN_ZONE_TYPE
|
IN_UNMERGING
|
IN_OTHER_REGION
),
// 882
ROUTE_TYPE_NONPARTITION_MERGE_LOCAL
=
(
UNKNOWN_ROLE
|
WITHOUT_PARTITION_TYPE
|
UNKNOWN_ZONE_TYPE
|
IN_MERGING
|
IN_SAME_IDC
),
// 884
ROUTE_TYPE_NONPARTITION_MERGE_REGION
=
(
UNKNOWN_ROLE
|
WITHOUT_PARTITION_TYPE
|
UNKNOWN_ZONE_TYPE
|
IN_MERGING
|
IN_SAME_REGION
),
// 885
ROUTE_TYPE_NONPARTITION_MERGE_REMOTE
=
(
UNKNOWN_ROLE
|
WITHOUT_PARTITION_TYPE
|
UNKNOWN_ZONE_TYPE
|
IN_MERGING
|
IN_OTHER_REGION
),
// 886
ROUTE_TYPE_LEADER
=
(
IS_LEADER
|
WITH_PARTITION_TYPE
|
MAX_ZONE_TYPE_VALUE
|
MAX_MERGE_VALUE
|
MAX_IDC_VALUE
),
// 319
ROUTE_TYPE_FOLLOWER_PARTITION_UNMERGE_LOCAL
=
(
IS_FOLLOWER
|
WITH_PARTITION_TYPE
|
UNKNOWN_ZONE_TYPE
|
IN_UNMERGING
|
IN_SAME_IDC
),
// 48
ROUTE_TYPE_FOLLOWER_PARTITION_UNMERGE_REGION
=
(
IS_FOLLOWER
|
WITH_PARTITION_TYPE
|
UNKNOWN_ZONE_TYPE
|
IN_UNMERGING
|
IN_SAME_REGION
),
// 49
ROUTE_TYPE_FOLLOWER_PARTITION_UNMERGE_REMOTE
=
(
IS_FOLLOWER
|
WITH_PARTITION_TYPE
|
UNKNOWN_ZONE_TYPE
|
IN_UNMERGING
|
IN_OTHER_REGION
),
// 50
ROUTE_TYPE_FOLLOWER_PARTITION_MERGE_LOCAL
=
(
IS_FOLLOWER
|
WITH_PARTITION_TYPE
|
UNKNOWN_ZONE_TYPE
|
IN_MERGING
|
IN_SAME_IDC
),
// 52
ROUTE_TYPE_FOLLOWER_PARTITION_MERGE_REGION
=
(
IS_FOLLOWER
|
WITH_PARTITION_TYPE
|
UNKNOWN_ZONE_TYPE
|
IN_MERGING
|
IN_SAME_REGION
),
// 53
ROUTE_TYPE_FOLLOWER_PARTITION_MERGE_REMOTE
=
(
IS_FOLLOWER
|
WITH_PARTITION_TYPE
|
UNKNOWN_ZONE_TYPE
|
IN_MERGING
|
IN_OTHER_REGION
),
// 54
ROUTE_TYPE_LEADER_PARTITION_UNMERGE_LOCAL
=
(
IS_LEADER
|
WITH_PARTITION_TYPE
|
UNKNOWN_ZONE_TYPE
|
IN_UNMERGING
|
IN_SAME_IDC
),
// 304
ROUTE_TYPE_LEADER_PARTITION_UNMERGE_REGION
=
(
IS_LEADER
|
WITH_PARTITION_TYPE
|
UNKNOWN_ZONE_TYPE
|
IN_UNMERGING
|
IN_SAME_REGION
),
// 305
ROUTE_TYPE_LEADER_PARTITION_UNMERGE_REMOTE
=
(
IS_LEADER
|
WITH_PARTITION_TYPE
|
UNKNOWN_ZONE_TYPE
|
IN_UNMERGING
|
IN_OTHER_REGION
),
// 306
ROUTE_TYPE_LEADER_PARTITION_MERGE_LOCAL
=
(
IS_LEADER
|
WITH_PARTITION_TYPE
|
UNKNOWN_ZONE_TYPE
|
IN_MERGING
|
IN_SAME_IDC
),
// 308
ROUTE_TYPE_LEADER_PARTITION_MERGE_REGION
=
(
IS_LEADER
|
WITH_PARTITION_TYPE
|
UNKNOWN_ZONE_TYPE
|
IN_MERGING
|
IN_SAME_REGION
),
// 309
ROUTE_TYPE_LEADER_PARTITION_MERGE_REMOTE
=
(
IS_LEADER
|
WITH_PARTITION_TYPE
|
UNKNOWN_ZONE_TYPE
|
IN_MERGING
|
IN_OTHER_REGION
),
// 310
ROUTE_TYPE_MAX
=
(
MAX_ROLE_TYPE_VALUE
|
MAX_PARTITION_TYPE_VALUE
|
MAX_ZONE_TYPE_VALUE
|
MAX_MERGE_VALUE
|
MAX_IDC_VALUE
),
//1023
ROUTE_TYPE_PARTITION_UNMERGE_LOCAL
=
(
UNKNOWN_ROLE
|
WITH_PARTITION_TYPE
|
UNKNOWN_ZONE_TYPE
|
IN_UNMERGING
|
IN_SAME_IDC
),
// 816
ROUTE_TYPE_PARTITION_UNMERGE_REGION
=
(
UNKNOWN_ROLE
|
WITH_PARTITION_TYPE
|
UNKNOWN_ZONE_TYPE
|
IN_UNMERGING
|
IN_SAME_REGION
),
// 817
ROUTE_TYPE_PARTITION_UNMERGE_REMOTE
=
(
UNKNOWN_ROLE
|
WITH_PARTITION_TYPE
|
UNKNOWN_ZONE_TYPE
|
IN_UNMERGING
|
IN_OTHER_REGION
),
// 818
ROUTE_TYPE_PARTITION_MERGE_LOCAL
=
(
UNKNOWN_ROLE
|
WITH_PARTITION_TYPE
|
UNKNOWN_ZONE_TYPE
|
IN_MERGING
|
IN_SAME_IDC
),
// 820
ROUTE_TYPE_PARTITION_MERGE_REGION
=
(
UNKNOWN_ROLE
|
WITH_PARTITION_TYPE
|
UNKNOWN_ZONE_TYPE
|
IN_MERGING
|
IN_SAME_REGION
),
// 821
ROUTE_TYPE_PARTITION_MERGE_REMOTE
=
(
UNKNOWN_ROLE
|
WITH_PARTITION_TYPE
|
UNKNOWN_ZONE_TYPE
|
IN_MERGING
|
IN_OTHER_REGION
),
// 822
ROUTE_TYPE_NONPARTITION_UNMERGE_LOCAL
=
(
UNKNOWN_ROLE
|
WITHOUT_PARTITION_TYPE
|
UNKNOWN_ZONE_TYPE
|
IN_UNMERGING
|
IN_SAME_IDC
),
// 880
ROUTE_TYPE_NONPARTITION_UNMERGE_REGION
=
(
UNKNOWN_ROLE
|
WITHOUT_PARTITION_TYPE
|
UNKNOWN_ZONE_TYPE
|
IN_UNMERGING
|
IN_SAME_REGION
),
// 881
ROUTE_TYPE_NONPARTITION_UNMERGE_REMOTE
=
(
UNKNOWN_ROLE
|
WITHOUT_PARTITION_TYPE
|
UNKNOWN_ZONE_TYPE
|
IN_UNMERGING
|
IN_OTHER_REGION
),
// 882
ROUTE_TYPE_NONPARTITION_MERGE_LOCAL
=
(
UNKNOWN_ROLE
|
WITHOUT_PARTITION_TYPE
|
UNKNOWN_ZONE_TYPE
|
IN_MERGING
|
IN_SAME_IDC
),
// 884
ROUTE_TYPE_NONPARTITION_MERGE_REGION
=
(
UNKNOWN_ROLE
|
WITHOUT_PARTITION_TYPE
|
UNKNOWN_ZONE_TYPE
|
IN_MERGING
|
IN_SAME_REGION
),
// 885
ROUTE_TYPE_NONPARTITION_MERGE_REMOTE
=
(
UNKNOWN_ROLE
|
WITHOUT_PARTITION_TYPE
|
UNKNOWN_ZONE_TYPE
|
IN_MERGING
|
IN_OTHER_REGION
),
// 886
ROUTE_TYPE_LEADER
=
(
IS_LEADER
|
WITH_PARTITION_TYPE
|
MAX_ZONE_TYPE_VALUE
|
MAX_MERGE_VALUE
|
MAX_IDC_VALUE
),
// 319
ROUTE_TYPE_FOLLOWER_PARTITION_UNMERGE_LOCAL
=
(
IS_FOLLOWER
|
WITH_PARTITION_TYPE
|
UNKNOWN_ZONE_TYPE
|
IN_UNMERGING
|
IN_SAME_IDC
),
// 48
ROUTE_TYPE_FOLLOWER_PARTITION_UNMERGE_REGION
=
(
IS_FOLLOWER
|
WITH_PARTITION_TYPE
|
UNKNOWN_ZONE_TYPE
|
IN_UNMERGING
|
IN_SAME_REGION
),
// 49
ROUTE_TYPE_FOLLOWER_PARTITION_UNMERGE_REMOTE
=
(
IS_FOLLOWER
|
WITH_PARTITION_TYPE
|
UNKNOWN_ZONE_TYPE
|
IN_UNMERGING
|
IN_OTHER_REGION
),
// 50
ROUTE_TYPE_FOLLOWER_PARTITION_MERGE_LOCAL
=
(
IS_FOLLOWER
|
WITH_PARTITION_TYPE
|
UNKNOWN_ZONE_TYPE
|
IN_MERGING
|
IN_SAME_IDC
),
// 52
ROUTE_TYPE_FOLLOWER_PARTITION_MERGE_REGION
=
(
IS_FOLLOWER
|
WITH_PARTITION_TYPE
|
UNKNOWN_ZONE_TYPE
|
IN_MERGING
|
IN_SAME_REGION
),
// 53
ROUTE_TYPE_FOLLOWER_PARTITION_MERGE_REMOTE
=
(
IS_FOLLOWER
|
WITH_PARTITION_TYPE
|
UNKNOWN_ZONE_TYPE
|
IN_MERGING
|
IN_OTHER_REGION
),
// 54
ROUTE_TYPE_LEADER_PARTITION_UNMERGE_LOCAL
=
(
IS_LEADER
|
WITH_PARTITION_TYPE
|
UNKNOWN_ZONE_TYPE
|
IN_UNMERGING
|
IN_SAME_IDC
),
// 304
ROUTE_TYPE_LEADER_PARTITION_UNMERGE_REGION
=
(
IS_LEADER
|
WITH_PARTITION_TYPE
|
UNKNOWN_ZONE_TYPE
|
IN_UNMERGING
|
IN_SAME_REGION
),
// 305
ROUTE_TYPE_LEADER_PARTITION_UNMERGE_REMOTE
=
(
IS_LEADER
|
WITH_PARTITION_TYPE
|
UNKNOWN_ZONE_TYPE
|
IN_UNMERGING
|
IN_OTHER_REGION
),
// 306
ROUTE_TYPE_LEADER_PARTITION_MERGE_LOCAL
=
(
IS_LEADER
|
WITH_PARTITION_TYPE
|
UNKNOWN_ZONE_TYPE
|
IN_MERGING
|
IN_SAME_IDC
),
// 308
ROUTE_TYPE_LEADER_PARTITION_MERGE_REGION
=
(
IS_LEADER
|
WITH_PARTITION_TYPE
|
UNKNOWN_ZONE_TYPE
|
IN_MERGING
|
IN_SAME_REGION
),
// 309
ROUTE_TYPE_LEADER_PARTITION_MERGE_REMOTE
=
(
IS_LEADER
|
WITH_PARTITION_TYPE
|
UNKNOWN_ZONE_TYPE
|
IN_MERGING
|
IN_OTHER_REGION
),
// 310
ROUTE_TYPE_MAX
=
(
MAX_ROLE_TYPE_VALUE
|
MAX_PARTITION_TYPE_VALUE
|
MAX_ZONE_TYPE_VALUE
|
MAX_MERGE_VALUE
|
MAX_IDC_VALUE
),
//1023
};
common
::
ObString
get_route_type_string
(
const
ObRouteType
type
);
...
...
src/obproxy/proxy/route/ob_route_utils.cpp
浏览文件 @
4f40b15c
...
...
@@ -46,23 +46,23 @@ namespace obproxy
namespace
proxy
{
static
const
char
PART_KEY_EXTRA_SEPARATOR
=
';'
;
static
const
char
PART_KEY_EXTRA_SEPARATOR
=
';'
;
static
const
char
*
PROXY_PLAIN_SCHEMA_SQL
=
static
const
char
*
PROXY_PLAIN_SCHEMA_SQL
=
//svr_ip, sql_port, table_id, role, part_num, replica_num, spare1
"SELECT /*+READ_CONSISTENCY(WEAK)%s*/ * "
"FROM oceanbase.%s "
"WHERE tenant_name = '%.*s' AND database_name = '%.*s' AND table_name = '%.*s' "
"AND partition_id = %ld "
"ORDER BY role ASC LIMIT %ld"
;
static
const
char
*
PROXY_TENANT_SCHEMA_SQL
=
static
const
char
*
PROXY_TENANT_SCHEMA_SQL
=
//svr_ip, sql_port, table_id, role, part_num, replica_num
"SELECT /*+READ_CONSISTENCY(WEAK)*/ * "
"FROM oceanbase.%s "
"WHERE tenant_name = '%.*s' AND database_name = '%.*s' AND table_name = '%.*s' AND sql_port > 0 "
"ORDER BY partition_id ASC, role ASC LIMIT %ld"
;
static
const
char
*
PROXY_PART_INFO_SQL
=
static
const
char
*
PROXY_PART_INFO_SQL
=
"SELECT /*+READ_CONSISTENCY(WEAK)*/ template_num, part_level, part_num, part_type, part_space, part_expr, "
"part_interval_bin, interval_start_bin, sub_part_num, sub_part_type, sub_part_space, "
"sub_part_expr, def_sub_part_interval_bin, def_sub_interval_start_bin, "
...
...
@@ -71,28 +71,28 @@ static const char *PROXY_PART_INFO_SQL =
"FROM oceanbase.%s "
"WHERE table_id = %lu LIMIT %d;"
;
static
const
char
*
PROXY_FIRST_PART_SQL
=
static
const
char
*
PROXY_FIRST_PART_SQL
=
"SELECT /*+READ_CONSISTENCY(WEAK)*/ part_id, part_name, high_bound_val_bin, sub_part_num "
"FROM oceanbase.%s "
"WHERE table_id = %lu LIMIT %ld;"
;
// observer 2.1.1 do not have high_bound_val_bin, so use two different sql
static
const
char
*
PROXY_HASH_FIRST_PART_SQL
=
static
const
char
*
PROXY_HASH_FIRST_PART_SQL
=
"SELECT /*+READ_CONSISTENCY(WEAK)*/ part_id, part_name, sub_part_num "
"FROM oceanbase.%s "
"WHERE table_id = %lu LIMIT %ld;"
;
static
const
char
*
PROXY_SUB_PART_SQL
=
static
const
char
*
PROXY_SUB_PART_SQL
=
"SELECT /*+READ_CONSISTENCY(WEAK)*/ part_id, sub_part_id, high_bound_val_bin "
"FROM oceanbase.%s "
"WHERE table_id = %lu and part_id = %ld LIMIT %ld;"
;
static
const
char
*
PROXY_NON_TEMPLATE_SUB_PART_SQL
=
static
const
char
*
PROXY_NON_TEMPLATE_SUB_PART_SQL
=
"SELECT /*+READ_CONSISTENCY(WEAK)*/ part_id, sub_part_id, high_bound_val_bin "
"FROM oceanbase.%s "
"WHERE table_id = %lu LIMIT %ld;"
;
static
const
char
*
PROXY_ROUTINE_SCHEMA_SQL
=
static
const
char
*
PROXY_ROUTINE_SCHEMA_SQL
=
"SELECT /*+READ_CONSISTENCY(WEAK)*/ * "
"FROM oceanbase.%s "
"WHERE tenant_name = '%.*s' AND database_name = '%.*s' AND table_name = '%.*s' "
...
...
src/obproxy/stat/ob_stat_processor.cpp
浏览文件 @
4f40b15c
...
...
@@ -64,23 +64,23 @@ struct ObSessionStatTableSync : public event::ObContinuation
};
ObStatProcessor
g_stat_processor
;
volatile
int64_t
g_current_report_count
=
0
;
volatile
int64_t
g_current_report_count
=
0
;
const
char
*
ObStatProcessor
::
INSERT_PROXY_STAT_SQL_HEAD
=
const
char
*
ObStatProcessor
::
INSERT_PROXY_STAT_SQL_HEAD
=
"INSERT INTO %s "
"(cluster_name, proxy_ip, proxy_port, session_id, stat_name, value, info) VALUES "
;
const
char
*
ObStatProcessor
::
ObStatProcessor
::
INSERT_PROXY_STAT_SQL_VALUES_AND_INFO
=
"('%s', '%s', %d, %ld, '%s', %ld, '%s'),"
;
const
char
*
ObStatProcessor
::
INSERT_PROXY_STAT_SQL_VALUES_AND_INFO_END
=
const
char
*
ObStatProcessor
::
INSERT_PROXY_STAT_SQL_VALUES_AND_INFO_END
=
"('%s', '%s', %d, %ld, '%s', %ld, '%s') "
"ON DUPLICATE KEY UPDATE value = VALUES(value), info=VALUES(info);
\n
"
;
const
char
*
ObStatProcessor
::
ObStatProcessor
::
INSERT_PROXY_STAT_SQL_VALUES
=
const
char
*
ObStatProcessor
::
ObStatProcessor
::
INSERT_PROXY_STAT_SQL_VALUES
=
"('%s', '%s', %d, %lu, '%s', %ld, ''),"
;
const
char
*
ObStatProcessor
::
INSERT_PROXY_STAT_SQL_VALUES_END
=
const
char
*
ObStatProcessor
::
INSERT_PROXY_STAT_SQL_VALUES_END
=
"('%s', '%s', %d, %lu, '%s', %ld, '') "
"ON DUPLICATE KEY UPDATE value = VALUES(value);
\n
"
;
...
...
src/obproxy/utils/ob_proxy_blowfish.cpp
浏览文件 @
4f40b15c
...
...
@@ -8,6 +8,25 @@
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
* See the Mulan PubL v2 for more details.
*
* *************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#define USING_LOG_PREFIX PROXY
...
...
@@ -21,63 +40,7 @@ namespace oceanbase
{
namespace
obproxy
{
const
char
*
ObBlowFish
::
ENC_KEY_BYTES_PROD_STR
=
"gQzLk5tTcGYlQ47GG29xQxfbHIURCheJ"
;
int
ObBlowFish
::
encode
(
char
*
in
,
const
int64_t
in_len
,
char
*
out
,
const
int64_t
out_len
)
{
int
ret
=
OB_SUCCESS
;
if
(
OB_ISNULL
(
in
)
||
OB_ISNULL
(
out
))
{
ret
=
OB_INVALID_ARGUMENT
;
LOG_WARN
(
"invalid argument"
,
K
(
in
),
K
(
out
),
K
(
in_len
),
K
(
out_len
),
K
(
ret
));
}
else
{
char
tmp_out
[
OB_MAX_PASSWORD_LENGTH
];
memset
(
tmp_out
,
0
,
sizeof
(
tmp_out
));
int64_t
in_str_len
=
strlen
(
in
);
int64_t
padding_len
=
BF_BLOCK
-
in_str_len
%
BF_BLOCK
;
if
(
OB_UNLIKELY
(
in_str_len
+
padding_len
>=
in_len
))
{
ret
=
OB_SIZE_OVERFLOW
;
LOG_WARN
(
"in buffer size is not enough"
,
K
(
padding_len
),
K
(
in
),
K
(
in_len
),
K
(
ret
));
}
else
{
for
(
int64_t
i
=
in_str_len
;
i
<
in_str_len
+
padding_len
;
++
i
)
{
in
[
i
]
=
static_cast
<
char
>
(
padding_len
);
}
if
(
OB_FAIL
(
do_bf_ecb_encrypt
(
reinterpret_cast
<
const
unsigned
char
*>
(
in
),
in_str_len
+
padding_len
,
reinterpret_cast
<
unsigned
char
*>
(
tmp_out
),
OB_MAX_PASSWORD_LENGTH
,
BF_ENCRYPT
)))
{
LOG_WARN
(
"fail to do bf ecb encrypt"
,
K
(
in
),
K
(
padding_len
),
K
(
ret
));
}
else
if
(
OB_FAIL
(
covert_string_to_hex
(
tmp_out
,
strlen
(
tmp_out
),
out
,
out_len
)))
{
LOG_WARN
(
"fail to convert str to hex"
,
K
(
ret
));
}
}
}
return
ret
;
}
int
ObBlowFish
::
decode
(
const
char
*
in
,
const
int64_t
in_str_len
,
char
*
out
,
const
int64_t
out_len
)
{
int
ret
=
OB_SUCCESS
;
if
(
OB_ISNULL
(
in
)
||
OB_ISNULL
(
out
))
{
ret
=
OB_INVALID_ARGUMENT
;
LOG_WARN
(
"invalid argument"
,
K
(
in
),
K
(
out
),
K
(
in_str_len
),
K
(
out_len
),
K
(
ret
));
}
else
{
char
tmp_out
[
OB_MAX_PASSWORD_LENGTH
];
memset
(
tmp_out
,
0
,
sizeof
(
tmp_out
));
int64_t
tmp_out_len
=
0
;
if
(
OB_FAIL
(
convert_large_str_to_hex
(
in
,
in_str_len
,
tmp_out
,
OB_MAX_PASSWORD_LENGTH
,
tmp_out_len
)))
{
}
else
if
(
OB_FAIL
(
do_bf_ecb_encrypt
(
reinterpret_cast
<
const
unsigned
char
*>
(
tmp_out
),
tmp_out_len
,
reinterpret_cast
<
unsigned
char
*>
(
out
),
out_len
,
BF_DECRYPT
)))
{
LOG_WARN
(
"fail to do bf ecn encrypt"
,
K
(
ret
));
}
else
{
// trim padding number
int64_t
result_len
=
strlen
(
out
);
if
(
out
[
result_len
-
1
]
>=
1
&&
out
[
result_len
-
1
]
<=
8
)
{
int64_t
padding_len
=
out
[
result_len
-
1
];
result_len
=
result_len
-
padding_len
;
memset
(
out
+
result_len
,
0
,
padding_len
);
}
}
}
return
ret
;
}
const
char
*
ObBlowFish
::
ENC_KEY_BYTES_PROD_STR
=
""
;
int
ObBlowFish
::
do_bf_ecb_encrypt
(
const
unsigned
char
*
in
,
const
int64_t
in_str_len
,
unsigned
char
*
out
,
const
int64_t
out_len
,
...
...
@@ -89,13 +52,16 @@ int ObBlowFish::do_bf_ecb_encrypt(const unsigned char *in, const int64_t in_str_
||
OB_UNLIKELY
(
in_str_len
>
out_len
)
||
OB_UNLIKELY
(
BF_ENCRYPT
!=
enc_mode
&&
BF_DECRYPT
!=
enc_mode
))
{
ret
=
OB_INVALID_ARGUMENT
;
LOG_WARN
(
"invalid argument"
,
K
(
in
),
K
(
out
),
K
(
in_str_len
),
K
(
out_len
),
K
(
enc_mode
),
K
(
ret
));
LOG_WARN
(
"invalid argument"
,
K
(
in
),
K
(
out
),
K
(
in_str_len
),
K
(
out_len
),
K
(
enc_mode
),
K
(
ret
));
}
else
{
BF_KEY
bf_key
;
BF_set_key
(
&
bf_key
,
static_cast
<
int
>
(
strlen
(
ENC_KEY_BYTES_PROD_STR
)),
reinterpret_cast
<
const
unsigned
char
*>
(
ENC_KEY_BYTES_PROD_STR
));
BF_set_key
(
&
bf_key
,
static_cast
<
int
>
(
strlen
(
ObBlowFish
::
ENC_KEY_BYTES_PROD_STR
)),
reinterpret_cast
<
const
unsigned
char
*>
(
ObBlowFish
::
ENC_KEY_BYTES_PROD_STR
));
int
pos
=
0
;
while
(
pos
!=
in_str_len
)
{
BF_ecb_encrypt
(
reinterpret_cast
<
const
unsigned
char
*>
(
in
+
pos
),
reinterpret_cast
<
unsigned
char
*>
(
out
+
pos
),
&
bf_key
,
enc_mode
);
BF_ecb_encrypt
(
reinterpret_cast
<
const
unsigned
char
*>
(
in
+
pos
),
reinterpret_cast
<
unsigned
char
*>
(
out
+
pos
),
&
bf_key
,
enc_mode
);
pos
+=
BF_BLOCK
;
}
}
...
...
@@ -132,6 +98,7 @@ int ObBlowFish::covert_string_to_hex(const char *str, const int64_t str_len,
if
(
OB_ISNULL
(
str
)
||
OB_ISNULL
(
hex_str
)
||
OB_UNLIKELY
(
hex_len
<=
str_len
*
2
))
{
ret
=
OB_INVALID_ARGUMENT
;
LOG_WARN
(
"invalid argument"
,
K
(
hex_str
),
K
(
hex_len
),
K
(
str
),
K
(
str_len
),
K
(
ret
));
}
else
{
for
(
int64_t
i
=
0
;
OB_SUCC
(
ret
)
&&
i
<
str_len
;
++
i
)
{
if
(
OB_UNLIKELY
(
-
1
==
sprintf
(
hex_str
,
"%.2x"
,
static_cast
<
unsigned
char
>
(
str
[
i
]))))
{
...
...
@@ -147,7 +114,8 @@ int ObBlowFish::covert_string_to_hex(const char *str, const int64_t str_len,
}
int
ObBlowFish
::
convert_large_str_to_hex
(
const
char
*
str
,
const
int64_t
str_len
,
char
*
hex_str
,
const
int64_t
hex_len
,
int64_t
&
hex_str_len
)
char
*
hex_str
,
const
int64_t
hex_len
,
int64_t
&
hex_str_len
)
{
int
ret
=
OB_SUCCESS
;
UNUSED
(
hex_len
);
...
...
@@ -155,7 +123,8 @@ int ObBlowFish::convert_large_str_to_hex(const char *str, const int64_t str_len,
const
char
*
last_minus_pos
=
NULL
;
bool
is_negative
=
false
;
while
(
cursor
!=
str
+
str_len
)
{
cursor
=
static_cast
<
const
char
*>
(
memchr
(
reinterpret_cast
<
const
void
*>
(
cursor
),
'-'
,
static_cast
<
int32_t
>
(
str_len
-
(
cursor
-
str
))));
cursor
=
static_cast
<
const
char
*>
(
memchr
(
reinterpret_cast
<
const
void
*>
(
cursor
),
'-'
,
static_cast
<
int32_t
>
(
str_len
-
(
cursor
-
str
))));
if
(
NULL
!=
cursor
)
{
last_minus_pos
=
cursor
;
++
cursor
;
...
...
@@ -165,6 +134,7 @@ int ObBlowFish::convert_large_str_to_hex(const char *str, const int64_t str_len,
}
if
(
NULL
!=
last_minus_pos
&&
last_minus_pos
!=
str
)
{
ret
=
OB_INVALID_ARGUMENT
;
LOG_WARN
(
"invalid argument"
,
K
(
str
),
K
(
last_minus_pos
),
K
(
ret
));
}
else
{
if
(
NULL
==
last_minus_pos
)
{
cursor
=
str
;
...
...
@@ -235,7 +205,8 @@ int ObBlowFish::convert_large_str_to_hex(const char *str, const int64_t str_len,
return
ret
;
}
void
ObBlowFish
::
destructive_multi_add
(
int64_t
*
x
,
const
int64_t
int_num
,
int64_t
y
,
int64_t
z
)
void
ObBlowFish
::
destructive_multi_add
(
int64_t
*
x
,
const
int64_t
int_num
,
int64_t
y
,
int64_t
z
)
{
int64_t
ylong
=
y
&
0xffffffffL
;
int64_t
zlong
=
z
&
0xffffffffL
;
...
...
@@ -294,7 +265,8 @@ int ObBlowFish::get_bit_count(int var)
return
var
&
255
;
}
int
ObBlowFish
::
get_bit_len
(
int64_t
*
mag
,
int64_t
start_idx
,
int64_t
int_num
,
const
bool
is_negative
)
int
ObBlowFish
::
get_bit_len
(
int64_t
*
mag
,
int64_t
start_idx
,
int64_t
int_num
,
const
bool
is_negative
)
{
int
ret
=
-
1
;
int
mag_len
=
static_cast
<
int
>
(
int_num
-
start_idx
);
...
...
@@ -314,5 +286,67 @@ int ObBlowFish::get_bit_len(int64_t *mag, int64_t start_idx, int64_t int_num, co
return
ret
;
}
int
ObBlowFish
::
encode
(
char
*
in
,
const
int64_t
in_len
,
char
*
out
,
const
int64_t
out_len
)
{
int
ret
=
OB_SUCCESS
;
if
(
OB_ISNULL
(
in
)
||
OB_ISNULL
(
out
))
{
ret
=
OB_INVALID_ARGUMENT
;
LOG_WARN
(
"invalid argument"
,
K
(
in
),
K
(
out
),
K
(
in_len
),
K
(
out_len
),
K
(
ret
));
}
else
{
char
tmp_out
[
OB_MAX_PASSWORD_LENGTH
];
memset
(
tmp_out
,
0
,
sizeof
(
tmp_out
));
int64_t
in_str_len
=
strlen
(
in
);
int64_t
padding_len
=
BF_BLOCK
-
in_str_len
%
BF_BLOCK
;
if
(
OB_UNLIKELY
(
in_str_len
+
padding_len
>=
in_len
))
{
ret
=
OB_SIZE_OVERFLOW
;
LOG_WARN
(
"in buffer size is not enough"
,
K
(
padding_len
),
K
(
in
),
K
(
in_len
),
K
(
ret
));
}
else
{
for
(
int64_t
i
=
in_str_len
;
i
<
in_str_len
+
padding_len
;
++
i
)
{
in
[
i
]
=
static_cast
<
char
>
(
padding_len
);
}
if
(
OB_FAIL
(
do_bf_ecb_encrypt
(
reinterpret_cast
<
const
unsigned
char
*>
(
in
),
in_str_len
+
padding_len
,
reinterpret_cast
<
unsigned
char
*>
(
tmp_out
),
OB_MAX_PASSWORD_LENGTH
,
BF_ENCRYPT
)))
{
LOG_WARN
(
"fail to do bf ecb encrypt"
,
K
(
in
),
K
(
padding_len
),
K
(
ret
));
}
else
if
(
OB_FAIL
(
covert_string_to_hex
(
tmp_out
,
strlen
(
tmp_out
),
out
,
out_len
)))
{
LOG_WARN
(
"fail to convert str to hex"
,
K
(
ret
));
}
}
}
return
ret
;
}
int
ObBlowFish
::
decode
(
const
char
*
in
,
const
int64_t
in_str_len
,
char
*
out
,
const
int64_t
out_len
)
{
int
ret
=
OB_SUCCESS
;
if
(
OB_ISNULL
(
in
)
||
OB_ISNULL
(
out
))
{
ret
=
OB_INVALID_ARGUMENT
;
LOG_WARN
(
"invalid argument"
,
K
(
in
),
K
(
out
),
K
(
in_str_len
),
K
(
out_len
),
K
(
ret
));
}
else
{
char
tmp_out
[
OB_MAX_PASSWORD_LENGTH
];
memset
(
tmp_out
,
0
,
sizeof
(
tmp_out
));
int64_t
tmp_out_len
=
0
;
if
(
OB_FAIL
(
convert_large_str_to_hex
(
in
,
in_str_len
,
tmp_out
,
OB_MAX_PASSWORD_LENGTH
,
tmp_out_len
)))
{
LOG_WARN
(
"failt to convert large str to hex"
,
K
(
in
),
K
(
in_str_len
),
K
(
ret
));
}
else
if
(
OB_FAIL
(
do_bf_ecb_encrypt
(
reinterpret_cast
<
const
unsigned
char
*>
(
tmp_out
),
tmp_out_len
,
reinterpret_cast
<
unsigned
char
*>
(
out
),
out_len
,
BF_DECRYPT
)))
{
LOG_WARN
(
"fail to do bf ecn encrypt"
,
K
(
ret
));
}
else
{
// trim padding number
int64_t
result_len
=
strlen
(
out
);
if
(
out
[
result_len
-
1
]
>=
1
&&
out
[
result_len
-
1
]
<=
8
)
{
int64_t
padding_len
=
out
[
result_len
-
1
];
result_len
=
result_len
-
padding_len
;
memset
(
out
+
result_len
,
0
,
padding_len
);
}
}
}
return
ret
;
}
}
// end namespace obproxy
}
// end namespace oceanbase
src/obproxy/utils/ob_proxy_lib.h
浏览文件 @
4f40b15c
此差异已折叠。
点击以展开。
src/obproxy/utils/ob_proxy_table_define.cpp
浏览文件 @
4f40b15c
...
...
@@ -19,7 +19,7 @@ namespace oceanbase
{
namespace
obproxy
{
const
char
*
ObProxyTableInfo
::
CREATE_PROXY_TABLE_SQL
=
const
char
*
ObProxyTableInfo
::
CREATE_PROXY_TABLE_SQL
=
"CREATE TABLE IF NOT EXISTS %s (
\n
"
" proxy_ip varchar(%ld),
\n
"
" proxy_port bigint,
\n
"
...
...
@@ -43,7 +43,7 @@ const char *ObProxyTableInfo::CREATE_PROXY_TABLE_SQL =
" PRIMARY KEY(proxy_ip, proxy_port)
\n
"
");
\n
"
;
const
char
*
ObProxyTableInfo
::
CREATE_PROXY_CONFIG_TABLE_SQL
=
const
char
*
ObProxyTableInfo
::
CREATE_PROXY_CONFIG_TABLE_SQL
=
"CREATE TABLE IF NOT EXISTS %s (
\n
"
" app_name varchar(%ld),
\n
"
" name varchar(%ld),
\n
"
...
...
@@ -53,7 +53,7 @@ const char *ObProxyTableInfo:: CREATE_PROXY_CONFIG_TABLE_SQL =
" PRIMARY KEY(app_name, name)
\n
"
");
\n
"
;
const
char
*
ObProxyTableInfo
::
CREATE_PROXY_STAT_TABLE_SQL
=
const
char
*
ObProxyTableInfo
::
CREATE_PROXY_STAT_TABLE_SQL
=
"CREATE TABLE IF NOT EXISTS %s (
\n
"
" cluster_name varchar(%ld),
\n
"
" proxy_ip varchar(%ld),
\n
"
...
...
@@ -66,7 +66,7 @@ const char *ObProxyTableInfo::CREATE_PROXY_STAT_TABLE_SQL =
" PRIMARY KEY(cluster_name, proxy_ip, proxy_port, session_id, stat_name)"
");
\n
"
;
const
char
*
ObProxyTableInfo
::
CREATE_PROXY_KV_TABLE_SQL
=
const
char
*
ObProxyTableInfo
::
CREATE_PROXY_KV_TABLE_SQL
=
"CREATE TABLE IF NOT EXISTS %s (
\n
"
" name varchar(%ld),
\n
"
" datatype bigint,
\n
"
...
...
@@ -75,7 +75,7 @@ const char *ObProxyTableInfo::CREATE_PROXY_KV_TABLE_SQL =
" PRIMARY KEY(name)
\n
"
");
\n
"
;
const
char
*
ObProxyTableInfo
::
CREATE_PROXY_VIP_TENANT_TABLE_SQL
=
const
char
*
ObProxyTableInfo
::
CREATE_PROXY_VIP_TENANT_TABLE_SQL
=
"CREATE TABLE IF NOT EXISTS %s (
\n
"
" vid bigint DEFAULT 0,
\n
"
" vip varchar(%ld),
\n
"
...
...
@@ -86,29 +86,28 @@ const char *ObProxyTableInfo::CREATE_PROXY_VIP_TENANT_TABLE_SQL =
" PRIMARY KEY(vid, vip, vport)
\n
"
");
\n
"
;
const
char
*
ObProxyTableInfo
::
PROXY_INFO_TABLE_NAME
=
"ob_all_proxy"
;
const
char
*
ObProxyTableInfo
::
PROXY_CONFIG_TABLE_NAME
=
"ob_all_proxy_app_config"
;
const
char
*
ObProxyTableInfo
::
PROXY_STAT_TABLE_NAME
=
"ob_all_proxy_stat"
;
const
char
*
ObProxyTableInfo
::
PROXY_KV_TABLE_NAME
=
"ob_all_proxy_kv_table"
;
const
char
*
ObProxyTableInfo
::
PROXY_VIP_TENANT_TABLE_NAME
=
"ob_all_proxy_vip_tenant"
;
const
char
*
ObProxyTableInfo
::
PROXY_INFO_TABLE_NAME
=
"ob_all_proxy"
;
const
char
*
ObProxyTableInfo
::
PROXY_CONFIG_TABLE_NAME
=
"ob_all_proxy_app_config"
;
const
char
*
ObProxyTableInfo
::
PROXY_STAT_TABLE_NAME
=
"ob_all_proxy_stat"
;
const
char
*
ObProxyTableInfo
::
PROXY_KV_TABLE_NAME
=
"ob_all_proxy_kv_table"
;
const
char
*
ObProxyTableInfo
::
PROXY_VIP_TENANT_TABLE_NAME
=
"ob_all_proxy_vip_tenant"
;
const
char
*
ObProxyTableInfo
::
PROXY_VIP_TENANT_VERSION_NAME
=
"ob_proxy_vip_tenant_version"
;
const
char
*
ObProxyTableInfo
::
PROXY_VIP_TENANT_VERSION_NAME
=
"ob_proxy_vip_tenant_version"
;
const
char
*
ObProxyTableInfo
::
READ_ONLY_USERNAME_USER
=
"proxyro"
;
// do not modify
const
char
*
ObProxyTableInfo
::
READ_ONLY_USERNAME
=
"proxyro@sys"
;
// do not modify
const
char
*
ObProxyTableInfo
::
READ_ONLY_DATABASE
=
"oceanbase"
;
// do not modify
const
char
*
ObProxyTableInfo
::
READ_ONLY_PASSWD_STAGED1
=
"ee0e5138c912aed80b683c05303684be347ce81d"
;
// do not modify
const
char
*
ObProxyTableInfo
::
READ_ONLY_USERNAME_USER
=
"proxyro"
;
const
char
*
ObProxyTableInfo
::
READ_ONLY_USERNAME
=
"proxyro@sys"
;
const
char
*
ObProxyTableInfo
::
READ_ONLY_DATABASE
=
"oceanbase"
;
const
char
*
ObProxyTableInfo
::
TEST_MODE_USERNAME
=
"root@sys"
;
const
char
*
ObProxyTableInfo
::
TEST_MODE_PASSWORD
=
""
;
const
char
*
ObProxyTableInfo
::
TEST_MODE_DATABASE
=
"oceanbase"
;
const
char
*
ObProxyTableInfo
::
TEST_MODE_USERNAME
=
"root@sys"
;
const
char
*
ObProxyTableInfo
::
TEST_MODE_PASSWORD
=
""
;
const
char
*
ObProxyTableInfo
::
TEST_MODE_DATABASE
=
"oceanbase"
;
const
ObString
ObProxyTableInfo
::
PROXY_ALL_PROXY_HEADER
=
ObString
::
make_string
(
"all_proxy"
);
const
ObString
ObProxyTableInfo
::
PROXY_CONFIG_VERSION_NAME
=
ObString
::
make_string
(
".config_version"
);
const
ObString
ObProxyTableInfo
::
PROXY_UPGRADE_SWITCH_NAME
=
ObString
::
make_string
(
".upgrade_switch"
);
const
ObString
ObProxyTableInfo
::
PROXY_UPGRADE_START_TIME_NAME
=
ObString
::
make_string
(
".upgrade_start_time"
);
const
ObString
ObProxyTableInfo
::
PROXY_UPGRADE_DURATION_MINUTES_NAME
=
ObString
::
make_string
(
".upgrade_duration_minutes"
);
const
ObString
ObProxyTableInfo
::
PROXY_ALL_PROXY_HEADER
=
ObString
::
make_string
(
"all_proxy"
);
const
ObString
ObProxyTableInfo
::
PROXY_CONFIG_VERSION_NAME
=
ObString
::
make_string
(
".config_version"
);
const
ObString
ObProxyTableInfo
::
PROXY_UPGRADE_SWITCH_NAME
=
ObString
::
make_string
(
".upgrade_switch"
);
const
ObString
ObProxyTableInfo
::
PROXY_UPGRADE_START_TIME_NAME
=
ObString
::
make_string
(
".upgrade_start_time"
);
const
ObString
ObProxyTableInfo
::
PROXY_UPGRADE_DURATION_MINUTES_NAME
=
ObString
::
make_string
(
".upgrade_duration_minutes"
);
const
ObString
ObProxyTableInfo
::
PROXY_UPGRADE_NEW_BINARY_NAME
[
RELEASE_MAX
]
=
{
ObString
::
make_string
(
".new_binary_name_5u"
),
ObString
::
make_string
(
".new_binary_name_6u"
),
...
...
@@ -116,7 +115,7 @@ const ObString ObProxyTableInfo::PROXY_UPGRADE_NEW_BINARY_NAME[RELEASE_MAX] = {
ObString
::
make_string
(
".new_binary_name_unknown"
),
};
const
ObString
ObProxyTableInfo
::
PROXY_UPGRADE_NEW_BINARY_MD5
[
RELEASE_MAX
]
=
{
const
ObString
ObProxyTableInfo
::
PROXY_UPGRADE_NEW_BINARY_MD5
[
RELEASE_MAX
]
=
{
ObString
::
make_string
(
".new_binary_md5_5u"
),
ObString
::
make_string
(
".new_binary_md5_6u"
),
ObString
::
make_string
(
".new_binary_md5_7u"
),
...
...
src/obproxy/utils/ob_proxy_table_define.h
浏览文件 @
4f40b15c
...
...
@@ -67,7 +67,6 @@ public:
static
const
char
*
READ_ONLY_USERNAME_USER
;
static
const
char
*
READ_ONLY_USERNAME
;
static
const
char
*
READ_ONLY_DATABASE
;
static
const
char
*
READ_ONLY_PASSWD_STAGED1
;
static
const
char
*
TEST_MODE_USERNAME
;
static
const
char
*
TEST_MODE_PASSWORD
;
...
...
src/share/inner_table/ob_inner_table_schema.h
浏览文件 @
4f40b15c
...
...
@@ -313,7 +313,7 @@ const schema_create_func core_table_schema_creators [] = {
ObInnerTableSchema
::
all_ddl_operation_schema
,
NULL
,};
const
schema_create_func
sys_table_schema_creators
[]
=
{
const
schema_create_func
sys_table_schema_creators
[]
=
{
ObInnerTableSchema
::
all_meta_table_schema
,
ObInnerTableSchema
::
all_user_schema
,
ObInnerTableSchema
::
all_user_history_schema
,
...
...
src/share/inner_table/ob_inner_table_schema_constants.h
浏览文件 @
4f40b15c
此差异已折叠。
点击以展开。
src/share/schema/ob_column_schema.h
浏览文件 @
4f40b15c
...
...
@@ -32,21 +32,21 @@ namespace share
namespace
schema
{
const
char
*
const
STR_COLUMN_TYPE_INT
=
"int"
;
const
char
*
const
STR_COLUMN_TYPE_UINT64
=
"uint64"
;
const
char
*
const
STR_COLUMN_TYPE_FLOAT
=
"float"
;
const
char
*
const
STR_COLUMN_TYPE_UFLOAT
=
"ufloat"
;
const
char
*
const
STR_COLUMN_TYPE_DOUBLE
=
"double"
;
const
char
*
const
STR_COLUMN_TYPE_UDOUBLE
=
"udouble"
;
const
char
*
const
STR_COLUMN_TYPE_VCHAR
=
"varchar"
;
const
char
*
const
STR_COLUMN_TYPE_DATETIME
=
"datetime"
;
const
char
*
const
STR_COLUMN_TYPE_TIMESTAMP
=
"timestamp"
;
const
char
*
const
STR_COLUMN_TYPE_INT
=
"int"
;
const
char
*
const
STR_COLUMN_TYPE_UINT64
=
"uint64"
;
const
char
*
const
STR_COLUMN_TYPE_FLOAT
=
"float"
;
const
char
*
const
STR_COLUMN_TYPE_UFLOAT
=
"ufloat"
;
const
char
*
const
STR_COLUMN_TYPE_DOUBLE
=
"double"
;
const
char
*
const
STR_COLUMN_TYPE_UDOUBLE
=
"udouble"
;
const
char
*
const
STR_COLUMN_TYPE_VCHAR
=
"varchar"
;
const
char
*
const
STR_COLUMN_TYPE_DATETIME
=
"datetime"
;
const
char
*
const
STR_COLUMN_TYPE_TIMESTAMP
=
"timestamp"
;
const
char
*
const
STR_COLUMN_TYPE_PRECISE_DATETIME
=
"precise_datetime"
;
const
char
*
const
STR_COLUMN_TYPE_C_TIME
=
"create_time"
;
const
char
*
const
STR_COLUMN_TYPE_M_TIME
=
"modify_time"
;
const
char
*
const
STR_COLUMN_TYPE_BOOLEAN
=
"bool"
;
const
char
*
const
STR_COLUMN_TYPE_NUMBER
=
"number"
;
const
char
*
const
STR_COLUMN_TYPE_UNKNOWN
=
"unknown"
;
const
char
*
const
STR_COLUMN_TYPE_C_TIME
=
"create_time"
;
const
char
*
const
STR_COLUMN_TYPE_M_TIME
=
"modify_time"
;
const
char
*
const
STR_COLUMN_TYPE_BOOLEAN
=
"bool"
;
const
char
*
const
STR_COLUMN_TYPE_NUMBER
=
"number"
;
const
char
*
const
STR_COLUMN_TYPE_UNKNOWN
=
"unknown"
;
class
ObTableSchema
;
class
ObColumnSchemaV2
:
public
ObSchema
...
...
unittest/obproxy/parser/runner.py
浏览文件 @
4f40b15c
...
...
@@ -45,7 +45,7 @@ class MainHandler():
if
(
os
.
path
.
isfile
(
self
.
opt
.
base_parser
)):
run_cmd
(
"./%s -f %s -r %s"
%
(
self
.
opt
.
base_parser
,
self
.
opt
.
test_case
,
result_file_name
))
else
:
url
=
'http://
10.218.248.181:7788
/obproxy_build/%s'
%
self
.
opt
.
base_parser
url
=
'http://
ip:port
/obproxy_build/%s'
%
self
.
opt
.
base_parser
print
'get base parser from %s'
%
url
run_cmd
(
"wget %s -O %s &>/dev/null && chmod a+x %s"
%
(
url
,
self
.
opt
.
base_parser
,
self
.
opt
.
base_parser
))
if
(
os
.
path
.
isfile
(
self
.
opt
.
base_parser
)):
...
...
unittest/obproxy/test_config_server_processor.cpp
浏览文件 @
4f40b15c
...
...
@@ -210,12 +210,11 @@ TEST_F(TestConfigServerProcessor, test_get_json_config_info)
{
int
ret
=
OB_SUCCESS
;
config_processor_
.
proxy_config_
.
app_name
.
set_value
(
"ob1.kyle.sj"
);
config_processor_
.
proxy_config_
.
obproxy_config_server_url
.
set_value
(
"http://11.166.86.153:8080/diamond/cgi/a.py?key=unittest_test_config_server.proxy&method=get"
);
config_processor_
.
proxy_config_
.
obproxy_config_server_url
.
set_value
(
""
);
ret
=
config_processor_
.
refresh_json_config_info
();
ASSERT_EQ
(
OB_SUCCESS
,
ret
);
ASSERT_EQ
(
0
,
memcmp
(
config_processor_
.
json_config_info_
->
data_info_
.
bin_url_
.
ptr
(),
"
http://11.166.86.153:8877
"
,
config_processor_
.
json_config_info_
->
data_info_
.
bin_url_
.
length
()));
""
,
config_processor_
.
json_config_info_
->
data_info_
.
bin_url_
.
length
()));
ASSERT_EQ
(
0
,
memcmp
(
config_processor_
.
json_config_info_
->
data_info_
.
meta_table_info_
.
db_
.
ptr
(),
"oceanbase"
,
config_processor_
.
json_config_info_
->
data_info_
.
meta_table_info_
.
db_
.
length
()));
ASSERT_EQ
(
0
,
memcmp
(
config_processor_
.
json_config_info_
->
data_info_
.
meta_table_info_
.
username_
.
ptr
(),
...
...
@@ -224,8 +223,7 @@ TEST_F(TestConfigServerProcessor, test_get_json_config_info)
"admin"
,
config_processor_
.
json_config_info_
->
data_info_
.
meta_table_info_
.
password_
.
length
()));
ASSERT_EQ
(
1
,
config_processor_
.
json_config_info_
->
data_info_
.
cluster_array_
.
count
());
config_processor_
.
proxy_config_
.
obproxy_config_server_url
.
set_value
(
"http://11.166.86.153:8899/xxx"
);
config_processor_
.
proxy_config_
.
obproxy_config_server_url
.
set_value
(
""
);
ret
=
config_processor_
.
refresh_json_config_info
();
ASSERT_EQ
(
OB_CURL_ERROR
,
ret
);
}
...
...
@@ -238,22 +236,19 @@ TEST_F(TestConfigServerProcessor, test_do_fetch_json_config)
ObString
content
;
content
.
assign_buffer
(
buf
,
OB_PROXY_CONFIG_BUFFER_SIZE
);
config_processor_
.
proxy_config_
.
obproxy_config_server_url
.
set_value
(
"http://11.166.86.153:8080/diamond/cgi/a.py?key=unittest_test_config_server.proxy&method=get"
);
config_processor_
.
proxy_config_
.
obproxy_config_server_url
.
set_value
(
""
);
const
char
*
config_url
=
config_processor_
.
proxy_config_
.
obproxy_config_server_url
;
ret
=
config_processor_
.
fetch_by_curl
(
config_url
,
ObConfigServerProcessor
::
CURL_TRANSFER_TIMEOUT
,
static_cast
<
void
*>
(
&
content
),
ObConfigServerProcessor
::
write_data
);
ASSERT_EQ
(
OB_SUCCESS
,
ret
);
config_processor_
.
proxy_config_
.
obproxy_config_server_url
.
set_value
(
"http://11.166.86.153/xxx"
);
config_processor_
.
proxy_config_
.
obproxy_config_server_url
.
set_value
(
""
);
const
char
*
wrong_config_url
=
config_processor_
.
proxy_config_
.
obproxy_config_server_url
;
ret
=
config_processor_
.
fetch_by_curl
(
wrong_config_url
,
ObConfigServerProcessor
::
CURL_TRANSFER_TIMEOUT
,
static_cast
<
void
*>
(
&
content
),
ObConfigServerProcessor
::
write_data
);
ASSERT_EQ
(
OB_CURL_ERROR
,
ret
);
config_processor_
.
proxy_config_
.
obproxy_config_server_url
.
set_value
(
"http://11.166.86.153:8888/diamond/cgi/a.py?key=ob1.kyle.sj.test&method=get"
);
config_processor_
.
proxy_config_
.
obproxy_config_server_url
.
set_value
(
""
);
const
char
*
wrong_http_port
=
config_processor_
.
proxy_config_
.
obproxy_config_server_url
;
ret
=
config_processor_
.
fetch_by_curl
(
wrong_http_port
,
ObConfigServerProcessor
::
CURL_TRANSFER_TIMEOUT
,
static_cast
<
void
*>
(
&
content
),
ObConfigServerProcessor
::
write_data
);
...
...
@@ -263,9 +258,8 @@ TEST_F(TestConfigServerProcessor, test_do_fetch_json_config)
TEST_F
(
TestConfigServerProcessor
,
test_get_newest_cluster_rs_list
)
{
int
ret
=
OB_SUCCESS
;
config_processor_
.
proxy_config_
.
app_name
.
set_value
(
"ob1.kyle.sj"
);
config_processor_
.
proxy_config_
.
obproxy_config_server_url
.
set_value
(
"http://11.166.86.153:8080/diamond/cgi/a.py?key=unittest_test_config_server.proxy&method=get"
);
config_processor_
.
proxy_config_
.
app_name
.
set_value
(
""
);
config_processor_
.
proxy_config_
.
obproxy_config_server_url
.
set_value
(
""
);
ret
=
config_processor_
.
refresh_json_config_info
();
ASSERT_EQ
(
OB_SUCCESS
,
ret
);
...
...
@@ -279,7 +273,7 @@ TEST_F(TestConfigServerProcessor, test_do_fetch_proxy_bin)
{
int
ret
=
OB_SUCCESS
;
const
char
*
save_path
=
"obproxy_new"
;
config_processor_
.
json_config_info_
->
data_info_
.
bin_url_
.
url_
=
ObString
::
make_string
(
"
http://10.125.224.4:9191/method=get
"
);
config_processor_
.
json_config_info_
->
data_info_
.
bin_url_
.
url_
=
ObString
::
make_string
(
""
);
ret
=
config_processor_
.
do_fetch_proxy_bin
(
save_path
,
"obproxy.el6.x86_64.rpm"
);
ASSERT_EQ
(
OB_SUCCESS
,
ret
);
remove
(
save_path
);
...
...
@@ -293,7 +287,7 @@ TEST_F(TestConfigServerProcessor, test_do_fetch_proxy_bin)
ASSERT_EQ
(
OB_ERR_UNEXPECTED
,
ret
);
//test short timeout
const
char
*
bin_url
=
"
http://10.125.224.4:9191/method=get&Version=big.obproxy.el6.x86_64.rpm
"
;
const
char
*
bin_url
=
""
;
int
fd
=
0
;
if
((
fd
=
::
open
(
save_path
,
O_WRONLY
|
O_CREAT
,
...
...
@@ -307,7 +301,7 @@ TEST_F(TestConfigServerProcessor, test_do_fetch_proxy_bin)
remove
(
save_path
);
//test wrong url
const
char
*
wrong_bin_url
=
"
http://10.125.224.4:9191/method=get&Version=/test_dir/obproxy.el6.x86_64.rpm
"
;
const
char
*
wrong_bin_url
=
""
;
int64_t
fetch_timeout
=
config_processor_
.
proxy_config_
.
fetch_proxy_bin_timeout
/
1000000
;
//us --> s
if
(
fetch_timeout
<=
0
)
{
ret
=
OB_INVALID_ARGUMENT
;
...
...
@@ -324,13 +318,13 @@ TEST_F(TestConfigServerProcessor, test_do_fetch_proxy_bin)
TEST_F
(
TestConfigServerProcessor
,
test_get_idc_url
)
{
const
char
*
buf1
=
"
http://11.166.86.153:8080/oceanbase_obconfig/obtest_jianhua.sjh_10.125.224.4_ob1
"
;
const
char
*
buf2
=
"
http://ocp-api.alipay.com/services?Action=ObRootServiceInfo&User_ID=alibaba&UID=zhitao.rzt&ObRegion=rhz_obtrans60
"
;
const
char
*
buf3
=
"
http://ocp-api.alipay.com/services?action=obrootserviceinfo&user_id=alibaba&uid=zhitao.rzt&obregion=rhz_obtrans60
"
;
const
char
*
buf4
=
"
HTTP://OCP-API.ALIPAY.COM/SERVICES?ACTION=OBROOTSERVICEINFO&USER_ID=ALIBABA&UID=ZHITAO.RZT&OBREGION=RHZ_OBTRANS60
"
;
const
char
*
expect_buf1
=
"
http://11.166.86.153:8080/oceanbase_obconfig/obtest_jianhua.sjh_10.125.224.4_ob1_idc_list
"
;
const
char
*
expect_buf2
=
"
http://ocp-api.alipay.com/services?Action=ObIDCRegionInfo&User_ID=alibaba&UID=zhitao.rzt&ObRegion=rhz_obtrans60
"
;
const
char
*
expect_buf3
=
"
http://ocp-api.alipay.com/services?action=ObIDCRegionInfo&user_id=alibaba&uid=zhitao.rzt&obregion=rhz_obtrans60
"
;
const
char
*
buf1
=
""
;
const
char
*
buf2
=
""
;
const
char
*
buf3
=
""
;
const
char
*
buf4
=
""
;
const
char
*
expect_buf1
=
""
;
const
char
*
expect_buf2
=
""
;
const
char
*
expect_buf3
=
""
;
const
char
*
expect_buf4
=
"HTTP://OCP-API.ALIPAY.COM/SERVICES?ACTION=ObIDCRegionInfo&USER_ID=ALIBABA&UID=ZHITAO.RZT&OBREGION=RHZ_OBTRANS60"
;
const
int64_t
max_size
=
256
;
char
common_buf
[
256
];
...
...
@@ -364,8 +358,7 @@ TEST_F(TestConfigServerProcessor, test_get_idc_list)
{
int
ret
=
OB_SUCCESS
;
config_processor_
.
proxy_config_
.
app_name
.
set_value
(
"ob1.kyle.sj"
);
config_processor_
.
proxy_config_
.
obproxy_config_server_url
.
set_value
(
"http://11.166.86.153:8080/diamond/cgi/a.py?key=unittest_test_config_server.proxy&method=get"
);
config_processor_
.
proxy_config_
.
obproxy_config_server_url
.
set_value
(
""
);
ret
=
config_processor_
.
refresh_json_config_info
();
ASSERT_EQ
(
OB_SUCCESS
,
ret
);
...
...
unittest/obproxy/test_proxy_session_info.cpp
浏览文件 @
4f40b15c
...
...
@@ -49,7 +49,7 @@ TEST_F(TestProxySessionInfo, basic_func)
{
ObServerSessionInfo
session
;
session
.
reset
();
ObAddr
server
(
static_cast
<
ObAddr
::
VER
>
(
4
),
"
10.232.4.4
"
,
3300
);
ObAddr
server
(
static_cast
<
ObAddr
::
VER
>
(
4
),
""
,
3300
);
session
.
version_
.
sys_var_version_
=
100
;
session
.
version_
.
hot_sys_var_version_
=
100
;
session
.
version_
.
user_var_version_
=
1000
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录