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

Database not found error with default parameters #793

Open
krishnamoorthy-r opened this issue Mar 17, 2024 · 3 comments
Open

Database not found error with default parameters #793

krishnamoorthy-r opened this issue Mar 17, 2024 · 3 comments

Comments

@krishnamoorthy-r
Copy link

Expected Behavior

It should work successful.

Actual Behavior

2024-03-17T16:58:47.045Z fatal cmd/data.go:97 FATAL error {"error": "can't finish database migration for db mysql_2024-03-17_17df-e0a7: can't migrate database: error while validating existing database: target database doesn't exist"}
github.com/GoogleCloudPlatform/spanner-migration-tool/cmd.(*DataCmd).Execute.func1
/tmpfs/src/git/harbourbridge/cmd/data.go:97
github.com/GoogleCloudPlatform/spanner-migration-tool/cmd.(*DataCmd).Execute
/tmpfs/src/git/harbourbridge/cmd/data.go:152
github.com/google/subcommands.(*Commander).Execute
/tmpfs/src/git/harbourbridge/vendor/github.com/google/subcommands/subcommands.go:209
github.com/google/subcommands.Execute
/tmpfs/src/git/harbourbridge/vendor/github.com/google/subcommands/subcommands.go:492
main.main
/tmpfs/src/git/harbourbridge/main.go:58
runtime.main
/tmpfs/src/go/src/runtime/proc.go:250

Steps to Reproduce the Problem

exported variables:
export GCPProjectID=XXXXX
export SpannerInstanceID=xxx-spanner-instance
export MYSQLHOST=10.132.0.18
export MYSQLUSER=dbuser
export MYSQLDATABASE=xxx
export MYSQLPORT=3306
export MYSQLPWD=xxxxx

  1. spanner-migration-tool schema --source=MySQL
  2. spanner-migration-tool data --source=MySQL --source-profile="streamingCfg=streaming_cfg.json" --target-profile='project=XXXXX,instance=xxx-spanner-instance' --session=mysql_2024-03-17_524c-7ffe.session.json

Specifications

Latest gcloud on GCE VM.

@krishnamoorthy-r
Copy link
Author

I can see with gcloud spanner databases list that a database with some autogenerated name created.

krishraj_google_com@migration-job-instance:~$ gcloud spanner databases list --instance xxx-spanner-instance
NAME STATE VERSION_RETENTION_PERIOD EARLIEST_VERSION_TIME KMS_KEY_NAME ENABLE_DROP_PROTECTION
mysql_2024-03-17_524c-7ffe READY 1h 2024-03-17T16:38:37.369404Z

@bharadwaj-aditya
Copy link
Collaborator

The target profile needs to take the database name as input. This needs to be provided while running a data command, as it needs this information to know which database to perform the migration against.

@krishnamoorthy-r
Copy link
Author

Thanks, Can we make error message explicitly state this is required field and missing values? Rather than database not found error!

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

No branches or pull requests

2 participants