Commit 2197eea
authored
database: Add vitess + mysql 8.4 to our development environment (#8468)
The original plan for getting the Vitess infrastructure running was to
use
[vttestserver](https://vitess.io/docs/22.0/reference/programs/vttestserver)
as a starting point to reach a minimum viable setup. However,
vttestserver didn’t work out because some of its defaults conflicted
with how we clean up rows and the level of resources (threads) we need.
Fortunately, vttestserver is just a wrapper around
[vtcombo](https://vitess.io/docs/21.0/reference/programs/vtcombo) that
generates a [vttest
protobuf](https://github.com/vitessio/vitess/blob/v22.0.1/proto/vttest.proto)
describing the configuration for an in-memory topology server started by
vtcombo, encoded in JSON. By modifying vttestserver’s
[run.sh](https://github.com/vitessio/vitess/blob/v22.0.1/docker/vttestserver/run.sh),
we're able to interact with vtcombo directly, passing the JSON
configuration along with other vttestserver defaults reverse-engineered
from run.sh and
[vtprocess.go](https://github.com/vitessio/vitess/blob/v22.0.1/go/vt/vttest/vtprocess.go).
Vitess doesn’t provide a `vtcombo` image, we must build our own. Build
and upload a [boulder-vtcomboserver
image](https://hub.docker.com/repository/docker/letsencrypt/boulder-vtcomboserver)
on top of Docker's official MySQL 8.4 image, which provides native arm64
support. The accompanying tag-and-upload shell script defaults to amd64
for CI.
As an aside, Vitess’s official Dockerfiles are only published for amd64,
and modifying them to build for arm64 would prove difficult because
Oracle doesn’t publish MySQL arm64 binaries in its [Debian apt
repository](https://repo.mysql.com/apt/debian/pool/mysql-8.0/m/mysql-community).
With boulder-vtcomboserver up and running I was able to find/validate
the following issues and provide workarounds:
- **Problem:** db-migrate, the tool we use to apply database migrations,
must be configured to talk to MariaDB and to MySQL through Vitess
(vtgate + vttablet).
**Solution:** Create two new dbconfig YAML files (mariadb and vitess)
and use `test/entrypoint.sh` to set the appropriate file for
`sql-migrate` (`test/create_db.sh`) to use. Also, symlink each of these
two new files from db to db-next just like the old dbconfig.yml file.
- **Problem:** Vitess does not allow database `CREATE` statements and
any DDL containing them will be rejected by vtgate.
**Solution:** These databases are already created by vtcombo since
they’re defined as KEYSPACES. Skip database creation in
`test/create_db.sh`.
- **Problem:** Vitess does not allow user creation or grants (`CREATE
USER`, `GRANT`), and any DDL containing these commands will be blocked
by vtgate.
**Solution:** Skip user creation and grant steps in `test/create_db.sh`.
Set `%` for `--vschema_ddl_authorized_users` as vttestserver does, and
revisit this later for a more complete approach.
- **Problem:** vttablet default for maximum number of rows returned from
a (non-streaming) query (10,000) is too low for Boulder’s needs, causing
queries to fail due to vttablet rejecting them.
**Solution:** Increase `--queryserver-config-max-result-size` to
1,000,000 and `--queryserver-config-warn-result-size` to 1,000,000.
- **Problem:** vttablet default for connection pool size (16) and
maximum number of concurrent transactions (20) are too low for Boulder’s
needs, causing queries to fail due to vttablet being overloaded.
**Solution:** Increase `--queryserver-config-pool-size` to 64 and
`--queryserver-config-transaction-cap` to 80.
- **Problem:** Vitess does not allow `TRIGGER` statements and any DDL
containing them will be rejected by vtgate. Without TRIGGER statements
TestIssuanceCertStorageFailed, an integration test, will fail.
**Soluton:** Run these TRIGGER statements in an entrypoint
scripttest/vtcomboserver/install_trigger.sh, bypassing vtgate entirely.
Depends on #8479
Depends on #8489
Depends on #8490
Depends on #8494
Fixes #77361 parent 8b5aa62 commit 2197eea
File tree
29 files changed
+489
-52
lines changed- .github/workflows
- sa
- db-next
- db
- test
- integration
- proxysql
- secrets/dburls
- proxysql
- vitess
- vtcomboserver
29 files changed
+489
-52
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
57 | 63 | | |
58 | 64 | | |
59 | 65 | | |
60 | 66 | | |
61 | 67 | | |
62 | 68 | | |
| 69 | + | |
63 | 70 | | |
64 | 71 | | |
65 | 72 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
53 | | - | |
| 53 | + | |
54 | 54 | | |
| 55 | + | |
55 | 56 | | |
56 | 57 | | |
57 | 58 | | |
| |||
74 | 75 | | |
75 | 76 | | |
76 | 77 | | |
77 | | - | |
| 78 | + | |
78 | 79 | | |
79 | 80 | | |
80 | 81 | | |
81 | 82 | | |
82 | | - | |
| 83 | + | |
83 | 84 | | |
84 | 85 | | |
85 | 86 | | |
| |||
101 | 102 | | |
102 | 103 | | |
103 | 104 | | |
104 | | - | |
| 105 | + | |
105 | 106 | | |
106 | 107 | | |
107 | 108 | | |
| |||
144 | 145 | | |
145 | 146 | | |
146 | 147 | | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
147 | 163 | | |
148 | 164 | | |
149 | 165 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
This file was deleted.
File renamed without changes.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
25 | 33 | | |
26 | 34 | | |
27 | 35 | | |
| |||
79 | 87 | | |
80 | 88 | | |
81 | 89 | | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
82 | 107 | | |
83 | 108 | | |
84 | 109 | | |
| |||
122 | 147 | | |
123 | 148 | | |
124 | 149 | | |
| 150 | + | |
125 | 151 | | |
126 | 152 | | |
127 | 153 | | |
128 | 154 | | |
129 | | - | |
| 155 | + | |
130 | 156 | | |
131 | 157 | | |
132 | 158 | | |
| |||
146 | 172 | | |
147 | 173 | | |
148 | 174 | | |
| 175 | + | |
149 | 176 | | |
150 | 177 | | |
151 | 178 | | |
152 | 179 | | |
153 | 180 | | |
154 | 181 | | |
155 | 182 | | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
156 | 186 | | |
157 | 187 | | |
158 | 188 | | |
| |||
207 | 237 | | |
208 | 238 | | |
209 | 239 | | |
| 240 | + | |
210 | 241 | | |
211 | 242 | | |
212 | 243 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
| 47 | + | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
54 | 53 | | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
59 | 66 | | |
60 | 67 | | |
61 | 68 | | |
62 | 69 | | |
63 | 70 | | |
64 | | - | |
65 | | - | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
66 | 80 | | |
67 | | - | |
68 | | - | |
| 81 | + | |
69 | 82 | | |
70 | 83 | | |
71 | 84 | | |
| |||
78 | 91 | | |
79 | 92 | | |
80 | 93 | | |
81 | | - | |
| 94 | + | |
82 | 95 | | |
83 | 96 | | |
84 | 97 | | |
85 | 98 | | |
86 | | - | |
| 99 | + | |
87 | 100 | | |
88 | 101 | | |
89 | 102 | | |
90 | 103 | | |
91 | 104 | | |
92 | | - | |
| 105 | + | |
93 | 106 | | |
94 | | - | |
95 | | - | |
| 107 | + | |
96 | 108 | | |
97 | | - | |
98 | | - | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
99 | 118 | | |
100 | | - | |
101 | | - | |
| 119 | + | |
102 | 120 | | |
103 | 121 | | |
104 | 122 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
14 | | - | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
15 | 16 | | |
16 | | - | |
17 | | - | |
| 17 | + | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
22 | | - | |
23 | | - | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
24 | 39 | | |
25 | 40 | | |
26 | 41 | | |
| |||
0 commit comments