golang-migrate / migrate

Database migrations. CLI and Golang library.
Other
15.59k stars 1.41k forks source link

Cassandra multiple hosts cluster migrations failed #1071

Open easokol opened 7 months ago

easokol commented 7 months ago

Describe the Bug Unable to perform migrations on Cassandra multiple hosts cluster

Steps to Reproduce Steps to reproduce the behavior:

  1. Assume we have Cassandra cluster with 3 replicas replica1,replica2,replica3, hosts can be resolved and reached correctly.
  2. migrate -verbose -path=migrations -database "cassandra://replica1:9042,replica2:9042,replica3:9042/base?consistency=ALL" up
  3. See error error: gocql: unable to create session: failed to resolve any of the provided hostnames

Expected Behavior Migrations successful as with PostgreSQL, MongoDB, etc

Migrate Version 4.17.0

Loaded Source Drivers Source drivers: bitbucket, gitlab, godoc-vfs, s3, gcs, go-bindata, file, github, github-ee

Loaded Database Drivers Database drivers: stub, clickhouse, cassandra, mysql, pgx4, crdb-postgres, firebird, pgx5, cockroach, cockroachdb, mongodb+srv, sqlserver, spanner, pgx, postgres, yugabyte, rqlite, mongodb, firebirdsql, postgresql, redshift, yugabytedb, ysql, neo4j

Additional context There is issue with gocql https://github.com/gocql/gocql/issues/1509 But seems to be Migrate does not correctly support multiple hosts, they should be split to multiple args while call gocql.NewCluster() https://github.com/golang-migrate/migrate/blob/87ba13c3985dc5fceb0c30c08f371259d2623b43/database/cassandra/cassandra.go#L97

debuggerpk commented 6 months ago

are the hosts reachable? works fine for me.