use of alluxio.conf.InstancedConfiguration in project alluxio by Alluxio.
the class PersistCommandTest method persistOnRenameDirectory.
@Test
public void persistOnRenameDirectory() throws Exception {
InstancedConfiguration conf = new InstancedConfiguration(ServerConfiguration.global());
conf.set(PropertyKey.USER_FILE_WRITE_TYPE_DEFAULT, "MUST_CACHE");
conf.set(PropertyKey.USER_FILE_PERSIST_ON_RENAME, true);
try (FileSystemShell fsShell = new FileSystemShell(conf)) {
String testDir = FileSystemShellUtilsTest.resetFileHierarchy(sFileSystem);
String toPersist = testDir + "/foo";
String persisted = testDir + "/foo_persisted";
String doNotPersist = testDir + "/bar";
assertFalse(sFileSystem.getStatus(new AlluxioURI(testDir)).isPersisted());
assertFalse(sFileSystem.getStatus(new AlluxioURI(toPersist)).isPersisted());
assertFalse(sFileSystem.getStatus(new AlluxioURI(doNotPersist)).isPersisted());
int ret = fsShell.run("mv", toPersist, persisted);
Assert.assertEquals(mOutput.toString(), 0, ret);
CommonUtils.waitFor("Directory to be persisted", () -> {
try {
return sFileSystem.getStatus(new AlluxioURI(persisted)).isPersisted() && sFileSystem.getStatus(new AlluxioURI(persisted + "/foobar1")).isPersisted() && sFileSystem.getStatus(new AlluxioURI(persisted + "/foobar2")).isPersisted();
} catch (Exception e) {
return false;
}
}, WaitForOptions.defaults().setTimeoutMs(10000));
assertFalse(sFileSystem.getStatus(new AlluxioURI(testDir + "/bar")).isPersisted());
checkFilePersisted(new AlluxioURI(persisted + "/foobar1"), 10);
checkFilePersisted(new AlluxioURI(persisted + "/foobar2"), 20);
}
}
use of alluxio.conf.InstancedConfiguration in project alluxio by Alluxio.
the class AddCommandIntegrationTest method immediatelyEffectiveForShellCommands.
@Test
public void immediatelyEffectiveForShellCommands() throws Exception {
// Tests that after adding some path configuration, it's immediately effective for command
// line calls afterwards.
InstancedConfiguration conf = ServerConfiguration.global();
try (FileSystemShell fsShell = new FileSystemShell(conf);
FileSystemAdminShell fsAdminShell = new FileSystemAdminShell(conf)) {
Assert.assertEquals(0, fsAdminShell.run("pathConf", "add", "--property", WRITE_TYPE_THROUGH, PATH1));
Assert.assertEquals(0, fsAdminShell.run("pathConf", "add", "--property", WRITE_TYPE_CACHE_THROUGH, PATH2));
FileSystem fs = sLocalAlluxioClusterResource.get().getClient();
String file = "/file";
FileSystemTestUtils.createByteFile(fs, file, 100, CreateFilePOptions.getDefaultInstance());
fs.createDirectory(new AlluxioURI(PATH1), CreateDirectoryPOptions.newBuilder().setRecursive(true).build());
fs.createDirectory(new AlluxioURI(PATH2), CreateDirectoryPOptions.newBuilder().setRecursive(true).build());
AlluxioURI target = new AlluxioURI(PATH1 + file);
Assert.assertEquals(0, fsShell.run("cp", file, target.toString()));
URIStatus status = fs.getStatus(target);
Assert.assertEquals(0, status.getInMemoryPercentage());
Assert.assertEquals(PersistenceState.PERSISTED.toString(), status.getPersistenceState());
target = new AlluxioURI(PATH2 + file);
Assert.assertEquals(0, fsShell.run("cp", file, target.toString()));
status = fs.getStatus(target);
Assert.assertEquals(100, status.getInMemoryPercentage());
Assert.assertEquals(PersistenceState.PERSISTED.toString(), status.getPersistenceState());
}
}
use of alluxio.conf.InstancedConfiguration in project alluxio by Alluxio.
the class LocalCacheManagerIntegrationTest method before.
@Before
public void before() throws Exception {
mConf = new InstancedConfiguration(new AlluxioProperties());
mConf.set(PropertyKey.USER_CLIENT_CACHE_PAGE_SIZE, PAGE_SIZE_BYTES);
mConf.set(PropertyKey.USER_CLIENT_CACHE_SIZE, CACHE_SIZE_BYTES);
mConf.set(PropertyKey.USER_CLIENT_CACHE_ENABLED, true);
mConf.set(PropertyKey.USER_CLIENT_CACHE_DIR, mTemp.getRoot().getPath());
mConf.set(PropertyKey.USER_CLIENT_CACHE_ASYNC_WRITE_ENABLED, false);
mConf.set(PropertyKey.USER_CLIENT_CACHE_ASYNC_RESTORE_ENABLED, false);
mConf.set(PropertyKey.USER_CLIENT_CACHE_STORE_OVERHEAD, 0);
}
use of alluxio.conf.InstancedConfiguration in project alluxio by Alluxio.
the class WebUnderFileSystemFactoryTest method factory.
/**
* This test ensures the web UFS module correctly accepts paths that begin with / or file://.
*/
@Test
public void factory() {
AlluxioConfiguration conf = new InstancedConfiguration(ConfigurationUtils.defaults());
UnderFileSystemFactory factory = UnderFileSystemFactoryRegistry.find("https://downloads.alluxio.io/downloads/files/2.0.0-preview/", conf);
UnderFileSystemFactory factory2 = UnderFileSystemFactoryRegistry.find("http://downloads.alluxio.org/", conf);
UnderFileSystemFactory factory3 = UnderFileSystemFactoryRegistry.find("httpx://path", conf);
Assert.assertNotNull("A UnderFileSystemFactory should exist for http paths when using this module", factory);
Assert.assertNotNull("A UnderFileSystemFactory should exist for http paths when using this module", factory2);
Assert.assertNull("A UnderFileSystemFactory should not exist for non http paths when using this module", factory3);
}
use of alluxio.conf.InstancedConfiguration in project alluxio by Alluxio.
the class TimeBoundPageStoreTest method before.
@Before
public void before() throws Exception {
InstancedConfiguration conf = ConfigurationTestUtils.defaults();
conf.set(PropertyKey.USER_CLIENT_CACHE_PAGE_SIZE, PAGE_SIZE_BYTES);
conf.set(PropertyKey.USER_CLIENT_CACHE_SIZE, CACHE_SIZE_BYTES);
conf.set(PropertyKey.USER_CLIENT_CACHE_DIR, mTemp.getRoot().getAbsolutePath());
conf.set(PropertyKey.USER_CLIENT_CACHE_TIMEOUT_DURATION, "-1");
mPageStoreOptions = PageStoreOptions.create(conf);
mPageStore = new HangingPageStore(mPageStoreOptions);
conf.set(PropertyKey.USER_CLIENT_CACHE_TIMEOUT_DURATION, "2s");
mTimeBoundPageStoreOptions = PageStoreOptions.create(conf);
mTimeBoundPageStore = new TimeBoundPageStore(mPageStore, mTimeBoundPageStoreOptions);
}
Aggregations