{"action":"created","comment":{"url":"https://api.github.com/repos/druid-io/druid/pulls/comments/55392522","id":55392522,"diff_hunk":"@@ -0,0 +1,226 @@\n+/*\n+ * Licensed to Metamarkets Group Inc. (Metamarkets) under one\n+ * or more contributor license agreements.  See the NOTICE file\n+ * distributed with this work for additional information\n+ * regarding copyright ownership.  Metamarkets licenses this file\n+ * to you under the Apache License, Version 2.0 (the\n+ * \"License\"); you may not use this file except in compliance\n+ * with the License.  You may obtain a copy of the License at\n+ *\n+ *   http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing,\n+ * software distributed under the License is distributed on an\n+ * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n+ * KIND, either express or implied.  See the License for the\n+ * specific language governing permissions and limitations\n+ * under the License.\n+ */\n+\n+package io.druid.server.http;\n+\n+import com.fasterxml.jackson.core.type.TypeReference;\n+import com.fasterxml.jackson.databind.ObjectMapper;\n+import com.fasterxml.jackson.jaxrs.smile.SmileMediaTypes;\n+import com.google.common.base.Strings;\n+import com.google.inject.Inject;\n+import com.metamx.common.IAE;\n+import com.metamx.common.RE;\n+import com.metamx.common.logger.Logger;\n+import io.druid.audit.AuditInfo;\n+import io.druid.audit.AuditManager;\n+import io.druid.common.utils.ServletResourceUtils;\n+import io.druid.guice.annotations.Json;\n+import io.druid.guice.annotations.Smile;\n+import io.druid.server.namespace.cache.LookupCoordinatorManager;\n+\n+import javax.servlet.http.HttpServletRequest;\n+import javax.ws.rs.Consumes;\n+import javax.ws.rs.DELETE;\n+import javax.ws.rs.DefaultValue;\n+import javax.ws.rs.GET;\n+import javax.ws.rs.HeaderParam;\n+import javax.ws.rs.POST;\n+import javax.ws.rs.Path;\n+import javax.ws.rs.PathParam;\n+import javax.ws.rs.Produces;\n+import javax.ws.rs.core.Context;\n+import javax.ws.rs.core.MediaType;\n+import javax.ws.rs.core.Response;\n+import java.io.IOException;\n+import java.io.InputStream;\n+import java.util.Map;\n+\n+/**\n+ * Contains information about lookups exposed through the coordinator\n+ */\n+@Path(\"/druid/coordinator/v1/lookups\")\n+public class LookupCoordinatorResource\n+{\n+  private static final Logger LOG = new Logger(LookupCoordinatorResource.class);\n+  private final LookupCoordinatorManager lookupCoordinatorManager;\n+  private final @Smile ObjectMapper smileMapper;\n+  private final @Json ObjectMapper jsonMapper;\n+\n+  @Inject\n+  public LookupCoordinatorResource(\n+      final LookupCoordinatorManager lookupCoordinatorManager,\n+      final @Smile ObjectMapper smileMapper,\n+      final @Json ObjectMapper jsonMapper\n+  )\n+  {\n+    this.smileMapper = smileMapper;\n+    this.jsonMapper = jsonMapper;\n+    this.lookupCoordinatorManager = lookupCoordinatorManager;\n+  }\n+\n+  @GET\n+  @Produces({MediaType.APPLICATION_JSON, SmileMediaTypes.APPLICATION_JACKSON_SMILE})\n+  public Response getTiers()","path":"server/src/main/java/io/druid/server/http/LookupCoordinatorResource.java","position":79,"original_position":79,"commit_id":"2eb49ed719a5d4c138b75dccc994e6e5046c97df","original_commit_id":"2eb49ed719a5d4c138b75dccc994e6e5046c97df","user":{"login":"drcrallen","id":8213081,"avatar_url":"https://avatars.githubusercontent.com/u/8213081?v=3","gravatar_id":"","url":"https://api.github.com/users/drcrallen","html_url":"https://github.com/drcrallen","followers_url":"https://api.github.com/users/drcrallen/followers","following_url":"https://api.github.com/users/drcrallen/following{/other_user}","gists_url":"https://api.github.com/users/drcrallen/gists{/gist_id}","starred_url":"https://api.github.com/users/drcrallen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/drcrallen/subscriptions","organizations_url":"https://api.github.com/users/drcrallen/orgs","repos_url":"https://api.github.com/users/drcrallen/repos","events_url":"https://api.github.com/users/drcrallen/events{/privacy}","received_events_url":"https://api.github.com/users/drcrallen/received_events","type":"User","site_admin":false},"body":"Tiers that are not in the config cannot be managed by this workflow.\r\n\r\nMaybe `getManagedTiers` is more appropriate?\r\n\r\nI can add a query option to discover tiers if they are not currently known.","created_at":"2016-03-08T17:18:23Z","updated_at":"2016-03-08T17:18:23Z","html_url":"https://github.com/druid-io/druid/pull/1576#discussion_r55392522","pull_request_url":"https://api.github.com/repos/druid-io/druid/pulls/1576","_links":{"self":{"href":"https://api.github.com/repos/druid-io/druid/pulls/comments/55392522"},"html":{"href":"https://github.com/druid-io/druid/pull/1576#discussion_r55392522"},"pull_request":{"href":"https://api.github.com/repos/druid-io/druid/pulls/1576"}}},"pull_request":{"url":"https://api.github.com/repos/druid-io/druid/pulls/1576","id":41146223,"html_url":"https://github.com/druid-io/druid/pull/1576","diff_url":"https://github.com/druid-io/druid/pull/1576.diff","patch_url":"https://github.com/druid-io/druid/pull/1576.patch","issue_url":"https://api.github.com/repos/druid-io/druid/issues/1576","number":1576,"state":"open","locked":false,"title":"[QTL] Query time lookup cluster wide config","user":{"login":"drcrallen","id":8213081,"avatar_url":"https://avatars.githubusercontent.com/u/8213081?v=3","gravatar_id":"","url":"https://api.github.com/users/drcrallen","html_url":"https://github.com/drcrallen","followers_url":"https://api.github.com/users/drcrallen/followers","following_url":"https://api.github.com/users/drcrallen/following{/other_user}","gists_url":"https://api.github.com/users/drcrallen/gists{/gist_id}","starred_url":"https://api.github.com/users/drcrallen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/drcrallen/subscriptions","organizations_url":"https://api.github.com/users/drcrallen/orgs","repos_url":"https://api.github.com/users/drcrallen/repos","events_url":"https://api.github.com/users/drcrallen/events{/privacy}","received_events_url":"https://api.github.com/users/drcrallen/received_events","type":"User","site_admin":false},"body":"This is the next PR for QTL where cluster wide configuration is possible.\r\n\r\nThis approach uses POSTs from the coordinator to populate QTL information in all interested nodes. Interested nodes \"register\" via the Announcer (currently ZK based). But all communication occurs through HTTP directly between the coordinator and the node.\r\n\r\nThe PR lists over 4k lines, but a LOT of that is tests.\r\n\r\nTODO:\r\n\r\n* ~~Proposal for coordinator and node endpoints~~\r\n* ~~Squash~~\r\n* ~~Docs~~ Punted until extensions are updated\r\n* ~~Migrate coordinator code to a module.~~\r\n* ~~Figure out a better way to handle the listening handling. (see https://github.com/druid-io/druid/pull/2286 )~~ added in this PR in core\r\n* ~~Migrate lookup config to auditable config type.~~\r\n* ~~Rebase on https://github.com/druid-io/druid/pull/2291~~\r\n* ~~Move core stuff and extension stuff to its own commit~~\r\n* ~~Make sure put functions as expected. (I don't  think deleting actually works in this version)~~\r\n* ~~Make sure initialization behaves as expected~~\r\n* ~~Actually run the thing locally~~\r\n* ~~Reconcile need for static config vs dynamic config. Ex: what happens if someone requests a delete or get of a lookup defined in runtime.properties?~~ No static config\r\n* ~~More unit tests for delete funciton~~\r\n\r\nKNOWN ISSUES:\r\n\r\nCurrently if someone manually goes in and modifies lookups on a lookup node, the cluster wide config will attempt to re-populate that node. The way to get around this behavior is to add the lookups to the node independent of cluster-wide config.\r\n\r\nThe lookup coordinator does try to delete lookups that were removed from the config.\r\n\r\nTHERE IS A MAJOR CAVEAT HERE: If a node's network is disconnected during this delete (or it is otherwise temporarily unavailable) there is no good way for the coordinator to know that, when it can communicate with the node again, if the `some_lookup` is has is supposed to be there as a custom config, or if `some_lookup` is there from a failed delete.\r\n\r\nSuch an occurrence should be RARE in the current IMPL though. ","created_at":"2015-07-29T16:52:41Z","updated_at":"2016-03-08T17:18:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2f3560b30de11783f50820595f0ea8715dc6fd34","assignee":null,"milestone":{"url":"https://api.github.com/repos/druid-io/druid/milestones/18","html_url":"https://github.com/druid-io/druid/milestones/0.9.1","labels_url":"https://api.github.com/repos/druid-io/druid/milestones/18/labels","id":1526819,"number":18,"title":"0.9.1","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":35,"closed_issues":45,"state":"open","created_at":"2016-01-20T19:04:22Z","updated_at":"2016-03-08T06:52:58Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/druid-io/druid/pulls/1576/commits","review_comments_url":"https://api.github.com/repos/druid-io/druid/pulls/1576/comments","review_comment_url":"https://api.github.com/repos/druid-io/druid/pulls/comments{/number}","comments_url":"https://api.github.com/repos/druid-io/druid/issues/1576/comments","statuses_url":"https://api.github.com/repos/druid-io/druid/statuses/2eb49ed719a5d4c138b75dccc994e6e5046c97df","head":{"label":"metamx:queryTimeLookup_announce","ref":"queryTimeLookup_announce","sha":"2eb49ed719a5d4c138b75dccc994e6e5046c97df","user":{"login":"metamx","id":299329,"avatar_url":"https://avatars.githubusercontent.com/u/299329?v=3","gravatar_id":"","url":"https://api.github.com/users/metamx","html_url":"https://github.com/metamx","followers_url":"https://api.github.com/users/metamx/followers","following_url":"https://api.github.com/users/metamx/following{/other_user}","gists_url":"https://api.github.com/users/metamx/gists{/gist_id}","starred_url":"https://api.github.com/users/metamx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/metamx/subscriptions","organizations_url":"https://api.github.com/users/metamx/orgs","repos_url":"https://api.github.com/users/metamx/repos","events_url":"https://api.github.com/users/metamx/events{/privacy}","received_events_url":"https://api.github.com/users/metamx/received_events","type":"Organization","site_admin":false},"repo":{"id":28248872,"name":"druid","full_name":"metamx/druid","owner":{"login":"metamx","id":299329,"avatar_url":"https://avatars.githubusercontent.com/u/299329?v=3","gravatar_id":"","url":"https://api.github.com/users/metamx","html_url":"https://github.com/metamx","followers_url":"https://api.github.com/users/metamx/followers","following_url":"https://api.github.com/users/metamx/following{/other_user}","gists_url":"https://api.github.com/users/metamx/gists{/gist_id}","starred_url":"https://api.github.com/users/metamx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/metamx/subscriptions","organizations_url":"https://api.github.com/users/metamx/orgs","repos_url":"https://api.github.com/users/metamx/repos","events_url":"https://api.github.com/users/metamx/events{/privacy}","received_events_url":"https://api.github.com/users/metamx/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/metamx/druid","description":"Real²time Exploratory Analytics on Large Datasets","fork":true,"url":"https://api.github.com/repos/metamx/druid","forks_url":"https://api.github.com/repos/metamx/druid/forks","keys_url":"https://api.github.com/repos/metamx/druid/keys{/key_id}","collaborators_url":"https://api.github.com/repos/metamx/druid/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/metamx/druid/teams","hooks_url":"https://api.github.com/repos/metamx/druid/hooks","issue_events_url":"https://api.github.com/repos/metamx/druid/issues/events{/number}","events_url":"https://api.github.com/repos/metamx/druid/events","assignees_url":"https://api.github.com/repos/metamx/druid/assignees{/user}","branches_url":"https://api.github.com/repos/metamx/druid/branches{/branch}","tags_url":"https://api.github.com/repos/metamx/druid/tags","blobs_url":"https://api.github.com/repos/metamx/druid/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/metamx/druid/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/metamx/druid/git/refs{/sha}","trees_url":"https://api.github.com/repos/metamx/druid/git/trees{/sha}","statuses_url":"https://api.github.com/repos/metamx/druid/statuses/{sha}","languages_url":"https://api.github.com/repos/metamx/druid/languages","stargazers_url":"https://api.github.com/repos/metamx/druid/stargazers","contributors_url":"https://api.github.com/repos/metamx/druid/contributors","subscribers_url":"https://api.github.com/repos/metamx/druid/subscribers","subscription_url":"https://api.github.com/repos/metamx/druid/subscription","commits_url":"https://api.github.com/repos/metamx/druid/commits{/sha}","git_commits_url":"https://api.github.com/repos/metamx/druid/git/commits{/sha}","comments_url":"https://api.github.com/repos/metamx/druid/comments{/number}","issue_comment_url":"https://api.github.com/repos/metamx/druid/issues/comments{/number}","contents_url":"https://api.github.com/repos/metamx/druid/contents/{+path}","compare_url":"https://api.github.com/repos/metamx/druid/compare/{base}...{head}","merges_url":"https://api.github.com/repos/metamx/druid/merges","archive_url":"https://api.github.com/repos/metamx/druid/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/metamx/druid/downloads","issues_url":"https://api.github.com/repos/metamx/druid/issues{/number}","pulls_url":"https://api.github.com/repos/metamx/druid/pulls{/number}","milestones_url":"https://api.github.com/repos/metamx/druid/milestones{/number}","notifications_url":"https://api.github.com/repos/metamx/druid/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/metamx/druid/labels{/name}","releases_url":"https://api.github.com/repos/metamx/druid/releases{/id}","deployments_url":"https://api.github.com/repos/metamx/druid/deployments","created_at":"2014-12-19T22:30:25Z","updated_at":"2016-03-04T02:14:42Z","pushed_at":"2016-03-07T20:47:36Z","git_url":"git://github.com/metamx/druid.git","ssh_url":"git@github.com:metamx/druid.git","clone_url":"https://github.com/metamx/druid.git","svn_url":"https://github.com/metamx/druid","homepage":"http://druid.io","size":111055,"stargazers_count":58,"watchers_count":58,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":15,"mirror_url":null,"open_issues_count":1,"forks":15,"open_issues":1,"watchers":58,"default_branch":"master"}},"base":{"label":"druid-io:master","ref":"master","sha":"4fa08a13291949f9b2b98cee8300e6b38e376695","user":{"login":"druid-io","id":4203474,"avatar_url":"https://avatars.githubusercontent.com/u/4203474?v=3","gravatar_id":"","url":"https://api.github.com/users/druid-io","html_url":"https://github.com/druid-io","followers_url":"https://api.github.com/users/druid-io/followers","following_url":"https://api.github.com/users/druid-io/following{/other_user}","gists_url":"https://api.github.com/users/druid-io/gists{/gist_id}","starred_url":"https://api.github.com/users/druid-io/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/druid-io/subscriptions","organizations_url":"https://api.github.com/users/druid-io/orgs","repos_url":"https://api.github.com/users/druid-io/repos","events_url":"https://api.github.com/users/druid-io/events{/privacy}","received_events_url":"https://api.github.com/users/druid-io/received_events","type":"Organization","site_admin":false},"repo":{"id":6358188,"name":"druid","full_name":"druid-io/druid","owner":{"login":"druid-io","id":4203474,"avatar_url":"https://avatars.githubusercontent.com/u/4203474?v=3","gravatar_id":"","url":"https://api.github.com/users/druid-io","html_url":"https://github.com/druid-io","followers_url":"https://api.github.com/users/druid-io/followers","following_url":"https://api.github.com/users/druid-io/following{/other_user}","gists_url":"https://api.github.com/users/druid-io/gists{/gist_id}","starred_url":"https://api.github.com/users/druid-io/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/druid-io/subscriptions","organizations_url":"https://api.github.com/users/druid-io/orgs","repos_url":"https://api.github.com/users/druid-io/repos","events_url":"https://api.github.com/users/druid-io/events{/privacy}","received_events_url":"https://api.github.com/users/druid-io/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/druid-io/druid","description":"Column oriented distributed data store ideal for powering interactive applications","fork":false,"url":"https://api.github.com/repos/druid-io/druid","forks_url":"https://api.github.com/repos/druid-io/druid/forks","keys_url":"https://api.github.com/repos/druid-io/druid/keys{/key_id}","collaborators_url":"https://api.github.com/repos/druid-io/druid/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/druid-io/druid/teams","hooks_url":"https://api.github.com/repos/druid-io/druid/hooks","issue_events_url":"https://api.github.com/repos/druid-io/druid/issues/events{/number}","events_url":"https://api.github.com/repos/druid-io/druid/events","assignees_url":"https://api.github.com/repos/druid-io/druid/assignees{/user}","branches_url":"https://api.github.com/repos/druid-io/druid/branches{/branch}","tags_url":"https://api.github.com/repos/druid-io/druid/tags","blobs_url":"https://api.github.com/repos/druid-io/druid/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/druid-io/druid/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/druid-io/druid/git/refs{/sha}","trees_url":"https://api.github.com/repos/druid-io/druid/git/trees{/sha}","statuses_url":"https://api.github.com/repos/druid-io/druid/statuses/{sha}","languages_url":"https://api.github.com/repos/druid-io/druid/languages","stargazers_url":"https://api.github.com/repos/druid-io/druid/stargazers","contributors_url":"https://api.github.com/repos/druid-io/druid/contributors","subscribers_url":"https://api.github.com/repos/druid-io/druid/subscribers","subscription_url":"https://api.github.com/repos/druid-io/druid/subscription","commits_url":"https://api.github.com/repos/druid-io/druid/commits{/sha}","git_commits_url":"https://api.github.com/repos/druid-io/druid/git/commits{/sha}","comments_url":"https://api.github.com/repos/druid-io/druid/comments{/number}","issue_comment_url":"https://api.github.com/repos/druid-io/druid/issues/comments{/number}","contents_url":"https://api.github.com/repos/druid-io/druid/contents/{+path}","compare_url":"https://api.github.com/repos/druid-io/druid/compare/{base}...{head}","merges_url":"https://api.github.com/repos/druid-io/druid/merges","archive_url":"https://api.github.com/repos/druid-io/druid/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/druid-io/druid/downloads","issues_url":"https://api.github.com/repos/druid-io/druid/issues{/number}","pulls_url":"https://api.github.com/repos/druid-io/druid/pulls{/number}","milestones_url":"https://api.github.com/repos/druid-io/druid/milestones{/number}","notifications_url":"https://api.github.com/repos/druid-io/druid/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/druid-io/druid/labels{/name}","releases_url":"https://api.github.com/repos/druid-io/druid/releases{/id}","deployments_url":"https://api.github.com/repos/druid-io/druid/deployments","created_at":"2012-10-23T19:08:07Z","updated_at":"2016-03-08T09:04:22Z","pushed_at":"2016-03-08T17:09:09Z","git_url":"git://github.com/druid-io/druid.git","ssh_url":"git@github.com:druid-io/druid.git","clone_url":"https://github.com/druid-io/druid.git","svn_url":"https://github.com/druid-io/druid","homepage":"http://druid.io","size":126779,"stargazers_count":2511,"watchers_count":2511,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":605,"mirror_url":null,"open_issues_count":358,"forks":605,"open_issues":358,"watchers":2511,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/druid-io/druid/pulls/1576"},"html":{"href":"https://github.com/druid-io/druid/pull/1576"},"issue":{"href":"https://api.github.com/repos/druid-io/druid/issues/1576"},"comments":{"href":"https://api.github.com/repos/druid-io/druid/issues/1576/comments"},"review_comments":{"href":"https://api.github.com/repos/druid-io/druid/pulls/1576/comments"},"review_comment":{"href":"https://api.github.com/repos/druid-io/druid/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/druid-io/druid/pulls/1576/commits"},"statuses":{"href":"https://api.github.com/repos/druid-io/druid/statuses/2eb49ed719a5d4c138b75dccc994e6e5046c97df"}}}}