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

google_bigtable_gc_policy - don't apply all GC policies concurrently #9252

Assignees
Labels

Comments

@RayBB
Copy link

RayBB commented May 27, 2021

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request.
  • Please do not leave +1 or me too comments, they generate extra noise for issue followers and do not help prioritize the request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.
  • If an issue is assigned to the modular-magician user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If an issue is assigned to a user, that user is claiming responsibility for the issue. If an issue is assigned to hashibot, a community member has claimed the issue already.

Terraform Version

Terraform v0.15.1 + provider registry.terraform.io/hashicorp/google v3.66.1

Affected Resource(s)

  • google_bigtable_gc_policy

Terraform Configuration Files

# column families along with garbage collection policies
locals {
  bigtable_column_families = {
    "a"      = { max_days = 30 },
    "b"  = { max_versions = 8 },
    "c" = { max_days = 7, max_versions = 10000, mode = "UNION" },
    "d"     = {},
    "e"         = {}
  }
}

# google_bigtable_table.bt_table:
resource "google_bigtable_table" "bt_table" {
  instance_name = google_bigtable_instance.bt_instance.name
  name          = "userhistory"
  project       = var.project_id

  dynamic "column_family" {
    for_each = local.bigtable_column_families
    content { family = column_family.key }
  }
}

# garbage collection policies
resource "google_bigtable_gc_policy" "policy" {
  for_each      = local.bigtable_column_families
  instance_name = google_bigtable_instance.bt_instance.name
  table         = google_bigtable_table.bt_table.name
  column_family = each.key
  mode          = try(each.value.mode, null)
  dynamic "max_age" {
    for_each = try([each.value.max_days], [])
    content { days = max_age.value }
  }
  dynamic "max_version" {
    for_each = try([each.value.max_versions], [])
    content { number = max_version.value }
  }
}

Debug Output


│ Error: rpc error: code = FailedPrecondition desc = Could not modify schema of projects/my-project/instances/the-big-instance/tables/mytablehere, due to concurrent modifications. This could mean another change to this tables schema, or a change to the replication topology (adding/removing a cluster).
--
73 | │
74 | │   with google_bigtable_gc_policy.policy["a"],
75 | │   on main_bigtable.tf line 73, in resource "google_bigtable_gc_policy" "policy":
76 | │   73: resource "google_bigtable_gc_policy" "policy" {


Panic Output

Expected Behavior

When applying multiple GC policies the policies will be applied sequentially so no errors happen.

Actual Behavior

The GC policies are applied concurrently which causes all but the first policies to fail with the error mentioned above.

Steps to Reproduce

  1. Have a bigtable table with multiple column families.
  2. Add new GC rules to more than one column family
  3. Run tf apply and you will get the error for all but one of the GC rules.

Important Factoids

Nothing

References

Docs:

  • #0000
@github-actions
Copy link

github-actions bot commented Jul 5, 2021

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.