Skip to content
This repository was archived by the owner on Mar 26, 2026. It is now read-only.

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

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

kolea2 merged 5 commits into
googleapis:backup-different-instancefrom
AVaksman:restoreTo_another

Conversation

@AVaksman

@AVaksman AVaksman commented Dec 14, 2020 •

Copy link
Copy Markdown
Contributor
  • 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

codecov Bot commented Dec 14, 2020 •

Copy link
Copy Markdown

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 review from a team December 16, 2020 04:21
@stephenplusplus

Copy link
Copy Markdown
Contributor

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

@kolea2

kolea2 commented Dec 17, 2020

Copy link
Copy Markdown
Contributor

@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
Copy Markdown
Contributor

@kolea2 thank you!

@snippet-bot

snippet-bot Bot commented Dec 24, 2020 •

Copy link
Copy Markdown

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

Comment thread test/backup.ts

backup.restore(
tableId,
backup.restoreTo(

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

kolea2 commented Dec 30, 2020

Copy link
Copy Markdown
Contributor

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 subscribe to this conversation on GitHub. Already have an account? Sign in.

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