You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@drill.apache.org by ja...@apache.org on 2016/02/05 16:00:57 UTC
[4/5] drill git commit: DRILL-3581: Upgrade to Guava 18.0
DRILL-3581: Upgrade to Guava 18.0
- Replace Stopwatch constructors with .createStarted() or .createUnstarted()
- Stop using InputSupplier and Closeables.closeQuietly
- Clean up quiet closes to log or (preferably) propagate.
- Add log4j to enforcer exclusions.
- Update HBaseTestSuite to add patching of Closeables.closeQuietly() and Stopwatch legacy methods. Only needed when running HBaseMiniCluster.
- Remove log4j from HBase's pom to provide exception logging.
- Remove log4j from Hive's shaded pom.
- Update Catastrophic failures to use the same pattern to ensure reporting.
- Update test framework to avoid trying IPv6 resolution. (This removes 90s pause from HBase startup in my tests)
This closes #361.
This closes #157.
Project: http://git-wip-us.apache.org/repos/asf/drill/repo
Commit: http://git-wip-us.apache.org/repos/asf/drill/commit/422c5a83
Tree: http://git-wip-us.apache.org/repos/asf/drill/tree/422c5a83
Diff: http://git-wip-us.apache.org/repos/asf/drill/diff/422c5a83
Branch: refs/heads/master
Commit: 422c5a83b8e69e4169d3ebc946401248073c8bf8
Parents: dea0d8b
Author: Jacques Nadeau <ja...@apache.org>
Authored: Mon Sep 14 13:01:57 2015 -0700
Committer: Jacques Nadeau <ja...@apache.org>
Committed: Fri Feb 5 06:59:39 2016 -0800
----------------------------------------------------------------------
.../drill/common/CatastrophicFailure.java | 51 +++++++++++
.../apache/drill/common/config/DrillConfig.java | 2 +-
.../drill/common/scanner/ClassPathScanner.java | 2 +-
.../common/scanner/persistence/ScanResult.java | 2 +-
contrib/storage-hbase/pom.xml | 20 ++++
.../drill/exec/store/hbase/HBaseGroupScan.java | 2 +-
.../exec/store/hbase/HBaseRecordReader.java | 3 +-
.../org/apache/drill/hbase/BaseHBaseTest.java | 10 +-
.../org/apache/drill/hbase/GuavaPatcher.java | 96 ++++++++++++++++++++
.../org/apache/drill/hbase/HBaseTestsSuite.java | 2 +
.../src/test/resources/logback.xml | 4 +-
.../exec/store/hive/HiveMetadataProvider.java | 6 +-
contrib/storage-hive/hive-exec-shade/pom.xml | 6 ++
.../drill/exec/store/mongo/MongoGroupScan.java | 2 +-
.../exec/store/mongo/MongoRecordReader.java | 3 +-
exec/java-exec/pom.xml | 1 +
.../exec/client/PrintingResultsListener.java | 2 +-
.../drill/exec/client/QuerySubmitter.java | 2 +-
.../expr/fn/FunctionImplementationRegistry.java | 2 +-
.../drill/exec/expr/fn/FunctionInitializer.java | 4 +-
.../drill/exec/physical/impl/ImplCreator.java | 3 +-
.../impl/TopN/PriorityQueueTemplate.java | 6 +-
.../exec/physical/impl/TopN/TopNBatch.java | 9 +-
.../exec/physical/impl/sort/SortTemplate.java | 3 +-
.../exec/physical/impl/xsort/BatchGroup.java | 6 +-
.../physical/impl/xsort/ExternalSortBatch.java | 3 +-
.../exec/physical/impl/xsort/MSortTemplate.java | 3 +-
.../impl/xsort/SingleBatchSorterTemplate.java | 3 +-
.../logical/partition/PruneScanRule.java | 6 +-
.../exec/rpc/control/ControlConnection.java | 7 --
.../drill/exec/rpc/control/Controller.java | 4 +-
.../drill/exec/rpc/control/ControllerImpl.java | 15 ++-
.../exec/rpc/data/DataClientConnection.java | 4 -
.../exec/rpc/data/DataConnectionCreator.java | 10 +-
.../apache/drill/exec/rpc/user/UserServer.java | 7 +-
.../org/apache/drill/exec/server/Drillbit.java | 6 +-
.../drill/exec/service/ServiceEngine.java | 12 ++-
.../exec/store/StoragePluginRegistryImpl.java | 3 +-
.../apache/drill/exec/store/TimedRunnable.java | 2 +-
.../drill/exec/store/avro/AvroRecordReader.java | 2 +-
.../sequencefile/SequenceFileRecordReader.java | 3 +-
.../drill/exec/store/parquet/Metadata.java | 6 +-
.../exec/store/parquet/ParquetGroupScan.java | 2 +-
.../store/parquet/ParquetScanBatchCreator.java | 2 +-
.../store/parquet/columnreaders/PageReader.java | 6 +-
.../exec/store/schedule/AffinityCreator.java | 2 +-
.../exec/store/schedule/AssignmentCreator.java | 9 +-
.../exec/store/schedule/BlockMapBuilder.java | 6 +-
.../store/schedule/OldAssignmentCreator.java | 2 +-
.../drill/exec/store/sys/VersionIterator.java | 2 +-
.../exec/work/batch/SpoolingRawBatchBuffer.java | 6 +-
.../apache/drill/exec/work/foreman/Foreman.java | 6 +-
.../exec/work/fragment/FragmentExecutor.java | 7 +-
.../java/org/apache/drill/exec/RunRootExec.java | 2 +-
.../apache/drill/exec/server/TestBitRpc.java | 2 +-
.../store/parquet/ParquetRecordReaderTest.java | 5 +-
.../store/parquet/TestParquetPhysicalPlan.java | 3 +-
.../apache/drill/exec/work/batch/FileTest.java | 3 +-
exec/jdbc-all/pom.xml | 4 +
.../drill/jdbc/test/JdbcTestActionBase.java | 2 +-
.../drill/jdbc/test/JdbcTestQueryBase.java | 2 +-
.../drill/jdbc/test/TestJdbcDistQuery.java | 4 +-
.../org/apache/drill/exec/rpc/BasicServer.java | 2 +-
.../java/org/apache/drill/exec/rpc/RpcBus.java | 2 +-
pom.xml | 7 +-
.../org/apache/drill/fmpp/mojo/FMPPMojo.java | 3 +-
66 files changed, 295 insertions(+), 141 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/drill/blob/422c5a83/common/src/main/java/org/apache/drill/common/CatastrophicFailure.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/drill/common/CatastrophicFailure.java b/common/src/main/java/org/apache/drill/common/CatastrophicFailure.java
new file mode 100644
index 0000000..2f6536e
--- /dev/null
+++ b/common/src/main/java/org/apache/drill/common/CatastrophicFailure.java
@@ -0,0 +1,51 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.drill.common;
+
+import java.io.PrintStream;
+
+
+public class CatastrophicFailure {
+ private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(CatastrophicFailure.class);
+
+ private CatastrophicFailure() {
+ }
+
+ /**
+ * Exit the VM as we hit a catastrophic failure.
+ * @param e
+ * The Throwable that occurred
+ * @param name
+ * A descriptive message
+ * @param code
+ * An error code to exit the JVM with.
+ */
+ public static void exit(Throwable e, String message, int code) {
+ logger.error("Catastrophic Failure Occurred, exiting. Information message: {}", message, e);
+
+ final PrintStream out = ("true".equals(System.getProperty("drill.catastrophic_to_standard_out", "true"))) ? System.out
+ : System.err;
+ out.println("Catastrophic failure occurred. Exiting. Information follows: " + message);
+ e.printStackTrace(out);
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e2) {
+ }
+ System.exit(code);
+ }
+}
http://git-wip-us.apache.org/repos/asf/drill/blob/422c5a83/common/src/main/java/org/apache/drill/common/config/DrillConfig.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/drill/common/config/DrillConfig.java b/common/src/main/java/org/apache/drill/common/config/DrillConfig.java
index fa5dd29..43d05c3 100644
--- a/common/src/main/java/org/apache/drill/common/config/DrillConfig.java
+++ b/common/src/main/java/org/apache/drill/common/config/DrillConfig.java
@@ -177,7 +177,7 @@ public class DrillConfig extends NestedConfig {
final Properties overriderProps,
final boolean enableServerConfigs) {
final StringBuilder logString = new StringBuilder();
- final Stopwatch watch = new Stopwatch().start();
+ final Stopwatch watch = Stopwatch.createStarted();
overrideFileResourcePathname =
overrideFileResourcePathname == null
? CommonConstants.CONFIG_OVERRIDE_RESOURCE_PATHNAME
http://git-wip-us.apache.org/repos/asf/drill/blob/422c5a83/common/src/main/java/org/apache/drill/common/scanner/ClassPathScanner.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/drill/common/scanner/ClassPathScanner.java b/common/src/main/java/org/apache/drill/common/scanner/ClassPathScanner.java
index 6313b53..889efa3 100644
--- a/common/src/main/java/org/apache/drill/common/scanner/ClassPathScanner.java
+++ b/common/src/main/java/org/apache/drill/common/scanner/ClassPathScanner.java
@@ -383,7 +383,7 @@ public final class ClassPathScanner {
* @return the merged scan
*/
static ScanResult scan(Collection<URL> pathsToScan, Collection<String> packagePrefixes, Collection<String> scannedClasses, Collection<String> scannedAnnotations, ScanResult parentResult) {
- Stopwatch watch = new Stopwatch().start();
+ Stopwatch watch = Stopwatch.createStarted();
try {
AnnotationScanner annotationScanner = new AnnotationScanner(scannedAnnotations);
SubTypesScanner subTypesScanner = new SubTypesScanner(parentResult.getImplementations());
http://git-wip-us.apache.org/repos/asf/drill/blob/422c5a83/common/src/main/java/org/apache/drill/common/scanner/persistence/ScanResult.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/drill/common/scanner/persistence/ScanResult.java b/common/src/main/java/org/apache/drill/common/scanner/persistence/ScanResult.java
index a85fa15..7004bcb 100644
--- a/common/src/main/java/org/apache/drill/common/scanner/persistence/ScanResult.java
+++ b/common/src/main/java/org/apache/drill/common/scanner/persistence/ScanResult.java
@@ -132,7 +132,7 @@ public final class ScanResult {
*/
public <T> Set<Class<? extends T>> getImplementations(Class<T> c) {
ParentClassDescriptor p = getImplementations(c.getName());
- Stopwatch watch = new Stopwatch().start();
+ Stopwatch watch = Stopwatch.createStarted();
Set<Class<? extends T>> result = new HashSet<>();
try {
if (p != null) {
http://git-wip-us.apache.org/repos/asf/drill/blob/422c5a83/contrib/storage-hbase/pom.xml
----------------------------------------------------------------------
diff --git a/contrib/storage-hbase/pom.xml b/contrib/storage-hbase/pom.xml
index 53968aa..7d5a30e 100644
--- a/contrib/storage-hbase/pom.xml
+++ b/contrib/storage-hbase/pom.xml
@@ -34,6 +34,14 @@
<dependencies>
<dependency>
+ <!-- used to update stopwatch -->
+ <groupId>org.javassist</groupId>
+ <artifactId>javassist</artifactId>
+ <version>3.20.0-GA</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
<groupId>org.apache.drill.exec</groupId>
<artifactId>drill-java-exec</artifactId>
<version>${project.version}</version>
@@ -146,12 +154,24 @@
<groupId>org.apache.hbase</groupId>
<artifactId>hbase-testing-util</artifactId>
<classifier>tests</classifier>
+ <exclusions>
+ <exclusion>
+ <artifactId>log4j</artifactId>
+ <groupId>log4j</groupId>
+ </exclusion>
+ </exclusions>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-hdfs</artifactId>
<scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <artifactId>log4j</artifactId>
+ <groupId>log4j</groupId>
+ </exclusion>
+ </exclusions>
</dependency>
</dependencies>
</profile>
http://git-wip-us.apache.org/repos/asf/drill/blob/422c5a83/contrib/storage-hbase/src/main/java/org/apache/drill/exec/store/hbase/HBaseGroupScan.java
----------------------------------------------------------------------
diff --git a/contrib/storage-hbase/src/main/java/org/apache/drill/exec/store/hbase/HBaseGroupScan.java b/contrib/storage-hbase/src/main/java/org/apache/drill/exec/store/hbase/HBaseGroupScan.java
index 841ad7c..1d01635 100644
--- a/contrib/storage-hbase/src/main/java/org/apache/drill/exec/store/hbase/HBaseGroupScan.java
+++ b/contrib/storage-hbase/src/main/java/org/apache/drill/exec/store/hbase/HBaseGroupScan.java
@@ -85,7 +85,7 @@ public class HBaseGroupScan extends AbstractGroupScan implements DrillHBaseConst
private HBaseStoragePlugin storagePlugin;
- private Stopwatch watch = new Stopwatch();
+ private Stopwatch watch = Stopwatch.createUnstarted();
private Map<Integer, List<HBaseSubScanSpec>> endpointFragmentMapping;
http://git-wip-us.apache.org/repos/asf/drill/blob/422c5a83/contrib/storage-hbase/src/main/java/org/apache/drill/exec/store/hbase/HBaseRecordReader.java
----------------------------------------------------------------------
diff --git a/contrib/storage-hbase/src/main/java/org/apache/drill/exec/store/hbase/HBaseRecordReader.java b/contrib/storage-hbase/src/main/java/org/apache/drill/exec/store/hbase/HBaseRecordReader.java
index 32780f8..d093522 100644
--- a/contrib/storage-hbase/src/main/java/org/apache/drill/exec/store/hbase/HBaseRecordReader.java
+++ b/contrib/storage-hbase/src/main/java/org/apache/drill/exec/store/hbase/HBaseRecordReader.java
@@ -178,8 +178,7 @@ public class HBaseRecordReader extends AbstractRecordReader implements DrillHBas
@Override
public int next() {
- Stopwatch watch = new Stopwatch();
- watch.start();
+ Stopwatch watch = Stopwatch.createStarted();
if (rowKeyVector != null) {
rowKeyVector.clear();
rowKeyVector.allocateNew();
http://git-wip-us.apache.org/repos/asf/drill/blob/422c5a83/contrib/storage-hbase/src/test/java/org/apache/drill/hbase/BaseHBaseTest.java
----------------------------------------------------------------------
diff --git a/contrib/storage-hbase/src/test/java/org/apache/drill/hbase/BaseHBaseTest.java b/contrib/storage-hbase/src/test/java/org/apache/drill/hbase/BaseHBaseTest.java
index df83c56..0ccd8d6 100644
--- a/contrib/storage-hbase/src/test/java/org/apache/drill/hbase/BaseHBaseTest.java
+++ b/contrib/storage-hbase/src/test/java/org/apache/drill/hbase/BaseHBaseTest.java
@@ -46,8 +46,11 @@ public class BaseHBaseTest extends BaseTestQuery {
protected static HBaseStoragePluginConfig storagePluginConfig;
+
@BeforeClass
- public static void setUpBeforeClass() throws Exception {
+ public static void setupDefaultTestCluster() throws Exception {
+ GuavaPatcher.patch();
+
/*
* Change the following to HBaseTestsSuite.configure(false, true)
* if you want to test against an externally running HBase cluster.
@@ -55,12 +58,15 @@ public class BaseHBaseTest extends BaseTestQuery {
HBaseTestsSuite.configure(true, true);
HBaseTestsSuite.initCluster();
+ BaseTestQuery.setupDefaultTestCluster();
+
final StoragePluginRegistry pluginRegistry = getDrillbitContext().getStorage();
storagePlugin = (HBaseStoragePlugin) pluginRegistry.getPlugin(HBASE_STORAGE_PLUGIN_NAME);
storagePluginConfig = storagePlugin.getConfig();
storagePluginConfig.setEnabled(true);
storagePluginConfig.setZookeeperPort(HBaseTestsSuite.getZookeeperPort());
pluginRegistry.createOrUpdate(HBASE_STORAGE_PLUGIN_NAME, storagePluginConfig, true);
+
}
@AfterClass
@@ -102,4 +108,6 @@ public class BaseHBaseTest extends BaseTestQuery {
return sql.replace("[TABLE_NAME]", HBaseTestsSuite.TEST_TABLE_1);
}
+
+
}
http://git-wip-us.apache.org/repos/asf/drill/blob/422c5a83/contrib/storage-hbase/src/test/java/org/apache/drill/hbase/GuavaPatcher.java
----------------------------------------------------------------------
diff --git a/contrib/storage-hbase/src/test/java/org/apache/drill/hbase/GuavaPatcher.java b/contrib/storage-hbase/src/test/java/org/apache/drill/hbase/GuavaPatcher.java
new file mode 100644
index 0000000..3e0cdee
--- /dev/null
+++ b/contrib/storage-hbase/src/test/java/org/apache/drill/hbase/GuavaPatcher.java
@@ -0,0 +1,96 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.drill.hbase;
+
+import java.lang.reflect.Modifier;
+
+import javassist.ClassPool;
+import javassist.CtClass;
+import javassist.CtConstructor;
+import javassist.CtMethod;
+import javassist.CtNewMethod;
+
+import org.apache.drill.common.CatastrophicFailure;
+
+public class GuavaPatcher {
+
+ private static boolean patched;
+
+ public static synchronized void patch() {
+ if (!patched) {
+ try {
+ patchStopwatch();
+ patchCloseables();
+ patched = true;
+ } catch (Exception e) {
+ CatastrophicFailure.exit(e, "Unable to patch Guava classes.", -100);
+ }
+ }
+ }
+
+ /**
+ * Makes Guava stopwatch look like the old version for compatibility with hbase-server (for test purposes).
+ */
+ private static void patchStopwatch() throws Exception {
+
+ ClassPool cp = ClassPool.getDefault();
+ CtClass cc = cp.get("com.google.common.base.Stopwatch");
+
+ // Expose the constructor for Stopwatch for old libraries who use the pattern new Stopwatch().start().
+ for (CtConstructor c : cc.getConstructors()) {
+ if (!Modifier.isStatic(c.getModifiers())) {
+ c.setModifiers(Modifier.PUBLIC);
+ }
+ }
+
+ // Add back the Stopwatch.elapsedMillis() method for old consumers.
+ CtMethod newmethod = CtNewMethod.make(
+ "public long elapsedMillis() { return elapsed(java.util.concurrent.TimeUnit.MILLISECONDS); }", cc);
+ cc.addMethod(newmethod);
+
+ // Load the modified class instead of the original.
+ cc.toClass();
+
+ System.out.println("Google's Stopwatch patched for old HBase Guava version.");
+ }
+
+ private static void patchCloseables() throws Exception {
+
+ ClassPool cp = ClassPool.getDefault();
+ CtClass cc = cp.get("com.google.common.io.Closeables");
+
+ // Expose the constructor for Stopwatch for old libraries who use the pattern new Stopwatch().start().
+ for (CtConstructor c : cc.getConstructors()) {
+ if (!Modifier.isStatic(c.getModifiers())) {
+ c.setModifiers(Modifier.PUBLIC);
+ }
+ }
+
+ // Add back the Stopwatch.elapsedMillis() method for old consumers.
+ CtMethod newmethod = CtNewMethod.make(
+ "public static void closeQuietly(java.io.Closeable closeable) { try{closeable.close();}catch(Exception e){} }",
+ cc);
+ cc.addMethod(newmethod);
+
+ // Load the modified class instead of the original.
+ cc.toClass();
+
+ System.out.println("Google's Closeables patched for old HBase Guava version.");
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/drill/blob/422c5a83/contrib/storage-hbase/src/test/java/org/apache/drill/hbase/HBaseTestsSuite.java
----------------------------------------------------------------------
diff --git a/contrib/storage-hbase/src/test/java/org/apache/drill/hbase/HBaseTestsSuite.java b/contrib/storage-hbase/src/test/java/org/apache/drill/hbase/HBaseTestsSuite.java
index 4ecb4da..fe11265 100644
--- a/contrib/storage-hbase/src/test/java/org/apache/drill/hbase/HBaseTestsSuite.java
+++ b/contrib/storage-hbase/src/test/java/org/apache/drill/hbase/HBaseTestsSuite.java
@@ -81,6 +81,8 @@ public class HBaseTestsSuite {
@BeforeClass
public static void initCluster() throws Exception {
+ GuavaPatcher.patch();
+
if (initCount.get() == 0) {
synchronized (HBaseTestsSuite.class) {
if (initCount.get() == 0) {
http://git-wip-us.apache.org/repos/asf/drill/blob/422c5a83/contrib/storage-hbase/src/test/resources/logback.xml
----------------------------------------------------------------------
diff --git a/contrib/storage-hbase/src/test/resources/logback.xml b/contrib/storage-hbase/src/test/resources/logback.xml
index 6ef172b..c0a79a8 100644
--- a/contrib/storage-hbase/src/test/resources/logback.xml
+++ b/contrib/storage-hbase/src/test/resources/logback.xml
@@ -53,12 +53,14 @@
<logger name="org.apache.hadoop" additivity="false">
<level value="info" />
- <appender-ref ref="FILE" />
+ <appender-ref ref="STDOUT" />
+ <appender-ref ref="SOCKET" />
</logger>
<root>
<level value="error" />
<appender-ref ref="STDOUT" />
+ <appender-ref ref="SOCKET" />
</root>
</configuration>
http://git-wip-us.apache.org/repos/asf/drill/blob/422c5a83/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/HiveMetadataProvider.java
----------------------------------------------------------------------
diff --git a/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/HiveMetadataProvider.java b/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/HiveMetadataProvider.java
index 4006e44..3ecc831 100644
--- a/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/HiveMetadataProvider.java
+++ b/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/HiveMetadataProvider.java
@@ -62,7 +62,7 @@ public class HiveMetadataProvider {
private final HiveConf hiveConf;
private List<InputSplitWrapper> tableInputSplits;
- private final Stopwatch watch = new Stopwatch();
+ private final Stopwatch watch = Stopwatch.createUnstarted();
public HiveMetadataProvider(final String userName, final HiveReadEntry hiveReadEntry, final HiveConf hiveConf) {
this.hiveReadEntry = hiveReadEntry;
@@ -81,7 +81,7 @@ public class HiveMetadataProvider {
* @throws IOException
*/
public HiveStats getStats(final HiveReadEntry hiveReadEntry) throws IOException {
- final Stopwatch timeGetStats = new Stopwatch().start();
+ final Stopwatch timeGetStats = Stopwatch.createStarted();
final Table table = hiveReadEntry.getTable();
try {
@@ -154,7 +154,7 @@ public class HiveMetadataProvider {
* @return
*/
public List<InputSplitWrapper> getInputSplits(final HiveReadEntry hiveReadEntry) {
- final Stopwatch timeGetSplits = new Stopwatch().start();
+ final Stopwatch timeGetSplits = Stopwatch.createStarted();
try {
if (!isPartitionedTable) {
return getTableInputSplits();
http://git-wip-us.apache.org/repos/asf/drill/blob/422c5a83/contrib/storage-hive/hive-exec-shade/pom.xml
----------------------------------------------------------------------
diff --git a/contrib/storage-hive/hive-exec-shade/pom.xml b/contrib/storage-hive/hive-exec-shade/pom.xml
index 4f72262..d77e19a 100644
--- a/contrib/storage-hive/hive-exec-shade/pom.xml
+++ b/contrib/storage-hive/hive-exec-shade/pom.xml
@@ -35,6 +35,12 @@
<groupId>org.apache.hive</groupId>
<artifactId>hive-exec</artifactId>
<scope>compile</scope>
+ <exclusions>
+ <exclusion>
+ <artifactId>log4j</artifactId>
+ <groupId>log4j</groupId>
+ </exclusion>
+ </exclusions>
</dependency>
</dependencies>
http://git-wip-us.apache.org/repos/asf/drill/blob/422c5a83/contrib/storage-mongo/src/main/java/org/apache/drill/exec/store/mongo/MongoGroupScan.java
----------------------------------------------------------------------
diff --git a/contrib/storage-mongo/src/main/java/org/apache/drill/exec/store/mongo/MongoGroupScan.java b/contrib/storage-mongo/src/main/java/org/apache/drill/exec/store/mongo/MongoGroupScan.java
index 92a2bc7..426a6ee 100644
--- a/contrib/storage-mongo/src/main/java/org/apache/drill/exec/store/mongo/MongoGroupScan.java
+++ b/contrib/storage-mongo/src/main/java/org/apache/drill/exec/store/mongo/MongoGroupScan.java
@@ -108,7 +108,7 @@ public class MongoGroupScan extends AbstractGroupScan implements
private Map<String, List<ChunkInfo>> chunksInverseMapping;
- private Stopwatch watch = new Stopwatch();
+ private Stopwatch watch = Stopwatch.createUnstarted();
private boolean filterPushedDown = false;
http://git-wip-us.apache.org/repos/asf/drill/blob/422c5a83/contrib/storage-mongo/src/main/java/org/apache/drill/exec/store/mongo/MongoRecordReader.java
----------------------------------------------------------------------
diff --git a/contrib/storage-mongo/src/main/java/org/apache/drill/exec/store/mongo/MongoRecordReader.java b/contrib/storage-mongo/src/main/java/org/apache/drill/exec/store/mongo/MongoRecordReader.java
index 8e50c02..c9ce5bb 100644
--- a/contrib/storage-mongo/src/main/java/org/apache/drill/exec/store/mongo/MongoRecordReader.java
+++ b/contrib/storage-mongo/src/main/java/org/apache/drill/exec/store/mongo/MongoRecordReader.java
@@ -176,8 +176,7 @@ public class MongoRecordReader extends AbstractRecordReader {
writer.reset();
int docCount = 0;
- Stopwatch watch = new Stopwatch();
- watch.start();
+ Stopwatch watch = Stopwatch.createStarted();
try {
while (docCount < BaseValueVector.INITIAL_VALUE_ALLOCATION && cursor.hasNext()) {
http://git-wip-us.apache.org/repos/asf/drill/blob/422c5a83/exec/java-exec/pom.xml
----------------------------------------------------------------------
diff --git a/exec/java-exec/pom.xml b/exec/java-exec/pom.xml
index c6b04eb..751c810 100644
--- a/exec/java-exec/pom.xml
+++ b/exec/java-exec/pom.xml
@@ -27,6 +27,7 @@
<version>1.3</version>
<scope>test</scope>
</dependency>
+
<!-- <dependency> -->
<!-- <groupId>org.ow2.asm</groupId> -->
<!-- <artifactId>asm-util</artifactId> -->
http://git-wip-us.apache.org/repos/asf/drill/blob/422c5a83/exec/java-exec/src/main/java/org/apache/drill/exec/client/PrintingResultsListener.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/client/PrintingResultsListener.java b/exec/java-exec/src/main/java/org/apache/drill/exec/client/PrintingResultsListener.java
index 6bc8593..bdd2fab 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/client/PrintingResultsListener.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/client/PrintingResultsListener.java
@@ -44,7 +44,7 @@ public class PrintingResultsListener implements UserResultsListener {
private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(PrintingResultsListener.class);
private final AtomicInteger count = new AtomicInteger();
- private final Stopwatch w = new Stopwatch();
+ private final Stopwatch w = Stopwatch.createUnstarted();
private final RecordBatchLoader loader;
private final Format format;
private final int columnWidth;
http://git-wip-us.apache.org/repos/asf/drill/blob/422c5a83/exec/java-exec/src/main/java/org/apache/drill/exec/client/QuerySubmitter.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/client/QuerySubmitter.java b/exec/java-exec/src/main/java/org/apache/drill/exec/client/QuerySubmitter.java
index 76a0a31..c285fb7 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/client/QuerySubmitter.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/client/QuerySubmitter.java
@@ -186,7 +186,7 @@ public class QuerySubmitter {
System.out.println("Invalid format type: " + format);
return -1;
}
- Stopwatch watch = new Stopwatch();
+ Stopwatch watch = Stopwatch.createUnstarted();
for (String query : queries) {
AwaitableUserResultsListener listener =
new AwaitableUserResultsListener(new PrintingResultsListener(client.getConfig(), outputFormat, width));
http://git-wip-us.apache.org/repos/asf/drill/blob/422c5a83/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/FunctionImplementationRegistry.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/FunctionImplementationRegistry.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/FunctionImplementationRegistry.java
index 6be615d..a57f116 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/FunctionImplementationRegistry.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/FunctionImplementationRegistry.java
@@ -51,7 +51,7 @@ public class FunctionImplementationRegistry implements FunctionLookupContext {
}
public FunctionImplementationRegistry(DrillConfig config, ScanResult classpathScan){
- Stopwatch w = new Stopwatch().start();
+ Stopwatch w = Stopwatch.createStarted();
logger.debug("Generating function registry.");
drillFuncRegistry = new DrillFunctionRegistry(classpathScan);
http://git-wip-us.apache.org/repos/asf/drill/blob/422c5a83/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/FunctionInitializer.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/FunctionInitializer.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/FunctionInitializer.java
index 55d5d92..1007afc 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/FunctionInitializer.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/FunctionInitializer.java
@@ -33,7 +33,6 @@ import org.codehaus.janino.Scanner;
import org.mortbay.util.IO;
import com.google.common.collect.Maps;
-import com.google.common.io.InputSupplier;
import com.google.common.io.Resources;
/**
@@ -125,8 +124,7 @@ public class FunctionInitializer {
}
URL u = Resources.getResource(c, path);
- InputSupplier<InputStream> supplier = Resources.newInputStreamSupplier(u);
- try (InputStream is = supplier.getInput()) {
+ try (InputStream is = Resources.asByteSource(u).openStream()) {
if (is == null) {
throw new IOException(String.format(
"Failure trying to located source code for Class %s, tried to read on classpath location %s", c.getName(),
http://git-wip-us.apache.org/repos/asf/drill/blob/422c5a83/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/ImplCreator.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/ImplCreator.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/ImplCreator.java
index 8103030..6fd6ce2 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/ImplCreator.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/ImplCreator.java
@@ -72,8 +72,7 @@ public class ImplCreator {
root = IteratorValidatorInjector.rewritePlanWithIteratorValidator(context, root);
}
final ImplCreator creator = new ImplCreator();
- Stopwatch watch = new Stopwatch();
- watch.start();
+ Stopwatch watch = Stopwatch.createStarted();
try {
final RootExec rootExec = creator.getRootExec(root, context);
http://git-wip-us.apache.org/repos/asf/drill/blob/422c5a83/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/TopN/PriorityQueueTemplate.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/TopN/PriorityQueueTemplate.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/TopN/PriorityQueueTemplate.java
index 2b1830e..7f77ec5 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/TopN/PriorityQueueTemplate.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/TopN/PriorityQueueTemplate.java
@@ -88,8 +88,7 @@ public abstract class PriorityQueueTemplate implements PriorityQueue {
@Override
public void add(FragmentContext context, RecordBatchData batch) throws SchemaChangeException{
- Stopwatch watch = new Stopwatch();
- watch.start();
+ Stopwatch watch = Stopwatch.createStarted();
if (hyperBatch == null) {
hyperBatch = new ExpandableHyperContainer(batch.getContainer());
} else {
@@ -124,8 +123,7 @@ public abstract class PriorityQueueTemplate implements PriorityQueue {
@Override
public void generate() throws SchemaChangeException {
- Stopwatch watch = new Stopwatch();
- watch.start();
+ Stopwatch watch = Stopwatch.createStarted();
final DrillBuf drillBuf = allocator.buffer(4 * queueSize);
finalSv4 = new SelectionVector4(drillBuf, queueSize, 4000);
for (int i = queueSize - 1; i >= 0; i--) {
http://git-wip-us.apache.org/repos/asf/drill/blob/422c5a83/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/TopN/TopNBatch.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/TopN/TopNBatch.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/TopN/TopNBatch.java
index a6c3269..c0d8e98 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/TopN/TopNBatch.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/TopN/TopNBatch.java
@@ -180,8 +180,7 @@ public class TopNBatch extends AbstractRecordBatch<TopN> {
try{
outer: while (true) {
- Stopwatch watch = new Stopwatch();
- watch.start();
+ Stopwatch watch = Stopwatch.createStarted();
IterOutcome upstream;
if (first) {
upstream = IterOutcome.OK_NEW_SCHEMA;
@@ -284,8 +283,7 @@ public class TopNBatch extends AbstractRecordBatch<TopN> {
}
private void purge() throws SchemaChangeException {
- Stopwatch watch = new Stopwatch();
- watch.start();
+ Stopwatch watch = Stopwatch.createStarted();
VectorContainer c = priorityQueue.getHyperBatch();
VectorContainer newContainer = new VectorContainer(oContext);
SelectionVector4 selectionVector4 = priorityQueue.getHeapSv4();
@@ -380,8 +378,7 @@ public class TopNBatch extends AbstractRecordBatch<TopN> {
* @throws SchemaChangeException
*/
public void purgeAndResetPriorityQueue() throws SchemaChangeException, ClassTransformationException, IOException {
- final Stopwatch watch = new Stopwatch();
- watch.start();
+ final Stopwatch watch = Stopwatch.createStarted();
final VectorContainer c = priorityQueue.getHyperBatch();
final VectorContainer newContainer = new VectorContainer(oContext);
final SelectionVector4 selectionVector4 = priorityQueue.getHeapSv4();
http://git-wip-us.apache.org/repos/asf/drill/blob/422c5a83/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/sort/SortTemplate.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/sort/SortTemplate.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/sort/SortTemplate.java
index 593db0d..edb704f 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/sort/SortTemplate.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/sort/SortTemplate.java
@@ -47,8 +47,7 @@ public abstract class SortTemplate implements Sorter, IndexedSortable{
@Override
public void sort(SelectionVector4 vector4, VectorContainer container){
- Stopwatch watch = new Stopwatch();
- watch.start();
+ Stopwatch watch = Stopwatch.createStarted();
QuickSort qs = new QuickSort();
qs.sort(this, 0, vector4.getTotalCount());
logger.debug("Took {} us to sort {} records", watch.elapsed(TimeUnit.MICROSECONDS), vector4.getTotalCount());
http://git-wip-us.apache.org/repos/asf/drill/blob/422c5a83/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/xsort/BatchGroup.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/xsort/BatchGroup.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/xsort/BatchGroup.java
index e228305..5a3b305 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/xsort/BatchGroup.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/xsort/BatchGroup.java
@@ -92,8 +92,7 @@ public class BatchGroup implements VectorAccessible, AutoCloseable {
int recordCount = newContainer.getRecordCount();
WritableBatch batch = WritableBatch.getBatchNoHVWrap(recordCount, newContainer, false);
VectorAccessibleSerializable outputBatch = new VectorAccessibleSerializable(batch, allocator);
- Stopwatch watch = new Stopwatch();
- watch.start();
+ Stopwatch watch = Stopwatch.createStarted();
outputBatch.writeToStream(outputStream);
newContainer.zeroVectors();
logger.debug("Took {} us to spill {} records", watch.elapsed(TimeUnit.MICROSECONDS), recordCount);
@@ -107,8 +106,7 @@ public class BatchGroup implements VectorAccessible, AutoCloseable {
inputStream = fs.open(path);
}
VectorAccessibleSerializable vas = new VectorAccessibleSerializable(allocator);
- Stopwatch watch = new Stopwatch();
- watch.start();
+ Stopwatch watch = Stopwatch.createStarted();
vas.readFromStream(inputStream);
VectorContainer c = vas.get();
if (schema != null) {
http://git-wip-us.apache.org/repos/asf/drill/blob/422c5a83/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/xsort/ExternalSortBatch.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/xsort/ExternalSortBatch.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/xsort/ExternalSortBatch.java
index 3dc20dc..b2aa305 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/xsort/ExternalSortBatch.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/xsort/ExternalSortBatch.java
@@ -267,8 +267,7 @@ public class ExternalSortBatch extends AbstractRecordBatch<ExternalSort> {
if (spillCount == 0) {
return (getSelectionVector4().next()) ? IterOutcome.OK : IterOutcome.NONE;
} else {
- Stopwatch w = new Stopwatch();
- w.start();
+ Stopwatch w = Stopwatch.createStarted();
int count = copier.next(targetRecordCount);
if (count > 0) {
long t = w.elapsed(TimeUnit.MICROSECONDS);
http://git-wip-us.apache.org/repos/asf/drill/blob/422c5a83/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/xsort/MSortTemplate.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/xsort/MSortTemplate.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/xsort/MSortTemplate.java
index 6e37a68..3ed9cd0 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/xsort/MSortTemplate.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/xsort/MSortTemplate.java
@@ -124,8 +124,7 @@ public abstract class MSortTemplate implements MSorter, IndexedSortable {
@Override
public void sort(final VectorContainer container) {
- final Stopwatch watch = new Stopwatch();
- watch.start();
+ final Stopwatch watch = Stopwatch.createStarted();
while (runStarts.size() > 1) {
// check if we're cancelled/failed frequently
http://git-wip-us.apache.org/repos/asf/drill/blob/422c5a83/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/xsort/SingleBatchSorterTemplate.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/xsort/SingleBatchSorterTemplate.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/xsort/SingleBatchSorterTemplate.java
index fb123af..9a6bc8c 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/xsort/SingleBatchSorterTemplate.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/xsort/SingleBatchSorterTemplate.java
@@ -50,8 +50,7 @@ public abstract class SingleBatchSorterTemplate implements SingleBatchSorter, In
@Override
public void sort(SelectionVector2 vector2){
QuickSort qs = new QuickSort();
- Stopwatch watch = new Stopwatch();
- watch.start();
+ Stopwatch watch = Stopwatch.createStarted();
if (vector2.getCount() > 0) {
qs.sort(this, 0, vector2.getCount());
}
http://git-wip-us.apache.org/repos/asf/drill/blob/422c5a83/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/partition/PruneScanRule.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/partition/PruneScanRule.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/partition/PruneScanRule.java
index aefd247..5ef35d3 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/partition/PruneScanRule.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/partition/PruneScanRule.java
@@ -154,9 +154,7 @@ public abstract class PruneScanRule extends StoragePluginOptimizerRule {
protected void doOnMatch(RelOptRuleCall call, Filter filterRel, Project projectRel, TableScan scanRel) {
final String pruningClassName = getClass().getName();
logger.info("Beginning partition pruning, pruning class: {}", pruningClassName);
- Stopwatch totalPruningTime = new Stopwatch();
- totalPruningTime.start();
-
+ Stopwatch totalPruningTime = Stopwatch.createStarted();
final PlannerSettings settings = PrelUtil.getPlannerSettings(call.getPlanner());
PartitionDescriptor descriptor = getPartitionDescriptor(settings, scanRel);
@@ -196,7 +194,7 @@ public abstract class PruneScanRule extends StoragePluginOptimizerRule {
}
// stop watch to track how long we spend in different phases of pruning
- Stopwatch miscTimer = new Stopwatch();
+ Stopwatch miscTimer = Stopwatch.createUnstarted();
// track how long we spend building the filter tree
miscTimer.start();
http://git-wip-us.apache.org/repos/asf/drill/blob/422c5a83/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/ControlConnection.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/ControlConnection.java b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/ControlConnection.java
index 49f0f01..179a2f4 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/ControlConnection.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/ControlConnection.java
@@ -29,7 +29,6 @@ import org.apache.drill.exec.rpc.RemoteConnection;
import org.apache.drill.exec.rpc.RpcBus;
import org.apache.drill.exec.rpc.RpcOutcomeListener;
-import com.google.common.io.Closeables;
import com.google.protobuf.MessageLite;
public class ControlConnection extends RemoteConnection {
@@ -108,12 +107,6 @@ public class ControlConnection extends RemoteConnection {
return true;
}
- public void shutdownIfClient() {
- if (bus.isClient()) {
- Closeables.closeQuietly(bus);
- }
- }
-
@Override
public BufferAllocator getAllocator() {
return allocator;
http://git-wip-us.apache.org/repos/asf/drill/blob/422c5a83/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/Controller.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/Controller.java b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/Controller.java
index 94df739..d6b288c 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/Controller.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/Controller.java
@@ -20,8 +20,6 @@ package org.apache.drill.exec.rpc.control;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.DrillBuf;
-import java.io.Closeable;
-
import org.apache.drill.exec.exception.DrillbitStartupException;
import org.apache.drill.exec.proto.CoordinationProtos.DrillbitEndpoint;
import org.apache.drill.exec.rpc.UserRpcException;
@@ -35,7 +33,7 @@ import com.google.protobuf.Parser;
* making a connection. TODO: Controller should automatically straight route local BitCommunication rather than connecting to its
* self.
*/
-public interface Controller extends Closeable {
+public interface Controller extends AutoCloseable {
/**
* Get a Bit to Bit communication tunnel. If the BitCom doesn't have a tunnel attached to the node already, it will
http://git-wip-us.apache.org/repos/asf/drill/blob/422c5a83/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/ControllerImpl.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/ControllerImpl.java b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/ControllerImpl.java
index a22d207..ddc7778 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/ControllerImpl.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/ControllerImpl.java
@@ -17,6 +17,9 @@
*/
package org.apache.drill.exec.rpc.control;
+import java.util.List;
+
+import org.apache.drill.common.AutoCloseables;
import org.apache.drill.exec.ExecConstants;
import org.apache.drill.exec.exception.DrillbitStartupException;
import org.apache.drill.exec.memory.BufferAllocator;
@@ -24,7 +27,7 @@ import org.apache.drill.exec.proto.CoordinationProtos.DrillbitEndpoint;
import org.apache.drill.exec.server.BootStrapContext;
import org.apache.drill.exec.work.batch.ControlMessageHandler;
-import com.google.common.io.Closeables;
+import com.google.common.collect.Lists;
import com.google.protobuf.MessageLite;
import com.google.protobuf.Parser;
@@ -74,11 +77,15 @@ public class ControllerImpl implements Controller {
handlerRegistry.registerCustomHandler(messageTypeId, handler, parser);
}
- public void close() {
- Closeables.closeQuietly(server);
+ public void close() throws Exception {
+ List<AutoCloseable> closeables = Lists.newArrayList();
+ closeables.add(server);
+
for (ControlConnectionManager bt : connectionRegistry) {
- bt.close();
+ closeables.add(bt);
}
+
+ AutoCloseables.close(closeables);
}
http://git-wip-us.apache.org/repos/asf/drill/blob/422c5a83/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/data/DataClientConnection.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/data/DataClientConnection.java b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/data/DataClientConnection.java
index eb5778d..d6d83e5 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/data/DataClientConnection.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/data/DataClientConnection.java
@@ -27,7 +27,6 @@ import org.apache.drill.exec.proto.BitData.RpcType;
import org.apache.drill.exec.rpc.RemoteConnection;
import org.apache.drill.exec.rpc.RpcOutcomeListener;
-import com.google.common.io.Closeables;
import com.google.protobuf.MessageLite;
public class DataClientConnection extends RemoteConnection{
@@ -84,8 +83,5 @@ public class DataClientConnection extends RemoteConnection{
return true;
}
- public void shutdownIfClient() {
- Closeables.closeQuietly(client);
- }
}
http://git-wip-us.apache.org/repos/asf/drill/blob/422c5a83/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/data/DataConnectionCreator.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/data/DataConnectionCreator.java b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/data/DataConnectionCreator.java
index d1ba92b..a90d356 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/data/DataConnectionCreator.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/data/DataConnectionCreator.java
@@ -17,9 +17,9 @@
*/
package org.apache.drill.exec.rpc.data;
-import java.io.Closeable;
import java.util.concurrent.ConcurrentMap;
+import org.apache.drill.common.AutoCloseables;
import org.apache.drill.exec.exception.DrillbitStartupException;
import org.apache.drill.exec.memory.BufferAllocator;
import org.apache.drill.exec.proto.CoordinationProtos.DrillbitEndpoint;
@@ -28,12 +28,11 @@ import org.apache.drill.exec.server.BootStrapContext;
import org.apache.drill.exec.work.WorkManager.WorkerBee;
import com.google.common.collect.Maps;
-import com.google.common.io.Closeables;
/**
* Manages a connection for each endpoint.
*/
-public class DataConnectionCreator implements Closeable {
+public class DataConnectionCreator implements AutoCloseable {
static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(DataConnectionCreator.class);
private volatile DataServer server;
@@ -75,9 +74,8 @@ public class DataConnectionCreator implements Closeable {
}
@Override
- public void close() {
- Closeables.closeQuietly(server);
- dataAllocator.close();
+ public void close() throws Exception {
+ AutoCloseables.close(server, dataAllocator);
}
}
http://git-wip-us.apache.org/repos/asf/drill/blob/422c5a83/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/UserServer.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/UserServer.java b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/UserServer.java
index 049ae0c..306db14 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/UserServer.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/UserServer.java
@@ -57,7 +57,6 @@ import org.apache.drill.exec.rpc.user.security.UserAuthenticator;
import org.apache.drill.exec.rpc.user.security.UserAuthenticatorFactory;
import org.apache.drill.exec.work.user.UserWorker;
-import com.google.common.io.Closeables;
import com.google.protobuf.InvalidProtocolBufferException;
import com.google.protobuf.MessageLite;
@@ -284,7 +283,11 @@ public class UserServer extends BasicServer<RpcType, UserServer.UserClientConnec
@Override
public void close() throws IOException {
- Closeables.closeQuietly(authenticator);
+ try {
+ authenticator.close();
+ } catch (Exception e) {
+ logger.warn("Failure closing authenticator.", e);
+ }
super.close();
}
}
http://git-wip-us.apache.org/repos/asf/drill/blob/422c5a83/exec/java-exec/src/main/java/org/apache/drill/exec/server/Drillbit.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/server/Drillbit.java b/exec/java-exec/src/main/java/org/apache/drill/exec/server/Drillbit.java
index 9734a38..c781493 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/server/Drillbit.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/server/Drillbit.java
@@ -81,7 +81,7 @@ public class Drillbit implements AutoCloseable {
final DrillConfig config,
final RemoteServiceSet serviceSet,
final ScanResult classpathScan) throws Exception {
- final Stopwatch w = new Stopwatch().start();
+ final Stopwatch w = Stopwatch.createStarted();
logger.debug("Construction started.");
final boolean allowPortHunting = serviceSet != null;
context = new BootStrapContext(config, classpathScan);
@@ -102,7 +102,7 @@ public class Drillbit implements AutoCloseable {
}
public void run() throws Exception {
- final Stopwatch w = new Stopwatch().start();
+ final Stopwatch w = Stopwatch.createStarted();
logger.debug("Startup begun.");
coord.start(10000);
storeProvider.start();
@@ -126,7 +126,7 @@ public class Drillbit implements AutoCloseable {
if (isClosed) {
return;
}
- final Stopwatch w = new Stopwatch().start();
+ final Stopwatch w = Stopwatch.createStarted();
logger.debug("Shutdown begun.");
// wait for anything that is running to complete
http://git-wip-us.apache.org/repos/asf/drill/blob/422c5a83/exec/java-exec/src/main/java/org/apache/drill/exec/service/ServiceEngine.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/service/ServiceEngine.java b/exec/java-exec/src/main/java/org/apache/drill/exec/service/ServiceEngine.java
index 6444cb8..169e26e 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/service/ServiceEngine.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/service/ServiceEngine.java
@@ -21,7 +21,6 @@ import static java.util.concurrent.TimeUnit.MILLISECONDS;
import io.netty.buffer.PooledByteBufAllocatorL;
import io.netty.channel.EventLoopGroup;
-import java.io.Closeable;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.concurrent.Executor;
@@ -50,7 +49,6 @@ import org.apache.drill.exec.work.user.UserWorker;
import com.codahale.metrics.Gauge;
import com.codahale.metrics.MetricRegistry;
import com.google.common.base.Stopwatch;
-import com.google.common.io.Closeables;
public class ServiceEngine implements AutoCloseable {
static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(ServiceEngine.class);
@@ -161,12 +159,16 @@ public class ServiceEngine implements AutoCloseable {
return controller;
}
- private void submit(Executor p, final String name, final Closeable c) {
+ private void submit(Executor p, final String name, final AutoCloseable c) {
p.execute(new Runnable() {
@Override
public void run() {
- Stopwatch watch = new Stopwatch().start();
- Closeables.closeQuietly(c);
+ Stopwatch watch = Stopwatch.createStarted();
+ try {
+ c.close();
+ } catch (Exception e) {
+ logger.warn("Failure while closing {}.", name, e);
+ }
long elapsed = watch.elapsed(MILLISECONDS);
if (elapsed > 500) {
logger.info("closed " + name + " in " + elapsed + " ms");
http://git-wip-us.apache.org/repos/asf/drill/blob/422c5a83/exec/java-exec/src/main/java/org/apache/drill/exec/store/StoragePluginRegistryImpl.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/StoragePluginRegistryImpl.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/StoragePluginRegistryImpl.java
index aa9bf48..fefa183 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/StoragePluginRegistryImpl.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/StoragePluginRegistryImpl.java
@@ -379,8 +379,7 @@ public class StoragePluginRegistryImpl implements StoragePluginRegistry {
@Override
public void registerSchemas(SchemaConfig schemaConfig, SchemaPlus parent) throws IOException {
- Stopwatch watch = new Stopwatch();
- watch.start();
+ Stopwatch watch = Stopwatch.createStarted();
try {
Set<String> currentPluginNames = Sets.newHashSet(plugins.names());
http://git-wip-us.apache.org/repos/asf/drill/blob/422c5a83/exec/java-exec/src/main/java/org/apache/drill/exec/store/TimedRunnable.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/TimedRunnable.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/TimedRunnable.java
index c562f05..abb3a04 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/TimedRunnable.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/TimedRunnable.java
@@ -115,7 +115,7 @@ public abstract class TimedRunnable<V> implements Runnable {
* @throws IOException All exceptions are coerced to IOException since this was build for storage system tasks initially.
*/
public static <V> List<V> run(final String activity, final Logger logger, final List<TimedRunnable<V>> runnables, int parallelism) throws IOException {
- Stopwatch watch = new Stopwatch().start();
+ Stopwatch watch = Stopwatch.createStarted();
long timedRunnableStart=System.nanoTime();
if(runnables.size() == 1){
parallelism = 1;
http://git-wip-us.apache.org/repos/asf/drill/blob/422c5a83/exec/java-exec/src/main/java/org/apache/drill/exec/store/avro/AvroRecordReader.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/avro/AvroRecordReader.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/avro/AvroRecordReader.java
index 1405aa5..42de8b0 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/avro/AvroRecordReader.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/avro/AvroRecordReader.java
@@ -130,7 +130,7 @@ public class AvroRecordReader extends AbstractRecordReader {
@Override
public int next() {
- final Stopwatch watch = new Stopwatch().start();
+ final Stopwatch watch = Stopwatch.createStarted();
if (reader == null) {
throw new IllegalStateException("Avro reader is not open.");
http://git-wip-us.apache.org/repos/asf/drill/blob/422c5a83/exec/java-exec/src/main/java/org/apache/drill/exec/store/easy/sequencefile/SequenceFileRecordReader.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/easy/sequencefile/SequenceFileRecordReader.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/easy/sequencefile/SequenceFileRecordReader.java
index 24eed8a..2a131ba 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/easy/sequencefile/SequenceFileRecordReader.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/easy/sequencefile/SequenceFileRecordReader.java
@@ -124,8 +124,7 @@ public class SequenceFileRecordReader extends AbstractRecordReader {
@Override
public int next() {
- final Stopwatch watch = new Stopwatch();
- watch.start();
+ final Stopwatch watch = Stopwatch.createStarted();
if (keyVector != null) {
keyVector.clear();
keyVector.allocateNew();
http://git-wip-us.apache.org/repos/asf/drill/blob/422c5a83/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/Metadata.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/Metadata.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/Metadata.java
index 90507fa..590c612 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/Metadata.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/Metadata.java
@@ -198,8 +198,7 @@ public class Metadata {
private ParquetTableMetadata_v2 getParquetTableMetadata(String path) throws IOException {
Path p = new Path(path);
FileStatus fileStatus = fs.getFileStatus(p);
- Stopwatch watch = new Stopwatch();
- watch.start();
+ final Stopwatch watch = Stopwatch.createStarted();
List<FileStatus> fileStatuses = getFileStatuses(fileStatus);
logger.info("Took {} ms to get file statuses", watch.elapsed(TimeUnit.MILLISECONDS));
watch.reset();
@@ -425,8 +424,7 @@ public class Metadata {
* @throws IOException
*/
private ParquetTableMetadataBase readBlockMeta(String path) throws IOException {
- Stopwatch timer = new Stopwatch();
- timer.start();
+ Stopwatch timer = Stopwatch.createStarted();
Path p = new Path(path);
ObjectMapper mapper = new ObjectMapper();
http://git-wip-us.apache.org/repos/asf/drill/blob/422c5a83/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/ParquetGroupScan.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/ParquetGroupScan.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/ParquetGroupScan.java
index 1677f8b..dfe9084 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/ParquetGroupScan.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/ParquetGroupScan.java
@@ -108,7 +108,7 @@ public class ParquetGroupScan extends AbstractFileGroupScan {
private final List<ReadEntryWithPath> entries;
- private final Stopwatch watch = new Stopwatch();
+ private final Stopwatch watch = Stopwatch.createUnstarted();
private final ParquetFormatPlugin formatPlugin;
private final ParquetFormatConfig formatConfig;
private final DrillFileSystem fs;
http://git-wip-us.apache.org/repos/asf/drill/blob/422c5a83/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/ParquetScanBatchCreator.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/ParquetScanBatchCreator.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/ParquetScanBatchCreator.java
index afa4fa0..485f84a 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/ParquetScanBatchCreator.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/ParquetScanBatchCreator.java
@@ -120,7 +120,7 @@ public class ParquetScanBatchCreator implements BatchCreator<ParquetRowGroupScan
These fields will be added to the constructor below
*/
try {
- Stopwatch timer = new Stopwatch();
+ Stopwatch timer = Stopwatch.createUnstarted();
if ( ! footers.containsKey(e.getPath())){
timer.start();
ParquetMetadata footer = ParquetFileReader.readFooter(conf, new Path(e.getPath()));
http://git-wip-us.apache.org/repos/asf/drill/blob/422c5a83/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/PageReader.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/PageReader.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/PageReader.java
index bcc7b33..77a2161 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/PageReader.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/PageReader.java
@@ -131,7 +131,7 @@ final class PageReader {
private void loadDictionaryIfExists(final ColumnReader<?> parentStatus,
final ColumnChunkMetaData columnChunkMetaData, final FSDataInputStream f) throws IOException {
- Stopwatch timer = new Stopwatch();
+ Stopwatch timer = Stopwatch.createUnstarted();
if (columnChunkMetaData.getDictionaryPageOffset() > 0) {
f.seek(columnChunkMetaData.getDictionaryPageOffset());
long start=f.getPos();
@@ -163,7 +163,7 @@ final class PageReader {
}
public void readPage(PageHeader pageHeader, int compressedSize, int uncompressedSize, DrillBuf dest) throws IOException {
- Stopwatch timer = new Stopwatch();
+ Stopwatch timer = Stopwatch.createUnstarted();
long timeToRead;
long start=inputStream.getPos();
if (parentColumnReader.columnChunkMetaData.getCodec() == CompressionCodecName.UNCOMPRESSED) {
@@ -203,7 +203,7 @@ final class PageReader {
* @throws java.io.IOException
*/
public boolean next() throws IOException {
- Stopwatch timer = new Stopwatch();
+ Stopwatch timer = Stopwatch.createUnstarted();
currentPageCount = -1;
valuesRead = 0;
valuesReadyToRead = 0;
http://git-wip-us.apache.org/repos/asf/drill/blob/422c5a83/exec/java-exec/src/main/java/org/apache/drill/exec/store/schedule/AffinityCreator.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/schedule/AffinityCreator.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/schedule/AffinityCreator.java
index cf3daec..b6114fd 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/schedule/AffinityCreator.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/schedule/AffinityCreator.java
@@ -33,7 +33,7 @@ public class AffinityCreator {
static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(AffinityCreator.class);
public static <T extends CompleteWork> List<EndpointAffinity> getAffinityMap(List<T> work){
- Stopwatch watch = new Stopwatch();
+ Stopwatch watch = Stopwatch.createStarted();
long totalBytes = 0;
for (CompleteWork entry : work) {
http://git-wip-us.apache.org/repos/asf/drill/blob/422c5a83/exec/java-exec/src/main/java/org/apache/drill/exec/store/schedule/AssignmentCreator.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/schedule/AssignmentCreator.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/schedule/AssignmentCreator.java
index e76826d..9efcf4a 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/schedule/AssignmentCreator.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/schedule/AssignmentCreator.java
@@ -106,8 +106,7 @@ public class AssignmentCreator<T extends CompleteWork> {
* @return the minor fragment id to work units mapping
*/
private ListMultimap<Integer, T> getMappings() {
- Stopwatch watch = new Stopwatch();
- watch.start();
+ Stopwatch watch = Stopwatch.createStarted();
maxWork = (int) Math.ceil(units.size() / ((float) incomingEndpoints.size()));
LinkedList<WorkEndpointListPair<T>> workList = getWorkList();
LinkedList<WorkEndpointListPair<T>> unassignedWorkList;
@@ -179,8 +178,7 @@ public class AssignmentCreator<T extends CompleteWork> {
* @return the list of WorkEndpointListPairs
*/
private LinkedList<WorkEndpointListPair<T>> getWorkList() {
- Stopwatch watch = new Stopwatch();
- watch.start();
+ Stopwatch watch = Stopwatch.createStarted();
LinkedList<WorkEndpointListPair<T>> workList = Lists.newLinkedList();
for (T work : units) {
List<Map.Entry<DrillbitEndpoint,Long>> entries = Lists.newArrayList();
@@ -236,8 +234,7 @@ public class AssignmentCreator<T extends CompleteWork> {
* @return
*/
private Map<DrillbitEndpoint,FragIteratorWrapper> getEndpointIterators() {
- Stopwatch watch = new Stopwatch();
- watch.start();
+ Stopwatch watch = Stopwatch.createStarted();
Map<DrillbitEndpoint,FragIteratorWrapper> map = Maps.newLinkedHashMap();
Map<DrillbitEndpoint,List<Integer>> mmap = Maps.newLinkedHashMap();
for (int i = 0; i < incomingEndpoints.size(); i++) {
http://git-wip-us.apache.org/repos/asf/drill/blob/422c5a83/exec/java-exec/src/main/java/org/apache/drill/exec/store/schedule/BlockMapBuilder.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/schedule/BlockMapBuilder.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/schedule/BlockMapBuilder.java
index c5c351e..7a6825f 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/schedule/BlockMapBuilder.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/schedule/BlockMapBuilder.java
@@ -216,8 +216,7 @@ public class BlockMapBuilder {
* @throws IOException
*/
public EndpointByteMap getEndpointByteMap(FileWork work) throws IOException {
- Stopwatch watch = new Stopwatch();
- watch.start();
+ Stopwatch watch = Stopwatch.createStarted();
Path fileName = new Path(work.getPath());
@@ -267,8 +266,7 @@ public class BlockMapBuilder {
* Builds a mapping of Drillbit endpoints to hostnames
*/
private static ImmutableMap<String, DrillbitEndpoint> buildEndpointMap(Collection<DrillbitEndpoint> endpoints) {
- Stopwatch watch = new Stopwatch();
- watch.start();
+ Stopwatch watch = Stopwatch.createStarted();
HashMap<String, DrillbitEndpoint> endpointMap = Maps.newHashMap();
for (DrillbitEndpoint d : endpoints) {
String hostName = d.getAddress();
http://git-wip-us.apache.org/repos/asf/drill/blob/422c5a83/exec/java-exec/src/main/java/org/apache/drill/exec/store/schedule/OldAssignmentCreator.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/schedule/OldAssignmentCreator.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/schedule/OldAssignmentCreator.java
index 858cfef..48bb5f3 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/schedule/OldAssignmentCreator.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/schedule/OldAssignmentCreator.java
@@ -63,7 +63,7 @@ public class OldAssignmentCreator<T extends CompleteWork> {
OldAssignmentCreator(List<DrillbitEndpoint> incomingEndpoints, List<T> units) {
logger.debug("Assigning {} units to {} endpoints", units.size(), incomingEndpoints.size());
- Stopwatch watch = new Stopwatch();
+ Stopwatch watch = Stopwatch.createUnstarted();
Preconditions.checkArgument(incomingEndpoints.size() <= units.size(), String.format("Incoming endpoints %d "
+ "is greater than number of row groups %d", incomingEndpoints.size(), units.size()));
http://git-wip-us.apache.org/repos/asf/drill/blob/422c5a83/exec/java-exec/src/main/java/org/apache/drill/exec/store/sys/VersionIterator.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/sys/VersionIterator.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/sys/VersionIterator.java
index 7a94e22..5620ece 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/sys/VersionIterator.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/sys/VersionIterator.java
@@ -46,7 +46,7 @@ public class VersionIterator implements Iterator<Object>{
URL u = Resources.getResource("git.properties");
if(u != null){
Properties p = new Properties();
- p.load(Resources.newInputStreamSupplier(u).getInput());
+ p.load(Resources.asByteSource(u).openStream());
commit_id = p.getProperty("git.commit.id");
build_email = p.getProperty("git.build.user.email");
commit_time = p.getProperty("git.commit.time");
http://git-wip-us.apache.org/repos/asf/drill/blob/422c5a83/exec/java-exec/src/main/java/org/apache/drill/exec/work/batch/SpoolingRawBatchBuffer.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/work/batch/SpoolingRawBatchBuffer.java b/exec/java-exec/src/main/java/org/apache/drill/exec/work/batch/SpoolingRawBatchBuffer.java
index 9915b7e..74762a4 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/work/batch/SpoolingRawBatchBuffer.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/work/batch/SpoolingRawBatchBuffer.java
@@ -374,8 +374,7 @@ public class SpoolingRawBatchBuffer extends BaseRawBatchBuffer<SpoolingRawBatchB
}
public void writeToStream(FSDataOutputStream stream) throws IOException {
- Stopwatch watch = new Stopwatch();
- watch.start();
+ Stopwatch watch = Stopwatch.createStarted();
available = false;
check = ThreadLocalRandom.current().nextLong();
start = stream.getPos();
@@ -421,8 +420,7 @@ public class SpoolingRawBatchBuffer extends BaseRawBatchBuffer<SpoolingRawBatchB
final long check = stream.readLong();
pos = stream.getPos();
assert check == this.check : String.format("Check values don't match: %d %d, Position %d", this.check, check, currentPos);
- Stopwatch watch = new Stopwatch();
- watch.start();
+ Stopwatch watch = Stopwatch.createStarted();
BitData.FragmentRecordBatch header = BitData.FragmentRecordBatch.parseDelimitedFrom(stream);
pos = stream.getPos();
assert header != null : "header null after parsing from stream";
http://git-wip-us.apache.org/repos/asf/drill/blob/422c5a83/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/Foreman.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/Foreman.java b/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/Foreman.java
index cdbdfa4..bfc9dff 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/Foreman.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/Foreman.java
@@ -31,6 +31,7 @@ import java.util.Set;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
+import org.apache.drill.common.CatastrophicFailure;
import org.apache.drill.common.EventProcessor;
import org.apache.drill.common.concurrent.ExtendedLatch;
import org.apache.drill.common.config.DrillConfig;
@@ -272,10 +273,7 @@ public class Foreman implements Runnable {
* die here, they should get notified about that, and cancel themselves; we don't have to attempt to notify
* them, which might not work under these conditions.
*/
- System.out.println("Node ran out of Heap memory, exiting.");
- e.printStackTrace();
- System.out.flush();
- System.exit(-1);
+ CatastrophicFailure.exit(e, "Unable to handle out of memory condition in Foreman.", -1);
}
} finally {
http://git-wip-us.apache.org/repos/asf/drill/blob/422c5a83/exec/java-exec/src/main/java/org/apache/drill/exec/work/fragment/FragmentExecutor.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/work/fragment/FragmentExecutor.java b/exec/java-exec/src/main/java/org/apache/drill/exec/work/fragment/FragmentExecutor.java
index 9101c13..9df128f 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/work/fragment/FragmentExecutor.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/work/fragment/FragmentExecutor.java
@@ -24,6 +24,7 @@ import java.util.concurrent.Executor;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
+import org.apache.drill.common.CatastrophicFailure;
import org.apache.drill.common.DeferredException;
import org.apache.drill.common.SerializedExecutor;
import org.apache.drill.common.concurrent.ExtendedLatch;
@@ -266,11 +267,7 @@ public class FragmentExecutor implements Runnable {
fail(UserException.memoryError(e).build(logger));
} else {
// we have a heap out of memory error. The JVM in unstable, exit.
- System.err.println("Node ran out of Heap memory, exiting.");
- e.printStackTrace(System.err);
- System.err.flush();
- System.exit(-2);
-
+ CatastrophicFailure.exit(e, "Unable to handle out of memory condition in FragmentExecutor.", -2);
}
} catch (AssertionError | Exception e) {
fail(e);
http://git-wip-us.apache.org/repos/asf/drill/blob/422c5a83/exec/java-exec/src/test/java/org/apache/drill/exec/RunRootExec.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/RunRootExec.java b/exec/java-exec/src/test/java/org/apache/drill/exec/RunRootExec.java
index 5928dce..8d6cc0c 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/RunRootExec.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/RunRootExec.java
@@ -55,7 +55,7 @@ public class RunRootExec {
FragmentContext context = new FragmentContext(bitContext, PlanFragment.getDefaultInstance(), null, registry);
SimpleRootExec exec;
for (int i = 0; i < iterations; i ++) {
- Stopwatch w= new Stopwatch().start();
+ Stopwatch w = Stopwatch.createStarted();
System.out.println("STARTITER:" + i);
exec = new SimpleRootExec(ImplCreator.getExec(context, (FragmentRoot) plan.getSortedOperators(false).iterator().next()));
http://git-wip-us.apache.org/repos/asf/drill/blob/422c5a83/exec/java-exec/src/test/java/org/apache/drill/exec/server/TestBitRpc.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/server/TestBitRpc.java b/exec/java-exec/src/test/java/org/apache/drill/exec/server/TestBitRpc.java
index 73ed65e..155706e 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/server/TestBitRpc.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/server/TestBitRpc.java
@@ -151,7 +151,7 @@ public class TestBitRpc extends ExecTest {
private class TimingOutcome implements RpcOutcomeListener<Ack> {
private AtomicLong max;
- private Stopwatch watch = new Stopwatch().start();
+ private Stopwatch watch = Stopwatch.createStarted();
public TimingOutcome(AtomicLong max) {
super();
http://git-wip-us.apache.org/repos/asf/drill/blob/422c5a83/exec/java-exec/src/test/java/org/apache/drill/exec/store/parquet/ParquetRecordReaderTest.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/store/parquet/ParquetRecordReaderTest.java b/exec/java-exec/src/test/java/org/apache/drill/exec/store/parquet/ParquetRecordReaderTest.java
index fdfcf42..26ba316 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/store/parquet/ParquetRecordReaderTest.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/store/parquet/ParquetRecordReaderTest.java
@@ -291,7 +291,7 @@ public class ParquetRecordReaderTest extends BaseTestQuery {
TestFileGenerator.populateFieldInfoMap(props);
final ParquetResultListener resultListener =
new ParquetResultListener(getAllocator(), props, numberOfTimesRead, testValues);
- final Stopwatch watch = new Stopwatch().start();
+ final Stopwatch watch = Stopwatch.createStarted();
testWithListener(type, planText, resultListener);
resultListener.getResults();
// batchLoader.clear();
@@ -642,8 +642,7 @@ public class ParquetRecordReaderTest extends BaseTestQuery {
f.getParquetMetadata(), columns);
final TestOutputMutator mutator = new TestOutputMutator(allocator);
rr.setup(null, mutator);
- final Stopwatch watch = new Stopwatch();
- watch.start();
+ final Stopwatch watch = Stopwatch.createStarted();
int rowCount = 0;
while ((rowCount = rr.next()) > 0) {
http://git-wip-us.apache.org/repos/asf/drill/blob/422c5a83/exec/java-exec/src/test/java/org/apache/drill/exec/store/parquet/TestParquetPhysicalPlan.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/store/parquet/TestParquetPhysicalPlan.java b/exec/java-exec/src/test/java/org/apache/drill/exec/store/parquet/TestParquetPhysicalPlan.java
index 7afc05d..9282a45 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/store/parquet/TestParquetPhysicalPlan.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/store/parquet/TestParquetPhysicalPlan.java
@@ -127,8 +127,7 @@ public class TestParquetPhysicalPlan extends ExecTest {
try(DrillClient client = new DrillClient(config);) {
client.connect();
ParquetResultsListener listener = new ParquetResultsListener();
- Stopwatch watch = new Stopwatch();
- watch.start();
+ Stopwatch watch = Stopwatch.createStarted();
client.runQuery(org.apache.drill.exec.proto.UserBitShared.QueryType.PHYSICAL, Resources.toString(Resources.getResource(fileName),Charsets.UTF_8), listener);
System.out.println(String.format("Got %d total records in %d seconds", listener.await(), watch.elapsed(TimeUnit.SECONDS)));
client.close();
http://git-wip-us.apache.org/repos/asf/drill/blob/422c5a83/exec/java-exec/src/test/java/org/apache/drill/exec/work/batch/FileTest.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/work/batch/FileTest.java b/exec/java-exec/src/test/java/org/apache/drill/exec/work/batch/FileTest.java
index b98317f..4f8d863 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/work/batch/FileTest.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/work/batch/FileTest.java
@@ -58,8 +58,7 @@ public class FileTest {
out = fs.create(new Path("/tmp/file"));
for (int i = 0; i < 100; i++) {
bytes = new byte[256*1024];
- Stopwatch watch = new Stopwatch();
- watch.start();
+ Stopwatch watch = Stopwatch.createStarted();
out.write(bytes);
out.sync();
long t = watch.elapsed(TimeUnit.MILLISECONDS);
http://git-wip-us.apache.org/repos/asf/drill/blob/422c5a83/exec/jdbc-all/pom.xml
----------------------------------------------------------------------
diff --git a/exec/jdbc-all/pom.xml b/exec/jdbc-all/pom.xml
index a9059b4..7f1392c 100644
--- a/exec/jdbc-all/pom.xml
+++ b/exec/jdbc-all/pom.xml
@@ -57,6 +57,10 @@
<artifactId>log4j</artifactId>
</exclusion>
<exclusion>
+ <groupId>org.javassist</groupId>
+ <artifactId>javassist</artifactId>
+ </exclusion>
+ <exclusion>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase</artifactId>
</exclusion>
http://git-wip-us.apache.org/repos/asf/drill/blob/422c5a83/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/JdbcTestActionBase.java
----------------------------------------------------------------------
diff --git a/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/JdbcTestActionBase.java b/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/JdbcTestActionBase.java
index e065c8c..5b307d3 100644
--- a/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/JdbcTestActionBase.java
+++ b/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/JdbcTestActionBase.java
@@ -71,7 +71,7 @@ public class JdbcTestActionBase extends JdbcTestBase {
protected void testAction(JdbcAction action, long rowcount) throws Exception {
int rows = 0;
- Stopwatch watch = new Stopwatch().start();
+ Stopwatch watch = Stopwatch.createStarted();
ResultSet r = action.getResult(connection);
boolean first = true;
while (r.next()) {
http://git-wip-us.apache.org/repos/asf/drill/blob/422c5a83/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/JdbcTestQueryBase.java
----------------------------------------------------------------------
diff --git a/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/JdbcTestQueryBase.java b/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/JdbcTestQueryBase.java
index e1137bd..bde08b9 100644
--- a/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/JdbcTestQueryBase.java
+++ b/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/JdbcTestQueryBase.java
@@ -49,7 +49,7 @@ public class JdbcTestQueryBase extends JdbcTestBase {
boolean success = false;
try (Connection conn = connect("jdbc:drill:zk=local")) {
for (int x = 0; x < 1; x++) {
- Stopwatch watch = new Stopwatch().start();
+ Stopwatch watch = Stopwatch.createStarted();
Statement s = conn.createStatement();
ResultSet r = s.executeQuery(sql);
System.out.println(String.format("QueryId: %s", r.unwrap(DrillResultSet.class).getQueryId()));
http://git-wip-us.apache.org/repos/asf/drill/blob/422c5a83/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestJdbcDistQuery.java
----------------------------------------------------------------------
diff --git a/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestJdbcDistQuery.java b/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestJdbcDistQuery.java
index b5634bf..9970a8c 100644
--- a/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestJdbcDistQuery.java
+++ b/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestJdbcDistQuery.java
@@ -199,7 +199,7 @@ public class TestJdbcDistQuery extends JdbcTestBase {
// (e.g., for debugging) then define a constant field or local variable
// for the number of iterations.)
for (int x = 0; x < 1; x++) {
- Stopwatch watch = new Stopwatch().start();
+ Stopwatch watch = Stopwatch.createStarted();
Statement s = c.createStatement();
ResultSet r = s.executeQuery(sql);
boolean first = true;
@@ -222,7 +222,7 @@ public class TestJdbcDistQuery extends JdbcTestBase {
System.out.println();
}
- System.out.println(String.format("Query completed in %d millis.", watch.elapsedMillis()));
+ System.out.println(String.format("Query completed in %d millis.", watch.elapsed(TimeUnit.MILLISECONDS)));
}
System.out.println("\n\n\n");
http://git-wip-us.apache.org/repos/asf/drill/blob/422c5a83/exec/rpc/src/main/java/org/apache/drill/exec/rpc/BasicServer.java
----------------------------------------------------------------------
diff --git a/exec/rpc/src/main/java/org/apache/drill/exec/rpc/BasicServer.java b/exec/rpc/src/main/java/org/apache/drill/exec/rpc/BasicServer.java
index 2eebe59..8900034 100644
--- a/exec/rpc/src/main/java/org/apache/drill/exec/rpc/BasicServer.java
+++ b/exec/rpc/src/main/java/org/apache/drill/exec/rpc/BasicServer.java
@@ -217,7 +217,7 @@ public abstract class BasicServer<T extends EnumLite, C extends RemoteConnection
@Override
public void close() throws IOException {
try {
- Stopwatch watch = new Stopwatch().start();
+ Stopwatch watch = Stopwatch.createStarted();
// this takes 1s to complete
// known issue: https://github.com/netty/netty/issues/2545
eventLoopGroup.shutdownGracefully(0, 0, TimeUnit.SECONDS).get();
http://git-wip-us.apache.org/repos/asf/drill/blob/422c5a83/exec/rpc/src/main/java/org/apache/drill/exec/rpc/RpcBus.java
----------------------------------------------------------------------
diff --git a/exec/rpc/src/main/java/org/apache/drill/exec/rpc/RpcBus.java b/exec/rpc/src/main/java/org/apache/drill/exec/rpc/RpcBus.java
index acfb862..5cc10a8 100644
--- a/exec/rpc/src/main/java/org/apache/drill/exec/rpc/RpcBus.java
+++ b/exec/rpc/src/main/java/org/apache/drill/exec/rpc/RpcBus.java
@@ -275,7 +275,7 @@ public abstract class RpcBus<T extends EnumLite, C extends RemoteConnection> imp
logger.debug("Received message {}", msg);
}
final Channel channel = connection.getChannel();
- final Stopwatch watch = new Stopwatch().start();
+ final Stopwatch watch = Stopwatch.createStarted();
try{