Skip to content

Commit 4467e71

Browse files
committed
Enhancing automated testing for AWS Aurora
1 parent b297549 commit 4467e71

File tree

3 files changed

+70
-7
lines changed

3 files changed

+70
-7
lines changed

Aurora_Automated_Testing.md

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
2+
3+
### Compiling
4+
5+
To run AWS Aurora automated testing, ProxySQL needs to be compiled with `make testaurora`.
6+
7+
8+
### Prepare /etc/hosts
9+
10+
Add the following in `/etc/hosts` to simulate 30 IPs that proxysql will use to emulate 3 clusters:
11+
```
12+
127.0.1.11 host.1.11.aws-test.com
13+
127.0.1.12 host.1.12.aws-test.com
14+
127.0.1.13 host.1.13.aws-test.com
15+
127.0.1.14 host.1.14.aws-test.com
16+
127.0.1.15 host.1.15.aws-test.com
17+
127.0.1.16 host.1.16.aws-test.com
18+
127.0.1.17 host.1.17.aws-test.com
19+
127.0.1.18 host.1.18.aws-test.com
20+
127.0.1.19 host.1.19.aws-test.com
21+
127.0.1.20 host.1.20.aws-test.com
22+
23+
127.0.2.11 host.2.11.cluster2.aws.test
24+
127.0.2.12 host.2.12.cluster2.aws.test
25+
127.0.2.13 host.2.13.cluster2.aws.test
26+
127.0.2.14 host.2.14.cluster2.aws.test
27+
127.0.2.15 host.2.15.cluster2.aws.test
28+
127.0.2.16 host.2.16.cluster2.aws.test
29+
127.0.2.17 host.2.17.cluster2.aws.test
30+
127.0.2.18 host.2.18.cluster2.aws.test
31+
127.0.2.19 host.2.19.cluster2.aws.test
32+
127.0.2.20 host.2.20.cluster2.aws.test
33+
34+
127.0.3.11 host.3.11.aws.3.test.com
35+
127.0.3.12 host.3.12.aws.3.test.com
36+
127.0.3.13 host.3.13.aws.3.test.com
37+
127.0.3.14 host.3.14.aws.3.test.com
38+
127.0.3.15 host.3.15.aws.3.test.com
39+
127.0.3.16 host.3.16.aws.3.test.com
40+
127.0.3.17 host.3.17.aws.3.test.com
41+
127.0.3.18 host.3.18.aws.3.test.com
42+
127.0.3.19 host.3.19.aws.3.test.com
43+
127.0.3.20 host.3.20.aws.3.test.com
44+
```
45+
46+
### shutdown mysqld
47+
48+
When running automated testing, ProxySQL will listen on many IPs (30) an on port 3306.
49+
You need to make sure that MySQL server is not running, or not listening on port 3306.
50+
51+
52+
### Running proxysql
53+
54+
`proxysql` needs to be executed with `--sqlite3-server` .
55+
For example, to run it under `gdb`: `run -f -D . --sqlite3-server`
56+
57+

lib/ProxySQL_Admin.cpp

+9-3
Original file line numberDiff line numberDiff line change
@@ -10297,7 +10297,13 @@ void ProxySQL_Admin::enable_aurora_testing() {
1029710297
if (j==1) {
1029810298
serverid = "host." + std::to_string(j) + "." + std::to_string(i+11) + ".aws-test.com";
1029910299
} else {
10300-
serverid = "127.0." + std::to_string(j) + "." + std::to_string(i+11);
10300+
if (j==2) {
10301+
serverid = "host." + std::to_string(j) + "." + std::to_string(i+11) + ".cluster2.aws.test";
10302+
} else {
10303+
if (j==3) {
10304+
serverid = "host." + std::to_string(j) + "." + std::to_string(i+11) + ".aws.3.test.com";
10305+
}
10306+
}
1030110307
}
1030210308
string sessionid= "";
1030310309
sessionid = "b80ef4b4-" + serverid + "-aa01";
@@ -10312,8 +10318,8 @@ void ProxySQL_Admin::enable_aurora_testing() {
1031210318
}
1031310319
sqlite3_finalize(statement);
1031410320
admindb->execute("INSERT INTO mysql_aws_aurora_hostgroups (writer_hostgroup, reader_hostgroup, active, domain_name, max_lag_ms, check_interval_ms, check_timeout_ms, writer_is_also_reader, new_reader_weight, comment) VALUES (1271, 1272, 1, '.aws-test.com', 25, 120, 90, 1, 1, 'Automated Aurora Testing Cluster 1')");
10315-
admindb->execute("INSERT INTO mysql_aws_aurora_hostgroups (writer_hostgroup, reader_hostgroup, active, max_lag_ms, check_interval_ms, check_timeout_ms, writer_is_also_reader, new_reader_weight, comment) VALUES (1273, 1274, 1, 25, 120, 90, 0, 1, 'Automated Aurora Testing Cluster 2')");
10316-
admindb->execute("INSERT INTO mysql_aws_aurora_hostgroups (writer_hostgroup, reader_hostgroup, active, max_lag_ms, check_interval_ms, check_timeout_ms, writer_is_also_reader, new_reader_weight, comment) VALUES (1275, 1276, 1, 25, 120, 90, 0, 2, 'Automated Aurora Testing Cluster 3')");
10321+
admindb->execute("INSERT INTO mysql_aws_aurora_hostgroups (writer_hostgroup, reader_hostgroup, active, domain_name, max_lag_ms, check_interval_ms, check_timeout_ms, writer_is_also_reader, new_reader_weight, comment) VALUES (1273, 1274, 1, '.cluster2.aws.test', 25, 120, 90, 0, 1, 'Automated Aurora Testing Cluster 2')");
10322+
admindb->execute("INSERT INTO mysql_aws_aurora_hostgroups (writer_hostgroup, reader_hostgroup, active, domain_name, max_lag_ms, check_interval_ms, check_timeout_ms, writer_is_also_reader, new_reader_weight, comment) VALUES (1275, 1276, 1, '.aws.3.test.com', 25, 120, 90, 0, 2, 'Automated Aurora Testing Cluster 3')");
1031710323
admindb->execute("UPDATE mysql_aws_aurora_hostgroups SET active=1");
1031810324
//admindb->execute("update mysql_servers set max_replication_lag=20");
1031910325
load_mysql_servers_to_runtime();

lib/SQLite3_Server.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -899,11 +899,11 @@ void SQLite3_Server::populate_aws_aurora_table(MySQL_Session *sess) {
899899
}
900900
for (unsigned int i=0; i<num_aurora_servers[cluster_id]; i++) {
901901
string serverid = "";
902-
if (cluster_id==0) {
902+
//if (cluster_id==0) {
903903
serverid = "host." + std::to_string(cluster_id+1) + "." + std::to_string(i+11);
904-
} else {
905-
serverid = "127.0." + std::to_string(cluster_id+1) + "." + std::to_string(i+11);
906-
}
904+
//} else {
905+
// serverid = "127.0." + std::to_string(cluster_id+1) + "." + std::to_string(i+11);
906+
//}
907907
string sessionid= "";
908908
float lag_ms = 0;
909909
if (i==cur_aurora_writer[cluster_id]) {

0 commit comments

Comments
 (0)