I am trying to upgrade to the new Go SDK while also migrating to a scopes and collections model for multi-tenancy. The Go SDK upgrade seems successful – I can call CB 6.6 successfully using cluster.Query(). However, when calling CB7 and trying to use scope.Query(), I only get ambiguous timeout errors. In both cases, timeout options are set at the cluster level:
// Connect the SDK to Couchbase Server.
timeConfig := gocb.TimeoutsConfig{
ConnectTimeout: (time.Duration(config.CBConnTimeout * 1000)) * time.Millisecond,
KVTimeout: (time.Duration(config.CBKVTimeout * 1000)) * time.Millisecond,
QueryTimeout: (time.Duration(config.CBOpTimeout * 1000)) * time.Millisecond,
}
clusterOpts := gocb.ClusterOptions{
Authenticator: gocb.PasswordAuthenticator{
Username: config.CBUser,
Password: config.SQLPwd,
},
TimeoutsConfig: timeConfig,
}
myCB, err = gocb.Connect(config.CBURL, clusterOpts)
if err != nil {
log.Fatalln("InitCB:", err)
}
I have tried setting the Timeout property of scope.Query(), but without success:
opts := &gocb.QueryOptions{}
if len(holders) > 0 {
opts.PositionalParameters = holders
}
opts.Timeout = (time.Duration(config.CBOpTimeout * 1000)) * time.Millisecond
rowSet, err = myCBScope.Query(queryStr, opts)
if err != nil {
log.Println(logName, err)
return cbytes, err
}