Search in sources :

Example 11 with MountPOptions

use of alluxio.grpc.MountPOptions in project alluxio by Alluxio.

the class MultiUfsMountIntegrationTest method mountNestedWithUpdatedOptions.

@Test
public void mountNestedWithUpdatedOptions() throws Exception {
    MountPOptions options3 = MountPOptions.newBuilder().putAllProperties(UFS_CONF3).build();
    mFileSystem.mount(mMountPoint3, new AlluxioURI(mUfsUri3), options3);
    MountPOptions options4 = MountPOptions.newBuilder().putAllProperties(UFS_CONF4).build();
    mFileSystem.mount(mMountPoint4, new AlluxioURI(mUfsUri4), options4);
    Map<String, MountPointInfo> mountTable = mFileSystem.getMountTable();
    Assert.assertTrue(mountTable.containsKey(MOUNT_POINT3));
    MountPointInfo mountPointInfo3 = mountTable.get(MOUNT_POINT3);
    Assert.assertEquals(mUfsUri3, mountPointInfo3.getUfsUri());
    Assert.assertEquals(UFS_CONF3.size(), mountPointInfo3.getProperties().size());
    Assert.assertTrue(mountPointInfo3.getProperties().containsKey(PropertyKey.Name.S3A_ACCESS_KEY));
    Assert.assertNotEquals(UFS_CONF3.get(PropertyKey.Name.S3A_ACCESS_KEY), mountPointInfo3.getProperties().get(PropertyKey.Name.S3A_ACCESS_KEY));
    Assert.assertTrue(mountTable.containsKey(MOUNT_POINT4_NESTED));
    MountPointInfo mountPointInfo4 = mountTable.get(MOUNT_POINT4_NESTED);
    Assert.assertEquals(mUfsUri4, mountPointInfo4.getUfsUri());
    Assert.assertEquals(UFS_CONF4.size(), mountPointInfo3.getProperties().size());
    Assert.assertEquals(UFS_CONF4, mountPointInfo4.getProperties());
    MountPOptions options5 = MountPOptions.newBuilder().putAllProperties(UFS_CONF2).build();
    UnderFileSystemFactoryRegistry.register(new ConfExpectingUnderFileSystemFactory("ufs3", UFS_CONF2));
    mFileSystem.updateMount(mMountPoint3, options5);
    mountTable = mFileSystem.getMountTable();
    Assert.assertTrue(mountTable.containsKey(MOUNT_POINT3));
    MountPointInfo mountPointInfo5 = mountTable.get(MOUNT_POINT3);
    Assert.assertEquals(UFS_CONF2, mountPointInfo5.getProperties());
}
Also used : MountPOptions(alluxio.grpc.MountPOptions) MountPointInfo(alluxio.wire.MountPointInfo) ConfExpectingUnderFileSystemFactory(alluxio.testutils.underfs.ConfExpectingUnderFileSystemFactory) AlluxioURI(alluxio.AlluxioURI) BaseIntegrationTest(alluxio.testutils.BaseIntegrationTest) Test(org.junit.Test)

Example 12 with MountPOptions

use of alluxio.grpc.MountPOptions in project alluxio by Alluxio.

the class MultiUfsMountIntegrationTest method mountWithUpdatedOptions.

