{"action":"created","comment":{"url":"https://api.github.com/repos/linkedin/pinot/pulls/comments/76711064","id":76711064,"diff_hunk":"@@ -206,25 +211,37 @@ protected void setupInitialSegments(String realtimeTableName, ZNRecord partition\n     List<ZNRecord> records = new ArrayList<>(nPartitions);\n     final long now = System.currentTimeMillis();\n     final int seqNum = 0; // Initial seq number for the segments\n+\n     for (int i = 0; i < nPartitions; i++) {\n-      final List instances = partitionMap.get(Integer.toString(i));\n-      LLCRealtimeSegmentZKMetadata metadata = new LLCRealtimeSegmentZKMetadata();\n-      final String rawTableName = TableNameBuilder.extractRawTableName(realtimeTableName);\n-      LLCSegmentName llcSegmentName = new LLCSegmentName(rawTableName, i, seqNum, now);\n-      final String segName = llcSegmentName.getSegmentName();\n-\n-      metadata.setCreationTime(now);\n-      metadata.setStartOffset(startOffset);\n-      metadata.setNumReplicas(instances.size());\n-      metadata.setTableName(rawTableName);\n-      metadata.setSegmentName(segName);\n-      metadata.setStatus(CommonConstants.Segment.Realtime.Status.IN_PROGRESS);\n-\n-      ZNRecord record = metadata.toZNRecord();\n-      final String znodePath = PinotRealtimeSegmentManager.getSegmentsPath() + \"/\" + realtimeTableName + \"/\" + segName;\n-      paths.add(znodePath);\n-      records.add(record);\n-      idealStateEntries.put(segName, instances);\n+      SimpleConsumerWrapper kafkaConsumer = SimpleConsumerWrapper.forPartitionConsumption(new KafkaSimpleConsumerFactoryImpl(),\n+          bootstrapHosts, \"dummyClientId\", topicName, i);\n+      try {\n+        final List instances = partitionMap.get(Integer.toString(i));\n+        LLCRealtimeSegmentZKMetadata metadata = new LLCRealtimeSegmentZKMetadata();\n+        final String rawTableName = TableNameBuilder.extractRawTableName(realtimeTableName);\n+        LLCSegmentName llcSegmentName = new LLCSegmentName(rawTableName, i, seqNum, now);\n+        final String segName = llcSegmentName.getSegmentName();\n+\n+        metadata.setCreationTime(now);\n+\n+        final long startOffset = kafkaConsumer.fetchPartitionOffset(initialOffset);","path":"pinot-controller/src/main/java/com/linkedin/pinot/controller/helix/core/realtime/PinotLLCRealtimeSegmentManager.java","position":82,"original_position":82,"commit_id":"ed4f06ad7eb789a5da92b394d7c32fb1d45ff767","original_commit_id":"ed4f06ad7eb789a5da92b394d7c32fb1d45ff767","user":{"login":"mcvsubbu","id":2279037,"avatar_url":"https://avatars.githubusercontent.com/u/2279037?v=3","gravatar_id":"","url":"https://api.github.com/users/mcvsubbu","html_url":"https://github.com/mcvsubbu","followers_url":"https://api.github.com/users/mcvsubbu/followers","following_url":"https://api.github.com/users/mcvsubbu/following{/other_user}","gists_url":"https://api.github.com/users/mcvsubbu/gists{/gist_id}","starred_url":"https://api.github.com/users/mcvsubbu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mcvsubbu/subscriptions","organizations_url":"https://api.github.com/users/mcvsubbu/orgs","repos_url":"https://api.github.com/users/mcvsubbu/repos","events_url":"https://api.github.com/users/mcvsubbu/events{/privacy}","received_events_url":"https://api.github.com/users/mcvsubbu/received_events","type":"User","site_admin":false},"body":"we should add a timeout here as an argument to fetchPartitionOffset. ","created_at":"2016-08-30T00:12:51Z","updated_at":"2016-08-30T00:12:51Z","html_url":"https://github.com/linkedin/pinot/pull/462#discussion_r76711064","pull_request_url":"https://api.github.com/repos/linkedin/pinot/pulls/462","_links":{"self":{"href":"https://api.github.com/repos/linkedin/pinot/pulls/comments/76711064"},"html":{"href":"https://github.com/linkedin/pinot/pull/462#discussion_r76711064"},"pull_request":{"href":"https://api.github.com/repos/linkedin/pinot/pulls/462"}}},"pull_request":{"url":"https://api.github.com/repos/linkedin/pinot/pulls/462","id":83187574,"html_url":"https://github.com/linkedin/pinot/pull/462","diff_url":"https://github.com/linkedin/pinot/pull/462.diff","patch_url":"https://github.com/linkedin/pinot/pull/462.patch","issue_url":"https://api.github.com/repos/linkedin/pinot/issues/462","number":462,"state":"open","locked":false,"title":"Fetch initial Kafka offset on table creation","user":{"login":"jfim","id":246807,"avatar_url":"https://avatars.githubusercontent.com/u/246807?v=3","gravatar_id":"","url":"https://api.github.com/users/jfim","html_url":"https://github.com/jfim","followers_url":"https://api.github.com/users/jfim/followers","following_url":"https://api.github.com/users/jfim/following{/other_user}","gists_url":"https://api.github.com/users/jfim/gists{/gist_id}","starred_url":"https://api.github.com/users/jfim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jfim/subscriptions","organizations_url":"https://api.github.com/users/jfim/orgs","repos_url":"https://api.github.com/users/jfim/repos","events_url":"https://api.github.com/users/jfim/events{/privacy}","received_events_url":"https://api.github.com/users/jfim/received_events","type":"User","site_admin":false},"body":"Fetch the Kafka start offset on a per-partition basis when creating a\nnew LLC realtime table, so that tables consuming from an already\nexisting Kafka topic have a valid start offset.","created_at":"2016-08-29T23:54:11Z","updated_at":"2016-08-30T00:12:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"83c6f13ae2ba38e45eb3499722847a3cd16de62c","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/linkedin/pinot/pulls/462/commits","review_comments_url":"https://api.github.com/repos/linkedin/pinot/pulls/462/comments","review_comment_url":"https://api.github.com/repos/linkedin/pinot/pulls/comments{/number}","comments_url":"https://api.github.com/repos/linkedin/pinot/issues/462/comments","statuses_url":"https://api.github.com/repos/linkedin/pinot/statuses/ed4f06ad7eb789a5da92b394d7c32fb1d45ff767","head":{"label":"linkedin:kafka-offset-initial-fetch","ref":"kafka-offset-initial-fetch","sha":"ed4f06ad7eb789a5da92b394d7c32fb1d45ff767","user":{"login":"linkedin","id":357098,"avatar_url":"https://avatars.githubusercontent.com/u/357098?v=3","gravatar_id":"","url":"https://api.github.com/users/linkedin","html_url":"https://github.com/linkedin","followers_url":"https://api.github.com/users/linkedin/followers","following_url":"https://api.github.com/users/linkedin/following{/other_user}","gists_url":"https://api.github.com/users/linkedin/gists{/gist_id}","starred_url":"https://api.github.com/users/linkedin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/linkedin/subscriptions","organizations_url":"https://api.github.com/users/linkedin/orgs","repos_url":"https://api.github.com/users/linkedin/repos","events_url":"https://api.github.com/users/linkedin/events{/privacy}","received_events_url":"https://api.github.com/users/linkedin/received_events","type":"Organization","site_admin":false},"repo":{"id":19961085,"name":"pinot","full_name":"linkedin/pinot","owner":{"login":"linkedin","id":357098,"avatar_url":"https://avatars.githubusercontent.com/u/357098?v=3","gravatar_id":"","url":"https://api.github.com/users/linkedin","html_url":"https://github.com/linkedin","followers_url":"https://api.github.com/users/linkedin/followers","following_url":"https://api.github.com/users/linkedin/following{/other_user}","gists_url":"https://api.github.com/users/linkedin/gists{/gist_id}","starred_url":"https://api.github.com/users/linkedin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/linkedin/subscriptions","organizations_url":"https://api.github.com/users/linkedin/orgs","repos_url":"https://api.github.com/users/linkedin/repos","events_url":"https://api.github.com/users/linkedin/events{/privacy}","received_events_url":"https://api.github.com/users/linkedin/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/linkedin/pinot","description":"A realtime distributed OLAP datastore","fork":false,"url":"https://api.github.com/repos/linkedin/pinot","forks_url":"https://api.github.com/repos/linkedin/pinot/forks","keys_url":"https://api.github.com/repos/linkedin/pinot/keys{/key_id}","collaborators_url":"https://api.github.com/repos/linkedin/pinot/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/linkedin/pinot/teams","hooks_url":"https://api.github.com/repos/linkedin/pinot/hooks","issue_events_url":"https://api.github.com/repos/linkedin/pinot/issues/events{/number}","events_url":"https://api.github.com/repos/linkedin/pinot/events","assignees_url":"https://api.github.com/repos/linkedin/pinot/assignees{/user}","branches_url":"https://api.github.com/repos/linkedin/pinot/branches{/branch}","tags_url":"https://api.github.com/repos/linkedin/pinot/tags","blobs_url":"https://api.github.com/repos/linkedin/pinot/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/linkedin/pinot/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/linkedin/pinot/git/refs{/sha}","trees_url":"https://api.github.com/repos/linkedin/pinot/git/trees{/sha}","statuses_url":"https://api.github.com/repos/linkedin/pinot/statuses/{sha}","languages_url":"https://api.github.com/repos/linkedin/pinot/languages","stargazers_url":"https://api.github.com/repos/linkedin/pinot/stargazers","contributors_url":"https://api.github.com/repos/linkedin/pinot/contributors","subscribers_url":"https://api.github.com/repos/linkedin/pinot/subscribers","subscription_url":"https://api.github.com/repos/linkedin/pinot/subscription","commits_url":"https://api.github.com/repos/linkedin/pinot/commits{/sha}","git_commits_url":"https://api.github.com/repos/linkedin/pinot/git/commits{/sha}","comments_url":"https://api.github.com/repos/linkedin/pinot/comments{/number}","issue_comment_url":"https://api.github.com/repos/linkedin/pinot/issues/comments{/number}","contents_url":"https://api.github.com/repos/linkedin/pinot/contents/{+path}","compare_url":"https://api.github.com/repos/linkedin/pinot/compare/{base}...{head}","merges_url":"https://api.github.com/repos/linkedin/pinot/merges","archive_url":"https://api.github.com/repos/linkedin/pinot/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/linkedin/pinot/downloads","issues_url":"https://api.github.com/repos/linkedin/pinot/issues{/number}","pulls_url":"https://api.github.com/repos/linkedin/pinot/pulls{/number}","milestones_url":"https://api.github.com/repos/linkedin/pinot/milestones{/number}","notifications_url":"https://api.github.com/repos/linkedin/pinot/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/linkedin/pinot/labels{/name}","releases_url":"https://api.github.com/repos/linkedin/pinot/releases{/id}","deployments_url":"https://api.github.com/repos/linkedin/pinot/deployments","created_at":"2014-05-19T23:27:48Z","updated_at":"2016-08-27T12:23:33Z","pushed_at":"2016-08-30T00:11:02Z","git_url":"git://github.com/linkedin/pinot.git","ssh_url":"git@github.com:linkedin/pinot.git","clone_url":"https://github.com/linkedin/pinot.git","svn_url":"https://github.com/linkedin/pinot","homepage":"https://github.com/linkedin/pinot/wiki","size":143153,"stargazers_count":1332,"watchers_count":1332,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":216,"mirror_url":null,"open_issues_count":74,"forks":216,"open_issues":74,"watchers":1332,"default_branch":"master"}},"base":{"label":"linkedin:master","ref":"master","sha":"431e0e359d43dddb669a6503c9f5971696af1e4d","user":{"login":"linkedin","id":357098,"avatar_url":"https://avatars.githubusercontent.com/u/357098?v=3","gravatar_id":"","url":"https://api.github.com/users/linkedin","html_url":"https://github.com/linkedin","followers_url":"https://api.github.com/users/linkedin/followers","following_url":"https://api.github.com/users/linkedin/following{/other_user}","gists_url":"https://api.github.com/users/linkedin/gists{/gist_id}","starred_url":"https://api.github.com/users/linkedin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/linkedin/subscriptions","organizations_url":"https://api.github.com/users/linkedin/orgs","repos_url":"https://api.github.com/users/linkedin/repos","events_url":"https://api.github.com/users/linkedin/events{/privacy}","received_events_url":"https://api.github.com/users/linkedin/received_events","type":"Organization","site_admin":false},"repo":{"id":19961085,"name":"pinot","full_name":"linkedin/pinot","owner":{"login":"linkedin","id":357098,"avatar_url":"https://avatars.githubusercontent.com/u/357098?v=3","gravatar_id":"","url":"https://api.github.com/users/linkedin","html_url":"https://github.com/linkedin","followers_url":"https://api.github.com/users/linkedin/followers","following_url":"https://api.github.com/users/linkedin/following{/other_user}","gists_url":"https://api.github.com/users/linkedin/gists{/gist_id}","starred_url":"https://api.github.com/users/linkedin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/linkedin/subscriptions","organizations_url":"https://api.github.com/users/linkedin/orgs","repos_url":"https://api.github.com/users/linkedin/repos","events_url":"https://api.github.com/users/linkedin/events{/privacy}","received_events_url":"https://api.github.com/users/linkedin/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/linkedin/pinot","description":"A realtime distributed OLAP datastore","fork":false,"url":"https://api.github.com/repos/linkedin/pinot","forks_url":"https://api.github.com/repos/linkedin/pinot/forks","keys_url":"https://api.github.com/repos/linkedin/pinot/keys{/key_id}","collaborators_url":"https://api.github.com/repos/linkedin/pinot/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/linkedin/pinot/teams","hooks_url":"https://api.github.com/repos/linkedin/pinot/hooks","issue_events_url":"https://api.github.com/repos/linkedin/pinot/issues/events{/number}","events_url":"https://api.github.com/repos/linkedin/pinot/events","assignees_url":"https://api.github.com/repos/linkedin/pinot/assignees{/user}","branches_url":"https://api.github.com/repos/linkedin/pinot/branches{/branch}","tags_url":"https://api.github.com/repos/linkedin/pinot/tags","blobs_url":"https://api.github.com/repos/linkedin/pinot/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/linkedin/pinot/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/linkedin/pinot/git/refs{/sha}","trees_url":"https://api.github.com/repos/linkedin/pinot/git/trees{/sha}","statuses_url":"https://api.github.com/repos/linkedin/pinot/statuses/{sha}","languages_url":"https://api.github.com/repos/linkedin/pinot/languages","stargazers_url":"https://api.github.com/repos/linkedin/pinot/stargazers","contributors_url":"https://api.github.com/repos/linkedin/pinot/contributors","subscribers_url":"https://api.github.com/repos/linkedin/pinot/subscribers","subscription_url":"https://api.github.com/repos/linkedin/pinot/subscription","commits_url":"https://api.github.com/repos/linkedin/pinot/commits{/sha}","git_commits_url":"https://api.github.com/repos/linkedin/pinot/git/commits{/sha}","comments_url":"https://api.github.com/repos/linkedin/pinot/comments{/number}","issue_comment_url":"https://api.github.com/repos/linkedin/pinot/issues/comments{/number}","contents_url":"https://api.github.com/repos/linkedin/pinot/contents/{+path}","compare_url":"https://api.github.com/repos/linkedin/pinot/compare/{base}...{head}","merges_url":"https://api.github.com/repos/linkedin/pinot/merges","archive_url":"https://api.github.com/repos/linkedin/pinot/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/linkedin/pinot/downloads","issues_url":"https://api.github.com/repos/linkedin/pinot/issues{/number}","pulls_url":"https://api.github.com/repos/linkedin/pinot/pulls{/number}","milestones_url":"https://api.github.com/repos/linkedin/pinot/milestones{/number}","notifications_url":"https://api.github.com/repos/linkedin/pinot/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/linkedin/pinot/labels{/name}","releases_url":"https://api.github.com/repos/linkedin/pinot/releases{/id}","deployments_url":"https://api.github.com/repos/linkedin/pinot/deployments","created_at":"2014-05-19T23:27:48Z","updated_at":"2016-08-27T12:23:33Z","pushed_at":"2016-08-30T00:11:02Z","git_url":"git://github.com/linkedin/pinot.git","ssh_url":"git@github.com:linkedin/pinot.git","clone_url":"https://github.com/linkedin/pinot.git","svn_url":"https://github.com/linkedin/pinot","homepage":"https://github.com/linkedin/pinot/wiki","size":143153,"stargazers_count":1332,"watchers_count":1332,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":216,"mirror_url":null,"open_issues_count":74,"forks":216,"open_issues":74,"watchers":1332,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/linkedin/pinot/pulls/462"},"html":{"href":"https://github.com/linkedin/pinot/pull/462"},"issue":{"href":"https://api.github.com/repos/linkedin/pinot/issues/462"},"comments":{"href":"https://api.github.com/repos/linkedin/pinot/issues/462/comments"},"review_comments":{"href":"https://api.github.com/repos/linkedin/pinot/pulls/462/comments"},"review_comment":{"href":"https://api.github.com/repos/linkedin/pinot/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/linkedin/pinot/pulls/462/commits"},"statuses":{"href":"https://api.github.com/repos/linkedin/pinot/statuses/ed4f06ad7eb789a5da92b394d7c32fb1d45ff767"}}}}
{"actor":{"display_login":"mcvsubbu"}}