Skip to content

Commit 368d775

Browse files
Daniel LiMonica Joshi
authored andcommitted
Added - Support for Database Management MySQL Heatwave
1 parent 0ff06c8 commit 368d775

7 files changed

+259
-42
lines changed

internal/integrationtest/database_management_managed_my_sql_database_test.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,16 @@ func TestDatabaseManagementManagedMySqlDatabaseResource_basic(t *testing.T) {
6666
resource.TestCheckResourceAttrSet(singularDatasourceName, "compartment_id"),
6767
resource.TestCheckResourceAttrSet(singularDatasourceName, "db_name"),
6868
resource.TestCheckResourceAttrSet(singularDatasourceName, "db_version"),
69+
resource.TestCheckResourceAttrSet(singularDatasourceName, "heat_wave_memory_size"),
70+
resource.TestCheckResourceAttrSet(singularDatasourceName, "heat_wave_node_shape"),
71+
resource.TestCheckResourceAttr(singularDatasourceName, "heat_wave_nodes.#", "2"),
6972
resource.TestCheckResourceAttrSet(singularDatasourceName, "id"),
73+
resource.TestCheckResourceAttrSet(singularDatasourceName, "is_heat_wave_active"),
74+
resource.TestCheckResourceAttrSet(singularDatasourceName, "is_heat_wave_enabled"),
75+
resource.TestCheckResourceAttrSet(singularDatasourceName, "is_lakehouse_enabled"),
7076
resource.TestCheckResourceAttrSet(singularDatasourceName, "name"),
7177
resource.TestCheckResourceAttrSet(singularDatasourceName, "time_created"),
78+
resource.TestCheckResourceAttrSet(singularDatasourceName, "time_created_heat_wave"),
7279
),
7380
},
7481
})

internal/service/database_management/database_management_managed_my_sql_database_data_source.go

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,55 @@ func DatabaseManagementManagedMySqlDatabaseDataSource() *schema.Resource {
3434
Type: schema.TypeString,
3535
Computed: true,
3636
},
37+
"heat_wave_cluster_display_name": {
38+
Type: schema.TypeString,
39+
Computed: true,
40+
},
41+
"heat_wave_memory_size": {
42+
Type: schema.TypeInt,
43+
Computed: true,
44+
},
45+
"heat_wave_node_shape": {
46+
Type: schema.TypeString,
47+
Computed: true,
48+
},
49+
"heat_wave_nodes": {
50+
Type: schema.TypeList,
51+
Computed: true,
52+
Elem: &schema.Resource{
53+
Schema: map[string]*schema.Schema{
54+
// Required
55+
56+
// Optional
57+
58+
// Computed
59+
"id": {
60+
Type: schema.TypeString,
61+
Computed: true,
62+
},
63+
"status": {
64+
Type: schema.TypeString,
65+
Computed: true,
66+
},
67+
"time_created": {
68+
Type: schema.TypeString,
69+
Computed: true,
70+
},
71+
},
72+
},
73+
},
74+
"is_heat_wave_active": {
75+
Type: schema.TypeBool,
76+
Computed: true,
77+
},
78+
"is_heat_wave_enabled": {
79+
Type: schema.TypeBool,
80+
Computed: true,
81+
},
82+
"is_lakehouse_enabled": {
83+
Type: schema.TypeBool,
84+
Computed: true,
85+
},
3786
"name": {
3887
Type: schema.TypeString,
3988
Computed: true,
@@ -42,6 +91,10 @@ func DatabaseManagementManagedMySqlDatabaseDataSource() *schema.Resource {
4291
Type: schema.TypeString,
4392
Computed: true,
4493
},
94+
"time_created_heat_wave": {
95+
Type: schema.TypeString,
96+
Computed: true,
97+
},
4598
},
4699
}
47100
}
@@ -102,6 +155,36 @@ func (s *DatabaseManagementManagedMySqlDatabaseDataSourceCrud) SetData() error {
102155
s.D.Set("db_version", *s.Res.DbVersion)
103156
}
104157

