"Cluster key mismatch" when doing "ScanAll" operation



My program got “Cluster key mismatch” when doing “ScanAll” operation. How can I fix this?

the code snippet is

ac.ScanAll(nil, "ns", "set")

and stack trace is

2015/12/03 16:53:48 [fatal]Cluster key mismatch
panic: [fatal]Cluster key mismatch

goroutine 1 [running]:
log.Panic(0xc820045be8, 0x2, 0x2)
	/go/1.5.1/libexec/src/log/log.go:320 +0xc1
main.chk(0x7fcc74c6f028, 0xc8203ae020)
	/go/src/xxx/counter/main.go:293 +0x13a
main.scan(0xc820112630, 0x493e0)
	go/src/xxx/counter/main.go:139 +0x588
	/go/src/xxx/counter/main.go:55 +0x2bd

goroutine 17 [select]:
github.com/aerospike/aerospike-client-go.(*Cluster).clusterBoss(0xc8200bc400, 0xc82007e690)
	/go/src/github.com/aerospike/aerospike-client-go/cluster.go:115 +0x2b4
created by github.com/aerospike/aerospike-client-go.NewCluster
	/go/src/github.com/aerospike/aerospike-client-go/cluster.go:97 +0x622



Which version of the Server/Client are you using?

  • server version: 3.6.0
  • storage config: memory + raw ssd
  • golang client: 1.7

It keep throwing “Cluster key mismatch” error when sever is in migration

after migration, the error disaapears.


By default, ScanPolicy.FailOnClusterChange is set to true, which causes the scan to fail on migrations. You can set it to false to avoid this, but may miss some newer records, or get duplicate data back.

You can also set the ScanPolicy.WaitUntilMigrationsAreOver to true, though this would wait until the migrations are over before it starts the scan.



I am using Java Client: 3.1.8

I don’t see a flag of ScanPolicy.WaitUntilMigrationsAreOver. Is it only in golang client? And if yes, do you plan to add it to the Java Client too?


Yes it is only a Go client feature. I’ll pass your request on to the Java client dev to add support.