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