@Test
public void mountWithUpdatedOptions() throws Exception {
    MountPOptions options3 = MountPOptions.newBuilder().putAllProperties(UFS_CONF3).build();
    mFileSystem.mount(mMountPoint3, new AlluxioURI(mUfsUri3), options3);
    Map<String, MountPointInfo> mountTable = mFileSystem.getMountTable();
    Assert.assertTrue(mountTable.containsKey(MOUNT_POINT3));
    MountPointInfo mountPointInfo3 = mountTable.get(MOUNT_POINT3);
    Assert.assertEquals(mUfsUri3, mountPointInfo3.getUfsUri());
    Assert.assertEquals(UFS_CONF3.size(), mountPointInfo3.getProperties().size());
    Assert.assertTrue(mountPointInfo3.getProperties().containsKey(PropertyKey.Name.S3A_ACCESS_KEY));
    Assert.assertNotEquals(UFS_CONF3.get(PropertyKey.Name.S3A_ACCESS_KEY), mountPointInfo3.getProperties().get(PropertyKey.Name.S3A_ACCESS_KEY));
    MountPOptions options4 = MountPOptions.newBuilder().putAllProperties(UFS_CONF2).build();
    UnderFileSystemFactoryRegistry.register(new ConfExpectingUnderFileSystemFactory("ufs3", UFS_CONF2));
    mFileSystem.updateMount(mMountPoint3, options4);
    mountTable = mFileSystem.getMountTable();
    Assert.assertTrue(mountTable.containsKey(MOUNT_POINT3));
    MountPointInfo mountPointInfo4 = mountTable.get(MOUNT_POINT3);
    Assert.assertEquals(UFS_CONF2, mountPointInfo4.getProperties());
}
Also used : MountPOptions(alluxio.grpc.MountPOptions) MountPointInfo(alluxio.wire.MountPointInfo) ConfExpectingUnderFileSystemFactory(alluxio.testutils.underfs.ConfExpectingUnderFileSystemFactory) AlluxioURI(alluxio.AlluxioURI) BaseIntegrationTest(alluxio.testutils.BaseIntegrationTest) Test(org.junit.Test)

Example 13 with MountPOptions

use of alluxio.grpc.MountPOptions in project alluxio by Alluxio.

the class AsyncUfsAbsentPathCacheTest method removeMountPoint.

@Test
public void removeMountPoint() throws Exception {
    String ufsBase = "/a/b";
    String alluxioBase = "/mnt" + ufsBase;
    // Create ufs directories
    assertTrue((new File(mLocalUfsPath + ufsBase)).mkdirs());
    // 'base + /c' will be the first absent path
    process(new AlluxioURI(alluxioBase + "/c/d"));
    checkPaths(new AlluxioURI(alluxioBase + "/c"));
    // Unmount
    assertTrue(mMountTable.delete(NoopJournalContext.INSTANCE, new AlluxioURI("/mnt"), true));
    // Re-mount the same ufs
    long newMountId = IdUtils.getRandomNonNegativeLong();
    MountPOptions options = MountContext.defaults().getOptions().build();
    mUfsManager.addMount(newMountId, new AlluxioURI(mLocalUfsPath), UnderFileSystemConfiguration.defaults(ConfigurationTestUtils.defaults()).setReadOnly(options.getReadOnly()).setShared(options.getShared()).createMountSpecificConf(Collections.<String, String>emptyMap()));
    mMountTable.add(NoopJournalContext.INSTANCE, new AlluxioURI("/mnt"), new AlluxioURI(mLocalUfsPath), newMountId, options);
    // The cache should not contain any paths now.
    assertFalse(mUfsAbsentPathCache.isAbsentSince(new AlluxioURI("/mnt/a/b/c/d"), UfsAbsentPathCache.ALWAYS));
    assertFalse(mUfsAbsentPathCache.isAbsentSince(new AlluxioURI("/mnt/a/b/c"), UfsAbsentPathCache.ALWAYS));
    assertFalse(mUfsAbsentPathCache.isAbsentSince(new AlluxioURI("/mnt/a/b"), UfsAbsentPathCache.ALWAYS));
    assertFalse(mUfsAbsentPathCache.isAbsentSince(new AlluxioURI("/mnt/a"), UfsAbsentPathCache.ALWAYS));
    assertFalse(mUfsAbsentPathCache.isAbsentSince(new AlluxioURI("/mnt/"), UfsAbsentPathCache.ALWAYS));
}
Also used : MountPOptions(alluxio.grpc.MountPOptions) File(java.io.File) AlluxioURI(alluxio.AlluxioURI) Test(org.junit.Test)

Example 14 with MountPOptions

use of alluxio.grpc.MountPOptions in project alluxio by Alluxio.

the class AsyncUfsAbsentPathCacheTest method before.

