Skip to content

Commit

Permalink
Release 1.4.9
Browse files Browse the repository at this point in the history
  • Loading branch information
laurentgo committed Mar 6, 2018
1 parent 82bcc76 commit a01f82b
Show file tree
Hide file tree
Showing 170 changed files with 7,442 additions and 1,437 deletions.
2 changes: 1 addition & 1 deletion client/jdbc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<groupId>com.dremio.client</groupId>
<artifactId>dremio-client-parent</artifactId>
<version>1.4.4-201801230630490666-6d69d32</version>
<version>1.4.9-201802191836310213_7195059</version>
</parent>
<artifactId>dremio-client-jdbc</artifactId>
<name>Client - JDBC Driver</name>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017 Dremio Corporation
* Copyright (C) 2017-2018 Dremio Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -25,7 +25,6 @@
import java.sql.SQLClientInfoException;
import java.sql.SQLException;
import java.sql.SQLFeatureNotSupportedException;
import java.sql.SQLNonTransientConnectionException;
import java.sql.SQLWarning;
import java.sql.SQLXML;
import java.sql.Savepoint;
Expand All @@ -36,9 +35,7 @@
import java.util.TimeZone;
import java.util.concurrent.Executor;

import org.apache.arrow.memory.BufferAllocator;
import org.apache.arrow.memory.OutOfMemoryException;
import org.apache.arrow.memory.RootAllocatorFactory;
import org.apache.calcite.avatica.AvaticaConnection;
import org.apache.calcite.avatica.AvaticaFactory;
import org.apache.calcite.avatica.AvaticaStatement;
Expand All @@ -49,19 +46,13 @@
import org.slf4j.Logger;

import com.dremio.common.config.SabotConfig;
import com.dremio.common.exceptions.UserException;
import com.dremio.exec.client.DremioClient;
import com.dremio.exec.rpc.RpcException;
import com.dremio.exec.server.SabotNode;
import com.dremio.exec.store.StoragePluginRegistry;
import com.dremio.exec.util.TestUtilities;
import com.dremio.jdbc.AlreadyClosedSqlException;
import com.dremio.jdbc.DremioConnection;
import com.dremio.jdbc.DremioConnectionConfig;
import com.dremio.jdbc.InvalidParameterSqlException;
import com.dremio.jdbc.JdbcApiSqlException;
import com.dremio.service.coordinator.ClusterCoordinator;
import com.dremio.service.coordinator.local.LocalClusterCoordinator;
import com.google.common.base.Throwables;

