use of org.apache.drill.exec.server.Drillbit in project drill by apache.
the class ClusterMockStorageFixture method insertMockStorage.
/**
* This should be called after bits are started
* @param name the mock storage name we are going to create
*/
public void insertMockStorage(String name, boolean breakRegisterSchema) {
for (Drillbit bit : drillbits()) {
// Bit name and registration.
final StoragePluginRegistry pluginRegistry = bit.getContext().getStorage();
MockBreakageStorage plugin;
try {
MockBreakageStorageEngineConfig config = MockBreakageStorageEngineConfig.INSTANCE;
config.setEnabled(true);
pluginRegistry.put(name, config);
plugin = (MockBreakageStorage) pluginRegistry.getPlugin(name);
} catch (PluginException e) {
throw new IllegalStateException(e);
}
plugin.setBreakRegister(breakRegisterSchema);
}
}
use of org.apache.drill.exec.server.Drillbit in project drill by apache.
the class TestSpoolingBuffer method testMultipleExchangesSingleThread.
@Test
public void testMultipleExchangesSingleThread() throws Exception {
RemoteServiceSet serviceSet = RemoteServiceSet.getLocalServiceSet();
DrillConfig conf = DrillConfig.create("drill-spool-test-module.conf");
try (Drillbit bit1 = new Drillbit(conf, serviceSet);
DrillClient client = new DrillClient(conf, serviceSet.getCoordinator())) {
bit1.run();
client.connect();
List<QueryDataBatch> results = client.runQuery(org.apache.drill.exec.proto.UserBitShared.QueryType.PHYSICAL, Files.asCharSource(DrillFileUtils.getResourceAsFile("/work/batch/multiple_exchange.json"), Charsets.UTF_8).read());
int count = 0;
for (QueryDataBatch b : results) {
if (b.getHeader().getRowCount() != 0) {
count += b.getHeader().getRowCount();
}
b.release();
}
assertEquals(500024, count);
}
}
use of org.apache.drill.exec.server.Drillbit in project drill by apache.
the class BaseTestQuery method closeClient.
@AfterClass
public static void closeClient() throws Exception {
if (client != null) {
client.close();
client = null;
}
if (bits != null) {
for (Drillbit bit : bits) {
if (bit != null) {
bit.close();
}
}
bits = null;
}
if (serviceSet != null) {
serviceSet.close();
serviceSet = null;
}
if (allocator != null) {
allocator.close();
allocator = null;
}
}
use of org.apache.drill.exec.server.Drillbit in project drill by apache.
the class BaseTestQuery method openClient.
private static void openClient(Properties properties) throws Exception {
if (properties == null) {
properties = new Properties();
}
allocator = RootAllocatorFactory.newRoot(config);
serviceSet = RemoteServiceSet.getLocalServiceSet();
dirTestWatcher.newDfsTestTmpDir();
bits = new Drillbit[drillbitCount];
for (int i = 0; i < drillbitCount; i++) {
bits[i] = new Drillbit(config, serviceSet, classpathScan);
bits[i].run();
StoragePluginRegistry pluginRegistry = bits[i].getContext().getStorage();
StoragePluginTestUtils.configureFormatPlugins(pluginRegistry);
StoragePluginTestUtils.updateSchemaLocation(StoragePluginTestUtils.DFS_PLUGIN_NAME, pluginRegistry, dirTestWatcher.getDfsTestTmpDir(), TMP_SCHEMA);
StoragePluginTestUtils.updateSchemaLocation(StoragePluginTestUtils.DFS_PLUGIN_NAME, pluginRegistry, dirTestWatcher.getRootDir(), ROOT_SCHEMA);
StoragePluginTestUtils.updateSchemaLocation(StoragePluginTestUtils.DFS_PLUGIN_NAME, pluginRegistry, dirTestWatcher.getRootDir(), SchemaFactory.DEFAULT_WS_NAME);
}
if (!properties.containsKey(DrillProperties.DRILLBIT_CONNECTION)) {
properties.setProperty(DrillProperties.DRILLBIT_CONNECTION, String.format("localhost:%s", bits[0].getUserPort()));
}
DrillConfig clientConfig = DrillConfig.forClient();
client = QueryTestUtil.createClient(clientConfig, serviceSet, MAX_WIDTH_PER_NODE, properties);
}
use of org.apache.drill.exec.server.Drillbit in project drill by apache.
the class BaseTestQuery method openClient.
private static void openClient(Properties properties) throws Exception {
allocator = RootAllocatorFactory.newRoot(config);
serviceSet = RemoteServiceSet.getLocalServiceSet();
dfsTestTmpSchemaLocation = TestUtilities.createTempDir();
bits = new Drillbit[drillbitCount];
for (int i = 0; i < drillbitCount; i++) {
bits[i] = new Drillbit(config, serviceSet, classpathScan);
bits[i].run();
final StoragePluginRegistry pluginRegistry = bits[i].getContext().getStorage();
TestUtilities.updateDfsTestTmpSchemaLocation(pluginRegistry, dfsTestTmpSchemaLocation);
TestUtilities.makeDfsTmpSchemaImmutable(pluginRegistry);
}
client = QueryTestUtil.createClient(config, serviceSet, MAX_WIDTH_PER_NODE, properties);
}
Aggregations