Skip to content

feat: implement restore table to a different instance feature#830

Merged
kolea2 merged 5 commits intogoogleapis:backup-different-instancefrom
AVaksman:restoreTo_another
Dec 30, 2020
Merged

feat: implement restore table to a different instance feature#830
kolea2 merged 5 commits intogoogleapis:backup-different-instancefrom
AVaksman:restoreTo_another

Conversation

@AVaksman
Copy link
Contributor

@AVaksman AVaksman commented Dec 14, 2020

  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

#ToDo

  • Add System test
  • Add Samples for
    • Backup#restoreTo()
    • Instance#createTableFromBackup()

This PR proposes the following design

  • Introduce an additional function Backup#restoreTo(config, callback?) which accepts a config parameter of the type
    export interface RestoreTableConfig {
      tableId: string;
      instance?: Instance | string;
      gaxOptions?: CallOptions;
    }
  • Backup#restore() delegates to Backup#restoreTo() with this.cluster.instance value for config.instance.
  • Instance#createTableFromBackup() now respects both
    • Backup object created on a different instance.
    • As well as a string of full backup name (path) that contains a different (form this.id) instanceId.

Other design options

!Breaking:

  • Replace Backup#restore() with the proposed Backup#restoreTo() implementation
  • Include the changes with current pending 4.0.0 release

Non Breaking:

  • Add an optional instance parameter to Backup#restore()
    • This design might be a bit messier than desired
      restore(
        tableId: string,
        instanceOrGaxOptionsOrCallback?:
          | Instance
          | string
          | CallOptions
          | RestoreTableCallback,
        gaxOptionsOrCallback?: CallOptions | RestoreTableCallback,
        cb?: RestoreTableCallback
      ): void | Promise<RestoreTableResponse> {...}
    • This design will diverge from the established pattern
       function(OneRequiredParamIfAny, optionsOrCallback?, callback?) {...}

@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label Dec 14, 2020
@product-auto-label product-auto-label bot added the api: bigtable Issues related to the googleapis/nodejs-bigtable API. label Dec 14, 2020
@codecov
Copy link

codecov bot commented Dec 14, 2020

Codecov Report

Merging #830 (53d9ca5) into backup-different-instance (0ef8976) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@                    Coverage Diff                     @@
##           backup-different-instance     #830   +/-   ##
==========================================================
  Coverage                      99.22%   99.22%           
==========================================================
  Files                             18       18           
  Lines                          17416    17488   +72     
  Branches                        1025     1033    +8     
==========================================================
+ Hits                           17281    17353   +72     
  Misses                           132      132           
  Partials                           3        3           
Impacted Files Coverage Δ
src/backup.ts 100.00% <100.00%> (ø)
src/instance.ts 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0ef8976...53d9ca5. Read the comment docs.

@AVaksman AVaksman requested a review from kolea2 December 14, 2020 18:54
@AVaksman AVaksman marked this pull request as ready for review December 16, 2020 04:21
@AVaksman AVaksman requested a review from a team December 16, 2020 04:21
@AVaksman AVaksman requested a review from a team as a code owner December 16, 2020 04:21
@stephenplusplus
Copy link
Contributor

@AVaksman is there any additional context for the reasoning of this addition?

@kolea2
Copy link
Contributor

kolea2 commented Dec 17, 2020

@AVaksman is there any additional context for the reasoning of this addition?

Hey @stephenplusplus! We will be working on this in all languages, here's the Java draft for reference: googleapis/java-bigtable#515

@stephenplusplus
Copy link
Contributor

@kolea2 thank you!

@snippet-bot
Copy link

snippet-bot bot commented Dec 24, 2020

Here is the summary of changes.

You added 1 region tag.
You deleted 1 region tag.

This comment is generated by snippet-bot.
If you find problems with this result, please file an issue at:
https://github.com/googleapis/repo-automation-bots/issues.
To update this comment, add snippet-bot:force-run label or use the checkbox below:

  • Refresh this comment


backup.restore(
tableId,
backup.restoreTo(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we may want to leave some of these tests as is, so we don't lose coverage on .restore() functionality?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To have gRPC call implementation only in one place Backup#restore() (as more restrictive wrapper since can only restore to the same instance) delegates to Backup#restoreTo() and passing this.cluster.instance value as the config.instance param.
The current unit tests for Backup#restore() are to verify that it properly delegates to Backup#restoreTo() with and without optional gaxOptions param.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

got it, just want to confirm we still have at least one restore test in place for coverage?

@kolea2
Copy link
Contributor

kolea2 commented Dec 30, 2020

Looking good, merging into backup-different-instance as a WIP

@kolea2 kolea2 merged commit 06c082c into googleapis:backup-different-instance Dec 30, 2020
gcf-merge-on-green bot pushed a commit that referenced this pull request May 4, 2021
…863)

* feat: implement restore table to a different instance feature

* chore: docs

* chore: add system test

* fix(samples): region tag

* fix: docs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: bigtable Issues related to the googleapis/nodejs-bigtable API. cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants