I still cannot reproduce this issue. Here’s the code I’m trying:
package main
import (
"flag"
"fmt"
"log"
"math/rand"
"runtime"
"sync"
as "github.com/aerospike/aerospike-client-go"
asl "github.com/aerospike/aerospike-client-go/logger"
)
var host = flag.String("h", "127.0.0.1", "host")
var port = flag.Int("p", 3000, "port")
var user = flag.String("U", "", "User.")
var password = flag.String("P", "", "Password.")
var clientPolicy *as.ClientPolicy
func main() {
runtime.GOMAXPROCS(runtime.NumCPU())
asl.Logger.SetLevel(asl.DEBUG)
flag.Parse()
clientPolicy = as.NewClientPolicy()
if *user != "" {
clientPolicy.User = *user
clientPolicy.Password = *password
}
client, err := as.NewClientWithPolicyAndHost(clientPolicy, as.NewHost(*host, *port))
if err != nil {
log.Fatal(err)
}
defer client.Close()
var wg sync.WaitGroup
wg.Add(1)
fmt.Println("Populating the LLists...")
l := make([]interface{}, 1000)
for j := 0; j < 1000; j++ {
l[j] = j
}
for i := 0; i < 1000; i++ {
fmt.Println(i)
key, _ := as.NewKey("test", "test", i)
listPut := client.GetLargeList(nil, key, "listName", "")
err = listPut.Destroy()
if err != nil {
panic(err)
}
err = listPut.Add(l...)
if err != nil {
panic(err)
}
}
fmt.Println("Scanning the LLists...")
for i := 0; i < 32; i++ {
go func() {
defer wg.Done()
for {
key, _ := as.NewKey("test", "test", rand.Intn(1000))
list := client.GetLargeList(nil, key, "listName", "")
_, err := list.Scan()
// fmt.Println(e)
if err != nil {
fmt.Println(err)
}
}
}()
}
fmt.Println("Scanning the Records...")
for i := 0; i < 32; i++ {
go func() {
defer wg.Done()
for {
rs, err := client.ScanAll(nil, "test", "test")
if err != nil {
fmt.Println(err)
}
for res := range rs.Results() {
if res.Err != nil {
fmt.Println(err)
}
// fmt.Println(res.Record)
}
}
}()
}
fmt.Println("PUT/GET the Records...")
for i := 0; i < 32; i++ {
go func() {
defer wg.Done()
for {
key, _ := as.NewKey("test", "test", rand.Intn(1000))
err := client.Put(nil, key, as.BinMap{"a": 1, "b": 2})
if err != nil {
fmt.Println(err)
}
_, err = client.Get(nil, key)
if err != nil {
fmt.Println(err)
}
}
}()
}
wg.Wait()
fmt.Println("Success...")
}
It does LList Scan, Normal Scan on Set, Get and Put on parallel. Could you run it on your end to see if it prints out an error somewhere?
It would be nice to check if you are using the latest Go client as well ($ go get -u …)