MySQL HeatWave
OCI MySQL HeatWave DB systems, API version 20190415 (SDK package mysql, clients
DbSystemClient, MysqlaasClient and WorkRequestsClient, CLI oci mysql). Each DB system is
backed by a real MySQL container, so the endpoint GetDbSystem returns is one an application can
connect to with the admin user it was created with. Real OCI serves the API on
mysql.{region}.ocp.{domain}; floci-oci serves it on port 4599 with the other services.
Supported operations
| Area | Operations |
|---|---|
| DB systems | CreateDbSystem, GetDbSystem, ListDbSystems, UpdateDbSystem, DeleteDbSystem |
| Runtime | StartDbSystem, StopDbSystem, RestartDbSystem |
| Catalog | ListShapes, ListVersions |
| Configurations | CreateConfiguration, GetConfiguration, ListConfigurations, UpdateConfiguration, DeleteConfiguration |
| Work requests | GetWorkRequest, ListWorkRequests, ListWorkRequestErrors, ListWorkRequestLogs, CancelWorkRequest |
How a DB system runs
- One container per DB system.
CreateDbSystemreturns the systemCREATINGwith anIN_PROGRESSwork request and starts amysql:<version>container in the background. Once MySQL answers on TCP the system becomesACTIVEand the work requestSUCCEEDED. Terraform waits on the lifecycle state,oci mysql db-system create --wait-for-stateon the work request. A container that exits, or one that is not ready withinFLOCI_OCI_SERVICES_MYSQL_READY_TIMEOUT_SECONDS(default 180), marks the systemFAILED(MySQL has noNEEDS_ATTENTIONstate) and its work requestFAILED, with the reason listed byListWorkRequestErrors. - Version and image.
mysqlVersiontakes a version fromListVersions(8.4.4) or a family (8.4, its newest version); without one a DB system runs8.4.4. The version picks the image throughFLOCI_OCI_SERVICES_MYSQL_IMAGE(defaultmysql:{version}). A newmysqlVersiononUpdateDbSystemrestarts the server on the new image. - Admin user.
adminUsernameandadminPasswordare required when the sidecar runs. The admin is created with every privilege on the first start; the password is not stored. A newadminPasswordonUpdateDbSystemis accepted and not applied to the server. - Endpoint. MySQL's port is published on a host port from
FLOCI_OCI_SERVICES_MYSQL_BASE_PORT..MAX_PORT(default13306..13405), one per DB system, andendpoints[0]carries the host and port to connect to:localhostand that port when floci-oci runs on the host, the container's name and3306when it runs in a container (clients on the same Docker network). The top-levelportandportXstay as requested (default3306and33060), since Terraform replaces a DB system whoseportchanges. The X Protocol port is not published. - Stop, start and restart keep the data volume.
StopDbSystemandRestartDbSystemrequireshutdownType(IMMEDIATE,FASTorSLOW); the container is stopped the same way for each. - Delete removes the container. The data volume goes with it in
memorystorage mode or whenFLOCI_OCI_STORAGE_PRUNE_VOLUMES_ON_DELETEis set. The system stays readable asDELETED. A container that is already gone counts as removed; when Docker cannot remove it, the system isFAILEDwith the error inlifecycleDetails, its work requestFAILED, and it keeps its container, volume and host port, so the delete can be sent again (inferred). - Mock mode (
FLOCI_OCI_SERVICES_MYSQL_MOCK=true) starts nothing: DB systems becomeACTIVEat once, with an endpoint nothing listens on, and the admin credentials are optional.
Wire notes
- Every list returns a bare JSON array (
[]DbSystemSummary,[]ShapeSummary,[]VersionSummary,[]ConfigurationSummary,[]WorkRequestSummary), paged withopc-next-pagewhere the SDK pages it;ListShapesandListVersionsare not paged. Every list requirescompartmentId. ListDbSystemstakesisUpToDate, which the SDKs describe as filtering DB systems on whether they use the latest revision of their configuration.UpdateConfigurationcannot change a configuration's variables (the SDK'sUpdateConfigurationDetailscarries only names and tags), so each configuration has one revision and every DB system uses it:isUpToDate=truefilters nothing out andisUpToDate=falsefinds no DB system. That reading is inferred; OCI documents no other way for a configuration to gain a revision.CreateDbSystemanswers200with the DbSystem,etag,locationandopc-work-request-id. Update, delete, start, stop and restart answer202with onlyopc-work-request-id. The SDKs record no status codes; these follow the other floci-oci services with work requests.adminUsernameandadminPasswordnever appear in a response, as in the SDK model.sourceis always{"sourceType": "NONE"}.subnetIdandnsgIdsmust exist in Networking, otherwise400 RelatedResourceNotAuthorizedOrNotFound. Nothing is attached to a real network.
Emulator choices
These defaults are floci-oci's own; no Oracle source in the reference corpus states them.
- When omitted:
dataStorageSizeInGBs50, fault domainFAULT-DOMAIN-1, maintenance windowSUN 00:00, a backup policy enabled with window00:00and 7 days of retention,deletionPolicyDELETE/SKIP_FINAL_BACKUP/ not protected,crashRecoveryENABLED,databaseManagementDISABLED,READ_WRITE/UNRESTRICTED, and system-generated certificates. A display name defaults tomysqldbsystem<timestamp>. - The maintenance window comes back exactly as sent (
sun 01:00stays lowercase), since Terraform compares it as a string. - A DB system with
deletionPolicy.isDeleteProtectedtrue answersDeleteDbSystemwith409 Conflictuntil the protection is turned off. - A
FAILEDDB system still takes anUpdateDbSystemthat changes onlydeletionPolicy,displayName,descriptionor tags, so a protected system whose container never started can be unprotected and deleted. Any other field answers409 Conflict. OCI does not document updates inFAILED; this rule is inferred. CancelWorkRequestanswers409 Conflict: operations are not cancellable.- An operation the DB system's state does not allow is refused with
409. A refusal while the system isCREATING,UPDATINGorDELETINGis409 IncorrectState, which OCI SDKs retry until the operation finishes; in any other state a retry cannot succeed, so it is409 Conflict, which they do not retry. Two requests that arrive together are decided one at a time: each sees the state the one before it left. A second lifecycle operation is then refused while the first is under way, except a delete, which cancels the operation in progress. Either way no work request is leftIN_PROGRESS. dataStorageSizeInGBsmay grow, never shrink (400 InvalidParameter). Storage limits, backup policies and maintenance windows are recorded, not acted on.
Shapes, versions and configurations
- Shapes and their CPU and memory sizes come from Oracle's
Supported Shapes
page: the ECPU shapes (
MySQL.Free,MySQL.2toMySQL.384), a subset of the OCPU shapes (MySQL.VM.Standard.E3.*,E4.*,Standard3.*) and theMySQL.HeatWave.*shapes.isSupportedForlistsHEATWAVECLUSTERfor the shapes that page says support one. A shape changes nothing about the container. - Versions are a subset of Oracle's
MySQL Server Versions,
picked so each one exists as a
mysqlimage tag:8.0.39to8.0.41,8.4.2to8.4.4,9.1.0and9.2.0. The family labels (8.4 - Long Term Support release) are floci-oci's. - Default configurations are
<shape>.Standaloneand<shape>.HAfor every shape, the names Oracle's page gives. Their OCIDs are stable across restarts, they belong to the tenancy, and they carry no variables. A DB system created withoutconfigurationIdgets the Standalone (or, withisHighlyAvailable, the HA) default of its shape. - Custom configurations take a
shapeName, an optionalparentConfigurationIdwhose variables they start from, andvariables. The variables are stored and returned but not applied to the server. A configuration a DB system uses cannot be deleted (409 Conflict), and a DB system's configuration must be for its shape (400 InvalidParameter).
Not emulated
Backups and restore, HeatWave clusters, read replicas, channels, blue-green deployments,
maintenance events and DB system status reports. Creating a DB system from a source other than
NONE answers 400 InvalidParameter. isHighlyAvailable is recorded; there is one server either
way.
Quickstart
The subnet has to exist first: create one as in the Networking quickstart.
E="--endpoint http://localhost:4599"
TENANCY=ocid1.tenancy.oc1..flocilocaltenancy0000000000000000000000000000000000000000
# Create a DB system and wait for it
oci mysql db-system create $E --compartment-id "$TENANCY" --shape-name MySQL.2 \
--subnet-id <subnetId> --admin-username admin_user --admin-password 'BEstrO0ng_#11' \
--wait-for-state SUCCEEDED
# Where to connect
oci mysql db-system get $E --db-system-id <dbSystemId> --query 'data.endpoints[0]'
mysql -h 127.0.0.1 -P <port> -u admin_user -p