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

Feature/backups samples with restore #2

Open
wants to merge 12 commits into
base: feature/backups-samples-part-1
Choose a base branch
from

Conversation

prunge-helix
Copy link

Added restore sample.

The restore database name is generated similarly to the test database name with a different prefix and similar truncation logic to prevent > 30 character errors.

I have noticed there's some race condition happening with the DB. Sometimes it works, sometimes getting an error:

snippet_test.go:299: got output "deletebackup failed with rpc error: code = FailedPrecondition desc = Backup projects/appdev-soda-spanner-staging/instances/test-instance/backups/my-backup cannot be deleted at the moment because it is still in use by 1 databases for pending restore activity. Please try deleting the backup once the restore or post-restore optimize operations have completed on these databases. The databases using this backup are displayed in the UI in the Backups table `In use by` column, and returned by the GetBackup API."; want it to contain "Deleted backup [my-backup]"

My best guess is that the optimizing stage is sometimes still ongoing after the restore operation completes which requires the backup to still be present. Do we need to wait for the database state to exit the 'optimizing' state?

@prunge-helix
Copy link
Author

I'm also getting that same error with deleting a backup from the node samples as well. Pretty sure I had the node samples working at one point so maybe this has changed? Or maybe it's always been a race and I've never hit it before.

@jeanbza
Copy link

jeanbza commented Dec 5, 2019

Could you add tbpg@ to this review?

@skuruppu
Copy link

Could you add tbpg@ to this review?

Please also add @larkee to the repo.

@prunge-helix
Copy link
Author

Could you add tbpg@ to this review?

Please also add @larkee to the repo.

@jsuresh @ashvds would you be do the add/invite? I don't have enough permissions to do this.

@ashvds
Copy link
Member

ashvds commented Dec 10, 2019

They both have invites

Could you add tbpg@ to this review?

Please also add @larkee to the repo.

@jsuresh @ashvds would you be do the add/invite? I don't have enough permissions to do this.

@skuruppu skuruppu requested a review from larkee December 12, 2019 03:30
@larkee
Copy link

larkee commented Dec 17, 2019

My best guess is that the optimizing stage is sometimes still ongoing after the restore operation completes which requires the backup to still be present. Do we need to wait for the database state to exit the 'optimizing' state?

Sorry, I totally missed this. Yes, you need to wait for the database to finish optimizing before you can delete the backup.

…mples-with-restore

# Conflicts:
#	spanner/spanner_snippets/snippet_test.go
@prunge-helix
Copy link
Author

Sorry, I totally missed this. Yes, you need to wait for the database to finish optimizing before you can delete the backup.

Added poll loop in the test harness to wait for the restored database to come out of the READY_OPTIMIZING state. de7f5a0

Copy link

@larkee larkee left a comment

Choose a reason for hiding this comment

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

LGTM - minor nits

spanner/spanner_snippets/snippet_test.go Outdated Show resolved Hide resolved
spanner/spanner_snippets/snippet_test.go Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants