Skip to content

Commit 0bb8fc2

Browse files
Project: Configurable DB Params (#755)
* Added support for Configurable DB Params (#714) * Added support and unit tests for new config endpoints * Added support and unit tests for changes to DB get, create, and update endpoints * Fix lint * Added missing omitempty * Removed invalid fields from Configurable DB changes (#729) * Removed stale fields * Fix lint * Add integration tests for Configurable DB Params (#728) * Add database engine config test cases * remove prints * lint * removing invalid fields * add negative test case * address assertion failures * add fixtures * remove invalid fields in assertions * Allow nullable DB Engine Config fields to be set to explicit null values (#742) * Allow nullable fields to be set to explicit null value * Fix int tests * adding test cases * update password_encryption pointer * update test fixtures and order * update test fixtures and order * rename test * add fixture --------- Co-authored-by: Youjung Kim <[email protected]> * Updated type for modified fields (#750) * Updated type for changed fields * remove pg13 negative test case --------- Co-authored-by: Youjung Kim <[email protected]> --------- Co-authored-by: Youjung Kim <[email protected]> Co-authored-by: Youjung Kim <[email protected]>
1 parent 891c21f commit 0bb8fc2

21 files changed

+14501
-27
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ BIN_DIR := $(GOPATH)/bin
44
INTEGRATION_DIR := ./test/integration
55
FIXTURES_DIR := $(INTEGRATION_DIR)/fixtures
66

7+
TEST_TAGS := integration
78
TEST_TIMEOUT := 5h
89

910
SKIP_DOCKER ?= 0

mysql.go

Lines changed: 334 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,326 @@ type MySQLDatabase struct {
5050
UsedDiskSizeGB int `json:"used_disk_size_gb"`
5151
TotalDiskSizeGB int `json:"total_disk_size_gb"`
5252
Port int `json:"port"`
53+
54+
EngineConfig MySQLDatabaseEngineConfig `json:"engine_config"`
55+
}
56+
57+
type MySQLDatabaseEngineConfig struct {
58+
MySQL *MySQLDatabaseEngineConfigMySQL `json:"mysql,omitempty"`
59+
BinlogRetentionPeriod *int `json:"binlog_retention_period,omitempty"`
60+
}
61+
62+
type MySQLDatabaseEngineConfigMySQL struct {
63+
ConnectTimeout *int `json:"connect_timeout,omitempty"`
64+
DefaultTimeZone *string `json:"default_time_zone,omitempty"`
65+
GroupConcatMaxLen *float64 `json:"group_concat_max_len,omitempty"`
66+
InformationSchemaStatsExpiry *int `json:"information_schema_stats_expiry,omitempty"`
67+
InnoDBChangeBufferMaxSize *int `json:"innodb_change_buffer_max_size,omitempty"`
68+
InnoDBFlushNeighbors *int `json:"innodb_flush_neighbors,omitempty"`
69+
InnoDBFTMinTokenSize *int `json:"innodb_ft_min_token_size,omitempty"`
70+
InnoDBFTServerStopwordTable **string `json:"innodb_ft_server_stopword_table,omitempty"`
71+
InnoDBLockWaitTimeout *int `json:"innodb_lock_wait_timeout,omitempty"`
72+
InnoDBLogBufferSize *int `json:"innodb_log_buffer_size,omitempty"`
73+
InnoDBOnlineAlterLogMaxSize *int `json:"innodb_online_alter_log_max_size,omitempty"`
74+
InnoDBReadIOThreads *int `json:"innodb_read_io_threads,omitempty"`
75+
InnoDBRollbackOnTimeout *bool `json:"innodb_rollback_on_timeout,omitempty"`
76+
InnoDBThreadConcurrency *int `json:"innodb_thread_concurrency,omitempty"`
77+
InnoDBWriteIOThreads *int `json:"innodb_write_io_threads,omitempty"`
78+
InteractiveTimeout *int `json:"interactive_timeout,omitempty"`
79+
InternalTmpMemStorageEngine *string `json:"internal_tmp_mem_storage_engine,omitempty"`
80+
MaxAllowedPacket *int `json:"max_allowed_packet,omitempty"`
81+
MaxHeapTableSize *int `json:"max_heap_table_size,omitempty"`
82+
NetBufferLength *int `json:"net_buffer_length,omitempty"`
83+
NetReadTimeout *int `json:"net_read_timeout,omitempty"`
84+
NetWriteTimeout *int `json:"net_write_timeout,omitempty"`
85+
SortBufferSize *int `json:"sort_buffer_size,omitempty"`
86+
SQLMode *string `json:"sql_mode,omitempty"`
87+
SQLRequirePrimaryKey *bool `json:"sql_require_primary_key,omitempty"`
88+
TmpTableSize *int `json:"tmp_table_size,omitempty"`
89+
WaitTimeout *int `json:"wait_timeout,omitempty"`
90+
}
91+
92+
type MySQLDatabaseConfigInfo struct {
93+
MySQL MySQLDatabaseConfigInfoMySQL `json:"mysql"`
94+
BinlogRetentionPeriod MySQLDatabaseConfigInfoBinlogRetentionPeriod `json:"binlog_retention_period"`
95+
}
96+
97+
type MySQLDatabaseConfigInfoMySQL struct {
98+
ConnectTimeout ConnectTimeout `json:"connect_timeout"`
99+
DefaultTimeZone DefaultTimeZone `json:"default_time_zone"`
100+
GroupConcatMaxLen GroupConcatMaxLen `json:"group_concat_max_len"`
101+
InformationSchemaStatsExpiry InformationSchemaStatsExpiry `json:"information_schema_stats_expiry"`
102+
InnoDBChangeBufferMaxSize InnoDBChangeBufferMaxSize `json:"innodb_change_buffer_max_size"`
103+
InnoDBFlushNeighbors InnoDBFlushNeighbors `json:"innodb_flush_neighbors"`
104+
InnoDBFTMinTokenSize InnoDBFTMinTokenSize `json:"innodb_ft_min_token_size"`
105+
InnoDBFTServerStopwordTable InnoDBFTServerStopwordTable `json:"innodb_ft_server_stopword_table"`
106+
InnoDBLockWaitTimeout InnoDBLockWaitTimeout `json:"innodb_lock_wait_timeout"`
107+
InnoDBLogBufferSize InnoDBLogBufferSize `json:"innodb_log_buffer_size"`
108+
InnoDBOnlineAlterLogMaxSize InnoDBOnlineAlterLogMaxSize `json:"innodb_online_alter_log_max_size"`
109+
InnoDBReadIOThreads InnoDBReadIOThreads `json:"innodb_read_io_threads"`
110+
InnoDBRollbackOnTimeout InnoDBRollbackOnTimeout `json:"innodb_rollback_on_timeout"`
111+
InnoDBThreadConcurrency InnoDBThreadConcurrency `json:"innodb_thread_concurrency"`
112+
InnoDBWriteIOThreads InnoDBWriteIOThreads `json:"innodb_write_io_threads"`
113+
InteractiveTimeout InteractiveTimeout `json:"interactive_timeout"`
114+
InternalTmpMemStorageEngine InternalTmpMemStorageEngine `json:"internal_tmp_mem_storage_engine"`
115+
MaxAllowedPacket MaxAllowedPacket `json:"max_allowed_packet"`
116+
MaxHeapTableSize MaxHeapTableSize `json:"max_heap_table_size"`
117+
NetBufferLength NetBufferLength `json:"net_buffer_length"`
118+
NetReadTimeout NetReadTimeout `json:"net_read_timeout"`
119+
NetWriteTimeout NetWriteTimeout `json:"net_write_timeout"`
120+
SortBufferSize SortBufferSize `json:"sort_buffer_size"`
121+
SQLMode SQLMode `json:"sql_mode"`
122+
SQLRequirePrimaryKey SQLRequirePrimaryKey `json:"sql_require_primary_key"`
123+
TmpTableSize TmpTableSize `json:"tmp_table_size"`
124+
WaitTimeout WaitTimeout `json:"wait_timeout"`
125+
}
126+
127+
type ConnectTimeout struct {
128+
Description string `json:"description"`
129+
Example int `json:"example"`
130+
Maximum int `json:"maximum"`
131+
Minimum int `json:"minimum"`
132+
RequiresRestart bool `json:"requires_restart"`
133+
Type string `json:"type"`
134+
}
135+
136+
type DefaultTimeZone struct {
137+
Description string `json:"description"`
138+
Example string `json:"example"`
139+
MaxLength int `json:"maxLength"`
140+
MinLength int `json:"minLength"`
141+
Pattern string `json:"pattern"`
142+
RequiresRestart bool `json:"requires_restart"`
143+
Type string `json:"type"`
144+
}
145+
146+
type GroupConcatMaxLen struct {
147+
Description string `json:"description"`
148+
Example float64 `json:"example"`
149+
Maximum float64 `json:"maximum"`
150+
Minimum float64 `json:"minimum"`
151+
RequiresRestart bool `json:"requires_restart"`
152+
Type string `json:"type"`
153+
}
154+
155+
type InformationSchemaStatsExpiry struct {
156+
Description string `json:"description"`
157+
Example int `json:"example"`
158+
Maximum int `json:"maximum"`
159+
Minimum int `json:"minimum"`
160+
RequiresRestart bool `json:"requires_restart"`
161+
Type string `json:"type"`
162+
}
163+
164+
type InnoDBChangeBufferMaxSize struct {
165+
Description string `json:"description"`
166+
Example int `json:"example"`
167+
Maximum int `json:"maximum"`
168+
Minimum int `json:"minimum"`
169+
RequiresRestart bool `json:"requires_restart"`
170+
Type string `json:"type"`
171+
}
172+
173+
type InnoDBFlushNeighbors struct {
174+
Description string `json:"description"`
175+
Example int `json:"example"`
176+
Maximum int `json:"maximum"`
177+
Minimum int `json:"minimum"`
178+
RequiresRestart bool `json:"requires_restart"`
179+
Type string `json:"type"`
180+
}
181+
182+
type InnoDBFTMinTokenSize struct {
183+
Description string `json:"description"`
184+
Example int `json:"example"`
185+
Maximum int `json:"maximum"`
186+
Minimum int `json:"minimum"`
187+
RequiresRestart bool `json:"requires_restart"`
188+
Type string `json:"type"`
189+
}
190+
191+
type InnoDBFTServerStopwordTable struct {
192+
Description string `json:"description"`
193+
Example string `json:"example"`
194+
MaxLength int `json:"maxLength"`
195+
Pattern string `json:"pattern"`
196+
RequiresRestart bool `json:"requires_restart"`
197+
Type []string `json:"type"`
198+
}
199+
200+
type InnoDBLockWaitTimeout struct {
201+
Description string `json:"description"`
202+
Example int `json:"example"`
203+
Maximum int `json:"maximum"`
204+
Minimum int `json:"minimum"`
205+
RequiresRestart bool `json:"requires_restart"`
206+
Type string `json:"type"`
207+
}
208+
209+
type InnoDBLogBufferSize struct {
210+
Description string `json:"description"`
211+
Example int `json:"example"`
212+
Maximum int `json:"maximum"`
213+
Minimum int `json:"minimum"`
214+
RequiresRestart bool `json:"requires_restart"`
215+
Type string `json:"type"`
216+
}
217+
218+
type InnoDBOnlineAlterLogMaxSize struct {
219+
Description string `json:"description"`
220+
Example int `json:"example"`
221+
Maximum int `json:"maximum"`
222+
Minimum int `json:"minimum"`
223+
RequiresRestart bool `json:"requires_restart"`
224+
Type string `json:"type"`
225+
}
226+
227+
type InnoDBReadIOThreads struct {
228+
Description string `json:"description"`
229+
Example int `json:"example"`
230+
Maximum int `json:"maximum"`
231+
Minimum int `json:"minimum"`
232+
RequiresRestart bool `json:"requires_restart"`
233+
Type string `json:"type"`
234+
}
235+
236+
type InnoDBRollbackOnTimeout struct {
237+
Description string `json:"description"`
238+
Example bool `json:"example"`
239+
RequiresRestart bool `json:"requires_restart"`
240+
Type string `json:"type"`
241+
}
242+
243+
type InnoDBThreadConcurrency struct {
244+
Description string `json:"description"`
245+
Example int `json:"example"`
246+
Maximum int `json:"maximum"`
247+
Minimum int `json:"minimum"`
248+
RequiresRestart bool `json:"requires_restart"`
249+
Type string `json:"type"`
250+
}
251+
252+
type InnoDBWriteIOThreads struct {
253+
Description string `json:"description"`
254+
Example int `json:"example"`
255+
Maximum int `json:"maximum"`
256+
Minimum int `json:"minimum"`
257+
RequiresRestart bool `json:"requires_restart"`
258+
Type string `json:"type"`
259+
}
260+
261+
type InteractiveTimeout struct {
262+
Description string `json:"description"`
263+
Example int `json:"example"`
264+
Maximum int `json:"maximum"`
265+
Minimum int `json:"minimum"`
266+
RequiresRestart bool `json:"requires_restart"`
267+
Type string `json:"type"`
268+
}
269+
270+
type InternalTmpMemStorageEngine struct {
271+
Description string `json:"description"`
272+
Enum []string `json:"enum"`
273+
Example string `json:"example"`
274+
RequiresRestart bool `json:"requires_restart"`
275+
Type string `json:"type"`
276+
}
277+
278+
type MaxAllowedPacket struct {
279+
Description string `json:"description"`
280+
Example int `json:"example"`
281+
Maximum int `json:"maximum"`
282+
Minimum int `json:"minimum"`
283+
RequiresRestart bool `json:"requires_restart"`
284+
Type string `json:"type"`
285+
}
286+
287+
type MaxHeapTableSize struct {
288+
Description string `json:"description"`
289+
Example int `json:"example"`
290+
Maximum int `json:"maximum"`
291+
Minimum int `json:"minimum"`
292+
RequiresRestart bool `json:"requires_restart"`
293+
Type string `json:"type"`
294+
}
295+
296+
type NetBufferLength struct {
297+
Description string `json:"description"`
298+
Example int `json:"example"`
299+
Maximum int `json:"maximum"`
300+
Minimum int `json:"minimum"`
301+
RequiresRestart bool `json:"requires_restart"`
302+
Type string `json:"type"`
303+
}
304+
305+
type NetReadTimeout struct {
306+
Description string `json:"description"`
307+
Example int `json:"example"`
308+
Maximum int `json:"maximum"`
309+
Minimum int `json:"minimum"`
310+
RequiresRestart bool `json:"requires_restart"`
311+
Type string `json:"type"`
312+
}
313+
314+
type NetWriteTimeout struct {
315+
Description string `json:"description"`
316+
Example int `json:"example"`
317+
Maximum int `json:"maximum"`
318+
Minimum int `json:"minimum"`
319+
RequiresRestart bool `json:"requires_restart"`
320+
Type string `json:"type"`
321+
}
322+
323+
type SortBufferSize struct {
324+
Description string `json:"description"`
325+
Example int `json:"example"`
326+
Maximum int `json:"maximum"`
327+
Minimum int `json:"minimum"`
328+
RequiresRestart bool `json:"requires_restart"`
329+
Type string `json:"type"`
330+
}
331+
332+
type SQLMode struct {
333+
Description string `json:"description"`
334+
Example string `json:"example"`
335+
MaxLength int `json:"maxLength"`
336+
Pattern string `json:"pattern"`
337+
RequiresRestart bool `json:"requires_restart"`
338+
Type string `json:"type"`
339+
}
340+
341+
type SQLRequirePrimaryKey struct {
342+
Description string `json:"description"`
343+
Example bool `json:"example"`
344+
RequiresRestart bool `json:"requires_restart"`
345+
Type string `json:"type"`
346+
}
347+
348+
type TmpTableSize struct {
349+
Description string `json:"description"`
350+
Example int `json:"example"`
351+
Maximum int `json:"maximum"`
352+
Minimum int `json:"minimum"`
353+
RequiresRestart bool `json:"requires_restart"`
354+
Type string `json:"type"`
355+
}
356+
357+
type WaitTimeout struct {
358+
Description string `json:"description"`
359+
Example int `json:"example"`
360+
Maximum int `json:"maximum"`
361+
Minimum int `json:"minimum"`
362+
RequiresRestart bool `json:"requires_restart"`
363+
Type string `json:"type"`
364+
}
365+
366+
type MySQLDatabaseConfigInfoBinlogRetentionPeriod struct {
367+
Description string `json:"description"`
368+
Example int `json:"example"`
369+
Maximum int `json:"maximum"`
370+
Minimum int `json:"minimum"`
371+
RequiresRestart bool `json:"requires_restart"`
372+
Type string `json:"type"`
53373
}
54374

55375
func (d *MySQLDatabase) UnmarshalJSON(b []byte) error {
@@ -90,17 +410,19 @@ type MySQLCreateOptions struct {
90410
// Deprecated: SSLConnection is a deprecated property, as it is no longer supported in DBaaS V2.
91411
SSLConnection bool `json:"ssl_connection,omitempty"`
92412

93-
Fork *DatabaseFork `json:"fork,omitempty"`
413+
Fork *DatabaseFork `json:"fork,omitempty"`
414+
EngineConfig *MySQLDatabaseEngineConfig `json:"engine_config,omitempty"`
94415
}
95416

96417
// MySQLUpdateOptions fields are used when altering the existing MySQL Database
97418
type MySQLUpdateOptions struct {
98-
Label string `json:"label,omitempty"`
99-
AllowList *[]string `json:"allow_list,omitempty"`
100-
Updates *DatabaseMaintenanceWindow `json:"updates,omitempty"`
101-
Type string `json:"type,omitempty"`
102-
ClusterSize int `json:"cluster_size,omitempty"`
103-
Version string `json:"version,omitempty"`
419+
Label string `json:"label,omitempty"`
420+
AllowList *[]string `json:"allow_list,omitempty"`
421+
Updates *DatabaseMaintenanceWindow `json:"updates,omitempty"`
422+
Type string `json:"type,omitempty"`
423+
ClusterSize int `json:"cluster_size,omitempty"`
424+
Version string `json:"version,omitempty"`
425+
EngineConfig *MySQLDatabaseEngineConfig `json:"engine_config,omitempty"`
104426
}
105427

106428
// MySQLDatabaseBackup is information for interacting with a backup for the existing MySQL Database
@@ -245,3 +567,8 @@ func (c *Client) ResumeMySQLDatabase(ctx context.Context, databaseID int) error
245567
e := formatAPIPath("databases/mysql/instances/%d/resume", databaseID)
246568
return doPOSTRequestNoRequestResponseBody(ctx, c, e)
247569
}
570+
571+
// GetMySQLDatabaseConfig returns a detailed list of all the configuration options for MySQL Databases
572+
func (c *Client) GetMySQLDatabaseConfig(ctx context.Context) (*MySQLDatabaseConfigInfo, error) {
573+
return doGETRequest[MySQLDatabaseConfigInfo](ctx, c, "databases/mysql/config")
574+
}

0 commit comments

Comments
 (0)