use of alluxio.grpc.GetStatusPOptions in project alluxio by Alluxio.
the class UfsSyncIntegrationTest method getStatusDirSyncOnlyTouchingChildren.
// https://github.com/Alluxio/alluxio/issues/12372
@Test
public void getStatusDirSyncOnlyTouchingChildren() throws Exception {
String dir1 = PathUtils.concatPath(EXISTING_DIR, "dir_should_sync");
String dir2 = PathUtils.concatPath(dir1, "dir_should_not_sync");
new File(ufsPath(dir1)).mkdirs();
new File(ufsPath(dir2)).mkdirs();
GetStatusPOptions optionsAlways = GetStatusPOptions.newBuilder().setLoadMetadataType(LoadMetadataPType.NEVER).setCommonOptions(PSYNC_ALWAYS).build();
checkGetStatus(EXISTING_DIR, optionsAlways, true);
ListStatusPOptions optionsNever = ListStatusPOptions.newBuilder().setLoadMetadataType(LoadMetadataPType.NEVER).setCommonOptions(PSYNC_NEVER).setRecursive(false).build();
checkListStatus(dir2, optionsNever, false);
}
use of alluxio.grpc.GetStatusPOptions in project alluxio by Alluxio.
the class UfsSyncIntegrationTest method ufsMetadataContentChange.
@Test
public void ufsMetadataContentChange() throws Exception {
FileSystemTestUtils.loadFile(mFileSystem, alluxioPath(EXISTING_FILE));
GetStatusPOptions options = GetStatusPOptions.newBuilder().setLoadMetadataType(LoadMetadataPType.NEVER).setCommonOptions(PSYNC_ALWAYS).build();
URIStatus status = mFileSystem.getStatus(new AlluxioURI(alluxioPath(EXISTING_FILE)), options);
Assert.assertNotNull(status);
long prevFileid = status.getFileId();
// Set the mode for the file
FileUtils.changeLocalFilePermission(ufsPath(EXISTING_FILE), "rwxrwxrwx");
status = mFileSystem.getStatus(new AlluxioURI(alluxioPath(EXISTING_FILE)), options);
Assert.assertNotNull(status);
// Make sure the mode is correctly updated with a metadata change only
assertEquals(FileUtils.translatePosixPermissionToMode(PosixFilePermissions.fromString("rwxrwxrwx")), status.getMode());
// Change the permission of the file and the file id should not change
assertEquals(prevFileid, status.getFileId());
// Change the content of the file and the file id should change as a result because it is
// deleted and reloaded.
writeUfsFile(ufsPath(EXISTING_FILE), 2);
status = mFileSystem.getStatus(new AlluxioURI(alluxioPath(EXISTING_FILE)), options);
Assert.assertNotNull(status);
Assert.assertNotEquals(prevFileid, status.getFileId());
}
use of alluxio.grpc.GetStatusPOptions in project alluxio by Alluxio.
the class LoadMetadataIntegrationTest method loadAlwaysConfiguration.
@LocalAlluxioClusterResource.Config(confParams = { PropertyKey.Name.USER_FILE_METADATA_LOAD_TYPE, "ALWAYS" })
@Test
public void loadAlwaysConfiguration() throws Exception {
GetStatusPOptions options = GetStatusPOptions.getDefaultInstance();
checkGetStatus("/mnt/dir1/dirA/fileDNE1", options, false, false, 1);
checkGetStatus("/mnt/dir1/dirA/fileDNE1", options, false, false, 1);
}
use of alluxio.grpc.GetStatusPOptions in project alluxio by Alluxio.
the class LoadMetadataIntegrationTest method loadMetadataOnceAfterUfsCreate.
@Test
public void loadMetadataOnceAfterUfsCreate() throws Exception {
GetStatusPOptions options = GetStatusPOptions.newBuilder().setLoadMetadataType(LoadMetadataPType.ONCE).build();
// dirB does not exist yet
checkGetStatus("/mnt/dir1/dirA/dirB/file", options, false, false, 1);
// create dirB in UFS
assertTrue(new File(mLocalUfsPath + "/dir1/dirA/dirB").mkdirs());
// 'ONCE' still should not load the metadata
checkGetStatus("/mnt/dir1/dirA/dirB/file", options, false, false, 0);
// load metadata for dirB with 'ALWAYS'
checkGetStatus("/mnt/dir1/dirA/dirB", GetStatusPOptions.newBuilder().setLoadMetadataType(LoadMetadataPType.ALWAYS).build(), true, true, 3);
// 'ONCE' should now load the metadata, but will be handled by the absent cache,
// so no need to go to the ufs
checkGetStatus("/mnt/dir1/dirA/dirB/file", options, false, false, 0);
}
use of alluxio.grpc.GetStatusPOptions in project alluxio by Alluxio.
the class LoadMetadataIntegrationTest method loadMetadataOnceAfterUfsDelete.
@Test
public void loadMetadataOnceAfterUfsDelete() throws Exception {
GetStatusPOptions options = GetStatusPOptions.newBuilder().setLoadMetadataType(LoadMetadataPType.ONCE).build();
// create dirB in UFS
assertTrue(new File(mLocalUfsPath + "/dir1/dirA/dirB").mkdirs());
checkGetStatus("/mnt/dir1/dirA/dirB/file", options, false, false, 1);
checkGetStatus("/mnt/dir1/dirA/dirB/file", options, false, false, 0);
// delete dirB in UFS
assertTrue(new File(mLocalUfsPath + "/dir1/dirA/dirB").delete());
// 'ONCE' should not be affected if UFS is changed
checkGetStatus("/mnt/dir1/dirA/dirB/file", options, false, false, 0);
// force load metadata with 'ALWAYS'
checkGetStatus("/mnt/dir1/dirA/dirB", GetStatusPOptions.newBuilder().setLoadMetadataType(LoadMetadataPType.ALWAYS).build(), false, false, 1);
// 'ONCE' should still not load metadata, since the ancestor is absent
checkGetStatus("/mnt/dir1/dirA/dirB/file", options, false, false, 0);
}
Aggregations