Search in sources :

Example 21 with ListStatusPOptions

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

the class LoadMetadataIntegrationTest method loadMetadataListDir.

@Test
public void loadMetadataListDir() throws Exception {
    ListStatusPOptions listOptions = ListStatusPOptions.newBuilder().setRecursive(false).setLoadMetadataType(LoadMetadataPType.ONCE).setCommonOptions(FileSystemMasterCommonPOptions.newBuilder().setSyncIntervalMs(-1)).build();
    checkListStatus("/mnt/", listOptions, true, true, 3);
}
Also used : ListStatusPOptions(alluxio.grpc.ListStatusPOptions) BaseIntegrationTest(alluxio.testutils.BaseIntegrationTest) Test(org.junit.Test)

Example 22 with ListStatusPOptions

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

the class LoadMetadataIntegrationTest method absentCacheListStatus.

@Test
public void absentCacheListStatus() throws Exception {
    ListStatusPOptions options = ListStatusPOptions.newBuilder().setLoadMetadataType(LoadMetadataPType.ONCE).setCommonOptions(FileSystemMasterCommonPOptions.newBuilder().setSyncIntervalMs(-1)).build();
    // The first time, it needs status of /dir1, /dir1/dirA to create the dirs in Alluxio
    // and the file itself
    checkListStatus("/mnt/dir1/dirA/file", options, true, true, 3);
    // The second time, it only needs to sync the file, so 1 access
    checkListStatus("/mnt/dir1/dirA/file", options, true, true, 0);
    // The first time, it needs status of /dir1, /dir1/dirA to create the dirs in Alluxio
    // and the file itself
    checkListStatus("/mnt/dir1/dirDNE", options, false, false, 1);
    // The second time, it only needs to sync the file, so 1 access
    checkListStatus("/mnt/dir1/dirDNE/dirDNE2/file1", options, false, false, 0);
}
Also used : ListStatusPOptions(alluxio.grpc.ListStatusPOptions) BaseIntegrationTest(alluxio.testutils.BaseIntegrationTest) Test(org.junit.Test)

Example 23 with ListStatusPOptions

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

the class LoadMetadataIntegrationTest method listStatusLoadsFile.

@Test
public void listStatusLoadsFile() throws Exception {
    GetStatusPOptions getStatusOptions = GetStatusPOptions.newBuilder().setLoadMetadataType(LoadMetadataPType.ONCE).build();
    ListStatusPOptions lsOptions = ListStatusPOptions.newBuilder().setLoadMetadataType(LoadMetadataPType.ALWAYS).setCommonOptions(PSYNC_ALWAYS).build();
    // load metadata for dirA with 'ALWAYS'
    checkListStatus("/mnt/dir1/dirA", lsOptions, true, true, 3);
    // the file should already be loaded
    checkGetStatus("/mnt/dir1/dirA/file", getStatusOptions, true, true, 0);
}
Also used : GetStatusPOptions(alluxio.grpc.GetStatusPOptions) ListStatusPOptions(alluxio.grpc.ListStatusPOptions) BaseIntegrationTest(alluxio.testutils.BaseIntegrationTest) Test(org.junit.Test)

Example 24 with ListStatusPOptions

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

the class LoadMetadataIntegrationTest method repeatedChildrenSync.

@Test
public void repeatedChildrenSync() throws Exception {
    ListStatusPOptions listOptions = ListStatusPOptions.newBuilder().setRecursive(true).setLoadMetadataType(LoadMetadataPType.ONCE).setCommonOptions(FileSystemMasterCommonPOptions.newBuilder().setSyncIntervalMs(-1)).build();
    GetStatusPOptions getOptions = GetStatusPOptions.newBuilder().setLoadMetadataType(LoadMetadataPType.ONCE).setCommonOptions(FileSystemMasterCommonPOptions.newBuilder().setSyncIntervalMs(-1)).build();
    // This can be improved
    checkGetStatus("/mnt/dir1/dirA/file", getOptions, true, true, 3);
    checkListStatus("/mnt/dir1/", listOptions, true, true, 3);
}
Also used : GetStatusPOptions(alluxio.grpc.GetStatusPOptions) ListStatusPOptions(alluxio.grpc.ListStatusPOptions) BaseIntegrationTest(alluxio.testutils.BaseIntegrationTest) Test(org.junit.Test)

Example 25 with ListStatusPOptions

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

the class UfsSyncIntegrationTest method clusterRestartSync.

@Test
public void clusterRestartSync() throws Exception {
    ListStatusPOptions listStatusPOptions = ListStatusPOptions.newBuilder().setLoadMetadataType(LoadMetadataPType.NEVER).setCommonOptions(PSYNC_LARGE_INTERVAL).build();
    List<URIStatus> statusList = mFileSystem.listStatus(new AlluxioURI(alluxioPath(EXISTING_DIR)), listStatusPOptions);
    Assert.assertNotNull(statusList);
    assertEquals(0, statusList.size());
    mLocalAlluxioClusterResource.get().stopMasters();
    mLocalAlluxioClusterResource.get().startMasters();
    List<URIStatus> statusListAfterRestart = mFileSystem.listStatus(new AlluxioURI(alluxioPath(EXISTING_DIR)), listStatusPOptions);
    Assert.assertNotNull(statusListAfterRestart);
    assertEquals(0, statusListAfterRestart.size());
    writeUfsFile(ufsPath(NEW_FILE_UNDER_DIR), 1);
    List<URIStatus> statusListAgain = mFileSystem.listStatus(new AlluxioURI(alluxioPath(EXISTING_DIR)), listStatusPOptions);
    Assert.assertNotNull(statusListAgain);
    assertEquals(0, statusListAgain.size());
    Thread.sleep(LARGE_INTERVAL_MS);
    List<URIStatus> statusListAfterSleeping = mFileSystem.listStatus(new AlluxioURI(alluxioPath(EXISTING_DIR)), listStatusPOptions);
    Assert.assertNotNull(statusListAfterSleeping);
    assertEquals(1, statusListAfterSleeping.size());
}
Also used : URIStatus(alluxio.client.file.URIStatus) ListStatusPOptions(alluxio.grpc.ListStatusPOptions) AlluxioURI(alluxio.AlluxioURI) BaseIntegrationTest(alluxio.testutils.BaseIntegrationTest) Test(org.junit.Test)

Aggregations

ListStatusPOptions (alluxio.grpc.ListStatusPOptions)34 Test (org.junit.Test)24 BaseIntegrationTest (alluxio.testutils.BaseIntegrationTest)21 AlluxioURI (alluxio.AlluxioURI)17 URIStatus (alluxio.client.file.URIStatus)14 File (java.io.File)9 GetStatusPOptions (alluxio.grpc.GetStatusPOptions)7 HashMap (java.util.HashMap)3 FileSystem (alluxio.client.file.FileSystem)2 AlluxioException (alluxio.exception.AlluxioException)2 FileDoesNotExistException (alluxio.exception.FileDoesNotExistException)2 ListBucketResult (alluxio.proxy.s3.ListBucketResult)2 FileWriter (java.io.FileWriter)2 IOException (java.io.IOException)2 AtomicLong (java.util.concurrent.atomic.AtomicLong)2 AuthenticatedUserRule (alluxio.AuthenticatedUserRule)1 Constants (alluxio.Constants)1 UnderFileSystemFactoryRegistryRule (alluxio.UnderFileSystemFactoryRegistryRule)1 FileOutStream (alluxio.client.file.FileOutStream)1 PropertyKey (alluxio.conf.PropertyKey)1