From e5c1bedc2548d6ab7cc37475d34ccc6f1252259c Mon Sep 17 00:00:00 2001 From: megan07 Date: Wed, 11 Dec 2019 18:30:41 +0000 Subject: [PATCH] do not retry if sql api returns 409 for deleted instance name Signed-off-by: Modular Magician --- google-beta/error_retry_predicates.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/google-beta/error_retry_predicates.go b/google-beta/error_retry_predicates.go index d02614392a..c5d02726fc 100644 --- a/google-beta/error_retry_predicates.go +++ b/google-beta/error_retry_predicates.go @@ -33,6 +33,10 @@ func pubsubTopicProjectNotReady(err error) (bool, string) { func isSqlOperationInProgressError(err error) (bool, string) { if gerr, ok := err.(*googleapi.Error); ok && gerr.Code == 409 { + if strings.Contains(gerr.Body, "you cannot reuse the name of the deleted instance until one week from the deletion date.") { + return false, "" + } + return true, "Waiting for other concurrent Cloud SQL operations to finish" } return false, ""