Skip to content

Commit 5a5bf04

Browse files
authored
v1.6.1 (#146)
1 parent 1530c14 commit 5a5bf04

File tree

27 files changed

+261
-81
lines changed

27 files changed

+261
-81
lines changed

_cmd.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -854,6 +854,7 @@ def __init__(self):
854854
self.parser.add_option('--max-session-num', type='int', help="Max session unit number. Not supported after version 4.0")
855855
self.parser.add_option('--unit-num', type='int', help="Pool unit number.")
856856
self.parser.add_option('-z', '--zone-list', type='string', help="Tenant zone list.")
857+
self.parser.add_option('--mode', type='string', help='Tenant compatibility mode. {mysql,oracle} [mysql]', default='mysql')
857858
self.parser.add_option('--charset', type='string', help="Tenant charset.")
858859
self.parser.add_option('--collate', type='string', help="Tenant COLLATE.")
859860
self.parser.add_option('--replica-num', type='int', help="Tenant replica number.")
@@ -925,6 +926,8 @@ class MySQLTestCommand(TestMirrorCommand):
925926

926927
def __init__(self):
927928
super(MySQLTestCommand, self).__init__('mysqltest', 'Run a mysqltest for a deployment.')
929+
self.parser.add_option('--mode', type='string', help='Test mode. Available values are mysql, oracle, and both.', default='both')
930+
# self.parser.add_option('--case-mode', type='string', help='case run mode [mysql,oracle]', default='mysql')
928931
self.parser.add_option('--component', type='string', help='Components for mysqltest.')
929932
self.parser.add_option('--test-server', type='string', help='The server for mysqltest. By default, the first root server in the component is the mysqltest server.')
930933
self.parser.add_option('--user', type='string', help='Username for a test. [admin]', default='admin')
@@ -1042,7 +1045,7 @@ def __init__(self):
10421045
self.parser.add_option('--remote-tbl-dir', type='string', help='Directory for the tbl on target observers. Make sure that you have read and write access to the directory when you start observer.')
10431046
self.parser.add_option('--disable-transfer', '--dt', action='store_true', help='Disable the transfer. When enabled, OBD will use the tbl files under remote-tbl-dir instead of transferring local tbl files to remote remote-tbl-dir.')
10441047
self.parser.add_option('--dss-config', type='string', help='Directory for dists.dss. [/usr/tpc-h-tools/tpc-h-tools]', default='/usr/tpc-h-tools/tpc-h-tools/')
1045-
self.parser.add_option('-O', '--optimization', type='int', help='Optimization level {0/1}. [1]', default=1)
1048+
self.parser.add_option('-O', '--optimization', type='int', help='Optimization level {0/1/2}. [1] 0 - No optimization. 1 - Optimize some of the parameters which do not need to restart servers. 2 - Optimize all the parameters and maybe RESTART SERVERS for better performance.', default=1)
10461049
self.parser.add_option('--test-only', action='store_true', help='Only testing SQLs are executed. No initialization is executed.')
10471050
self.parser.add_option('-S', '--skip-cluster-status-check', action='store_true', help='Skip cluster status check', default=False)
10481051

_deploy.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -625,6 +625,8 @@ def _check_param(self, config):
625625
return error
626626

627627
def set_global_conf(self, conf):
628+
if not isinstance(conf, dict):
629+
raise Exception('%s global config is not a dictionary. Please check the syntax of your configuration file.\n See https://github.com/oceanbase/obdeploy/blob/master/docs/zh-CN/4.configuration-file-description.md' % self.name)
628630
self._original_global_conf = deepcopy(conf)
629631
self._global_conf = None
630632
self._clear_cache_server()

_errno.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ class InitDirFailedErrorMessage(object):
6262
EC_ULIMIT_CHECK = OBDErrorCode(1007, '({server}) {key} must not be less than {need} (Current value: {now})')
6363

6464
EC_OBSERVER_NOT_ENOUGH_MEMORY = OBDErrorCode(2000, '({ip}) not enough memory. (Free: {free}, Need: {need})')
65+
EC_OBSERVER_NOT_ENOUGH_MEMORY_ALAILABLE = OBDErrorCode(2000, '({ip}) not enough memory. (Available: {available}, Need: {need})')
66+
EC_OBSERVER_NOT_ENOUGH_MEMORY_CACHED = OBDErrorCode(2000, '({ip}) not enough memory. (Free: {free}, Buff/Cache: {cached}, Need: {need})')
6567
EC_OBSERVER_CAN_NOT_MIGRATE_IN = OBDErrorCode(2001, 'server can not migrate in')
6668
EC_OBSERVER_FAIL_TO_START = OBDErrorCode(2002, 'Failed to start {server} observer')
6769
EC_OBSERVER_NOT_ENOUGH_DISK_4_CLOG = OBDErrorCode(2003, '({ip}) {path} not enough disk space for clog. Use redo_dir to set other disk for clog, or reduce the value of datafile_size')

_repository.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -172,19 +172,23 @@ def extract(worker):
172172

173173
class ParallerExtractor(object):
174174

175-
MAX_PARALLER = cpu_count() if cpu_count() else 8
175+
MAX_PARALLER = cpu_count() * 2 if cpu_count() else 8
176+
MAX_SIZE = 100
177+
MIN_SIZE = 20
176178

177179
def __init__(self, pkg, files, stdio=None):
178180
self.pkg = pkg
179181
self.files = files
180182
self.stdio = stdio
181183

182184
def extract(self):
185+
if not self.files:
186+
return
183187
workers = []
184188
file_num = len(self.files)
185-
paraler = int(min(self.MAX_PARALLER, file_num))
186-
size = min(100, int(file_num / paraler))
187-
size = int(max(10, size))
189+
paraller = int(min(self.MAX_PARALLER, file_num))
190+
size = min(self.MAX_SIZE, int(file_num / paraller)) #
191+
size = int(max(self.MIN_SIZE, size))
188192
index = 0
189193
while index < file_num:
190194
p_index = index + size
@@ -195,7 +199,7 @@ def extract(self):
195199
))
196200
index = p_index
197201

