SCAN command is failing on a cluster without replicas
Closed this issue · 2 comments
Pre-condition : Created a cluster with 3 master nodes and no replicas. There is need for a lean cluster in dev environment.
Scenario : Created a scanner using cluster client to scan through the keys. It always returns empty results without any error.
Reason : NewMulti() internally use Clients() to retrieve the node information. Clients() implemented by cluster depends on the secondary nodes to identify the primary nodes.
Sample Code:
func ScanKeys(ctx context.Context, client *radix.Cluster){
scanner := radix.ScannerConfig{
Command: scanCmd,
Pattern: pattern,
}.NewMulti(client)
var key string
for scanner.Next(ctx, &key) {
// use key to read values.
}
// return values read.
}
Thanks @anoopss83 , you're right that it's because of the way Clients
was constructing its result. I've pushed a fix up, I will tag a new release once I've also fixed #344.
Thanks @mediocregopher