Search in sources :

Example 11 with GetStatusPOptions

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

the class LoadMetadataIntegrationTest method absentCacheGetStatus.

@Test
public void absentCacheGetStatus() throws Exception {
    GetStatusPOptions options = GetStatusPOptions.newBuilder().setLoadMetadataType(LoadMetadataPType.ONCE).setCommonOptions(FileSystemMasterCommonPOptions.newBuilder().setSyncIntervalMs(-1)).build();
    checkGetStatus("/mnt/dir1/dirA/dirDNE/", options, false, false, 1);
    checkGetStatus("/mnt/dir1/dirA/dirDNE2/file2", options, false, false, 1);
    checkGetStatus("/mnt/dir1/dirA/fileDNE1", options, false, false, 1);
    checkGetStatus("/mnt/dir1/dirA/dirDNE2", options, false, false, 1);
    checkGetStatus("/mnt/dir1/dirA/dirDNE/", options, false, false, 0);
    checkGetStatus("/mnt/dir1/dirA/fileDNE1", options, false, false, 0);
    checkGetStatus("/mnt/dir1/dirA/dirDNE/fileDNE", options, false, false, 0);
    checkGetStatus("/mnt/dir1/dirA/dirDNE/dirB/fileDNE", options, false, false, 0);
    GetStatusPOptions optionsAlways = GetStatusPOptions.newBuilder().setLoadMetadataType(LoadMetadataPType.ALWAYS).setCommonOptions(FileSystemMasterCommonPOptions.newBuilder().setSyncIntervalMs(-1)).build();
    checkGetStatus("/mnt/dir1/dirA/dirDNE/", optionsAlways, false, false, 1);
    checkGetStatus("/mnt/dir1/dirA/fileDNE1", optionsAlways, false, false, 1);
}
Also used : GetStatusPOptions(alluxio.grpc.GetStatusPOptions) BaseIntegrationTest(alluxio.testutils.BaseIntegrationTest) Test(org.junit.Test)

Example 12 with GetStatusPOptions

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

the class LoadMetadataIntegrationTest method getStatusDoesNotLoadFile.

@Test
public void getStatusDoesNotLoadFile() 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'
    checkGetStatus("/mnt/dir1/dirA", getStatusOptions, true, true, 2);
    // the file should NOT already be loaded
    checkGetStatus("/mnt/dir1/dirA/file", getStatusOptions, true, true, 1);
}
Also used : GetStatusPOptions(alluxio.grpc.GetStatusPOptions) ListStatusPOptions(alluxio.grpc.ListStatusPOptions) BaseIntegrationTest(alluxio.testutils.BaseIntegrationTest) Test(org.junit.Test)

Example 13 with GetStatusPOptions

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

the class LoadMetadataIntegrationTest method loadOnceConfiguration.

@LocalAlluxioClusterResource.Config(confParams = { PropertyKey.Name.USER_FILE_METADATA_LOAD_TYPE, "ONCE" })
@Test
public void loadOnceConfiguration() throws Exception {
    GetStatusPOptions options = GetStatusPOptions.getDefaultInstance();
    checkGetStatus("/mnt/dir1/dirA/fileDNE1", options, false, false, 1);
    checkGetStatus("/mnt/dir1/dirA/fileDNE1", options, false, false, 0);
}
Also used : GetStatusPOptions(alluxio.grpc.GetStatusPOptions) BaseIntegrationTest(alluxio.testutils.BaseIntegrationTest) Test(org.junit.Test)

Example 14 with GetStatusPOptions

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

the class UfsSyncIntegrationTest method getStatusNoSync.

@Test
public void getStatusNoSync() throws Exception {
    GetStatusPOptions options = GetStatusPOptions.newBuilder().setLoadMetadataType(LoadMetadataPType.NEVER).setCommonOptions(PSYNC_NEVER).build();
    checkGetStatus(EXISTING_DIR, options, false);
    checkGetStatus(EXISTING_FILE, options, false);
    // Create new ufs paths.
    new File(ufsPath(NEW_DIR)).mkdirs();
    writeUfsFile(ufsPath(NEW_FILE), 2);
    checkGetStatus(NEW_DIR, options, false);
    checkGetStatus(NEW_FILE, options, false);
}
Also used : File(java.io.File) GetStatusPOptions(alluxio.grpc.GetStatusPOptions) BaseIntegrationTest(alluxio.testutils.BaseIntegrationTest) Test(org.junit.Test)

Example 15 with GetStatusPOptions

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

the class UfsSyncIntegrationTest method lastModifiedLocalFileSync.

@Test(timeout = 10000)
public void lastModifiedLocalFileSync() throws Exception {
    int sizefactor = 10;
    GetStatusPOptions options = GetStatusPOptions.newBuilder().setLoadMetadataType(LoadMetadataPType.NEVER).setCommonOptions(PSYNC_ALWAYS).build();
    writeUfsFile(ufsPath(EXISTING_FILE), sizefactor);
    URIStatus status = mFileSystem.getStatus(new AlluxioURI(alluxioPath(EXISTING_FILE)), options);
    String startFingerprint = status.getUfsFingerprint();
    long startLength = status.getLength();
    long modTime = new File(ufsPath(EXISTING_FILE)).lastModified();
    long newModTime = modTime;
    while (newModTime == modTime) {
        // Sleep for a bit for a different last mod time.
        // This could be flaky, so
        long delay = 100;
        CommonUtils.sleepMs(delay);
        // Write the same file, but with a different last mod time.
        writeUfsFile(ufsPath(EXISTING_FILE), sizefactor);
        newModTime = new File(ufsPath(EXISTING_FILE)).lastModified();
    }
    status = mFileSystem.getStatus(new AlluxioURI(alluxioPath(EXISTING_FILE)), options);
    // Verify the sizes are the same, but the fingerprints are different.
    // Will only work with local ufs, since local ufs uses the last mod time for the content hash.
    assertTrue(status.getLength() == startLength);
    Assert.assertNotEquals(startFingerprint, status.getUfsFingerprint());
}
Also used : URIStatus(alluxio.client.file.URIStatus) File(java.io.File) GetStatusPOptions(alluxio.grpc.GetStatusPOptions) AlluxioURI(alluxio.AlluxioURI) BaseIntegrationTest(alluxio.testutils.BaseIntegrationTest) Test(org.junit.Test)

Aggregations

GetStatusPOptions (alluxio.grpc.GetStatusPOptions)38 Test (org.junit.Test)34 BaseIntegrationTest (alluxio.testutils.BaseIntegrationTest)26 AlluxioURI (alluxio.AlluxioURI)17 URIStatus (alluxio.client.file.URIStatus)12 File (java.io.File)9 ListStatusPOptions (alluxio.grpc.ListStatusPOptions)6 AbstractFileSystemShellTest (alluxio.client.cli.fs.AbstractFileSystemShellTest)4 DeletePOptions (alluxio.grpc.DeletePOptions)4 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)4 FileInfo (alluxio.wire.FileInfo)2 AlluxioConfiguration (alluxio.conf.AlluxioConfiguration)1 AlluxioException (alluxio.exception.AlluxioException)1 SetAttributePOptions (alluxio.grpc.SetAttributePOptions)1 GrpcCallTracker (alluxio.master.file.contexts.GrpcCallTracker)1 Mode (alluxio.security.authorization.Mode)1 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 FileWriter (java.io.FileWriter)1 IOException (java.io.IOException)1 RejectedExecutionException (java.util.concurrent.RejectedExecutionException)1