A read pool in a Google Cloud SQL MySQL cluster is a fully managed group of read replicas which can auto-scale based on server metrics such as CPU utilisation. Recently I gave it a try and replaced existing read replicas with a read pool. Everything went well until when setting flags.
I manage Cloud SQL configurations with Terraform + Terragrunt, and I got the following error when I run
│ Error: Error waiting for Update Instance: set MySQL flags error: Error 3017 (HY000): This operation cannot be performed with a running replica sql thread; run STOP REPLICA SQL_THREAD first
As the error message suggested, I tried to stop the replica thread but that failed too since read pools are fully managed and the replication state is part of that.
There are quite some flags to set, which are kind of best practice accumulated through out the years. To troubleshoot this, I tried to set a single flag from the list, and that worked. Then I realised the flags which caused this error must be replication related! After I removed the following flags, the problem went away.
flags_not_allowed_for_read_pools = [
{
name = "slave_parallel_type"
value = "LOGICAL_CLOCK"
},
{
name = "slave_preserve_commit_order"
value = "off"
},
]🙂
