Google-cloud-go: bigtable: Allow resetting a family's default GCPolicy to the default value

Created on 9 Jun 2017  路  4Comments  路  Source: googleapis/google-cloud-go

As a user of the Bigtable Go API, I'd like to be able to set a family's GCPolicy back to the default value.

I'd imagine it looking something like this in use, using a GCPolicy that represents the default policy;

gcPolicy := bigtable.DefaultGCPolicy()
err = c.SetGCPolicy(ctx, tableName, familyName, gcPolicy)
if err != nil {
    return fmt.Errorf("Error setting GC policy. %s", err)
}
bigtable feature request

Most helpful comment

Thanks for your quick responses! I'm going to go forward with having a GCPolicy set for a google_bigtable_family being a requirement. Like you said, we won't run into this situation, and as well, we'll be following the encouraged practices of the API by explicitly setting one.

All 4 comments

Can I ask what the use case is for this? In general we would in encourage you to choose a policy rather than rely on the default, which isn't guaranteed to be anything in particular and is probably not what you actually want.

Hi Gary!
I'm working on Bigtable support in Hashicorp's Terraform tool. It's one of the GCP provider's most requested features.

If you aren't familiar with Terraform, it manages cloud infrastructure as code. So, a user creates a terraform config file looking something like this;

resource "google_bigtable_instance" "instance" {
  name     = "tf-instance"
  cluster_id = "tf-instance"
  zone = "us-central1-b"
  num_nodes = 3
  storage_type = "HDD"
}

resource "google_bigtable_table" "table" {
  name     = "tf-table"
  instance_name = "${google_bigtable_instance.instance.name}"
  split_keys = ["a", "b", "c"]
}

resource "google_bigtable_family" "family" {
  name     = "tf-family"
  instance_name = "${google_bigtable_instance.instance.name}"
  table_name = "${google_bigtable_table.table.name}"
  version_policy = 10
}

And Terraform will create the resources specified. If a resource drifts from the configuration, Terraform will update it if possible, in order to bring it back in line. Otherwise, it will destroy and recreate it and any of its dependent resources.

As unintuitive as it feels to reset to an undefined default policy, the behaviour we expect is that a resource that looked like;

resource "google_bigtable_family" "family" {
  name     = "tf-family"
  instance_name = "${google_bigtable_instance.instance.name}"
  table_name = "${google_bigtable_table.table.name}"
  version_policy = 10
}

and was then updated to:

resource "google_bigtable_family" "family" {
  name     = "tf-family"
  instance_name = "${google_bigtable_instance.instance.name}"
  table_name = "${google_bigtable_table.table.name}"
}

would be indistinguishable from a resource that looked like that at creation time. This means that we would expect the GCPolicy string in FamilyInfo to be "<default>", as a result of having an undefined GCPolicy on that family.

I see, thanks for the explanation. While the API doesn't require a GC policy to be set, can you make it a requirement for the google_bigtable_family resource (like I imagine name is already)?. This would (if I'm understanding it correctly) mean that we'd never get into the situation you're describing.

Thanks for your quick responses! I'm going to go forward with having a GCPolicy set for a google_bigtable_family being a requirement. Like you said, we won't run into this situation, and as well, we'll be following the encouraged practices of the API by explicitly setting one.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dragan-cikic-shortcut picture dragan-cikic-shortcut  路  3Comments

3cham picture 3cham  路  3Comments

deelienardy picture deelienardy  路  3Comments

muratsplat picture muratsplat  路  3Comments

purohit picture purohit  路  4Comments