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());
}
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());
}
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));
}
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);
}
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();
}
Aggregations