@@ -202,10 +202,17 @@ func resourceBigtableGCPolicyUpsert(d *schema.ResourceData, meta interface{}) er
202202 tableName := d .Get ("table" ).(string )
203203 columnFamily := d .Get ("column_family" ).(string )
204204
205- err = retryTimeDuration ( func () error {
205+ retryFunc := func () ( interface {}, error ) {
206206 reqErr := c .SetGCPolicy (ctx , tableName , columnFamily , gcPolicy )
207- return reqErr
208- }, d .Timeout (schema .TimeoutCreate ), isBigTableRetryableError )
207+ return "" , reqErr
208+ }
209+ // The default create timeout is 20 minutes.
210+ timeout := d .Timeout (schema .TimeoutCreate )
211+ pollInterval := time .Duration (30 ) * time .Second
212+ // Mutations to gc policies can only happen one-at-a-time and take some amount of time.
213+ // Use a fixed polling rate of 30s based on the RetryInfo returned by the server rather than
214+ // the standard up-to-10s exponential backoff for those operations.
215+ _ , err = retryWithPolling (retryFunc , timeout , pollInterval , isBigTableRetryableError )
209216 if err != nil {
210217 return err
211218 }
@@ -376,10 +383,14 @@ func resourceBigtableGCPolicyDestroy(d *schema.ResourceData, meta interface{}) e
376383
377384 defer c .Close ()
378385
379- err = retryTimeDuration ( func () error {
386+ retryFunc := func () ( interface {}, error ) {
380387 reqErr := c .SetGCPolicy (ctx , d .Get ("table" ).(string ), d .Get ("column_family" ).(string ), bigtable .NoGcPolicy ())
381- return reqErr
382- }, d .Timeout (schema .TimeoutDelete ), isBigTableRetryableError )
388+ return "" , reqErr
389+ }
390+ // The default delete timeout is 20 minutes.
391+ timeout := d .Timeout (schema .TimeoutDelete )
392+ pollInterval := time .Duration (30 ) * time .Second
393+ _ , err = retryWithPolling (retryFunc , timeout , pollInterval , isBigTableRetryableError )
383394 if err != nil {
384395 return err
385396 }
0 commit comments