Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bigtable: Retry GC policy operations with a longer poll interval #12717

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/6627.txt
@@ -0,0 +1,3 @@
```release-note:enhancement
bigtable: retry GC policy operations with a longer poll interval
```
23 changes: 17 additions & 6 deletions google/resource_bigtable_gc_policy.go
Expand Up @@ -202,10 +202,17 @@ func resourceBigtableGCPolicyUpsert(d *schema.ResourceData, meta interface{}) er
tableName := d.Get("table").(string)
columnFamily := d.Get("column_family").(string)

err = retryTimeDuration(func() error {
retryFunc := func() (interface{}, error) {
reqErr := c.SetGCPolicy(ctx, tableName, columnFamily, gcPolicy)
return reqErr
}, d.Timeout(schema.TimeoutCreate), isBigTableRetryableError)
return "", reqErr
}
// The default create timeout is 20 minutes.
timeout := d.Timeout(schema.TimeoutCreate)
pollInterval := time.Duration(30) * time.Second
// Mutations to gc policies can only happen one-at-a-time and take some amount of time.
// Use a fixed polling rate of 30s based on the RetryInfo returned by the server rather than
// the standard up-to-10s exponential backoff for those operations.
_, err = retryWithPolling(retryFunc, timeout, pollInterval, isBigTableRetryableError)
if err != nil {
return err
}
Expand Down Expand Up @@ -376,10 +383,14 @@ func resourceBigtableGCPolicyDestroy(d *schema.ResourceData, meta interface{}) e

defer c.Close()

err = retryTimeDuration(func() error {
retryFunc := func() (interface{}, error) {
reqErr := c.SetGCPolicy(ctx, d.Get("table").(string), d.Get("column_family").(string), bigtable.NoGcPolicy())
return reqErr
}, d.Timeout(schema.TimeoutDelete), isBigTableRetryableError)
return "", reqErr
}
// The default delete timeout is 20 minutes.
timeout := d.Timeout(schema.TimeoutDelete)
pollInterval := time.Duration(30) * time.Second
_, err = retryWithPolling(retryFunc, timeout, pollInterval, isBigTableRetryableError)
if err != nil {
return err
}
Expand Down