Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public class BootStrapContext implements AutoCloseable {
private final DrillConfig config;
private final EventLoopGroup loop;
private final EventLoopGroup loop2;
private final EventLoopGroup userLoopGroup;
private final MetricRegistry metrics;
private final BufferAllocator allocator;
private final ScanResult classpathScan;
Expand All @@ -53,6 +54,8 @@ public BootStrapContext(DrillConfig config, ScanResult classpathScan) {
this.loop2 = TransportCheck.createEventLoopGroup(config.getInt(ExecConstants.BIT_SERVER_RPC_THREADS), "BitClient-");
// Note that metrics are stored in a static instance
this.metrics = DrillMetrics.getRegistry();
this.userLoopGroup = TransportCheck.createEventLoopGroup(config.getInt(ExecConstants.USER_SERVER_RPC_THREADS),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a comment here stating that "userLoopGroup" threads will be used for "UserServerRPCThreads" and "ClientRPCThreads" in WebServer DrillClient instance.

"UserServer-");
this.allocator = RootAllocatorFactory.newRoot(config);
this.executor = new ThreadPoolExecutor(0, Integer.MAX_VALUE, 60L, TimeUnit.SECONDS,
new SynchronousQueue<Runnable>(),
Expand Down Expand Up @@ -83,6 +86,10 @@ public EventLoopGroup getBitClientLoopGroup() {
return loop2;
}

public EventLoopGroup getUserLoopGroup() {
return userLoopGroup;
}

public MetricRegistry getMetrics() {
return metrics;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ public StoragePluginRegistry getStorage() {
return this.storagePlugins;
}

public EventLoopGroup getBitLoopGroup() {
return context.getBitLoopGroup();
public EventLoopGroup getUserLoopGroup() {
return context.getUserLoopGroup();
}

public DataConnectionCreator getDataConnectionsPool() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ protected DrillClient createDrillClient(final String userName, final String pass
.setConfig(drillbitContext.getConfig())
.setClusterCoordinator(drillbitContext.getClusterCoordinator())
.setAllocator(drillbitContext.getAllocator())
.setEventLoopGroup(drillbitContext.getUserLoopGroup())
.setExecutorService(drillbitContext.getExecutor())
.build();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the builder be extended to also (optionally) do connect? Or, return a connect builder?

Here I'm thinking that it would be helpful to have a single builder gather things like the user name property and the connection string (which would seem to be a DrillClient parameter but is actually a connection property.)

That is, either:

DrillClient.builder( ) ...
   .withUser( userName )
   .connectTo( "myHost", 1234 )
  .build( );

Or

DrillClient.builder( ) ...
   .buildClient( )
   .withUser( userName )
   .connectTo( "myHost", 1234 )
   .connect( );

final Properties props = new Properties();
props.setProperty("user", userName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ public DrillClient getDrillClient() throws IOException {
.setConfig(drillbitContext.getConfig())
.setClusterCoordinator(drillbitContext.getClusterCoordinator())
.setAllocator(drillbitContext.getAllocator())
.setEventLoopGroup(drillbitContext.getUserLoopGroup())
.setExecutorService(drillbitContext.getExecutor())
.build();
drillClient.connect();
return drillClient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

import static java.util.concurrent.TimeUnit.MILLISECONDS;
import io.netty.buffer.PooledByteBufAllocatorL;
import io.netty.channel.EventLoopGroup;

import java.net.InetAddress;
import java.net.UnknownHostException;
Expand All @@ -35,7 +34,6 @@
import org.apache.drill.exec.memory.BufferAllocator;
import org.apache.drill.exec.metrics.DrillMetrics;
import org.apache.drill.exec.proto.CoordinationProtos.DrillbitEndpoint;
import org.apache.drill.exec.rpc.TransportCheck;
import org.apache.drill.exec.rpc.control.Controller;
import org.apache.drill.exec.rpc.control.ControllerImpl;
import org.apache.drill.exec.rpc.control.WorkEventBus;
Expand Down Expand Up @@ -73,13 +71,11 @@ public ServiceEngine(ControlMessageHandler controlMessageHandler, UserWorker use
"drill.exec.rpc.bit.server.memory.control.reservation", "drill.exec.rpc.bit.server.memory.control.maximum");
dataAllocator = newAllocator(context, "rpc:bit-data",
"drill.exec.rpc.bit.server.memory.data.reservation", "drill.exec.rpc.bit.server.memory.data.maximum");
final EventLoopGroup eventLoopGroup = TransportCheck.createEventLoopGroup(
context.getConfig().getInt(ExecConstants.USER_SERVER_RPC_THREADS), "UserServer-");
this.userServer = new UserServer(
context.getConfig(),
context.getClasspathScan(),
userAllocator,
eventLoopGroup,
context.getUserLoopGroup(),
userWorker,
context.getExecutor());
this.controller = new ControllerImpl(context, controlMessageHandler, controlAllocator, allowPortHunting);
Expand Down