When a preferred maintenance window is configured for instances, it only guarantees that the maintenance event will not start outside the window. It does
not guarantee to finish within the specified window as stated
here. (which I believe is probably what happened in your case).
Also, in addition to regular maintenance (which is done during the maintenance window) there are some other occasions when your instance may go through a downtime like this. Here are some examples:
- You or another user on GCP changes instance size, flags, replication type, etc.
- Metadata update of an instance, which can be triggered by admin or users in the instance ACL (Access Control List).
- The machine hosting your instance has a hardware failure. Redundant storage and ACID storage engine means your data is safe in such a case, but MySQL must then be started on a new instance, resulting in a downtime period.