158+
if s.Res.HeatWaveClusterDisplayName != nil {
159+
s.D.Set("heat_wave_cluster_display_name", *s.Res.HeatWaveClusterDisplayName)
160+
}
161+
162+
if s.Res.HeatWaveMemorySize != nil {
163+
s.D.Set("heat_wave_memory_size", *s.Res.HeatWaveMemorySize)
164+
}
165+
166+
if s.Res.HeatWaveNodeShape != nil {
167+
s.D.Set("heat_wave_node_shape", *s.Res.HeatWaveNodeShape)
168+
}
169+
170+
heatWaveNodes := []interface{}{}
171+
for _, item := range s.Res.HeatWaveNodes {
172+
heatWaveNodes = append(heatWaveNodes, HeatWaveNodeToMap(item))
173+
}
174+
s.D.Set("heat_wave_nodes", heatWaveNodes)
175+
176+
if s.Res.IsHeatWaveActive != nil {
177+
s.D.Set("is_heat_wave_active", *s.Res.IsHeatWaveActive)
178+
}
179+
180+
if s.Res.IsHeatWaveEnabled != nil {
181+
s.D.Set("is_heat_wave_enabled", *s.Res.IsHeatWaveEnabled)
182+
}
183+
184+
if s.Res.IsLakehouseEnabled != nil {
185+
s.D.Set("is_lakehouse_enabled", *s.Res.IsLakehouseEnabled)
186+
}
187+
105188
if s.Res.Name != nil {
106189
s.D.Set("name", *s.Res.Name)
107190
}
@@ -110,5 +193,9 @@ func (s *DatabaseManagementManagedMySqlDatabaseDataSourceCrud) SetData() error {
110193
s.D.Set("time_created", s.Res.TimeCreated.String())
111194
}
112195

196+
if s.Res.TimeCreatedHeatWave != nil {
197+
s.D.Set("time_created_heat_wave", s.Res.TimeCreatedHeatWave.String())
198+
}
199+
113200
return nil
114201
}

internal/service/database_management/database_management_managed_my_sql_database_sql_data_data_source.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,14 @@ func DatabaseManagementManagedMySqlDatabaseSqlDataDataSource() *schema.Resource
7474
Type: schema.TypeString,
7575
Computed: true,
7676
},
77+
"heat_wave_offloaded": {
78+
Type: schema.TypeFloat,
79+
Computed: true,
80+
},
81+
"heat_wave_out_of_memory": {
82+
Type: schema.TypeFloat,
83+
Computed: true,
84+
},
7785
"last_seen": {
7886
Type: schema.TypeString,
7987
Computed: true,
@@ -307,6 +315,14 @@ func MySqlDataSummaryToMap(obj oci_database_management.MySqlDataSummary) map[str
307315
result["first_seen"] = obj.FirstSeen.String()
308316
}
309317

318+
if obj.HeatWaveOffloaded != nil {
319+
result["heat_wave_offloaded"] = float32(*obj.HeatWaveOffloaded)
320+
}
321+
322+
if obj.HeatWaveOutOfMemory != nil {
323+
result["heat_wave_out_of_memory"] = float32(*obj.HeatWaveOutOfMemory)
324+
}
325+
310326
if obj.LastSeen != nil {
311327
result["last_seen"] = obj.LastSeen.String()
312328
}

internal/service/database_management/database_management_managed_my_sql_databases_data_source.go

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,59 @@ func DatabaseManagementManagedMySqlDatabasesDataSource() *schema.Resource {
4949
Type: schema.TypeString,
5050
Computed: true,
5151
},
52+
"heat_wave_cluster_display_name": {
53+
Type: schema.TypeString,
54+
Computed: true,
55+
},
56+
"heat_wave_memory_size": {
57+
Type: schema.TypeInt,
58+
Computed: true,
59+
},
60+
"heat_wave_node_shape": {
61+
Type: schema.TypeString,
62+
Computed: true,
63+
},
64+
"heat_wave_nodes": {
65+
Type: schema.TypeList,
66+
Computed: true,
67+
Elem: &schema.Resource{
68+
Schema: map[string]*schema.Schema{
69+
// Required
70+
71+
// Optional
72+
73+
// Computed
74+
"id": {
75+
Type: schema.TypeString,
76+
Computed: true,
77+
},
78+
"status": {
79+
Type: schema.TypeString,
80+
Computed: true,
81+
},
82+
"time_created": {
83+
Type: schema.TypeString,
84+
Computed: true,
85+
},
86+
},
87+
},
88+
},
5289
"id": {
5390
Type: schema.TypeString,
5491
Computed: true,
5592
},
93+
"is_heat_wave_active": {
94+
Type: schema.TypeBool,
95+
Computed: true,
96+
},
97+
"is_heat_wave_enabled": {
98+
Type: schema.TypeBool,
99+
Computed: true,
100+
},
101+
"is_lakehouse_enabled": {
102+
Type: schema.TypeBool,
103+
Computed: true,
104+
},
56105
"name": {
57106
Type: schema.TypeString,
58107
Computed: true,
@@ -61,6 +110,10 @@ func DatabaseManagementManagedMySqlDatabasesDataSource() *schema.Resource {
61110
Type: schema.TypeString,
62111
Computed: true,
63112
},
113+
"time_created_heat_wave": {
114+
Type: schema.TypeString,
115+
Computed: true,
116+
},
64117
},
65118
},
66119
},
@@ -148,6 +201,22 @@ func (s *DatabaseManagementManagedMySqlDatabasesDataSourceCrud) SetData() error
148201
return nil
149202
}
150203

