Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bucky: first stab at supporting fnv1a_ch hash algo #18

Merged
merged 2 commits into from
Aug 17, 2017
Merged

bucky: first stab at supporting fnv1a_ch hash algo #18

merged 2 commits into from
Aug 17, 2017

Conversation

grobian
Copy link
Contributor

@grobian grobian commented Jul 12, 2017

Support fnv1a_ch next to carbon_ch. This means port needs to be
recognised, which can be given in the form HOST[:PORT[:INSTANCE]]. The
previous form of HOST[:INSTANCE] is still supported by parsing instance
as a number, if so, it is assumed to be a port.

I would like some basic review on the sanity of this change. I can't imagine everything works as expected this way.

Support fnv1a_ch next to carbon_ch.  This means port needs to be
recognised, which can be given in the form HOST[:PORT[:INSTANCE]].  The
previous form of HOST[:INSTANCE] is still supported by parsing instance
as a number, if so, it is assumed to be a port.
@jjneely
Copy link
Owner

jjneely commented Aug 1, 2017

I've stumbled over my own design flaw of SERVER:PORT or SERVER:INSTANCE before. So that is the crux of the issue here. I need to fix that and do what you do with carbon-c-relay:

host[:port][=instance]

@grobian
Copy link
Contributor Author

grobian commented Aug 2, 2017

That would actually be less guesswork for the parsing, I think. I struggled a bit with it, as you probably have seen :)

t.nodes = append(t.nodes, node)
for i := 0; i < t.replicas; i++ {
var e RingEntry
replica_key := fmt.Sprintf("%s:%d", node.KeyValue(), i)
e.position = computeRingPosition(replica_key)
replica_key := fmt.Sprintf("%d-%s", node.FNV1aKeyValue(), i)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something is backward here. It looks like the format string should be "%s-%d"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, this looks wrong indeed.

@jjneely
Copy link
Owner

jjneely commented Aug 14, 2017

grobian-fnv1a_ch is my WIP branch with your code, Grobian. Do you have any test data that I can use with this that is verified? Building some tests to make sure the fnv1a code works as expected is next.

@grobian
Copy link
Contributor Author

grobian commented Aug 15, 2017

I can produce the hash-ring position dump easily, what kind of tests do you have in mind?

@jjneely
Copy link
Owner

jjneely commented Aug 15, 2017

I've updated grobian-fnv1a_ch with a fnv1a_test.go file with some basic sanity tests, nothing exhaustive. At this point, my basic tests that the hashing algorithm produces sane results is not matching the results I get from running carbon-c-relay in test mode. Can you take a look at that?

Once things are working, I'd like to have some more tests as I've definitely had strange corner cases in the hashing algorithms come up in the past.

@grobian
Copy link
Contributor Author

grobian commented Aug 16, 2017

I think we can use something like https://github.com/grobian/carbon-c-relay/blob/master/test/issue236.out as base here, I'll extract the first hits for all of the inputs

@jjneely
Copy link
Owner

jjneely commented Aug 16, 2017

grobian-fnv1a_ch updated again. This looks like it works and passes the limited tests I've setup. More tests are double plus good here.

I'm not sure what was going on with the Golang standard library version of the FNV1a32 hash, but it was giving me very odd results. Being that I implemented FNV1a64 internally for the jump hash, I did so for FNV1a32 and she started working like a charm.

There are changes in buckyd in this code base that's have not been reflected in the bucky client. That's forth coming.

@jjneely jjneely merged commit 9d5eb1b into jjneely:master Aug 17, 2017
@grobian grobian deleted the fnv1a_ch branch August 20, 2017 08:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants