golang-migrate / migrate

Database migrations. CLI and Golang library.
Other
15.6k stars 1.42k forks source link

Getting "Cannot achieve consistency level ALL" error #596

Open Broham opened 3 years ago

Broham commented 3 years ago

Describe the Bug I'm attempting to run migrate to populate a database I have, but when I run the command it comes back with the error: error: Cannot achieve consistency level ALL in line 0: SELECT version, dirty FROM "schema_migrations" LIMIT 1

I've found a number of different posts related to this error message but they all seem to be related to TRUNCATE commands. I'm wondering why this might be happening and if there is a workaround? My keyspace definition is as follows: CREATE KEYSPACE cs_workflow_v2 WITH replication = {'class': 'NetworkTopologyStrategy', 'beta-cassandra-01': '3'} AND durable_writes = true; Is it possible to migrate without changing to SimpleStrategy with 1 node?

Steps to Reproduce Steps to reproduce the behavior:

  1. My migrations look like 'migrate -database cassandra://{some ip....}:9042/cs_workflow_v2 -path {some path...} -verbose up'
  2. See error: error: Cannot achieve consistency level ALL in line 0: SELECT version, dirty FROM "schema_migrations" LIMIT 1

Expected Behavior The data would migrate without errors

Migrate Version v4.14.1

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

Loaded Database Drivers cassandra, cockroachdb, firebird, neo4j, postgres, postgresql, redshift, crdb-postgres, firebirdsql, mongodb, mongodb+srv, spanner, sqlserver, stub, clickhouse, cockroach, mysql

Go Version go version go1.16.5 darwin/amd64

dhui commented 3 years ago

'NetworkTopologyStrategy' should work. Is your cluster healthy when you're running migrations? Are there any timeouts between nodes?

Also, you can change the consistency for migrations to a level you find acceptable to work around any issues.