Commit d8672f7
Fix TLS verify error when gh-ost discovers the replication master (#1487)
* Update connection.DuplicateCredentials function to set correct ServerName property
Ensure the ServerName TLS property matches the new connection
instance key hostname to avoid TLS verify errors like the following:
2025-01-02 02:07:26 FATAL tls: failed to verify certificate: x509: certificate is valid for [old host], not [new host]
This is only one part of the fix for this issue. The second part,
registering TLS Config with the mysql driver, will come in
subsequent commits.
* Use connection.DuplicateCredentials in cases where the connection key changes
* Extract TLS config key name generation to GetDBTLSConfigKey function
* Extract function to register a connection's TLS config with the mysql driver
This allows us to register TLS configuration is the various places
where connection configs are created and before they're used.
* Register TLS config when setting up master connection info
This ensures that the master's TLS config has been registered with
the mysql driver before any connections are attempted.
This is the second part of resolving the following TLS verify
error:
2025-01-02 02:07:26 FATAL tls: failed to verify certificate: x509: certificate is valid for [old host], not [new host]
* Register TLS config when setting up the throttler's connection info
This ensures that the throttler's TLS config has been registered with
the mysql driver before any connections are attempted.
This is the second part of resolving the following TLS verify
error:
2025-01-02 02:07:26 FATAL tls: failed to verify certificate: x509: certificate is valid for [old host], not [new host]
---------
Co-authored-by: meiji163 <meiji163@github.com>1 parent 2ea0e60 commit d8672f7
File tree
5 files changed
+55
-9
lines changed- go
- logic
- mysql
5 files changed
+55
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
791 | 791 | | |
792 | 792 | | |
793 | 793 | | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
794 | 797 | | |
795 | 798 | | |
796 | 799 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
215 | 215 | | |
216 | 216 | | |
217 | 217 | | |
218 | | - | |
219 | | - | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
220 | 222 | | |
221 | 223 | | |
222 | 224 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
55 | 65 | | |
56 | 66 | | |
57 | 67 | | |
| |||
103 | 113 | | |
104 | 114 | | |
105 | 115 | | |
106 | | - | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
107 | 130 | | |
108 | 131 | | |
109 | 132 | | |
| |||
122 | 145 | | |
123 | 146 | | |
124 | 147 | | |
125 | | - | |
| 148 | + | |
126 | 149 | | |
127 | 150 | | |
128 | 151 | | |
| |||
142 | 165 | | |
143 | 166 | | |
144 | 167 | | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
56 | 59 | | |
57 | 60 | | |
58 | 61 | | |
| |||
72 | 75 | | |
73 | 76 | | |
74 | 77 | | |
| 78 | + | |
75 | 79 | | |
76 | 80 | | |
77 | 81 | | |
| |||
95 | 99 | | |
96 | 100 | | |
97 | 101 | | |
98 | | - | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
99 | 105 | | |
100 | 106 | | |
101 | 107 | | |
102 | 108 | | |
103 | | - | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
104 | 115 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
136 | 136 | | |
137 | 137 | | |
138 | 138 | | |
139 | | - | |
140 | | - | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
141 | 144 | | |
142 | 145 | | |
143 | 146 | | |
| |||
0 commit comments