Comments (11)
I have somehow overlooked this issue. Will be fixed in next release.
Thank you for your patience.
from aerospike-client-go.
We ran into the same issue recently. Are there any updates on this?
from aerospike-client-go.
That's how it is supposed to work by design. We haven't been sure if it is prudent to change this behavior.
Why do you think it shouldn't return an error?
from aerospike-client-go.
I was under the impression that this constructor gets a list of hosts it tries to connect to. If any of those hosts work, the client established connection to the cluster and everything is fine.
Consider this: Lets say we have an aerospike cluster with three nodes at host1
, host2
and host3
. So our setup would look similar to the one above. All nodes are up and running and we can start our Go backend to connect to it.
Now node1
goes down. Kernel panic or whatever. The aerospike cluster can deal with it, that's what we have replication for. But if I want to restart by Go backend now, I will get an error, even though it could connect to the cluster by connecting to one of the remaining and working hosts.
Since the cluster itself is fine I believe it is an error to fail connecting to it just because a node is down or somehow unreachable. Isn't that exactly what the list of multiple hosts is designed for?
from aerospike-client-go.
I can't quite reproduce this bug. How are you hitting this? All mixes of non-existing host and non-existing running db connect successfully. Stopping and restarting a node also works fine.
Can you provide a small snippet (or a precise description of the situation in which it occurs?)
This is the code I'm using:
l.Logger.SetLevel(l.DEBUG)
host1 := &Host{
Name: "ubvm1", // a non-existing host
Port: 3000,
}
host2 := &Host{
Name: "ubvm", // a existing host, but without aerospike server on the specified port
Port: 3040,
}
host3 := &Host{
Name: "ubvm", // a aerospike server host
Port: 3000,
}
// cli, err := NewClientWithPolicyAndHost(nil, host2, host3) // No error returned
// cli, err := NewClientWithPolicyAndHost(nil, host1, host3) // Also no errors
cli, err := NewClientWithPolicyAndHost(nil, host1, host2, host3) // also no errors!
if err != nil {
panic(err) // this never happens
}
defer cli.Close()
log.Println("Successful...")
from aerospike-client-go.
@khaf: With an aerospike server running locally (with vagrant) I run this code:
package main
import (
"fmt"
as "github.com/aerospike/aerospike-client-go"
)
func main() {
var err error
valid := &as.Host{
Name: "127.0.0.1",
Port: 3000,
}
noexist := &as.Host{
Name: "noexist",
Port: 3000,
}
_, err = as.NewClientWithPolicyAndHost(nil, valid)
fmt.Printf("NewClient(valid) err: %q \t(should be nil)\n", err)
_, err = as.NewClientWithPolicyAndHost(nil, noexist)
fmt.Printf("NewClient(noexist) err: %q \t(should not be nil)\n", err)
_, err = as.NewClientWithPolicyAndHost(nil, valid, noexist)
fmt.Printf("NewClient(valid, noexist) err: %q \t(should be nil)\n", err)
_, err = as.NewClientWithPolicyAndHost(nil, noexist, valid)
fmt.Printf("NewClient(noexist, valid) err: %q \t(should be nil)\n", err)
}
And get this output:
NewClient(valid) err: %!q(<nil>) (should be nil)
NewClient(noexist) err: "Failed to connect to host(s): []" (should not be nil)
NewClient(valid, noexist) err: "Failed to connect to host(s): [ ]" (should be nil)
NewClient(noexist, valid) err: "Failed to connect to host(s): [ ]" (should be nil)
So in the last two cases as.NewClientWithPolicyAndHost
returns an error even though one of the provided hosts is valid.
I'm using v1.10.0
(commit 3b2628a) of aerospike-client-go
.
from aerospike-client-go.
Interesting. Your snippet works as expected on my system. Is there a way you could share your vagrant setup?
I'm running my code on go1.5.3 darwin/amd64
, on MacOS X v10.11.3. My databases are on VMWare Fusion Ubuntu 14.04 LTS installations.
from aerospike-client-go.
It seems to be a timeout issue. I found that Cluster.waitTillStabilized
ran into the one second timeout of the default ClientPolicy
. I tried using a client policy with two seconds timeout and now it works as expected.
It would have been helpful to see in the error message that it ran into a timeout.
from aerospike-client-go.
Thanks for the help. I will increase the ClientPolicy.Timeout
and will return an error from waitTillStabilized
method to help pinpoint the problem in the future.
from aerospike-client-go.
Fixed in v1.11
from aerospike-client-go.
Thanks!
from aerospike-client-go.
Related Issues (20)
- Difference size of allocated memory between client v4.5 and v6.9.1 HOT 3
- PARAMETER_ERROR using expressions and batch write HOT 21
- Client v6 occasionally crushes with concurrent map read and map write HOT 6
- Partition map empty error from Aerospike on vm HOT 7
- panic: unaligned 64-bit atomic operation in Cluster.tend (on 32bit) HOT 4
- Is there a way to get items in list for a PK? HOT 2
- BatchGet with secondary index HOT 3
- command execution timed out in go-client when Docker container is restarted HOT 2
- Is there any way to mock client for UT? HOT 3
- Why is ClientPolicy.Timeout used to create new connections during reads instead of basePolicy.connectTimeout HOT 11
- Type consts are hidden in `internal/particle_type` HOT 7
- How to get show distribution time_to_live HOT 1
- invalid go.mod on master HOT 2
- Could you clarify timeouts for the Query? HOT 10
- [6.14.0] Proto registration conflict caused by `kv.proto` HOT 13
- Support more integer sizes in the Expressions API. HOT 1
- Getting record keys when using QueryObjects
- Is it possible to index and filter keys in map?
- 6.4 upgrade from 5.7 HOT 3
- Massive amount of memory occupied by `newPartitionStatus` and `newNodePartitions` HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aerospike-client-go.