Search in sources :

Example 6 with WorkspaceConfig

use of org.apache.drill.exec.store.dfs.WorkspaceConfig in project drill by apache.

the class TestUtilities method makeDfsTmpSchemaImmutable.

/**
   * Make the dfs.tmp schema immutable, so that tests writers don't use the dfs.tmp to create views.
   * Schema "dfs.tmp" added as part of the default bootstrap plugins file that comes with drill-java-exec jar
   */
public static void makeDfsTmpSchemaImmutable(final StoragePluginRegistry pluginRegistry) throws ExecutionSetupException {
    @SuppressWarnings("resource") final FileSystemPlugin dfsPlugin = (FileSystemPlugin) pluginRegistry.getPlugin(dfsPluginName);
    final FileSystemConfig dfsPluginConfig = (FileSystemConfig) dfsPlugin.getConfig();
    final WorkspaceConfig tmpWSConfig = dfsPluginConfig.workspaces.get(dfsTmpSchema);
    final WorkspaceConfig newTmpWSConfig = new WorkspaceConfig(tmpWSConfig.getLocation(), false, tmpWSConfig.getDefaultInputFormat());
    dfsPluginConfig.workspaces.remove(dfsTmpSchema);
    dfsPluginConfig.workspaces.put(dfsTmpSchema, newTmpWSConfig);
    pluginRegistry.createOrUpdate(dfsPluginName, dfsPluginConfig, true);
}
Also used : FileSystemPlugin(org.apache.drill.exec.store.dfs.FileSystemPlugin) WorkspaceConfig(org.apache.drill.exec.store.dfs.WorkspaceConfig) FileSystemConfig(org.apache.drill.exec.store.dfs.FileSystemConfig)

Example 7 with WorkspaceConfig

use of org.apache.drill.exec.store.dfs.WorkspaceConfig in project drill by apache.

the class TestCTTAS method init.

@BeforeClass
public static void init() throws Exception {
    MockUp<UUID> uuidMockUp = mockRandomUUID(session_id);
    Properties testConfigurations = cloneDefaultTestConfigProperties();
    testConfigurations.put(ExecConstants.DEFAULT_TEMPORARY_WORKSPACE, TEMP_SCHEMA);
    updateTestCluster(1, DrillConfig.create(testConfigurations));
    uuidMockUp.tearDown();
    StoragePluginRegistry pluginRegistry = getDrillbitContext().getStorage();
    FileSystemConfig pluginConfig = (FileSystemConfig) pluginRegistry.getPlugin(test_schema).getConfig();
    pluginConfig.workspaces.put(temp2_wk, new WorkspaceConfig(TestUtilities.createTempDir(), true, null));
    pluginRegistry.createOrUpdate(test_schema, pluginConfig, true);
    fs = FileSystem.get(new Configuration());
    expectedFolderPermission = new FsPermission(StorageStrategy.TEMPORARY.getFolderPermission());
    expectedFilePermission = new FsPermission(StorageStrategy.TEMPORARY.getFilePermission());
}
Also used : StoragePluginRegistry(org.apache.drill.exec.store.StoragePluginRegistry) Configuration(org.apache.hadoop.conf.Configuration) WorkspaceConfig(org.apache.drill.exec.store.dfs.WorkspaceConfig) FileSystemConfig(org.apache.drill.exec.store.dfs.FileSystemConfig) FsPermission(org.apache.hadoop.fs.permission.FsPermission) UUID(java.util.UUID) Properties(java.util.Properties) BeforeClass(org.junit.BeforeClass)

Aggregations

WorkspaceConfig (org.apache.drill.exec.store.dfs.WorkspaceConfig)7 FileSystemConfig (org.apache.drill.exec.store.dfs.FileSystemConfig)4 FsPermission (org.apache.hadoop.fs.permission.FsPermission)4 FileSystemPlugin (org.apache.drill.exec.store.dfs.FileSystemPlugin)3 Path (org.apache.hadoop.fs.Path)3 StoragePluginRegistry (org.apache.drill.exec.store.StoragePluginRegistry)2 StringContains.containsString (org.hamcrest.core.StringContains.containsString)2 Properties (java.util.Properties)1 UUID (java.util.UUID)1 Configuration (org.apache.hadoop.conf.Configuration)1 BeforeClass (org.junit.BeforeClass)1