Github user paul-rogers commented on a diff in the pull request:
https://github.com/apache/drill/pull/1094#discussion_r169214241
--- Diff:
exec/jdbc/src/main/java/org/apache/drill/jdbc/impl/DrillConnectionImpl.java ---
@@ -108,73 +108,81 @@ protected DrillConnectionImpl(DriverImpl driver,
AvaticaFactory factory,
super.setReadOnly(false);
this.config = new DrillConnectionConfig(info);
+ try{
+ try {
+ String connect = null;
- try {
- String connect = null;
-
- if (config.isLocal()) {
- try {
- Class.forName("org.eclipse.jetty.server.Handler");
- } catch (final ClassNotFoundException e) {
- throw new SQLNonTransientConnectionException(
- "Running Drill in embedded mode using Drill's jdbc-all JDBC"
- + " driver Jar file alone is not supported.", e);
- }
-
- final DrillConfig dConfig = DrillConfig.create(info);
- this.allocator = RootAllocatorFactory.newRoot(dConfig);
- RemoteServiceSet set = GlobalServiceSetReference.SETS.get();
- if (set == null) {
- // We're embedded; start a local drill bit.
- serviceSet = RemoteServiceSet.getLocalServiceSet();
- set = serviceSet;
+ if (config.isLocal()) {
try {
- bit = new Drillbit(dConfig, serviceSet);
- bit.run();
- } catch (final UserException e) {
- throw new SQLException(
- "Failure in starting embedded Drillbit: " + 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 Drillbit:
" + e, e);
+ Class.forName("org.eclipse.jetty.server.Handler");
+ } catch (final ClassNotFoundException e) {
+ throw new SQLNonTransientConnectionException(
+ "Running Drill in embedded mode using Drill's jdbc-all
JDBC"
+ + " driver Jar file alone is not supported.", e);
+ }
+
+ final DrillConfig dConfig = DrillConfig.create(info);
+ this.allocator = RootAllocatorFactory.newRoot(dConfig);
--- End diff --
Not your bug: error in original code. Drill JDBC allows creation of
multiple connections. Each will have a separate root allocator. This might
oversubscribe memory in extreme case. Probably need to file a JIRA for this
case.
---