198-
pool = Pool(processes=paraler)
202+
pool = Pool(processes=paraller)
199203
try:
200204
results = pool.map(ParallerExtractWorker.extract, workers)
201205
for r in results:

core.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -890,7 +890,7 @@ def genconfig(self, name, opt=Values()):
890890
self._call_stdio('verbose', 'Get deploy configuration')
891891
deploy_config = deploy.deploy_config
892892
if not deploy_config:
893-
self._call_stdio('error', 'Deploy configuration is empty.\nIt may be caused by a failure to resolve the configuration.\nPlease check your configuration file.')
893+
self._call_stdio('error', 'Deploy configuration is empty.\nIt may be caused by a failure to resolve the configuration.\nPlease check your configuration file.\nSee https://github.com/oceanbase/obdeploy/blob/master/docs/zh-CN/4.configuration-file-description.md')
894894
return False
895895

896896
# Check the best suitable mirror for the components and installation plugins. Install locally
@@ -1061,7 +1061,7 @@ def change_deploy_config_style(self, name, options=Values()):
10611061
return False
10621062
deploy_config = deploy.deploy_config
10631063
if not deploy_config:
1064-
self._call_stdio('error', 'Deploy configuration is empty.\nIt may be caused by a failure to resolve the configuration.\nPlease check your configuration file.')
1064+
self._call_stdio('error', 'Deploy configuration is empty.\nIt may be caused by a failure to resolve the configuration.\nPlease check your configuration file.\nSee https://github.com/oceanbase/obdeploy/blob/master/docs/zh-CN/4.configuration-file-description.md')
10651065
return False
10661066

