use of org.apache.drill.exec.store.mock.MockBreakageStorage in project drill by axbaretto.
the class ClusterMockStorageFixture method insertMockStorage.
/**
* This should be called after bits are started
* @param name nthe 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();
MockStorageEngineConfig config = MockStorageEngineConfig.INSTANCE;
@SuppressWarnings("resource") MockBreakageStorage plugin = new MockBreakageStorage(MockStorageEngineConfig.INSTANCE, bit.getContext(), name);
((StoragePluginRegistryImpl) pluginRegistry).definePlugin(name, config, plugin);
plugin.setBreakRegister(breakRegisterSchema);
}
}
use of org.apache.drill.exec.store.mock.MockBreakageStorage in project drill by apache.
the class TestInfoSchemaFilterPushDown method testLazySchemaRegistration.
/**
* As reported in DRILL-8057, even queries against INFORMATION_SCHEMA that
* included a filter that could be pushed down would be penalised by eager
* schema registration executed on every enabled storage plugin instance.
* This resulted in slow or even failed INFORMATION_SCHEMA schema queries
* when some storage plugin was unresponsive, even if it was not needed for
* the query being run. This test checks that lazy schema registration is
* working by installing a mock storage plugin to act as a canary.
*/
@Test
public void testLazySchemaRegistration() throws Exception {
ClusterMockStorageFixture cluster = ClusterFixture.builder(dirTestWatcher).buildCustomMockStorage();
// This mock storage plugin throws an exception from registerSchemas which
// would have been enough to correctly make this test fail were it not that
// the exception gets swallowed by StoragePluginRegistryImpl so we need to
// inspect a counter instead.
cluster.insertMockStorage("registerSchema canary", true);
ClientFixture client = cluster.clientFixture();
final String query = "SELECT * FROM INFORMATION_SCHEMA.`TABLES` WHERE TABLE_SCHEMA='INFORMATION_SCHEMA'";
client.queryBuilder().sql(query).run();
StoragePluginRegistry spr = cluster.drillbit().getContext().getStorage();
MockBreakageStorage mbs = (MockBreakageStorage) spr.getPlugin("registerSchema canary");
// no attempt to register schemas on the canary should have been made
assertEquals(0, mbs.registerAttemptCount);
}
use of org.apache.drill.exec.store.mock.MockBreakageStorage 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);
}
}
Aggregations