From 54c48aac6ddd3d811120d1803c17e7f785fca2cf Mon Sep 17 00:00:00 2001 From: fjy Date: Mon, 20 May 2013 12:06:21 -0700 Subject: [PATCH 1/2] fix DruidSetup not working --- .../druid/coordination/ServerManager.java | 4 +- .../v1/QueryableIndexStorageAdapter.java | 80 +++++++++---------- .../com/metamx/druid/utils/DruidSetup.java | 2 + 3 files changed, 45 insertions(+), 41 deletions(-) diff --git a/server/src/main/java/com/metamx/druid/coordination/ServerManager.java b/server/src/main/java/com/metamx/druid/coordination/ServerManager.java index 155d9e20793..9d117695321 100644 --- a/server/src/main/java/com/metamx/druid/coordination/ServerManager.java +++ b/server/src/main/java/com/metamx/druid/coordination/ServerManager.java @@ -20,6 +20,7 @@ package com.metamx.druid.coordination; import com.google.common.base.Function; +import com.google.common.base.Predicates; import com.google.common.collect.Ordering; import com.metamx.common.ISE; import com.metamx.common.guava.FunctionalIterable; @@ -254,7 +255,8 @@ public class ServerManager implements QuerySegmentWalker ); } } - ); + ) + .filter(Predicates.>notNull()); } } ); diff --git a/server/src/main/java/com/metamx/druid/index/v1/QueryableIndexStorageAdapter.java b/server/src/main/java/com/metamx/druid/index/v1/QueryableIndexStorageAdapter.java index 2e3dcaa3b16..5d4a938fd92 100644 --- a/server/src/main/java/com/metamx/druid/index/v1/QueryableIndexStorageAdapter.java +++ b/server/src/main/java/com/metamx/druid/index/v1/QueryableIndexStorageAdapter.java @@ -144,6 +144,10 @@ public class QueryableIndexStorageAdapter extends BaseStorageAdapter final Interval dataInterval = new Interval(getMinTime().getMillis(), gran.next(getMaxTime().getMillis())); + if (!actualInterval.overlaps(dataInterval)) { + return ImmutableList.of(); + } + if (actualInterval.getStart().isBefore(dataInterval.getStart())) { actualInterval = actualInterval.withStart(dataInterval.getStart()); } @@ -260,7 +264,7 @@ public class QueryableIndexStorageAdapter extends BaseStorageAdapter final Map genericColumnCache = Maps.newHashMap(); final Map complexColumnCache = Maps.newHashMap(); - final Map objectColumnCache = Maps.newHashMap(); + final Map objectColumnCache = Maps.newHashMap(); final GenericColumn timestamps = index.getTimeColumn().getGenericColumn(); @@ -352,8 +356,7 @@ public class QueryableIndexStorageAdapter extends BaseStorageAdapter return column.lookupId(name); } }; - } - else { + } else { return new DimensionSelector() { @Override @@ -412,8 +415,8 @@ public class QueryableIndexStorageAdapter extends BaseStorageAdapter if (cachedMetricVals == null) { Column holder = index.getColumn(metricName); if (holder != null && holder.getCapabilities().getType() == ValueType.FLOAT) { - cachedMetricVals = holder.getGenericColumn(); - genericColumnCache.put(metricName, cachedMetricVals); + cachedMetricVals = holder.getGenericColumn(); + genericColumnCache.put(metricName, cachedMetricVals); } } @@ -484,27 +487,25 @@ public class QueryableIndexStorageAdapter extends BaseStorageAdapter if (cachedColumnVals == null) { Column holder = index.getColumn(columnName); - if(holder != null) { + if (holder != null) { final ColumnCapabilities capabilities = holder.getCapabilities(); - if(capabilities.hasMultipleValues()) { + if (capabilities.hasMultipleValues()) { throw new UnsupportedOperationException( - "makeObjectColumnSelector does not support multivalued columns" + "makeObjectColumnSelector does not support multivalued columns" ); } - if(capabilities.isDictionaryEncoded()) { + if (capabilities.isDictionaryEncoded()) { cachedColumnVals = holder.getDictionaryEncoding(); - } - else if(capabilities.getType() == ValueType.COMPLEX) { + } else if (capabilities.getType() == ValueType.COMPLEX) { cachedColumnVals = holder.getComplexColumn(); - } - else { + } else { cachedColumnVals = holder.getGenericColumn(); } } - if(cachedColumnVals != null) { + if (cachedColumnVals != null) { objectColumnCache.put(columnName, cachedColumnVals); } } @@ -513,11 +514,11 @@ public class QueryableIndexStorageAdapter extends BaseStorageAdapter return null; } - if(cachedColumnVals instanceof GenericColumn) { + if (cachedColumnVals instanceof GenericColumn) { final GenericColumn columnVals = (GenericColumn) cachedColumnVals; final ValueType type = columnVals.getType(); - if(type == ValueType.FLOAT) { + if (type == ValueType.FLOAT) { return new ObjectColumnSelector() { @Override @@ -533,7 +534,7 @@ public class QueryableIndexStorageAdapter extends BaseStorageAdapter } }; } - if(type == ValueType.LONG) { + if (type == ValueType.LONG) { return new ObjectColumnSelector() { @Override @@ -549,7 +550,7 @@ public class QueryableIndexStorageAdapter extends BaseStorageAdapter } }; } - if(type == ValueType.STRING) { + if (type == ValueType.STRING) { return new ObjectColumnSelector() { @Override @@ -585,7 +586,7 @@ public class QueryableIndexStorageAdapter extends BaseStorageAdapter }; } - final ComplexColumn columnVals = (ComplexColumn)cachedColumnVals; + final ComplexColumn columnVals = (ComplexColumn) cachedColumnVals; return new ObjectColumnSelector() { @Override @@ -623,8 +624,8 @@ public class QueryableIndexStorageAdapter extends BaseStorageAdapter Closeables.closeQuietly(complexColumn); } for (Object column : complexColumnCache.values()) { - if(column instanceof Closeable) { - Closeables.closeQuietly((Closeable)column); + if (column instanceof Closeable) { + Closeables.closeQuietly((Closeable) column); } } } @@ -791,8 +792,7 @@ public class QueryableIndexStorageAdapter extends BaseStorageAdapter return column.lookupId(name); } }; - } - else { + } else { return new DimensionSelector() { @Override @@ -851,8 +851,8 @@ public class QueryableIndexStorageAdapter extends BaseStorageAdapter if (cachedMetricVals == null) { Column holder = index.getColumn(metricName); if (holder != null && holder.getCapabilities().getType() == ValueType.FLOAT) { - cachedMetricVals = holder.getGenericColumn(); - genericColumnCache.put(metricName, cachedMetricVals); + cachedMetricVals = holder.getGenericColumn(); + genericColumnCache.put(metricName, cachedMetricVals); } } @@ -923,26 +923,24 @@ public class QueryableIndexStorageAdapter extends BaseStorageAdapter if (cachedColumnVals == null) { Column holder = index.getColumn(columnName); - if(holder != null) { - if(holder.getCapabilities().hasMultipleValues()) { + if (holder != null) { + if (holder.getCapabilities().hasMultipleValues()) { throw new UnsupportedOperationException( - "makeObjectColumnSelector does not support multivalued columns" + "makeObjectColumnSelector does not support multivalued columns" ); } final ValueType type = holder.getCapabilities().getType(); - if(holder.getCapabilities().isDictionaryEncoded()) { + if (holder.getCapabilities().isDictionaryEncoded()) { cachedColumnVals = holder.getDictionaryEncoding(); - } - else if(type == ValueType.COMPLEX) { + } else if (type == ValueType.COMPLEX) { cachedColumnVals = holder.getComplexColumn(); - } - else { + } else { cachedColumnVals = holder.getGenericColumn(); } } - if(cachedColumnVals != null) { + if (cachedColumnVals != null) { objectColumnCache.put(columnName, cachedColumnVals); } } @@ -951,11 +949,11 @@ public class QueryableIndexStorageAdapter extends BaseStorageAdapter return null; } - if(cachedColumnVals instanceof GenericColumn) { + if (cachedColumnVals instanceof GenericColumn) { final GenericColumn columnVals = (GenericColumn) cachedColumnVals; final ValueType type = columnVals.getType(); - if(type == ValueType.FLOAT) { + if (type == ValueType.FLOAT) { return new ObjectColumnSelector() { @Override @@ -971,7 +969,7 @@ public class QueryableIndexStorageAdapter extends BaseStorageAdapter } }; } - if(type == ValueType.LONG) { + if (type == ValueType.LONG) { return new ObjectColumnSelector() { @Override @@ -987,7 +985,7 @@ public class QueryableIndexStorageAdapter extends BaseStorageAdapter } }; } - if(type == ValueType.STRING) { + if (type == ValueType.STRING) { return new ObjectColumnSelector() { @Override @@ -1023,7 +1021,7 @@ public class QueryableIndexStorageAdapter extends BaseStorageAdapter }; } - final ComplexColumn columnVals = (ComplexColumn)cachedColumnVals; + final ComplexColumn columnVals = (ComplexColumn) cachedColumnVals; return new ObjectColumnSelector() { @Override @@ -1059,7 +1057,9 @@ public class QueryableIndexStorageAdapter extends BaseStorageAdapter Closeables.closeQuietly(complexColumn); } for (Object column : objectColumnCache.values()) { - if(column instanceof Closeable) Closeables.closeQuietly((Closeable)column); + if (column instanceof Closeable) { + Closeables.closeQuietly((Closeable) column); + } } } } diff --git a/server/src/main/java/com/metamx/druid/utils/DruidSetup.java b/server/src/main/java/com/metamx/druid/utils/DruidSetup.java index 5980f1e28b1..d77aba20f9d 100644 --- a/server/src/main/java/com/metamx/druid/utils/DruidSetup.java +++ b/server/src/main/java/com/metamx/druid/utils/DruidSetup.java @@ -103,11 +103,13 @@ public class DruidSetup if ("dump".equals(cmd) && args.length == 3) { final String zkConnect = args[1]; curator = connectToZK(zkConnect); + curator.start(); String zpathBase = args[2]; dumpFromZk(curator, zkConnect, zpathBase, System.out); } else if ("put".equals(cmd) && args.length == 3) { final String zkConnect = args[1]; curator = connectToZK(zkConnect); + curator.start(); final String pfile = args[2]; putToZk(curator, pfile); } else { From ee51a5d1ae61f534f32e50607f698829f6fa2d19 Mon Sep 17 00:00:00 2001 From: fjy Date: Mon, 20 May 2013 12:07:54 -0700 Subject: [PATCH 2/2] [maven-release-plugin] prepare release druid-0.4.12.5 --- client/pom.xml | 2 +- common/pom.xml | 2 +- examples/pom.xml | 2 +- index-common/pom.xml | 2 +- indexer/pom.xml | 2 +- merger/pom.xml | 2 +- pom.xml | 2 +- realtime/pom.xml | 2 +- server/pom.xml | 2 +- services/pom.xml | 4 ++-- 10 files changed, 11 insertions(+), 11 deletions(-) diff --git a/client/pom.xml b/client/pom.xml index ade5dfee23d..631636bcdea 100644 --- a/client/pom.xml +++ b/client/pom.xml @@ -28,7 +28,7 @@ com.metamx druid - 0.4.12.5-SNAPSHOT + 0.4.12.5 diff --git a/common/pom.xml b/common/pom.xml index be1b6c70433..21b12deb738 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -28,7 +28,7 @@ com.metamx druid - 0.4.12.5-SNAPSHOT + 0.4.12.5 diff --git a/examples/pom.xml b/examples/pom.xml index 369844f985c..5e83c04d5b2 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -9,7 +9,7 @@ com.metamx druid - 0.4.12.5-SNAPSHOT + 0.4.12.5 diff --git a/index-common/pom.xml b/index-common/pom.xml index bc9bdae8032..229aeaf16fd 100644 --- a/index-common/pom.xml +++ b/index-common/pom.xml @@ -28,7 +28,7 @@ com.metamx druid - 0.4.12.5-SNAPSHOT + 0.4.12.5 diff --git a/indexer/pom.xml b/indexer/pom.xml index f86da5c684f..55ae3f8f350 100644 --- a/indexer/pom.xml +++ b/indexer/pom.xml @@ -28,7 +28,7 @@ com.metamx druid - 0.4.12.5-SNAPSHOT + 0.4.12.5 diff --git a/merger/pom.xml b/merger/pom.xml index bf60cea247b..4142326c289 100644 --- a/merger/pom.xml +++ b/merger/pom.xml @@ -28,7 +28,7 @@ com.metamx druid - 0.4.12.5-SNAPSHOT + 0.4.12.5 diff --git a/pom.xml b/pom.xml index 3e55b83fbfc..f6382ab544f 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ com.metamx druid pom - 0.4.12.5-SNAPSHOT + 0.4.12.5 druid druid diff --git a/realtime/pom.xml b/realtime/pom.xml index dd9c3225176..d82ae1daa65 100644 --- a/realtime/pom.xml +++ b/realtime/pom.xml @@ -28,7 +28,7 @@ com.metamx druid - 0.4.12.5-SNAPSHOT + 0.4.12.5 diff --git a/server/pom.xml b/server/pom.xml index 6fc5e0cb39c..e6a6daff606 100644 --- a/server/pom.xml +++ b/server/pom.xml @@ -28,7 +28,7 @@ com.metamx druid - 0.4.12.5-SNAPSHOT + 0.4.12.5 diff --git a/services/pom.xml b/services/pom.xml index ca98d8794e1..37df9961be9 100644 --- a/services/pom.xml +++ b/services/pom.xml @@ -24,11 +24,11 @@ druid-services druid-services druid-services - 0.4.12.5-SNAPSHOT + 0.4.12.5 com.metamx druid - 0.4.12.5-SNAPSHOT + 0.4.12.5