@@ -202,10 +202,17 @@ func resourceBigtableGCPolicyUpsert(d *schema.ResourceData, meta interface{}) er
202
202
tableName := d .Get ("table" ).(string )
203
203
columnFamily := d .Get ("column_family" ).(string )
204
204
205
- err = retryTimeDuration ( func () error {
205
+ retryFunc := func () ( interface {}, error ) {
206
206
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 )
209
216
if err != nil {
210
217
return err
211
218
}
@@ -376,10 +383,14 @@ func resourceBigtableGCPolicyDestroy(d *schema.ResourceData, meta interface{}) e
376
383
377
384
defer c .Close ()
378
385
379
- err = retryTimeDuration ( func () error {
386
+ retryFunc := func () ( interface {}, error ) {
380
387
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 )
383
394
if err != nil {
384
395
return err
385
396
}
0 commit comments