10671067
style = getattr(options, 'style', '')
@@ -1211,11 +1211,11 @@ def deploy_cluster(self, name, opt=Values()):
12111211
self._call_stdio('verbose', 'Get deploy configuration')
12121212
deploy_config = deploy.deploy_config
12131213
if not deploy_config:
1214-
self._call_stdio('error', 'Deploy configuration is empty.\nIt may be caused by a failure to resolve the configuration.\nPlease check your configuration file.')
1214+
self._call_stdio('error', 'Deploy configuration is empty.\nIt may be caused by a failure to resolve the configuration.\nPlease check your configuration file.\nSee https://github.com/oceanbase/obdeploy/blob/master/docs/zh-CN/4.configuration-file-description.md')
12151215
return False
12161216

12171217
if not deploy_config.components:
1218-
self._call_stdio('error', 'Components not detected.\nPlease check the syntax of your configuration file.')
1218+
self._call_stdio('error', 'Components not detected.\nPlease check the syntax of your configuration file.\nSee https://github.com/oceanbase/obdeploy/blob/master/docs/zh-CN/4.configuration-file-description.md')
12191219
return False
12201220

12211221
for component_name in deploy_config.components:
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Quick deployment command
2+
3+
## obd demo
4+
5+
You can use this command to deploy and start the specified component on the local server without loading the configuration file. The fixed name of the cluster deployed is `demo`. After the deployment, you can run the `obd cluster list` command to view the cluster in the cluster list. You can also run other cluster commands, such as `obd cluster display demo`, to manage the cluster.
6+
7+
```bash
8+
obd demo [-c/--components]
9+
```
10+
11+
The following table describes the parameters.
12+
13+
| Parameter | Required | Data type | Default value | Description |
14+
|------------------|---------|------------|----------|--------------------------------------------------------------------|
15+
| -c/--components | No | String | oceanbase-ce,obproxy-ce,obagent,prometheus,grafana | The list of components that are separated with commas (`,`). You can use this parameter to specify the components to be deployed. |
16+
17+
By default, this command deploys the minimum specifications in the home directory of the current user, and the latest versions are deployed by default. You can use this command to deploy OceanBase Community Edition, OBProxy Community Edition, OBAgent, Grafana, and Prometheus.
18+
19+
You can select the version and specify the configurations of a component to be deployed.
20+
21+
```bash
22+
# Deploy components of the specified version.
23+
obd demo -c oceanbase-ce,obproxy-ce --oceanbase-ce.version=3.1.3
24+
# Specify the components to be deployed and the package hash of OceanBase Community Edition.
25+
obd demo -c oceanbase-ce,obproxy-ce --oceanbase-ce.package_hash=f38723204d49057d3e062ffad778edc1552a7c114622bf2a86fea769fbd202ea
26+
# Specify the installation path for all components to be deployed.
27+
## Deploy OceanBase Community Edition and OBProxy Community Edition in the /data/demo directory and create corresponding working directories for them.
28+
obd demo -c oceanbase-ce,obproxy-ce --home_path=/data/demo
29+
# Specify the installation path for all components to be deployed.
30+
obd demo --home_path=/path
31+
# Specify the installation path for a specific component to be deployed.
32+
## Deploy OceanBase Community Edition in the home directory and create a working directory for it, and deploy OBProxy Community Edition in the /data/playground/obproxy-ce directory.
33+
obd demo -c oceanbase-ce,obproxy-ce --obproxy-ce.home_path=/data/demo/
34+
# Specify the configurations of a component to be deployed.
35+
## Specify the mysql_port parameter of OceanBase Community Edition.
36+
obd demo --oceanbase-ce.mysql_port=3881
37+
```
38+
39+
> **Notice**
40+
>
41+
> This command supports only level-1 configurations under global that are specified by using options.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
test:
2+
system_config:
3+
- name: proxy_mem_limited
4+
value: 2G
5+
- name: slow_proxy_process_time_threshold
6+
value: 500ms
7+
- name: syslog_level
8+
value: error
9+
query_key: level
10+
- name: enable_prometheus
11+
value: false
12+
- name: enable_compression_protocol
13+
value: false
14+
need_restart: true
15+
value_type: BOOL
16+
- name: enable_ob_protocol_v2
17+
value: false
18+
need_restart: true
19+
value_type: BOOL
20+
- name: work_thread_num
21+
value: 128
22+
need_restart: true
23+
- name: enable_async_log
24+
value: true

