Search in sources :

Example 1 with IgniteHadoopFileSystem

use of org.apache.ignite.hadoop.fs.v1.IgniteHadoopFileSystem in project ignite by apache.

the class IgniteHadoopFileSystemLoggerStateSelfTest method fileSystem.

/**
     * Instantiate new file system.
     *
     * @return New file system.
     * @throws Exception If failed.
     */
private IgniteHadoopFileSystem fileSystem() throws Exception {
    Configuration fsCfg = new Configuration();
    fsCfg.addResource(U.resolveIgniteUrl("modules/core/src/test/config/hadoop/core-site-loopback.xml"));
    fsCfg.setBoolean("fs.igfs.impl.disable.cache", true);
    if (logging)
        fsCfg.setBoolean(String.format(PARAM_IGFS_LOG_ENABLED, "igfs@"), logging);
    fsCfg.setStrings(String.format(PARAM_IGFS_LOG_DIR, "igfs@"), U.getIgniteHome());
    return (IgniteHadoopFileSystem) FileSystem.get(new URI("igfs://igfs@/"), fsCfg);
}
Also used : IgfsIpcEndpointConfiguration(org.apache.ignite.igfs.IgfsIpcEndpointConfiguration) Configuration(org.apache.hadoop.conf.Configuration) FileSystemConfiguration(org.apache.ignite.configuration.FileSystemConfiguration) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) URI(java.net.URI) IgniteHadoopFileSystem(org.apache.ignite.hadoop.fs.v1.IgniteHadoopFileSystem)

Example 2 with IgniteHadoopFileSystem

use of org.apache.ignite.hadoop.fs.v1.IgniteHadoopFileSystem in project ignite by apache.

the class HadoopFileSystemCacheUtils method fileSystemForMrUserWithCaching.

/**
     * Common method to get the V1 file system in MapRed engine.
     * It gets the filesystem for the user specified in the
     * configuration with {@link MRJobConfig#USER_NAME} property.
     * The file systems are created and cached in the given map upon first request.
     *
     * @param uri The file system uri.
     * @param cfg The configuration.
     * @param map The caching map.
     * @return The file system.
     * @throws IOException On error.
     */
public static FileSystem fileSystemForMrUserWithCaching(@Nullable URI uri, Configuration cfg, HadoopLazyConcurrentMap<FsCacheKey, FileSystem> map) throws IOException {
    assert map != null;
    assert cfg != null;
    final String usr = getMrHadoopUser(cfg);
    assert usr != null;
    if (uri == null)
        uri = FileSystem.getDefaultUri(cfg);
    final FileSystem fs;
    try {
        final FsCacheKey key = new FsCacheKey(uri, usr, cfg);
        fs = map.getOrCreate(key);
    } catch (IgniteException ie) {
        throw new IOException(ie);
    }
    assert fs != null;
    assert !(fs instanceof IgniteHadoopFileSystem) || F.eq(usr, ((IgniteHadoopFileSystem) fs).user());
    return fs;
}
Also used : IgniteException(org.apache.ignite.IgniteException) IgniteHadoopFileSystem(org.apache.ignite.hadoop.fs.v1.IgniteHadoopFileSystem) FileSystem(org.apache.hadoop.fs.FileSystem) IOException(java.io.IOException) IgniteHadoopFileSystem(org.apache.ignite.hadoop.fs.v1.IgniteHadoopFileSystem)

Example 3 with IgniteHadoopFileSystem

use of org.apache.ignite.hadoop.fs.v1.IgniteHadoopFileSystem in project ignite by apache.

the class IgniteHadoopFileSystemAbstractSelfTest method testModeResolver.

/**
     * @throws Exception If failed.
     */
public void testModeResolver() throws Exception {
    IgfsModeResolver mr = ((IgniteHadoopFileSystem) fs).getModeResolver();
    assertEquals(mode, mr.resolveMode(IgfsPath.ROOT));
}
Also used : IgfsModeResolver(org.apache.ignite.internal.processors.igfs.IgfsModeResolver) IgniteHadoopFileSystem(org.apache.ignite.hadoop.fs.v1.IgniteHadoopFileSystem)

Example 4 with IgniteHadoopFileSystem

use of org.apache.ignite.hadoop.fs.v1.IgniteHadoopFileSystem in project ignite by apache.

the class IgniteHadoopFileSystemAbstractSelfTest method testInitialize.

/** @throws Exception If failed. */
public void testInitialize() throws Exception {
    final IgniteHadoopFileSystem fs = new IgniteHadoopFileSystem();
    fs.initialize(primaryFsUri, primaryFsCfg);
    // Check repeatable initialization.
    try {
        fs.initialize(primaryFsUri, primaryFsCfg);
        fail();
    } catch (IOException e) {
        assertTrue(e.getMessage().contains("File system is already initialized"));
    }
    assertEquals(primaryFsUri, fs.getUri());
    assertEquals(0, fs.getUsed());
    fs.close();
}
Also used : IOException(java.io.IOException) IgniteHadoopFileSystem(org.apache.ignite.hadoop.fs.v1.IgniteHadoopFileSystem)

Example 5 with IgniteHadoopFileSystem

use of org.apache.ignite.hadoop.fs.v1.IgniteHadoopFileSystem in project ignite by apache.

the class IgniteHadoopFileSystemAbstractSelfTest method testCloseIfNotInitialized.

/** @throws Exception If failed. */
public void testCloseIfNotInitialized() throws Exception {
    final FileSystem fs = new IgniteHadoopFileSystem();
    // Check close makes nothing harmful.
    fs.close();
}
Also used : FileSystem(org.apache.hadoop.fs.FileSystem) IgniteHadoopFileSystem(org.apache.ignite.hadoop.fs.v1.IgniteHadoopFileSystem) IgniteHadoopIgfsSecondaryFileSystem(org.apache.ignite.hadoop.fs.IgniteHadoopIgfsSecondaryFileSystem) IgniteFileSystem(org.apache.ignite.IgniteFileSystem) IgniteHadoopFileSystem(org.apache.ignite.hadoop.fs.v1.IgniteHadoopFileSystem)

Aggregations

IgniteHadoopFileSystem (org.apache.ignite.hadoop.fs.v1.IgniteHadoopFileSystem)5 IOException (java.io.IOException)2 FileSystem (org.apache.hadoop.fs.FileSystem)2 URI (java.net.URI)1 Configuration (org.apache.hadoop.conf.Configuration)1 IgniteException (org.apache.ignite.IgniteException)1 IgniteFileSystem (org.apache.ignite.IgniteFileSystem)1 CacheConfiguration (org.apache.ignite.configuration.CacheConfiguration)1 FileSystemConfiguration (org.apache.ignite.configuration.FileSystemConfiguration)1 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)1 IgniteHadoopIgfsSecondaryFileSystem (org.apache.ignite.hadoop.fs.IgniteHadoopIgfsSecondaryFileSystem)1 IgfsIpcEndpointConfiguration (org.apache.ignite.igfs.IgfsIpcEndpointConfiguration)1 IgfsModeResolver (org.apache.ignite.internal.processors.igfs.IgfsModeResolver)1