From 5bdcc3613c3c5dc65f5fd59ebcbe53fdd1b14a3b Mon Sep 17 00:00:00 2001 From: Fangjin Yang Date: Wed, 27 Mar 2013 10:40:44 -0700 Subject: [PATCH] fix inconsistent druid http paths + fix master console bugs --- .../com/metamx/druid/http/BrokerNode.java | 5 ++--- .../metamx/druid/realtime/RealtimeNode.java | 8 +++---- .../com/metamx/druid/http/ComputeNode.java | 13 +++++++----- .../resources/static/js/handlers-0.0.1.js | 21 ++++++++++++++----- 4 files changed, 30 insertions(+), 17 deletions(-) diff --git a/client/src/main/java/com/metamx/druid/http/BrokerNode.java b/client/src/main/java/com/metamx/druid/http/BrokerNode.java index 76e487efb56..b09507ad6e9 100644 --- a/client/src/main/java/com/metamx/druid/http/BrokerNode.java +++ b/client/src/main/java/com/metamx/druid/http/BrokerNode.java @@ -207,12 +207,11 @@ public class BrokerNode extends QueryableNode theModules.addAll(extraModules); final Injector injector = Guice.createInjector(theModules); - final Context root = new Context(getServer(), "/druid/v2", Context.SESSIONS); - + final Context root = new Context(getServer(), "/", Context.SESSIONS); root.addServlet(new ServletHolder(new StatusServlet()), "/status"); root.addServlet( new ServletHolder(new QueryServlet(getJsonMapper(), getSmileMapper(), texasRanger, getEmitter(), getRequestLogger())), - "/*" + "/druid/v2/*" ); root.addEventListener(new GuiceServletConfig(injector)); diff --git a/realtime/src/main/java/com/metamx/druid/realtime/RealtimeNode.java b/realtime/src/main/java/com/metamx/druid/realtime/RealtimeNode.java index 96052ae3d29..fa29d33a6e8 100644 --- a/realtime/src/main/java/com/metamx/druid/realtime/RealtimeNode.java +++ b/realtime/src/main/java/com/metamx/druid/realtime/RealtimeNode.java @@ -190,13 +190,13 @@ public class RealtimeNode extends BaseServerNode startMonitoring(monitors); - final Context v2Druid = new Context(getServer(), "/druid/v2", Context.SESSIONS); - v2Druid.addServlet(new ServletHolder(new StatusServlet()), "/status"); - v2Druid.addServlet( + final Context root = new Context(getServer(), "/", Context.SESSIONS); + root.addServlet(new ServletHolder(new StatusServlet()), "/status"); + root.addServlet( new ServletHolder( new QueryServlet(getJsonMapper(), getSmileMapper(), realtimeManager, emitter, getRequestLogger()) ), - "/*" + "/druid/v2/*" ); initialized = true; diff --git a/server/src/main/java/com/metamx/druid/http/ComputeNode.java b/server/src/main/java/com/metamx/druid/http/ComputeNode.java index 08b3eb93da3..0b801cd6aad 100644 --- a/server/src/main/java/com/metamx/druid/http/ComputeNode.java +++ b/server/src/main/java/com/metamx/druid/http/ComputeNode.java @@ -54,6 +54,7 @@ import org.jets3t.service.S3ServiceException; import org.jets3t.service.impl.rest.httpclient.RestS3Service; import org.jets3t.service.security.AWSCredentials; import org.mortbay.jetty.servlet.Context; +import org.mortbay.jetty.servlet.DefaultServlet; import org.mortbay.jetty.servlet.ServletHolder; import org.skife.config.ConfigurationObjectFactory; @@ -149,13 +150,12 @@ public class ComputeNode extends BaseServerNode startMonitoring(monitors); final Context root = new Context(getServer(), "/", Context.SESSIONS); - root.addServlet(new ServletHolder(new StatusServlet()), "/status"); root.addServlet( new ServletHolder( new QueryServlet(getJsonMapper(), getSmileMapper(), serverManager, emitter, getRequestLogger()) ), - "/*" + "/druid/v2/*" ); } @@ -221,9 +221,12 @@ public class ComputeNode extends BaseServerNode jsonMapper = new DefaultObjectMapper(); smileMapper = new DefaultObjectMapper(new SmileFactory()); smileMapper.getJsonFactory().setCodec(smileMapper); - } - else if (jsonMapper == null || smileMapper == null) { - throw new ISE("Only jsonMapper[%s] or smileMapper[%s] was set, must set neither or both.", jsonMapper, smileMapper); + } else if (jsonMapper == null || smileMapper == null) { + throw new ISE( + "Only jsonMapper[%s] or smileMapper[%s] was set, must set neither or both.", + jsonMapper, + smileMapper + ); } if (lifecycle == null) { diff --git a/server/src/main/resources/static/js/handlers-0.0.1.js b/server/src/main/resources/static/js/handlers-0.0.1.js index 63d52a094b1..faa78f417b6 100644 --- a/server/src/main/resources/static/js/handlers-0.0.1.js +++ b/server/src/main/resources/static/js/handlers-0.0.1.js @@ -6,10 +6,10 @@ $(document).ready(function() { var type = $('#select_type').attr('value') + ''; var view = $('#select_view').attr('value') + ''; - function handleTable() + function handleTable(dontDisplay) { $.get(basePath + type + '?full', function(data) { - buildTable(data, $('#result_table')); + buildTable(data, $('#result_table'), dontDisplay); $('.loading').hide(); $('#table_wrapper').show(); @@ -75,14 +75,25 @@ $(document).ready(function() { } $('#view_button').click(function() { - type = $('#select_type').attr('value') + ""; - view = $('#select_view').attr('value') + ""; + type = $('#select_type').attr('value') + ''; + view = $('#select_view').attr('value') + ''; resetViews(); switch (view) { case "table": - handleTable(); + var dontDisplay; + switch (type) { + case "servers": + case "datasources": + dontDisplay = ["segments"]; + break; + case "segments": + dontDisplay = ["shardSpec"]; + break; + } + + handleTable(dontDisplay); break; case "list": handleList(type.indexOf("segments") == -1);