{"action":"created","issue":{"url":"https://api.github.com/repos/ioriiod0/consistent_hash/issues/1","repository_url":"https://api.github.com/repos/ioriiod0/consistent_hash","labels_url":"https://api.github.com/repos/ioriiod0/consistent_hash/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/ioriiod0/consistent_hash/issues/1/comments","events_url":"https://api.github.com/repos/ioriiod0/consistent_hash/issues/1/events","html_url":"https://github.com/ioriiod0/consistent_hash/issues/1","id":319227345,"number":1,"title":"请教问题，如果后台节点不同节点经hash()计算后，得到相同的hash_index.这种场景考虑过么？","user":{"login":"achilsh","id":6417640,"avatar_url":"https://avatars0.githubusercontent.com/u/6417640?v=4","gravatar_id":"","url":"https://api.github.com/users/achilsh","html_url":"https://github.com/achilsh","followers_url":"https://api.github.com/users/achilsh/followers","following_url":"https://api.github.com/users/achilsh/following{/other_user}","gists_url":"https://api.github.com/users/achilsh/gists{/gist_id}","starred_url":"https://api.github.com/users/achilsh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/achilsh/subscriptions","organizations_url":"https://api.github.com/users/achilsh/orgs","repos_url":"https://api.github.com/users/achilsh/repos","events_url":"https://api.github.com/users/achilsh/events{/privacy}","received_events_url":"https://api.github.com/users/achilsh/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-05-01T15:16:10Z","updated_at":"2018-05-09T09:39:06Z","closed_at":null,"author_association":"NONE","body":"就是在计算不同虚节点的Hash时，存在hash 冲突场景。怎么解决这种情况下key经一致性hash算法的准确性？"},"comment":{"url":"https://api.github.com/repos/ioriiod0/consistent_hash/issues/comments/387682921","html_url":"https://github.com/ioriiod0/consistent_hash/issues/1#issuecomment-387682921","issue_url":"https://api.github.com/repos/ioriiod0/consistent_hash/issues/1","id":387682921,"user":{"login":"ioriiod0","id":1235459,"avatar_url":"https://avatars2.githubusercontent.com/u/1235459?v=4","gravatar_id":"","url":"https://api.github.com/users/ioriiod0","html_url":"https://github.com/ioriiod0","followers_url":"https://api.github.com/users/ioriiod0/followers","following_url":"https://api.github.com/users/ioriiod0/following{/other_user}","gists_url":"https://api.github.com/users/ioriiod0/gists{/gist_id}","starred_url":"https://api.github.com/users/ioriiod0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ioriiod0/subscriptions","organizations_url":"https://api.github.com/users/ioriiod0/orgs","repos_url":"https://api.github.com/users/ioriiod0/repos","events_url":"https://api.github.com/users/ioriiod0/events{/privacy}","received_events_url":"https://api.github.com/users/ioriiod0/received_events","type":"User","site_admin":false},"created_at":"2018-05-09T09:39:05Z","updated_at":"2018-05-09T09:39:05Z","author_association":"OWNER","body":"（好久没写C++了。。）\r\nconsistent_hash_map 底层使用的是stl::map来实现的。\r\ninsert 一个节点实际上是调用了stl:map的insert\r\n\r\n\r\n根据C++文档，如果碰到hash值一样的节点，insert会失败，是insert不进去：\r\n\r\n*Extends the container by inserting new elements, effectively increasing\r\nthe container size <http://www.cplusplus.com/map::size> by the number of\r\nelements inserted.*\r\n\r\n*Because element keys in a map <http://www.cplusplus.com/map> are unique,\r\nthe insertion operation checks whether each inserted element has a key\r\nequivalent to the one of an element already in the container, and if so,\r\nthe element is not inserted, returning an iterator to this existing element\r\n(if the function returns a value).*\r\n*For a similar container allowing for duplicate elements, see multimap\r\n<http://www.cplusplus.com/multimap>.*\r\n\r\n如果希望显式的解决hash碰撞的为，可以考虑修改代码，使用multimap实现.（在find的时候找到所有具有相同值得iter,random\r\nchoice一个返回）\r\n\r\n\r\n\r\n\r\n\r\n\r\n在 2018年5月1日 下午11:22，achilsh <notifications@github.com>写道：\r\n\r\n> 比如：\r\n> 当在计算后台节点的hash()时，考虑到虚节点在内，如果不同节点经计算得到一个相同的hash值，那么在一致性hash环上，\r\n> 就存在两个不同物理节点公用一个hash_index.当对key计算一致性hash 值时，正好落在这个hash_index.\r\n> 那到底取这两个物理节点的哪一个呢？\r\n>\r\n> —\r\n> You are receiving this because you are subscribed to this thread.\r\n> Reply to this email directly, view it on GitHub\r\n> <https://github.com/ioriiod0/consistent_hash/issues/1#issuecomment-385698431>,\r\n> or mute the thread\r\n> <https://github.com/notifications/unsubscribe-auth/ABLaAz-QGHUBWeCsPuYAAOBOnDmcNu-6ks5tuH3NgaJpZM4TuEHO>\r\n> .\r\n>\r\n"}}
{"actor":{"display_login":"ioriiod0"}}