{"action":"created","issue":{"url":"https://api.github.com/repos/druid-io/druid/issues/3578","repository_url":"https://api.github.com/repos/druid-io/druid","labels_url":"https://api.github.com/repos/druid-io/druid/issues/3578/labels{/name}","comments_url":"https://api.github.com/repos/druid-io/druid/issues/3578/comments","events_url":"https://api.github.com/repos/druid-io/druid/issues/3578/events","html_url":"https://github.com/druid-io/druid/pull/3578","id":183225554,"number":3578,"title":"Workaround non-thread-safe use of HLL aggregators.","user":{"login":"gianm","id":1214075,"avatar_url":"https://avatars.githubusercontent.com/u/1214075?v=3","gravatar_id":"","url":"https://api.github.com/users/gianm","html_url":"https://github.com/gianm","followers_url":"https://api.github.com/users/gianm/followers","following_url":"https://api.github.com/users/gianm/following{/other_user}","gists_url":"https://api.github.com/users/gianm/gists{/gist_id}","starred_url":"https://api.github.com/users/gianm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gianm/subscriptions","organizations_url":"https://api.github.com/users/gianm/orgs","repos_url":"https://api.github.com/users/gianm/repos","events_url":"https://api.github.com/users/gianm/events{/privacy}","received_events_url":"https://api.github.com/users/gianm/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/druid-io/druid/labels/Bug","name":"Bug","color":"fc2929"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/druid-io/druid/milestones/20","html_url":"https://github.com/druid-io/druid/milestones/0.9.2","labels_url":"https://api.github.com/repos/druid-io/druid/milestones/20/labels","id":1571409,"number":20,"title":"0.9.2","description":"","creator":{"login":"fjy","id":428325,"avatar_url":"https://avatars.githubusercontent.com/u/428325?v=3","gravatar_id":"","url":"https://api.github.com/users/fjy","html_url":"https://github.com/fjy","followers_url":"https://api.github.com/users/fjy/followers","following_url":"https://api.github.com/users/fjy/following{/other_user}","gists_url":"https://api.github.com/users/fjy/gists{/gist_id}","starred_url":"https://api.github.com/users/fjy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fjy/subscriptions","organizations_url":"https://api.github.com/users/fjy/orgs","repos_url":"https://api.github.com/users/fjy/repos","events_url":"https://api.github.com/users/fjy/events{/privacy}","received_events_url":"https://api.github.com/users/fjy/received_events","type":"User","site_admin":false},"open_issues":4,"closed_issues":219,"state":"open","created_at":"2016-02-08T22:01:21Z","updated_at":"2016-10-17T14:38:51Z","due_on":null,"closed_at":null},"comments":2,"created_at":"2016-10-15T18:41:39Z","updated_at":"2016-10-17T14:39:45Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/druid-io/druid/pulls/3578","html_url":"https://github.com/druid-io/druid/pull/3578","diff_url":"https://github.com/druid-io/druid/pull/3578.diff","patch_url":"https://github.com/druid-io/druid/pull/3578.patch"},"body":"Despite the non-thread-safety of HyperLogLogCollector, it is actually currently used\r\nby multiple threads during realtime indexing. HyperUniquesAggregator's \"aggregate\" and\r\n\"get\" methods can be called simultaneously by OnheapIncrementalIndex, since its\r\n\"doAggregate\" and \"getMetricObjectValue\" methods are not synchronized.\r\n\r\nThis means that the optimization of HyperLogLogCollector.fold in #3314 (saving and\r\nrestoring position rather than duplicating the storage buffer of the right-hand side)\r\ncould cause corruption in the face of concurrent writes.\r\n\r\nThis patch works around the issue by duplicating the storage buffer in \"get\" before\r\nreturning a collector. The returned collector still shares data with the original one,\r\nbut the situation is no worse than before #3314. In the future we may want to consider\r\nmaking a thread safe version of HLLC that avoids these kinds of problems in realtime\r\nindexing. But for now I thought it was best to do a small change that restored the old\r\nbehavior.\r\n\r\nFixes #3560."},"comment":{"url":"https://api.github.com/repos/druid-io/druid/issues/comments/254226751","html_url":"https://github.com/druid-io/druid/pull/3578#issuecomment-254226751","issue_url":"https://api.github.com/repos/druid-io/druid/issues/3578","id":254226751,"user":{"login":"fjy","id":428325,"avatar_url":"https://avatars.githubusercontent.com/u/428325?v=3","gravatar_id":"","url":"https://api.github.com/users/fjy","html_url":"https://github.com/fjy","followers_url":"https://api.github.com/users/fjy/followers","following_url":"https://api.github.com/users/fjy/following{/other_user}","gists_url":"https://api.github.com/users/fjy/gists{/gist_id}","starred_url":"https://api.github.com/users/fjy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fjy/subscriptions","organizations_url":"https://api.github.com/users/fjy/orgs","repos_url":"https://api.github.com/users/fjy/repos","events_url":"https://api.github.com/users/fjy/events{/privacy}","received_events_url":"https://api.github.com/users/fjy/received_events","type":"User","site_admin":false},"created_at":"2016-10-17T14:39:45Z","updated_at":"2016-10-17T14:39:45Z","body":"👍 "}}
{"actor":{"display_login":"fjy"}}