/**
 * Sets up a new {@link AsyncUfsAbsentPathCache} before a test runs.
 */
@Before
public void before() throws Exception {
    mLocalUfsPath = mTemp.getRoot().getAbsolutePath();
    mUfsManager = new MasterUfsManager();
    mMountTable = new MountTable(mUfsManager, new MountInfo(new AlluxioURI("/"), new AlluxioURI("/ufs"), 1, MountContext.defaults().getOptions().build()));
    mUfsAbsentPathCache = new AsyncUfsAbsentPathCache(mMountTable, THREADS);
    mMountId = IdUtils.getRandomNonNegativeLong();
    MountPOptions options = MountContext.defaults().getOptions().build();
    mUfsManager.addMount(mMountId, new AlluxioURI(mLocalUfsPath), UnderFileSystemConfiguration.defaults(ConfigurationTestUtils.defaults()).setReadOnly(options.getReadOnly()).setShared(options.getShared()).createMountSpecificConf(Collections.<String, String>emptyMap()));
    mMountTable.add(NoopJournalContext.INSTANCE, new AlluxioURI("/mnt"), new AlluxioURI(mLocalUfsPath), mMountId, options);
}
Also used : MountPOptions(alluxio.grpc.MountPOptions) MountInfo(alluxio.master.file.meta.options.MountInfo) MasterUfsManager(alluxio.underfs.MasterUfsManager) AlluxioURI(alluxio.AlluxioURI) Before(org.junit.Before)

Example 15 with MountPOptions

use of alluxio.grpc.MountPOptions in project alluxio by Alluxio.

the class BaseFileSystemTest method mount.

/**
 * Tests for the {@link BaseFileSystem#mount(AlluxioURI, AlluxioURI, MountPOptions)} method.
 */
@Test
public void mount() throws Exception {
    AlluxioURI alluxioPath = new AlluxioURI("/t");
    AlluxioURI ufsPath = new AlluxioURI("/u");
    MountPOptions mountOptions = MountPOptions.getDefaultInstance();
    doNothing().when(mFileSystemMasterClient).mount(alluxioPath, ufsPath, FileSystemOptions.mountDefaults(mConf).toBuilder().mergeFrom(mountOptions).build());
    mFileSystem.mount(alluxioPath, ufsPath, mountOptions);
    verify(mFileSystemMasterClient).mount(alluxioPath, ufsPath, FileSystemOptions.mountDefaults(mConf).toBuilder().mergeFrom(mountOptions).build());
    verifyFilesystemContextAcquiredAndReleased();
}
Also used : MountPOptions(alluxio.grpc.MountPOptions) AlluxioURI(alluxio.AlluxioURI) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Aggregations

MountPOptions (alluxio.grpc.MountPOptions)19 AlluxioURI (alluxio.AlluxioURI)14 Test (org.junit.Test)10 MountInfo (alluxio.master.file.meta.options.MountInfo)5 MountPointInfo (alluxio.wire.MountPointInfo)4 AccessControlException (alluxio.exception.AccessControlException)3 BaseIntegrationTest (alluxio.testutils.BaseIntegrationTest)3 ConfExpectingUnderFileSystemFactory (alluxio.testutils.underfs.ConfExpectingUnderFileSystemFactory)3 MasterUfsManager (alluxio.underfs.MasterUfsManager)3 ExceptionMessage (alluxio.exception.ExceptionMessage)2 FileAlreadyExistsException (alluxio.exception.FileAlreadyExistsException)2 InvalidPathException (alluxio.exception.InvalidPathException)2 NotFoundException (alluxio.exception.status.NotFoundException)2 UnavailableException (alluxio.exception.status.UnavailableException)2 GrpcUtils (alluxio.grpc.GrpcUtils)2 DelegatingJournaled (alluxio.master.journal.DelegatingJournaled)2 JournalContext (alluxio.master.journal.JournalContext)2 Journaled (alluxio.master.journal.Journaled)2 CheckpointName (alluxio.master.journal.checkpoint.CheckpointName)2 File (alluxio.proto.journal.File)2