GoogleCloudPlatform/spanner-migration-tool

Database not found error with default parameters

krishnamoorthy-r opened this issue · 3 comments

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.

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

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.

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