/**
Expand All @@ -79,10 +70,6 @@ class DremioConnectionImpl extends AvaticaConnection
final DremioConnectionConfig config;

private final DremioClient client;
private final BufferAllocator allocator;
private SabotNode bit;
private ClusterCoordinator clusterCoordinator;


protected DremioConnectionImpl(DriverImpl driver, AvaticaFactory factory,
String url, Properties info) throws SQLException {
Expand All @@ -98,57 +85,18 @@ protected DremioConnectionImpl(DriverImpl driver, AvaticaFactory factory,
final String connect;

if (config.isLocal()) {
try {
Class.forName("org.eclipse.jetty.server.Handler");
} catch (final ClassNotFoundException e) {
throw new SQLNonTransientConnectionException(
"Running Dremio in embedded mode using Dremio's jdbc-all JDBC"
+ " driver Jar file alone is not supported.", e);
}

final SabotConfig dConfig = SabotConfig.create(info);
this.allocator = RootAllocatorFactory.newRoot(dConfig);
ClusterCoordinator coordinator = GlobalCoordinatorReference.COORDINATORS.get();
if (coordinator == null) {
// We're embedded; start a local Dremio node.
clusterCoordinator = new LocalClusterCoordinator();
coordinator = clusterCoordinator;
try {
coordinator.start();
bit = new SabotNode(dConfig, clusterCoordinator);
bit.run();
} catch (final UserException e) {
throw new SQLException(
"Failure in starting embedded SabotNode: " + e.getMessage(),
e);
} catch (Exception e) {
// (Include cause exception's text in wrapping exception's text so
// it's more likely to get to user (e.g., via SQLLine), and use
// toString() since getMessage() text doesn't always mention error:)
throw new SQLException("Failure in starting embedded SabotNode: " + e, e);
}
} else {
clusterCoordinator = null;
bit = null;
}

makeTmpSchemaLocationsUnique(bit.getContext().getStorage(), info);

this.client = new DremioClient(dConfig, coordinator);
connect = null;
throw new UnsupportedOperationException("Dremio JDBC driver doesn't not support local mode operation");
} else if(config.isDirect()) {
final SabotConfig dConfig = SabotConfig.forClient();
this.allocator = RootAllocatorFactory.newRoot(dConfig);
this.client = new DremioClient(dConfig, true); // Get a direct connection
connect = config.getZookeeperConnectionString();
} else {
final SabotConfig dConfig = SabotConfig.forClient();
this.allocator = RootAllocatorFactory.newRoot(dConfig);
// TODO: Check: Why does new DremioClient() create another SabotConfig,
// with enableServerConfigs true, and cause scanning for function
// implementations (needed by a server, but not by a client-only
// process, right?)? Probably pass dConfig to construction.
this.client = new DremioClient();
this.client = new DremioClient(dConfig, false);
connect = config.getZookeeperConnectionString();
}
this.client.setClientName("Dremio JDBC Driver");
Expand Down Expand Up @@ -195,10 +143,6 @@ public DremioConnectionConfig getConfig() {
return config;
}

BufferAllocator getAllocator() {
return allocator;
}

@Override
public DremioClient getClient() {
return client;
Expand Down Expand Up @@ -781,39 +725,5 @@ void cleanup() {

// TODO all of these should use DeferredException when it is available from DRILL-2245
closeOrWarn(client, "Exception while closing client.", logger);
closeOrWarn(allocator, "Exception while closing allocator.", logger);

if (bit != null) {
bit.close();
}

closeOrWarn(clusterCoordinator, "Exception while closing cluster coordinator.", logger);
}

// TODO: Eliminate this test-specific hack from production code.
// If we're not going to have tests themselves explicitly handle making names
// unique, then at least move this logic into a test base class, and have it
// go through DremioConnection.getClient().
/**
* Test only code to make JDBC tests run concurrently. If the property <i>dremioJDBCUnitTests</i> is set to
* <i>true</i> in connection properties:
* - Update dfs_test.tmp workspace location with a temp directory. This temp is for exclusive use for test jvm.
* - Update dfs.tmp workspace to immutable, so that test writer don't try to create views in dfs.tmp
* @param pluginRegistry
*/
private static void makeTmpSchemaLocationsUnique(StoragePluginRegistry pluginRegistry, Properties props) {
try {
if (props != null && "true".equalsIgnoreCase(props.getProperty("dremioJDBCUnitTests"))) {
final String tmpDirPath = TestUtilities.createTempDir();
TestUtilities.updateDfsTestTmpSchemaLocation(pluginRegistry, tmpDirPath);
}
} catch(Throwable e) {
// Reason for catching Throwable is to capture NoSuchMethodError etc which depend on certain classed to be
// present in classpath which may not be available when just using the standalone JDBC. This is unlikely to
// happen, but just a safeguard to avoid failing user applications.
logger.warn("Failed to update tmp schema locations. This step is purely for testing purpose. " +
"Shouldn't be seen in production code.");
// Ignore the error and go with defaults
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017 Dremio Corporation
* Copyright (C) 2017-2018 Dremio Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -23,10 +23,6 @@
import java.sql.SQLFeatureNotSupportedException;
import java.util.Properties;

import org.slf4j.Logger;

import static org.slf4j.LoggerFactory.getLogger;

/**
* Proxy driver for tracing calls to a JDBC driver.
* Reports calls and parameter values to, and return values and exceptions from,
Expand Down Expand Up @@ -58,9 +54,9 @@
* </li>
* </ul>
* <p>
* For example, for an original URL of "{@code jdbc:dremio:zk=local}", the
* For example, for an original URL of "{@code jdbc:dremio:zk=localhost:2181}", the
* tracing URL is
* "{@code jdbc:proxy:com.dremio.jdbc.Driver:jdbc:dremio:zk=local}".
* "{@code jdbc:proxy:com.dremio.jdbc.Driver:jdbc:dremio:zk=localhost:2181}".
* </p>
* </li>
* <li>
Expand Down
Loading

0 comments on commit a01f82b

Please sign in to comment.