fix DruidSetup not working

This commit is contained in:
fjy 2013-05-20 12:06:21 -07:00
parent d826537672
commit 54c48aac6d
3 changed files with 45 additions and 41 deletions

View File

@ -20,6 +20,7 @@
package com.metamx.druid.coordination; package com.metamx.druid.coordination;
import com.google.common.base.Function; import com.google.common.base.Function;
import com.google.common.base.Predicates;
import com.google.common.collect.Ordering; import com.google.common.collect.Ordering;
import com.metamx.common.ISE; import com.metamx.common.ISE;
import com.metamx.common.guava.FunctionalIterable; import com.metamx.common.guava.FunctionalIterable;
@ -254,7 +255,8 @@ public class ServerManager implements QuerySegmentWalker
); );
} }
} }
); )
.filter(Predicates.<QueryRunner<T>>notNull());
} }
} }
); );

View File

@ -144,6 +144,10 @@ public class QueryableIndexStorageAdapter extends BaseStorageAdapter
final Interval dataInterval = new Interval(getMinTime().getMillis(), gran.next(getMaxTime().getMillis())); final Interval dataInterval = new Interval(getMinTime().getMillis(), gran.next(getMaxTime().getMillis()));
if (!actualInterval.overlaps(dataInterval)) {
return ImmutableList.of();
}
if (actualInterval.getStart().isBefore(dataInterval.getStart())) { if (actualInterval.getStart().isBefore(dataInterval.getStart())) {
actualInterval = actualInterval.withStart(dataInterval.getStart()); actualInterval = actualInterval.withStart(dataInterval.getStart());
} }
@ -352,8 +356,7 @@ public class QueryableIndexStorageAdapter extends BaseStorageAdapter
return column.lookupId(name); return column.lookupId(name);
} }
}; };
} } else {
else {
return new DimensionSelector() return new DimensionSelector()
{ {
@Override @Override
@ -495,11 +498,9 @@ public class QueryableIndexStorageAdapter extends BaseStorageAdapter
if (capabilities.isDictionaryEncoded()) { if (capabilities.isDictionaryEncoded()) {
cachedColumnVals = holder.getDictionaryEncoding(); cachedColumnVals = holder.getDictionaryEncoding();
} } else if (capabilities.getType() == ValueType.COMPLEX) {
else if(capabilities.getType() == ValueType.COMPLEX) {
cachedColumnVals = holder.getComplexColumn(); cachedColumnVals = holder.getComplexColumn();
} } else {
else {
cachedColumnVals = holder.getGenericColumn(); cachedColumnVals = holder.getGenericColumn();
} }
} }
@ -791,8 +792,7 @@ public class QueryableIndexStorageAdapter extends BaseStorageAdapter
return column.lookupId(name); return column.lookupId(name);
} }
}; };
} } else {
else {
return new DimensionSelector() return new DimensionSelector()
{ {
@Override @Override
@ -933,11 +933,9 @@ public class QueryableIndexStorageAdapter extends BaseStorageAdapter
if (holder.getCapabilities().isDictionaryEncoded()) { if (holder.getCapabilities().isDictionaryEncoded()) {
cachedColumnVals = holder.getDictionaryEncoding(); cachedColumnVals = holder.getDictionaryEncoding();
} } else if (type == ValueType.COMPLEX) {
else if(type == ValueType.COMPLEX) {
cachedColumnVals = holder.getComplexColumn(); cachedColumnVals = holder.getComplexColumn();
} } else {
else {
cachedColumnVals = holder.getGenericColumn(); cachedColumnVals = holder.getGenericColumn();
} }
} }
@ -1059,7 +1057,9 @@ public class QueryableIndexStorageAdapter extends BaseStorageAdapter
Closeables.closeQuietly(complexColumn); Closeables.closeQuietly(complexColumn);
} }
for (Object column : objectColumnCache.values()) { for (Object column : objectColumnCache.values()) {
if(column instanceof Closeable) Closeables.closeQuietly((Closeable)column); if (column instanceof Closeable) {
Closeables.closeQuietly((Closeable) column);
}
} }
} }
} }

View File

@ -103,11 +103,13 @@ public class DruidSetup
if ("dump".equals(cmd) && args.length == 3) { if ("dump".equals(cmd) && args.length == 3) {
final String zkConnect = args[1]; final String zkConnect = args[1];
curator = connectToZK(zkConnect); curator = connectToZK(zkConnect);
curator.start();
String zpathBase = args[2]; String zpathBase = args[2];
dumpFromZk(curator, zkConnect, zpathBase, System.out); dumpFromZk(curator, zkConnect, zpathBase, System.out);
} else if ("put".equals(cmd) && args.length == 3) { } else if ("put".equals(cmd) && args.length == 3) {
final String zkConnect = args[1]; final String zkConnect = args[1];
curator = connectToZK(zkConnect); curator = connectToZK(zkConnect);
curator.start();
final String pfile = args[2]; final String pfile = args[2];
putToZk(curator, pfile); putToZk(curator, pfile);
} else { } else {