{"action":"created","comment":{"url":"https://api.github.com/repos/pjain1/tranquility/pulls/comments/42539514","id":42539514,"diff_hunk":"@@ -214,18 +257,40 @@ class ClusteredBeam[EventType: Timestamper, InnerBeamType <: Beam[EventType]](\n               assert(prevBeamDicts.size < tuning.partitions)\n               assert(timestamp > prev.latestCloseTime)\n \n-              // We might want to cover multiple time segments in advance.\n-              val numSegmentsToCover = tuning.minSegmentsPerBeam +\n-                rand.nextInt(tuning.maxSegmentsPerBeam - tuning.minSegmentsPerBeam + 1)\n-              val intervalToCover = timestamp to tuning.segmentGranularity.increment(timestamp, numSegmentsToCover)\n-              val timestampsToCover = tuning.segmentGranularity.getIterable(intervalToCover).asScala.map(_.start)\n+              var optionalIntervalToCover = None: Option[Interval]\n+              var optionalTimestampsToCover = None: Option[Iterable[DateTime]]\n+              if(allowGranularityChange) {","path":"src/main/scala/com/metamx/tranquility/beam/ClusteredBeam.scala","position":112,"original_position":112,"commit_id":"f529dc749f8d2f175b1ace50ff3267ceeb1bfc12","original_commit_id":"f529dc749f8d2f175b1ace50ff3267ceeb1bfc12","user":{"login":"pjain1","id":11787983,"avatar_url":"https://avatars.githubusercontent.com/u/11787983?v=3","gravatar_id":"","url":"https://api.github.com/users/pjain1","html_url":"https://github.com/pjain1","followers_url":"https://api.github.com/users/pjain1/followers","following_url":"https://api.github.com/users/pjain1/following{/other_user}","gists_url":"https://api.github.com/users/pjain1/gists{/gist_id}","starred_url":"https://api.github.com/users/pjain1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pjain1/subscriptions","organizations_url":"https://api.github.com/users/pjain1/orgs","repos_url":"https://api.github.com/users/pjain1/repos","events_url":"https://api.github.com/users/pjain1/events{/privacy}","received_events_url":"https://api.github.com/users/pjain1/received_events","type":"User","site_admin":false},"body":"we will never create overlapping segments here - may be I did not understand your concern. ","created_at":"2015-10-20T19:07:05Z","updated_at":"2015-10-20T19:07:05Z","html_url":"https://github.com/pjain1/tranquility/pull/1#discussion_r42539514","pull_request_url":"https://api.github.com/repos/pjain1/tranquility/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/pjain1/tranquility/pulls/comments/42539514"},"html":{"href":"https://github.com/pjain1/tranquility/pull/1#discussion_r42539514"},"pull_request":{"href":"https://api.github.com/repos/pjain1/tranquility/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/pjain1/tranquility/pulls/1","id":48086818,"html_url":"https://github.com/pjain1/tranquility/pull/1","diff_url":"https://github.com/pjain1/tranquility/pull/1.diff","patch_url":"https://github.com/pjain1/tranquility/pull/1.patch","issue_url":"https://api.github.com/repos/pjain1/tranquility/issues/1","number":1,"state":"open","locked":false,"title":"Handle segment gran changes","user":{"login":"pjain1","id":11787983,"avatar_url":"https://avatars.githubusercontent.com/u/11787983?v=3","gravatar_id":"","url":"https://api.github.com/users/pjain1","html_url":"https://github.com/pjain1","followers_url":"https://api.github.com/users/pjain1/followers","following_url":"https://api.github.com/users/pjain1/following{/other_user}","gists_url":"https://api.github.com/users/pjain1/gists{/gist_id}","starred_url":"https://api.github.com/users/pjain1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pjain1/subscriptions","organizations_url":"https://api.github.com/users/pjain1/orgs","repos_url":"https://api.github.com/users/pjain1/repos","events_url":"https://api.github.com/users/pjain1/events{/privacy}","received_events_url":"https://api.github.com/users/pjain1/received_events","type":"User","site_admin":false},"body":"With this PR tranquility can handle segment granularity changes without losing data and preventing hung up tasks. \r\n\r\n - If the granularity in decreased then new tasks with changed segment granularity will be not be spawned till the time existing task can handle the incoming events. For example, if at 10:12 the gran is changed from 5 Minutes to 1 Minute then till 10:15 no new tasks will be spawned.\r\n - If the gran is increased then a partial beam (task having segment gran < the required segment gran) will be created to handle the events that falls in the interval not handled by currently active tasks for the new segment interval. For example, if the change is from 5 to 15 Minutes at 10:03 then a new task having interval 10:10 - 10:15 will be spawned to handle the incoming events.\r\n\r\nDuring the time new events come in for tasks spawned to handle segment granularity changes, tranquility will not perform smart things like warming up beams, performing strict checking on interval while constructing beam object from the dictionary etc.","created_at":"2015-10-19T15:29:12Z","updated_at":"2015-10-20T19:07:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cde8691b3220a775234ba7aff4d94c9178d68f64","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/pjain1/tranquility/pulls/1/commits","review_comments_url":"https://api.github.com/repos/pjain1/tranquility/pulls/1/comments","review_comment_url":"https://api.github.com/repos/pjain1/tranquility/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pjain1/tranquility/issues/1/comments","statuses_url":"https://api.github.com/repos/pjain1/tranquility/statuses/f529dc749f8d2f175b1ace50ff3267ceeb1bfc12","head":{"label":"pjain1:handle_restarts","ref":"handle_restarts","sha":"f529dc749f8d2f175b1ace50ff3267ceeb1bfc12","user":{"login":"pjain1","id":11787983,"avatar_url":"https://avatars.githubusercontent.com/u/11787983?v=3","gravatar_id":"","url":"https://api.github.com/users/pjain1","html_url":"https://github.com/pjain1","followers_url":"https://api.github.com/users/pjain1/followers","following_url":"https://api.github.com/users/pjain1/following{/other_user}","gists_url":"https://api.github.com/users/pjain1/gists{/gist_id}","starred_url":"https://api.github.com/users/pjain1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pjain1/subscriptions","organizations_url":"https://api.github.com/users/pjain1/orgs","repos_url":"https://api.github.com/users/pjain1/repos","events_url":"https://api.github.com/users/pjain1/events{/privacy}","received_events_url":"https://api.github.com/users/pjain1/received_events","type":"User","site_admin":false},"repo":{"id":35442426,"name":"tranquility","full_name":"pjain1/tranquility","owner":{"login":"pjain1","id":11787983,"avatar_url":"https://avatars.githubusercontent.com/u/11787983?v=3","gravatar_id":"","url":"https://api.github.com/users/pjain1","html_url":"https://github.com/pjain1","followers_url":"https://api.github.com/users/pjain1/followers","following_url":"https://api.github.com/users/pjain1/following{/other_user}","gists_url":"https://api.github.com/users/pjain1/gists{/gist_id}","starred_url":"https://api.github.com/users/pjain1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pjain1/subscriptions","organizations_url":"https://api.github.com/users/pjain1/orgs","repos_url":"https://api.github.com/users/pjain1/repos","events_url":"https://api.github.com/users/pjain1/events{/privacy}","received_events_url":"https://api.github.com/users/pjain1/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/pjain1/tranquility","description":"Tranquility heals for 9037 plus an additional 1542 every 2 sec. Stacks up to 3 times. The Druid must channel to maintain the spell.","fork":true,"url":"https://api.github.com/repos/pjain1/tranquility","forks_url":"https://api.github.com/repos/pjain1/tranquility/forks","keys_url":"https://api.github.com/repos/pjain1/tranquility/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pjain1/tranquility/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pjain1/tranquility/teams","hooks_url":"https://api.github.com/repos/pjain1/tranquility/hooks","issue_events_url":"https://api.github.com/repos/pjain1/tranquility/issues/events{/number}","events_url":"https://api.github.com/repos/pjain1/tranquility/events","assignees_url":"https://api.github.com/repos/pjain1/tranquility/assignees{/user}","branches_url":"https://api.github.com/repos/pjain1/tranquility/branches{/branch}","tags_url":"https://api.github.com/repos/pjain1/tranquility/tags","blobs_url":"https://api.github.com/repos/pjain1/tranquility/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pjain1/tranquility/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pjain1/tranquility/git/refs{/sha}","trees_url":"https://api.github.com/repos/pjain1/tranquility/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pjain1/tranquility/statuses/{sha}","languages_url":"https://api.github.com/repos/pjain1/tranquility/languages","stargazers_url":"https://api.github.com/repos/pjain1/tranquility/stargazers","contributors_url":"https://api.github.com/repos/pjain1/tranquility/contributors","subscribers_url":"https://api.github.com/repos/pjain1/tranquility/subscribers","subscription_url":"https://api.github.com/repos/pjain1/tranquility/subscription","commits_url":"https://api.github.com/repos/pjain1/tranquility/commits{/sha}","git_commits_url":"https://api.github.com/repos/pjain1/tranquility/git/commits{/sha}","comments_url":"https://api.github.com/repos/pjain1/tranquility/comments{/number}","issue_comment_url":"https://api.github.com/repos/pjain1/tranquility/issues/comments{/number}","contents_url":"https://api.github.com/repos/pjain1/tranquility/contents/{+path}","compare_url":"https://api.github.com/repos/pjain1/tranquility/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pjain1/tranquility/merges","archive_url":"https://api.github.com/repos/pjain1/tranquility/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pjain1/tranquility/downloads","issues_url":"https://api.github.com/repos/pjain1/tranquility/issues{/number}","pulls_url":"https://api.github.com/repos/pjain1/tranquility/pulls{/number}","milestones_url":"https://api.github.com/repos/pjain1/tranquility/milestones{/number}","notifications_url":"https://api.github.com/repos/pjain1/tranquility/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pjain1/tranquility/labels{/name}","releases_url":"https://api.github.com/repos/pjain1/tranquility/releases{/id}","created_at":"2015-05-11T18:36:10Z","updated_at":"2015-05-11T18:36:11Z","pushed_at":"2015-10-20T14:27:22Z","git_url":"git://github.com/pjain1/tranquility.git","ssh_url":"git@github.com:pjain1/tranquility.git","clone_url":"https://github.com/pjain1/tranquility.git","svn_url":"https://github.com/pjain1/tranquility","homepage":null,"size":481,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"pjain1:master","ref":"master","sha":"a56388404d75fd9062fa2ba468cf2a71795553cf","user":{"login":"pjain1","id":11787983,"avatar_url":"https://avatars.githubusercontent.com/u/11787983?v=3","gravatar_id":"","url":"https://api.github.com/users/pjain1","html_url":"https://github.com/pjain1","followers_url":"https://api.github.com/users/pjain1/followers","following_url":"https://api.github.com/users/pjain1/following{/other_user}","gists_url":"https://api.github.com/users/pjain1/gists{/gist_id}","starred_url":"https://api.github.com/users/pjain1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pjain1/subscriptions","organizations_url":"https://api.github.com/users/pjain1/orgs","repos_url":"https://api.github.com/users/pjain1/repos","events_url":"https://api.github.com/users/pjain1/events{/privacy}","received_events_url":"https://api.github.com/users/pjain1/received_events","type":"User","site_admin":false},"repo":{"id":35442426,"name":"tranquility","full_name":"pjain1/tranquility","owner":{"login":"pjain1","id":11787983,"avatar_url":"https://avatars.githubusercontent.com/u/11787983?v=3","gravatar_id":"","url":"https://api.github.com/users/pjain1","html_url":"https://github.com/pjain1","followers_url":"https://api.github.com/users/pjain1/followers","following_url":"https://api.github.com/users/pjain1/following{/other_user}","gists_url":"https://api.github.com/users/pjain1/gists{/gist_id}","starred_url":"https://api.github.com/users/pjain1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pjain1/subscriptions","organizations_url":"https://api.github.com/users/pjain1/orgs","repos_url":"https://api.github.com/users/pjain1/repos","events_url":"https://api.github.com/users/pjain1/events{/privacy}","received_events_url":"https://api.github.com/users/pjain1/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/pjain1/tranquility","description":"Tranquility heals for 9037 plus an additional 1542 every 2 sec. Stacks up to 3 times. The Druid must channel to maintain the spell.","fork":true,"url":"https://api.github.com/repos/pjain1/tranquility","forks_url":"https://api.github.com/repos/pjain1/tranquility/forks","keys_url":"https://api.github.com/repos/pjain1/tranquility/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pjain1/tranquility/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pjain1/tranquility/teams","hooks_url":"https://api.github.com/repos/pjain1/tranquility/hooks","issue_events_url":"https://api.github.com/repos/pjain1/tranquility/issues/events{/number}","events_url":"https://api.github.com/repos/pjain1/tranquility/events","assignees_url":"https://api.github.com/repos/pjain1/tranquility/assignees{/user}","branches_url":"https://api.github.com/repos/pjain1/tranquility/branches{/branch}","tags_url":"https://api.github.com/repos/pjain1/tranquility/tags","blobs_url":"https://api.github.com/repos/pjain1/tranquility/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pjain1/tranquility/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pjain1/tranquility/git/refs{/sha}","trees_url":"https://api.github.com/repos/pjain1/tranquility/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pjain1/tranquility/statuses/{sha}","languages_url":"https://api.github.com/repos/pjain1/tranquility/languages","stargazers_url":"https://api.github.com/repos/pjain1/tranquility/stargazers","contributors_url":"https://api.github.com/repos/pjain1/tranquility/contributors","subscribers_url":"https://api.github.com/repos/pjain1/tranquility/subscribers","subscription_url":"https://api.github.com/repos/pjain1/tranquility/subscription","commits_url":"https://api.github.com/repos/pjain1/tranquility/commits{/sha}","git_commits_url":"https://api.github.com/repos/pjain1/tranquility/git/commits{/sha}","comments_url":"https://api.github.com/repos/pjain1/tranquility/comments{/number}","issue_comment_url":"https://api.github.com/repos/pjain1/tranquility/issues/comments{/number}","contents_url":"https://api.github.com/repos/pjain1/tranquility/contents/{+path}","compare_url":"https://api.github.com/repos/pjain1/tranquility/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pjain1/tranquility/merges","archive_url":"https://api.github.com/repos/pjain1/tranquility/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pjain1/tranquility/downloads","issues_url":"https://api.github.com/repos/pjain1/tranquility/issues{/number}","pulls_url":"https://api.github.com/repos/pjain1/tranquility/pulls{/number}","milestones_url":"https://api.github.com/repos/pjain1/tranquility/milestones{/number}","notifications_url":"https://api.github.com/repos/pjain1/tranquility/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pjain1/tranquility/labels{/name}","releases_url":"https://api.github.com/repos/pjain1/tranquility/releases{/id}","created_at":"2015-05-11T18:36:10Z","updated_at":"2015-05-11T18:36:11Z","pushed_at":"2015-10-20T14:27:22Z","git_url":"git://github.com/pjain1/tranquility.git","ssh_url":"git@github.com:pjain1/tranquility.git","clone_url":"https://github.com/pjain1/tranquility.git","svn_url":"https://github.com/pjain1/tranquility","homepage":null,"size":481,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pjain1/tranquility/pulls/1"},"html":{"href":"https://github.com/pjain1/tranquility/pull/1"},"issue":{"href":"https://api.github.com/repos/pjain1/tranquility/issues/1"},"comments":{"href":"https://api.github.com/repos/pjain1/tranquility/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/pjain1/tranquility/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/pjain1/tranquility/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pjain1/tranquility/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/pjain1/tranquility/statuses/f529dc749f8d2f175b1ace50ff3267ceeb1bfc12"}}}}