jjneely / buckytools

Go implementation of useful tools for dealing with Graphite's Whisper DBs and Carbon hashing
Other
87 stars 21 forks source link

Bucky cluster isHealthy function fails when -h is not explicitly passed #12

Closed claudio-benfatto closed 7 years ago

claudio-benfatto commented 7 years ago

Hello here, thanks for the really useful project!

I experienced the following problem:

the cluster function for determining the cluster health:

    if len(master.Nodes) != len(ring)+1 {
        return false
    }

link to the isHealthy function kept failing because of the way the ring is constructed here build ring members

and of the way the current server name is read from the variable HostPort which defaults to localhost and not to the server address used in the ring SetupHostname.

This results in the following error:

Is cluster healthy: false
2017/04/05 10:34:26 Cluster is inconsistent.

Thanks

deniszh commented 7 years ago

👍 I removed '+1' there and it works.

claudio-benfatto commented 7 years ago

hello @deniszh, I was just thinking that maybe this check does not make sense anymore if you drop the +1 ;) :

        if srv == server {
            // Don't query the initial daemon again
            continue
        }

https://github.com/jjneely/buckytools/blob/master/bucky/cluster.go#L88-L92

jjneely commented 7 years ago

Yeah, this is a known issue I need to spend some time with. Its just the whole time thing...

claudio-benfatto commented 7 years ago

thanks @jjneely , let me know if you need help with anything in particular. Within my team we find the project really useful, and we'd like to start using it in production as well, so we wouldn't mind contributing. Just, in the current state it's not that easy to understand for us, where our effort should be directed.

Thanks!

jjneely commented 7 years ago

This is now fixed on master. Sorry for the delay.

The issue being that the default host:port or that given on the command line with -h may not be the exact spelling as used in the cluster ring definition. So we need to use the correct version once we've discovered the initial daemon.