optimize/obproxy/4.0.0/tpcc.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
build:
2+
system_config:
3+
- name: proxy_mem_limited
4+
value: 2G
5+
- name: slow_proxy_process_time_threshold
6+
value: 500ms
7+
- name: syslog_level
8+
value: error
9+
query_key: level
10+
- name: enable_prometheus
11+
value: false
12+
- name: enable_compression_protocol
13+
value: false
14+
need_restart: true
15+
value_type: BOOL
16+
- name: enable_ob_protocol_v2
17+
value: false
18+
need_restart: true
19+
value_type: BOOL
20+
- name: work_thread_num
21+
value: 128
22+
need_restart: true
23+
- name: enable_async_log
24+
value: true

plugins/grafana/7.5.17/oceanbase-metrics_rev1.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -218,11 +218,11 @@
218218
"exemplar": true,
219219
"expr": "(sum(rate(ob_sysstat{stat_id=\"40003\",ob_cluster_name=~\"$obcluster\",obzone=~\"$obzone\",svr_ip=~\"$observer\",tenant_name=~\"$tenant_name\"}[$__rate_interval])) by ($group) + sum(rate(ob_sysstat{stat_id=\"40005\",ob_cluster_name=~\"$obcluster\",obzone=~\"$obzone\",svr_ip=~\"$observer\",tenant_name=~\"$tenant_name\"}[$__rate_interval])) by ($group) + sum(rate(ob_sysstat{stat_id=\"40009\",ob_cluster_name=~\"$obcluster\",obzone=~\"$obzone\",svr_ip=~\"$observer\",tenant_name=~\"$tenant_name\"}[$__rate_interval])) by ($group) + sum(rate(ob_sysstat{stat_id=\"40009\",ob_cluster_name=~\"$obcluster\",obzone=~\"$obzone\",svr_ip=~\"$observer\",tenant_name=~\"$tenant_name\"}[$__rate_interval])) by ($group) + sum(rate(ob_sysstat{stat_id=\"40001\",ob_cluster_name=~\"$obcluster\",obzone=~\"$obzone\",svr_ip=~\"$observer\",tenant_name=~\"$tenant_name\"}[$__rate_interval])) by ($group))\n/\n(sum(rate(ob_sysstat{stat_id=\"40002\",ob_cluster_name=~\"$obcluster\",obzone=~\"$obzone\",svr_ip=~\"$observer\",tenant_name=~\"$tenant_name\"}[$__rate_interval])) by ($group) + sum(rate(ob_sysstat{stat_id=\"40004\",ob_cluster_name=~\"$obcluster\",obzone=~\"$obzone\",svr_ip=~\"$observer\",tenant_name=~\"$tenant_name\"}[$__rate_interval])) by ($group) + sum(rate(ob_sysstat{stat_id=\"40006\",ob_cluster_name=~\"$obcluster\",obzone=~\"$obzone\",svr_ip=~\"$observer\",tenant_name=~\"$tenant_name\"}[$__rate_interval])) by ($group) + sum(rate(ob_sysstat{stat_id=\"40008\",ob_cluster_name=~\"$obcluster\",obzone=~\"$obzone\",svr_ip=~\"$observer\",tenant_name=~\"$tenant_name\"}[$__rate_interval])) by ($group) + sum(rate(ob_sysstat{stat_id=\"40000\",ob_cluster_name=~\"$obcluster\",obzone=~\"$obzone\",svr_ip=~\"$observer\",tenant_name=~\"$tenant_name\"}[$__rate_interval])) by ($group))",
220220
"interval": "",
221-
"legendFormat": "qps rt {{$group}}",
221+
"legendFormat": "sql latency {{$group}}",
222222
"refId": "A"
223223
}
224224
],
225-
"title": "QPS rt",
225+
"title": "Sql Latency",
226226
"type": "timeseries"
227227
},
228228
{
@@ -2129,19 +2129,19 @@
21292129
"exemplar": true,
21302130
"expr": "(sum(rate(ob_sysstat{stat_id=\"10005\",ob_cluster_name=~\"$obcluster\",obzone=~\"$obzone\",svr_ip=~\"$observer\",tenant_name=~\"$tenant_name\"}[$__rate_interval])) by ($group) + sum(rate(ob_sysstat{stat_id=\"10006\",ob_cluster_name=~\"$obcluster\",obzone=~\"$obzone\",svr_ip=~\"$observer\",tenant_name=~\"$tenant_name\"}[$__rate_interval])) by ($group)) / sum(rate(ob_sysstat{stat_id=\"10000\",ob_cluster_name=~\"$obcluster\",obzone=~\"$obzone\",svr_ip=~\"$observer\",tenant_name=~\"$tenant_name\"}[$__rate_interval])) by ($group)",
21312131
"interval": "",
2132-
"legendFormat": "roc in rt {{$group}}",
2132+
"legendFormat": "rpc in Latency {{$group}}",
21332133
"refId": "A"
21342134
},
21352135
{
21362136
"exemplar": true,
21372137
"expr": "(sum(rate(ob_sysstat{stat_id=\"10005\",ob_cluster_name=~\"$obcluster\",obzone=~\"$obzone\",svr_ip=~\"$observer\",tenant_name=~\"$tenant_name\"}[$__rate_interval])) by ($group) + sum(rate(ob_sysstat{stat_id=\"10006\",ob_cluster_name=~\"$obcluster\",obzone=~\"$obzone\",svr_ip=~\"$observer\",tenant_name=~\"$tenant_name\"}[$__rate_interval])) by ($group)) / sum(rate(ob_sysstat{stat_id=\"10002\",ob_cluster_name=~\"$obcluster\",obzone=~\"$obzone\",svr_ip=~\"$observer\",tenant_name=~\"$tenant_name\"}[$__rate_interval])) by ($group)",
21382138
"hide": false,
21392139
"interval": "",
2140-
"legendFormat": "rpc out rt {{$group}}",
2140+
"legendFormat": "rpc out latency {{$group}}",
21412141
"refId": "B"
21422142
}
21432143
],
2144-
"title": "Rpc rt",
2144+
"title": "Rpc Latency",
21452145
"type": "timeseries"
21462146
},
21472147
{

plugins/mysqltest/3.1.0/init.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def parse_size(size):
3636
_bytes = int(size)
3737
else:
3838
units = {"B": 1, "K": 1<<10, "M": 1<<20, "G": 1<<30, "T": 1<<40}
39-
match = re.match(r'([1-9][0-9]*)\s*([B,K,M,G,T])', size.upper())
39+
match = re.match(r'(0|[1-9][0-9]*)\s*([B,K,M,G,T])', size.upper())
4040
_bytes = int(match.group(1)) * units[match.group(2)]
4141
return _bytes
4242

@@ -127,6 +127,7 @@ def exec_sql(cmd):
127127
exec_init = 'init.sql'
128128
exec_mini_init = 'init_mini.sql'
129129
exec_init_user = 'init_user.sql|root@mysql|test'
130+
exec_init_user_for_oracle = 'init_user_oracle.sql|SYS@oracle|SYS'
130131
client = plugin_context.clients[server]
131132
memory_limit = get_memory_limit(cursor, client)
132133
is_mini = memory_limit and parse_size(memory_limit) < (16<<30)

0 commit comments

Comments
 (0)