204+
func HeatWaveNodeToMap(obj oci_database_management.HeatWaveNode) map[string]interface{} {
205+
result := map[string]interface{}{}
206+
207+
if obj.Id != nil {
208+
result["id"] = string(*obj.Id)
209+
}
210+
211+
result["status"] = string(obj.Status)
212+
213+
if obj.TimeCreated != nil {
214+
result["time_created"] = obj.TimeCreated.String()
215+
}
216+
217+
return result
218+
}
219+
151220
func ManagedMySqlDatabaseSummaryToMap(obj oci_database_management.ManagedMySqlDatabaseSummary) map[string]interface{} {
152221
result := map[string]interface{}{}
153222

website/docs/d/database_management_managed_my_sql_database.html.markdown

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,20 @@ The following arguments are supported:
3434
The following attributes are exported:
3535

3636
* `compartment_id` - The OCID of the compartment.
37-
* `db_name` - MySQL Database Name
38-
* `db_version` - MySQL Database Version
39-
* `id` - The OCID of the Managed MySql Database.
37+
* `db_name` - The name of the MySQL Database.
38+
* `db_version` - The version of the MySQL Database.
39+
* `id` - The OCID of the Managed MySQL Database.
40+
* `time_created` - The date and time the Managed MySQL Database was created.
41+
* `heat_wave_cluster_display_name` - The name of the HeatWave cluster.
42+
* `heat_wave_memory_size` - The total memory belonging to the HeatWave cluster in GBs.
43+
* `heat_wave_node_shape` - Shape of the nodes in the HeatWave cluster.
44+
* `heat_wave_nodes` - The information about an individual HeatWave nodes in the cluster.
45+
* `id` - The ID associated with the HeatWave node.
46+
* `status` - The status of the HeatWave node. Indicates whether the status of the node is UP, DOWN, or UNKNOWN at the current time.
47+
* `time_created` - The date and time the node was created.
48+
* `is_heat_wave_active` - If the HeatWave cluster is active or not.
49+
* `is_heat_wave_enabled` - If HeatWave is enabled for this db system or not.
50+
* `is_lakehouse_enabled` - If HeatWave Lakehouse is enabled for the db system or not.
4051
* `name` - The name of the Managed MySQL Database.
41-
* `time_created` - The date and time the Managed Database was created.
52+
* `time_created_heat_wave` - The date and time the Managed MySQL Database was created.
4253

website/docs/d/database_management_managed_my_sql_database_sql_data.html.markdown

Lines changed: 52 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,23 @@ data "oci_database_management_managed_my_sql_database_sql_data" "test_managed_my
3131

3232
The following arguments are supported:
3333

34-
* `end_time` - (Required) The end time of the time range to retrieve the health metrics of a Managed Database in UTC in ISO-8601 format, which is "yyyy-MM-dd'T'hh:mm:ss.sss'Z'".
35-
* `filter_column` - (Optional) The parameter to filter results by key criteria.
36-
* `managed_my_sql_database_id` - (Required) The OCID of ManagedMySqlDatabase.
34+
* `end_time` - (Required) The end time of the time range to retrieve the health metrics of a Managed Database in UTC in ISO-8601 format, which is "yyyy-MM-dd'T'hh:mm:ss.sss'Z'".
35+
* `filter_column` - (Optional) The parameter to filter results by key criteria which include :
36+
* AVG_TIMER_WAIT
37+
* SUM_TIMER_WAIT
38+
* COUNT_STAR
39+
* SUM_ERRORS
40+
* SUM_ROWS_AFFECTED
41+
* SUM_ROWS_SENT
42+
* SUM_ROWS_EXAMINED
43+
* SUM_CREATED_TMP_TABLES
44+
* SUM_NO_INDEX_USED
45+
* SUM_NO_GOOD_INDEX_USED
46+
* FIRST_SEEN
47+
* LAST_SEEN
48+
* HEATWAVE_OFFLOADED
49+
* HEATWAVE_OUT_OF_MEMORY
50+
* `managed_my_sql_database_id` - (Required) The OCID of the Managed MySQL Database.
3751
* `start_time` - (Required) The start time of the time range to retrieve the health metrics of a Managed Database in UTC in ISO-8601 format, which is "yyyy-MM-dd'T'hh:mm:ss.sss'Z'".
3852

3953

@@ -47,37 +61,39 @@ The following attributes are exported:
4761

4862
The following attributes are exported:
4963

50-
* `items` - List of SQLDataSummary.
51-
* `avg_timer_wait` - The Average Execution Time.
52-
* `count_star` - The Number Of Times The Query Has Been Executed.
53-
* `digest` - The Digest Of The Normalized Query.
54-
* `digest_text` - The Normalized Query.
55-
* `first_seen` - When The Query Was First Seen. When The Table Is Truncated, The First Seen Value Is Also Reset.
56-
* `last_seen` - When The Query Was Seen The Last Time.
57-
* `max_timer_wait` - The Slowest The Query Has Been Executed.
58-
* `min_timer_wait` - The Fastest The Query Has Been Executed.
59-
* `quantile95` - The 95th Percentile Of The Query Latency. That Is, 95% Of The Queries Complete In The Time Given Or In Less Time.
60-
* `quantile99` - The 99th Percentile Of The Query Latency.
61-
* `quantile999` - The 99.9th Percentile Of The Query Latency.
62-
* `schema_name` - The Schema That Was The Default Schema When Executing The Query. If No Schema Was The Default, The Value Is NULL.
63-
* `sum_created_temp_disk_tables` - The Total Number Of On-Disk Internal Temporary Tables That Have Been Created By The Query.
64-
* `sum_created_temp_tables` - The Total Number Of Internal Temporary Tables – Whether Created In Memory Or On Disk – That Have Been Created By The Query.
65-
* `sum_errors` - The Total Number Of Errors That Have Been Encountered Executing The Query.
66-
* `sum_lock_time` - The Total Amount Of Time That Has Been Spent Waiting For Table Locks.
67-
* `sum_no_good_index_used` - The Total Number Of Times No Good Index Was Used. This Means That The ExtraColumn In The EXPLAIN Output Includes “Range Checked For Each Record.”
68-
* `sum_no_index_used` - The Total Number Of Times No Index Was Used To Execute The Query.
69-
* `sum_rows_affected` - The Total Number Of Rows That Have Been Modified By The Query.
70-
* `sum_rows_examined` - The Total Number Of Rows That Have Been Examined By The Query.
71-
* `sum_rows_sent` - The Total Number Of Rows That Have Been Returned (Sent) To The Client.
72-
* `sum_select_full_join` - The Total Number Of Joins That Have Performed Full Table Scans As There Is No Index For The Join Condition Or There Is No Join Condition. This Is The Same That Increments The Select_full_join Status Variable.
73-
* `sum_select_full_range_join` - The Total Number Of Joins That Use A Full Range Search. This Is The Same That Increments The Select_full_range_join Status Variable.
74-
* `sum_select_range` - The Total Number Of Times The Query Has Used A Range Search. This Is The Same That Increments The Select_range Status Variable.
75-
* `sum_select_range_check` - The Total Number Of Joins By The Query Where The Join Does Not Have An Index That Checks For The Index Usage After Each Row. This Is The Same That Increments The Select_range_check Status Variable.
76-
* `sum_select_scan` - The Total Number Of Times The Query Has Performed A Full Table Scan On The First Table In The Join. This Is The Same That Increments The Select_scan Status Variable.
77-
* `sum_sort_merge_passes` - The Total Number Of Sort Merge Passes That Have Been Done To Sort The Result Of The Query. This Is The Same That Increments The Sort_merge_passes Status Variable.
78-
* `sum_sort_range` - The Total Number Of Times A Sort Was Done Using Ranges. This Is The Same That Increments The Sort_range Status Variable.
79-
* `sum_sort_rows` - The Total Number Of Rows Sorted. This Is The Same That Increments The Sort_rowsStatus Variable.
80-
* `sum_sort_scan` - The Total Number Of Times A Sort Was Done By Scanning The Table. This Is The Same That Increments The Sort_scan Status Variable.
81-
* `sum_timer_wait` - The Total Amount Of Time That Has Been Spent Executing The Query.
82-
* `sum_warnings` - The Total Number Of Warnings That Have Been Encountered Executing The Query.
64+
* `items` - The list of SQLDataSummary records.
65+
* `avg_timer_wait` - The average execution time.
66+
* `count_star` - The number Of times the query has been executed.
67+
* `digest` - The digest information of the normalized query.
68+
* `digest_text` - The normalized query.
69+
* `first_seen` - The date and time the query was first seen. If the table is truncated, the first seen value is reset.
70+
* `heat_wave_offloaded` - The number of query executions offloaded to HeatWave.
71+
* `heat_wave_out_of_memory` - The number of query executions with HeatWave out-of-memory errors.
72+
* `last_seen` - The date and time the query was last seen.
73+
* `max_timer_wait` - The slowest the query has been executed.
74+
* `min_timer_wait` - The fastest the query has been executed.
75+
* `quantile95` - The 95th percentile of the query latency. That is, 95% of the queries complete in the time given or in less time.
76+
* `quantile99` - The 99th percentile of the query latency.
77+
* `quantile999` - The 99.9th percentile of the query latency.
78+
* `schema_name` - The name of the default schema when executing the query. If a schema is not set as the default, then the value is NULL.
79+
* `sum_created_temp_disk_tables` - The total number of On-Disk internal temporary tables that have been created by the query.
80+
* `sum_created_temp_tables` - The total number of internal temporary tables (in memory or on disk), which have been created by the query.
81+
* `sum_errors` - The total number of errors that have been encountered executing the query.
82+
* `sum_lock_time` - The total amount of time that has been spent waiting for table locks.
83+
* `sum_no_good_index_used` - The total number of times no good index was used. This means that the extra column in The EXPLAIN output includes “Range Checked For Each Record.”
84+
* `sum_no_index_used` - The total number of times no index was used to execute the query.
85+
* `sum_rows_affected` - The total number of rows that have been modified by the query.
86+
* `sum_rows_examined` - The total number of rows that have been examined by the query.
87+
* `sum_rows_sent` - The total number of rows that have been returned (sent) to the client.
88+
* `sum_select_full_join` - The total number of joins that have performed full table scans as there was no join condition or no index for the join condition. This is the same as the select_full_join status variable.
89+
* `sum_select_full_range_join` - The total number of joins that use a full range search. This is the same as the select_full_range_join status variable.
90+
* `sum_select_range` - The total number of times the query has used a range search. This is the same as the select_range status variable.
91+
* `sum_select_range_check` - The total number of joins by the query where the join does not have an index that checks for the index usage after each row. This is the same as the select_range_check status variable.
92+
* `sum_select_scan` - The total number of times the query has performed a full table scan on the first table in the join. This is the same as the select_scan status variable.
93+
* `sum_sort_merge_passes` - The total number of sort merge passes that have been done to sort the result of the query. This is the same as the sort_merge_passes status variable.
94+
* `sum_sort_range` - The total number of times a sort was done using ranges. This is the same as the sort_range status variable.
95+
* `sum_sort_rows` - The total number of rows sorted. This is the same as the sort_rowsStatus variable.
96+
* `sum_sort_scan` - The total number of times a sort was done by scanning the table. This is the same as the sort_scan status variable.
97+
* `sum_timer_wait` - The total amount of time that has been spent executing the query.
98+
* `sum_warnings` - The total number of warnings that have been encountered executing the query.
8399

0 commit comments

Comments
 (0)