Search code examples
google-cloud-sql

ERROR: (gcloud.sql.export.sql) HTTPError 409: Operation failed because another operation was already in progress


Running sql exports via jenkins (backups), On a regular basis i receive "ERROR: (gcloud.sql.export.sql) HTTPError 409: Operation failed because another operation was already in progress. ERROR: (gcloud.sql.operations.wait) argument OPERATION [OPERATION ...]: Must be specified.

I'm trying to determine where i can see which job are causing this to fail

ive tried to extending the gcloud sql operations wait --timeout to 1600 no luck

gcloud sql operations wait --timeout=1600


Solution

  • To wait for an operation, you need to specify the ID of the operation, as @PYB said. Here's how you can do that programmatically, like in a Jenkins script:

    $ gcloud sql operations list --instance=$DB_INSTANCE_NAME --filter='NOT status:done' --format='value(name)' | xargs -r gcloud sql operations wait
    $ gcloud sql ... # whatever you need to do