{"action":"created","comment":{"url":"https://api.github.com/repos/dahankzter/gocql/pulls/comments/210551559","pull_request_review_id":146788968,"id":210551559,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxMDU1MTU1OQ==","diff_hunk":"@@ -278,72 +276,78 @@ func (h *hostConnPool) String() string {\n func newHostConnPool(session *Session, host *HostInfo, port, size int,\n \tkeyspace string) *hostConnPool {\n \n-\t_, tokenAware := session.policy.(*tokenAwareHostPolicy)\n-\n \tpool := &hostConnPool{\n-\t\tsession:  session,\n-\t\thost:     host,\n-\t\tport:     port,\n-\t\taddr:     (&net.TCPAddr{IP: host.ConnectAddress(), Port: host.Port()}).String(),\n-\t\tsize:     size,\n-\t\tkeyspace: keyspace,\n-\t\tconns:    make(map[int]*Conn),\n-\t\tfilling:  false,\n-\t\tclosed:   false,\n-\n-\t\ttokenAware: tokenAware,\n-\t\tsharded:    uint32FromBool(host.shardingInfo.IsSharded()),\n+\t\tsession:   session,\n+\t\thost:      host,\n+\t\tport:      port,\n+\t\taddr:      (&net.TCPAddr{IP: host.ConnectAddress(), Port: host.Port()}).String(),\n+\t\tsize:      size,\n+\t\tkeyspace:  keyspace,\n+\t\tconns:     make([]*Conn, 0, size),\n+\t\tshardConn: make(map[int]*Conn),\n+\t\tfilling:   false,\n+\t\tclosed:    false,\n \t}\n \n \t// the pool is not filled or connected\n \treturn pool\n }\n \n-func (pool *hostConnPool) isTokenAware() bool {\n-\treturn pool.tokenAware\n-}\n-\n-func (pool *hostConnPool) isSharded() bool {\n-\treturn atomic.LoadUint32(&pool.sharded) == 1\n-}\n-\n // Pick a connection from this connection pool for the given query.\n func (pool *hostConnPool) Pick(token token) *Conn {\n-\tif pool.isTokenAware() && pool.isSharded() && token != nil {\n-\t\tif t, ok := token.(murmur3Token); ok {\n-\t\t\tshard := pool.host.shardingInfo.ShardForToken(int64(t))\n-\t\t\tpool.mu.RLock()\n-\t\t\tif c, ok := pool.conns[shard]; ok {\n-\t\t\t\tpool.mu.RUnlock()\n-\t\t\t\treturn c\n-\t\t\t}\n-\t\t\tpool.mu.RUnlock()\n-\t\t}\n-\t}\n \tpool.mu.RLock()\n \tdefer pool.mu.RUnlock()\n \n \tif pool.closed {\n \t\treturn nil\n \t}\n \n+\tsi := pool.host.ShardingInfo()\n+\tsharded := si.nrShards > 0 && token != nil\n+\n+\tpoolSize := pool.size\n+\tif sharded {\n+\t\tpoolSize = int(si.nrShards)\n+\t}\n+\n \tsize := len(pool.conns)","path":"connectionpool.go","position":90,"original_position":90,"commit_id":"fe285a16b140e1ac5cd4c0061be6e38c8556f75e","original_commit_id":"fe285a16b140e1ac5cd4c0061be6e38c8556f75e","user":{"login":"dahankzter","id":171091,"node_id":"MDQ6VXNlcjE3MTA5MQ==","avatar_url":"https://avatars2.githubusercontent.com/u/171091?v=4","gravatar_id":"","url":"https://api.github.com/users/dahankzter","html_url":"https://github.com/dahankzter","followers_url":"https://api.github.com/users/dahankzter/followers","following_url":"https://api.github.com/users/dahankzter/following{/other_user}","gists_url":"https://api.github.com/users/dahankzter/gists{/gist_id}","starred_url":"https://api.github.com/users/dahankzter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dahankzter/subscriptions","organizations_url":"https://api.github.com/users/dahankzter/orgs","repos_url":"https://api.github.com/users/dahankzter/repos","events_url":"https://api.github.com/users/dahankzter/events{/privacy}","received_events_url":"https://api.github.com/users/dahankzter/received_events","type":"User","site_admin":false},"body":"Ah it's fine now that I got that the map is just an index. It needs to be kept in sync though.","created_at":"2018-08-16T10:45:16Z","updated_at":"2018-08-16T10:45:16Z","html_url":"https://github.com/dahankzter/gocql/pull/2#discussion_r210551559","pull_request_url":"https://api.github.com/repos/dahankzter/gocql/pulls/2","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/dahankzter/gocql/pulls/comments/210551559"},"html":{"href":"https://github.com/dahankzter/gocql/pull/2#discussion_r210551559"},"pull_request":{"href":"https://api.github.com/repos/dahankzter/gocql/pulls/2"}},"in_reply_to_id":210547539},"pull_request":{"url":"https://api.github.com/repos/dahankzter/gocql/pulls/2","id":208802292,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA4ODAyMjky","html_url":"https://github.com/dahankzter/gocql/pull/2","diff_url":"https://github.com/dahankzter/gocql/pull/2.diff","patch_url":"https://github.com/dahankzter/gocql/pull/2.patch","issue_url":"https://api.github.com/repos/dahankzter/gocql/issues/2","number":2,"state":"open","locked":false,"title":"MMT fixes","user":{"login":"mmatczuk","id":1617930,"node_id":"MDQ6VXNlcjE2MTc5MzA=","avatar_url":"https://avatars3.githubusercontent.com/u/1617930?v=4","gravatar_id":"","url":"https://api.github.com/users/mmatczuk","html_url":"https://github.com/mmatczuk","followers_url":"https://api.github.com/users/mmatczuk/followers","following_url":"https://api.github.com/users/mmatczuk/following{/other_user}","gists_url":"https://api.github.com/users/mmatczuk/gists{/gist_id}","starred_url":"https://api.github.com/users/mmatczuk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mmatczuk/subscriptions","organizations_url":"https://api.github.com/users/mmatczuk/orgs","repos_url":"https://api.github.com/users/mmatczuk/repos","events_url":"https://api.github.com/users/mmatczuk/events{/privacy}","received_events_url":"https://api.github.com/users/mmatczuk/received_events","type":"User","site_admin":false},"body":"Code cleanup. It would be good to see a diff against master as it removes some of the custom code. I'm pretty sure that filling needs fixing.","created_at":"2018-08-16T09:45:47Z","updated_at":"2018-08-16T10:45:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e5cbb1f169688a12161183df76aff9233ce0f578","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/dahankzter/gocql/pulls/2/commits","review_comments_url":"https://api.github.com/repos/dahankzter/gocql/pulls/2/comments","review_comment_url":"https://api.github.com/repos/dahankzter/gocql/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dahankzter/gocql/issues/2/comments","statuses_url":"https://api.github.com/repos/dahankzter/gocql/statuses/fe285a16b140e1ac5cd4c0061be6e38c8556f75e","head":{"label":"mmatczuk:mmt/scylla_shard_aware","ref":"mmt/scylla_shard_aware","sha":"fe285a16b140e1ac5cd4c0061be6e38c8556f75e","user":{"login":"mmatczuk","id":1617930,"node_id":"MDQ6VXNlcjE2MTc5MzA=","avatar_url":"https://avatars3.githubusercontent.com/u/1617930?v=4","gravatar_id":"","url":"https://api.github.com/users/mmatczuk","html_url":"https://github.com/mmatczuk","followers_url":"https://api.github.com/users/mmatczuk/followers","following_url":"https://api.github.com/users/mmatczuk/following{/other_user}","gists_url":"https://api.github.com/users/mmatczuk/gists{/gist_id}","starred_url":"https://api.github.com/users/mmatczuk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mmatczuk/subscriptions","organizations_url":"https://api.github.com/users/mmatczuk/orgs","repos_url":"https://api.github.com/users/mmatczuk/repos","events_url":"https://api.github.com/users/mmatczuk/events{/privacy}","received_events_url":"https://api.github.com/users/mmatczuk/received_events","type":"User","site_admin":false},"repo":{"id":101973737,"node_id":"MDEwOlJlcG9zaXRvcnkxMDE5NzM3Mzc=","name":"gocql","full_name":"mmatczuk/gocql","owner":{"login":"mmatczuk","id":1617930,"node_id":"MDQ6VXNlcjE2MTc5MzA=","avatar_url":"https://avatars3.githubusercontent.com/u/1617930?v=4","gravatar_id":"","url":"https://api.github.com/users/mmatczuk","html_url":"https://github.com/mmatczuk","followers_url":"https://api.github.com/users/mmatczuk/followers","following_url":"https://api.github.com/users/mmatczuk/following{/other_user}","gists_url":"https://api.github.com/users/mmatczuk/gists{/gist_id}","starred_url":"https://api.github.com/users/mmatczuk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mmatczuk/subscriptions","organizations_url":"https://api.github.com/users/mmatczuk/orgs","repos_url":"https://api.github.com/users/mmatczuk/repos","events_url":"https://api.github.com/users/mmatczuk/events{/privacy}","received_events_url":"https://api.github.com/users/mmatczuk/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mmatczuk/gocql","description":"Package gocql implements a fast and robust Cassandra client for the Go programming language.","fork":true,"url":"https://api.github.com/repos/mmatczuk/gocql","forks_url":"https://api.github.com/repos/mmatczuk/gocql/forks","keys_url":"https://api.github.com/repos/mmatczuk/gocql/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mmatczuk/gocql/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mmatczuk/gocql/teams","hooks_url":"https://api.github.com/repos/mmatczuk/gocql/hooks","issue_events_url":"https://api.github.com/repos/mmatczuk/gocql/issues/events{/number}","events_url":"https://api.github.com/repos/mmatczuk/gocql/events","assignees_url":"https://api.github.com/repos/mmatczuk/gocql/assignees{/user}","branches_url":"https://api.github.com/repos/mmatczuk/gocql/branches{/branch}","tags_url":"https://api.github.com/repos/mmatczuk/gocql/tags","blobs_url":"https://api.github.com/repos/mmatczuk/gocql/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mmatczuk/gocql/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mmatczuk/gocql/git/refs{/sha}","trees_url":"https://api.github.com/repos/mmatczuk/gocql/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mmatczuk/gocql/statuses/{sha}","languages_url":"https://api.github.com/repos/mmatczuk/gocql/languages","stargazers_url":"https://api.github.com/repos/mmatczuk/gocql/stargazers","contributors_url":"https://api.github.com/repos/mmatczuk/gocql/contributors","subscribers_url":"https://api.github.com/repos/mmatczuk/gocql/subscribers","subscription_url":"https://api.github.com/repos/mmatczuk/gocql/subscription","commits_url":"https://api.github.com/repos/mmatczuk/gocql/commits{/sha}","git_commits_url":"https://api.github.com/repos/mmatczuk/gocql/git/commits{/sha}","comments_url":"https://api.github.com/repos/mmatczuk/gocql/comments{/number}","issue_comment_url":"https://api.github.com/repos/mmatczuk/gocql/issues/comments{/number}","contents_url":"https://api.github.com/repos/mmatczuk/gocql/contents/{+path}","compare_url":"https://api.github.com/repos/mmatczuk/gocql/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mmatczuk/gocql/merges","archive_url":"https://api.github.com/repos/mmatczuk/gocql/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mmatczuk/gocql/downloads","issues_url":"https://api.github.com/repos/mmatczuk/gocql/issues{/number}","pulls_url":"https://api.github.com/repos/mmatczuk/gocql/pulls{/number}","milestones_url":"https://api.github.com/repos/mmatczuk/gocql/milestones{/number}","notifications_url":"https://api.github.com/repos/mmatczuk/gocql/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mmatczuk/gocql/labels{/name}","releases_url":"https://api.github.com/repos/mmatczuk/gocql/releases{/id}","deployments_url":"https://api.github.com/repos/mmatczuk/gocql/deployments","created_at":"2017-08-31T07:41:33Z","updated_at":"2017-08-31T07:41:34Z","pushed_at":"2018-08-16T09:40:06Z","git_url":"git://github.com/mmatczuk/gocql.git","ssh_url":"git@github.com:mmatczuk/gocql.git","clone_url":"https://github.com/mmatczuk/gocql.git","svn_url":"https://github.com/mmatczuk/gocql","homepage":"http://gocql.github.io/","size":2842,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"bsd-3-clause","name":"BSD 3-Clause \"New\" or \"Revised\" License","spdx_id":"BSD-3-Clause","url":"https://api.github.com/licenses/bsd-3-clause","node_id":"MDc6TGljZW5zZTU="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"dahankzter:scylla_shard_aware","ref":"scylla_shard_aware","sha":"820146a6a2dca1dbbf032851cf4297077a013447","user":{"login":"dahankzter","id":171091,"node_id":"MDQ6VXNlcjE3MTA5MQ==","avatar_url":"https://avatars2.githubusercontent.com/u/171091?v=4","gravatar_id":"","url":"https://api.github.com/users/dahankzter","html_url":"https://github.com/dahankzter","followers_url":"https://api.github.com/users/dahankzter/followers","following_url":"https://api.github.com/users/dahankzter/following{/other_user}","gists_url":"https://api.github.com/users/dahankzter/gists{/gist_id}","starred_url":"https://api.github.com/users/dahankzter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dahankzter/subscriptions","organizations_url":"https://api.github.com/users/dahankzter/orgs","repos_url":"https://api.github.com/users/dahankzter/repos","events_url":"https://api.github.com/users/dahankzter/events{/privacy}","received_events_url":"https://api.github.com/users/dahankzter/received_events","type":"User","site_admin":false},"repo":{"id":141391985,"node_id":"MDEwOlJlcG9zaXRvcnkxNDEzOTE5ODU=","name":"gocql","full_name":"dahankzter/gocql","owner":{"login":"dahankzter","id":171091,"node_id":"MDQ6VXNlcjE3MTA5MQ==","avatar_url":"https://avatars2.githubusercontent.com/u/171091?v=4","gravatar_id":"","url":"https://api.github.com/users/dahankzter","html_url":"https://github.com/dahankzter","followers_url":"https://api.github.com/users/dahankzter/followers","following_url":"https://api.github.com/users/dahankzter/following{/other_user}","gists_url":"https://api.github.com/users/dahankzter/gists{/gist_id}","starred_url":"https://api.github.com/users/dahankzter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dahankzter/subscriptions","organizations_url":"https://api.github.com/users/dahankzter/orgs","repos_url":"https://api.github.com/users/dahankzter/repos","events_url":"https://api.github.com/users/dahankzter/events{/privacy}","received_events_url":"https://api.github.com/users/dahankzter/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dahankzter/gocql","description":"Package gocql implements a fast and robust Cassandra client for the Go programming language.","fork":true,"url":"https://api.github.com/repos/dahankzter/gocql","forks_url":"https://api.github.com/repos/dahankzter/gocql/forks","keys_url":"https://api.github.com/repos/dahankzter/gocql/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dahankzter/gocql/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dahankzter/gocql/teams","hooks_url":"https://api.github.com/repos/dahankzter/gocql/hooks","issue_events_url":"https://api.github.com/repos/dahankzter/gocql/issues/events{/number}","events_url":"https://api.github.com/repos/dahankzter/gocql/events","assignees_url":"https://api.github.com/repos/dahankzter/gocql/assignees{/user}","branches_url":"https://api.github.com/repos/dahankzter/gocql/branches{/branch}","tags_url":"https://api.github.com/repos/dahankzter/gocql/tags","blobs_url":"https://api.github.com/repos/dahankzter/gocql/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dahankzter/gocql/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dahankzter/gocql/git/refs{/sha}","trees_url":"https://api.github.com/repos/dahankzter/gocql/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dahankzter/gocql/statuses/{sha}","languages_url":"https://api.github.com/repos/dahankzter/gocql/languages","stargazers_url":"https://api.github.com/repos/dahankzter/gocql/stargazers","contributors_url":"https://api.github.com/repos/dahankzter/gocql/contributors","subscribers_url":"https://api.github.com/repos/dahankzter/gocql/subscribers","subscription_url":"https://api.github.com/repos/dahankzter/gocql/subscription","commits_url":"https://api.github.com/repos/dahankzter/gocql/commits{/sha}","git_commits_url":"https://api.github.com/repos/dahankzter/gocql/git/commits{/sha}","comments_url":"https://api.github.com/repos/dahankzter/gocql/comments{/number}","issue_comment_url":"https://api.github.com/repos/dahankzter/gocql/issues/comments{/number}","contents_url":"https://api.github.com/repos/dahankzter/gocql/contents/{+path}","compare_url":"https://api.github.com/repos/dahankzter/gocql/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dahankzter/gocql/merges","archive_url":"https://api.github.com/repos/dahankzter/gocql/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dahankzter/gocql/downloads","issues_url":"https://api.github.com/repos/dahankzter/gocql/issues{/number}","pulls_url":"https://api.github.com/repos/dahankzter/gocql/pulls{/number}","milestones_url":"https://api.github.com/repos/dahankzter/gocql/milestones{/number}","notifications_url":"https://api.github.com/repos/dahankzter/gocql/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dahankzter/gocql/labels{/name}","releases_url":"https://api.github.com/repos/dahankzter/gocql/releases{/id}","deployments_url":"https://api.github.com/repos/dahankzter/gocql/deployments","created_at":"2018-07-18T06:37:43Z","updated_at":"2018-07-18T06:37:45Z","pushed_at":"2018-08-16T09:45:48Z","git_url":"git://github.com/dahankzter/gocql.git","ssh_url":"git@github.com:dahankzter/gocql.git","clone_url":"https://github.com/dahankzter/gocql.git","svn_url":"https://github.com/dahankzter/gocql","homepage":"http://gocql.github.io/","size":2726,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":2,"license":{"key":"bsd-3-clause","name":"BSD 3-Clause \"New\" or \"Revised\" License","spdx_id":"BSD-3-Clause","url":"https://api.github.com/licenses/bsd-3-clause","node_id":"MDc6TGljZW5zZTU="},"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dahankzter/gocql/pulls/2"},"html":{"href":"https://github.com/dahankzter/gocql/pull/2"},"issue":{"href":"https://api.github.com/repos/dahankzter/gocql/issues/2"},"comments":{"href":"https://api.github.com/repos/dahankzter/gocql/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/dahankzter/gocql/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/dahankzter/gocql/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dahankzter/gocql/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/dahankzter/gocql/statuses/fe285a16b140e1ac5cd4c0061be6e38c8556f75e"}},"author_association":"NONE"}}
{"actor":{"display_login":"dahankzter"}}