Open sbonds opened 3 years ago
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @ambhatna, @savjani.
Author: | sbonds |
---|---|
Assignees: | - |
Labels: | `MySQL`, `Service Attention` |
Milestone: | - |
route to service team
Adding @Bashar-MSFT to help
Describe the bug
Command Name
az mysql server-logs download --name mysql-slow-$PAAS_HOST-2021061605.log --resource-group $PAAS_HOST_RG --server $PAAS_HOST
Errors:
To Reproduce
Find a MySQL PaaS host which generates a large "slow queries" log. Download the currently updating log with the command above using the $PAAS_HOST variable for the PaaS host name in Azure.
Expected behavior
The requested log file will (eventually) be downloaded.
Environment summary
Additional context
Microsoft case 2106020010003350 was opened for this issue. In the process of investigating that issue, we found that the connection reset behavior from the Azure side is intentional and needs to be handled by the Az CLI.
In particular, the blob will return connection reset when the file is written. We've noticed that this seems to happen in 32MB chunks, potentially due to upstream write buffering, hence the "large" requirement for replicating the issue.
Suggested fix
Microsoft proposed either using a lease, which is an exclusive write lock on the file or a snapshot. Write-locking a file used by the PaaS service seem like it would lead to unintended consequences on the back end, so I don't think this is a good plan.
Creating a snapshot, downloading the snapshot, then removing the snapshot seems like a very good plan for ensuring write consistency. This would be my suggested way of fixing/working around this bug.
Workaround with curl
A workaround is to use
az mysql server-logs list --resource-group $PAAS_HOST_RG --server $PAAS_HOST
to get a list of URLs with SAS for the logs. The appropriate SAS URL for the log in question can be fed to a very recent version of "curl" (newer than 7.52.0) which supports--retry-connrefused
which will allow the download to complete. For details about curl retry, see https://stackoverflow.com/questions/42873285/curl-retry-mechanism