GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — How should we resolve the fact that we can't make HappyBase create_table() atomic · Issue #1524 · googleapis/google-cloud-python

How should we resolve the fact that we can't make HappyBase create_table() atomic #1524

New issue
Copy link
New issue
Copy link
Closed
Closed
How should we resolve the fact that we can't make HappyBase create_table() atomic#1524
Copy link
Assignees
dhermes
Labels
api: bigtableIssues related to the Bigtable API.type: questionRequest for information or clarification. Not an issue.

Description

@dhermes
dhermes
opened on Feb 24, 2016
Issue body actions

See comment. The core issue is that in HBase/Thrift, there is a way to create the table along with the column families all at once while in Cloud Bigtable we have to make 1 create table request and then n create column family requests. If any of those fail then create_table() will exit in an "undefined" state.

Activity

  1. dhermes
    added
    type: questionRequest for information or clarification. Not an issue.
    api: bigtableIssues related to the Bigtable API.
    on Feb 24, 2016
  2. dhermes
    assigned
    jgeewax
    on Feb 24, 2016
  3. jgeewax commented on Feb 29, 2016

    @jgeewax
    jgeewax
    on Feb 29, 2016
    Contributor
    More actions

    And there's no way to wrap this in a transaction?

    What about if the CFs call fails, and they retry -- what happens then ?

    /cc @maxluebbe: Creating a table + CFs can't happen atomically in Cloud Bigtable?

  4. tseaver commented on Jul 1, 2016

    @tseaver
    tseaver
    on Jul 1, 2016
    Contributor
    More actions

    Hmm, looks like Bigtable V2 may have removed the restriction. The V1 proto for CreateTableRequest has:

    message CreateTableRequest {
      // The unique name of the cluster in which to create the new table.
      string name = 1;
    
      // The name by which the new table should be referred to within the cluster,
      // e.g. "foobar" rather than "<cluster_name>/tables/foobar".
      string table_id = 2;
    
      // The Table to create. The `name` field of the Table and all of its
      // ColumnFamilies must be left blank, and will be populated in the response.
      Table table = 3;

    but in V2:

    message CreateTableRequest {
      // An initial split point for a newly created table.
      message Split {
        // Row key to use as an initial tablet boundary.
        bytes key = 1;
      }
    
      // The unique name of the instance in which to create the table.
      // Values are of the form projects/<project>/instances/<instance>
      string parent = 1;
    
      // The name by which the new table should be referred to within the parent
      // instance, e.g. "foobar" rather than "<parent>/tables/foobar".
      string table_id = 2;
    
      // The Table to create.
      Table table = 3;

    @garye do I jump to conclusions, or can we populate column families into the table entry in V2?

  5. dhermes commented on Jul 2, 2016

    @dhermes
    dhermes
    on Jul 2, 2016
    ContributorAuthor
    More actions

    We could always check by making live requests against the API

  6. garye commented on Jul 2, 2016

    @garye
    garye
    on Jul 2, 2016
    Contributor
    More actions

    I haven't tested this but I'm reason sure that you can add column families
    at creation time.

    On Fri, Jul 1, 2016, 8:42 PM Danny Hermes [email protected] wrote:

    We could always check by making live requests against the API

    —
    You are receiving this because you were mentioned.
    Reply to this email directly, view it on GitHub
    #1524 (comment),
    or mute the thread
    https://github.com/notifications/unsubscribe/AACTr5Ko0g8rhJ1MCeVGHyEnrNKH2YNTks5qRbPvgaJpZM4Hh7KQ
    .

  7. tseaver commented on Jul 19, 2016

    @tseaver
    tseaver
    on Jul 19, 2016
    Contributor
    More actions

    @dhermes would you like me to tackle that?

  8. dhermes
    assigned
    dhermes
    and unassigned
    jgeewax
    on Jul 19, 2016
  9. dhermes commented on Jul 19, 2016

    @dhermes
    dhermes
    on Jul 19, 2016
    ContributorAuthor
    More actions

    I'll handle it.

  10. dhermes commented on Jul 19, 2016

    @dhermes
    dhermes
    on Jul 19, 2016
    ContributorAuthor
    More actions

    @garye I confirmed this works and also confirmed that it results in an INVALID_ARGUMENT with

    Table's 'name' field must be empty during creation

    if the CreateTableRequest.Table.name is set, the backend probably does this to avoid having to check a conflict with CreateTableRequest.table_id.


    Implementing it now, here is the snippet I used to confirm it works:

    from gcloud import _helpers
    from gcloud.bigtable._generated_v2 import bigtable_table_admin_pb2
    from gcloud.bigtable._generated_v2 import table_pb2
    from gcloud.bigtable.client import Client
    from gcloud.environment_vars import TESTS_PROJECT
    
    
    def main():
        # Set-up test env.
        _helpers.PROJECT = TESTS_PROJECT
    
        client = Client(admin=True)
        client.start()
    
        # New instance.
        instance_id = 'gcloud-test-issue-1524'
        instance = client.instance(instance_id, 'us-central1-c')
        instance.create()
    
        # New table object, but manually construct PB to create.
        table = instance.table('gcloud-python-test-table')
    
        table_pb = table_pb2.Table()
        col_fam_pb = table_pb.column_families['col-fam-id1']
        col_fam_pb.gc_rule.max_num_versions = 1
        request_pb = bigtable_table_admin_pb2.CreateTableRequest(
            parent=instance.name,
            table_id=table.table_id,
            table=table_pb,
        )
        try:
            client._table_stub.CreateTable(request_pb, client.timeout_seconds)
        finally:
            instance.delete()
            client.stop()
    
    
    if __name__ == '__main__':
        main()
  11. garye commented on Jul 19, 2016

    @garye
    garye
    on Jul 19, 2016
    Contributor
    More actions

    Awesome! Good to hear.

    On Tue, Jul 19, 2016, 6:13 PM Danny Hermes [email protected] wrote:

    @garye https://github.com/garye I confirmed this works and also
    confirmed that it results in an INVALID_ARGUMENT with

    Table's 'name' field must be empty during creation

    if the CreateTableRequest.Table.name is set, the backend probably does

    this to avoid having to check a conflict with CreateTableRequest.table_id.

    Implementing it now, here is the snippet I used to confirm it works:

    from gcloud import _helpersfrom gcloud.bigtable._generated_v2 import bigtable_table_admin_pb2from gcloud.bigtable._generated_v2 import table_pb2from gcloud.bigtable.client import Clientfrom gcloud.environment_vars import TESTS_PROJECT

    def main():
    # Set-up test env.
    _helpers.PROJECT = TESTS_PROJECT

    client = Client(admin=True)
    client.start()
    
    # New instance.
    instance_id = 'gcloud-test-issue-1524'
    instance = client.instance(instance_id, 'us-central1-c')
    instance.create()
    
    # New table object, but manually construct PB to create.
    table = instance.table('gcloud-python-test-table')
    
    # table_pb = table_pb2.Table(name=table.name)
    table_pb = table_pb2.Table()
    col_fam_pb = table_pb.column_families['col-fam-id1']
    col_fam_pb.gc_rule.max_num_versions = 1
    request_pb = bigtable_table_admin_pb2.CreateTableRequest(
        parent=instance.name,
        table_id=table.table_id,
        table=table_pb,
    )
    try:
        client._table_stub.CreateTable(request_pb, client.timeout_seconds)
    finally:
        instance.delete()
        client.stop()
    

    if name == 'main':
    main()

    —
    You are receiving this because you were mentioned.
    Reply to this email directly, view it on GitHub
    #1524 (comment),
    or mute the thread
    https://github.com/notifications/unsubscribe-auth/AACTr83kVAFPFnkfYxu2RYRC2S5G3zt8ks5qXUv_gaJpZM4Hh7KQ
    .

  12. dhermes
    added a commit that references this issue on Jul 19, 2016

    Making HappyBase create_table() atomic.

    This issue will close once commit c43fc06 is merged into the 'master' branch.
    c43fc06
  13. dhermes
    closed this as completedin #2002on Jul 20, 2016
  14. parthea
    added a commit that references this issue on Sep 22, 2023

    chore: move samples from python-docs-sample (#33)

    69c4425
  15. parthea
    added 3 commits that reference this issue on Nov 24, 2025

    chore: tidy up RestInterceptor comments (#1524)

    1177f87

    feat: ECP Provider drop cryptography requirement (#1524)

    52aec13

    chore(main): release 2.30.0 (#1507)

    11b1f4e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @dhermes
    dhermes

Labels

api: bigtableIssues related to the Bigtable API.type: questionRequest for information or clarification. Not an issue.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.