/** * @return the string representation of the persistence status, mutable */ // TODO(calvin): Consider returning the enum if it is moved to common public String getPersistenceState() { return mInfo.getPersistenceState(); }
private void checkPersistenceRequested(AlluxioURI testFile) throws Exception { FileInfo fileInfo = mFileSystemMaster.getFileInfo(testFile, GET_STATUS_CONTEXT); Map<Long, ExponentialTimer> persistRequests = getPersistRequests(); Assert.assertEquals(1, persistRequests.size()); Assert.assertEquals(0, getPersistJobs().size()); Assert.assertTrue(persistRequests.containsKey(fileInfo.getFileId())); Assert.assertEquals( PersistenceState.TO_BE_PERSISTED.toString(), fileInfo.getPersistenceState()); }
private void waitUntilPersisted(final AlluxioURI testFile) throws Exception { // Persistence completion is asynchronous, so waiting is necessary. CommonUtils.waitFor("async persistence is completed for file", () -> { try { FileInfo fileInfo = mFileSystemMaster.getFileInfo(testFile, GET_STATUS_CONTEXT); return fileInfo.getPersistenceState().equals(PersistenceState.PERSISTED.toString()); } catch (FileDoesNotExistException | InvalidPathException | AccessControlException | IOException e) { return false; } }, WaitForOptions.defaults().setTimeoutMs(30000)); FileInfo fileInfo = mFileSystemMaster.getFileInfo(testFile, GET_STATUS_CONTEXT); Map<Long, PersistJob> persistJobs = getPersistJobs(); Assert.assertEquals(0, getPersistRequests().size()); // We update the file info before removing the persist job, so we must wait here. CommonUtils.waitFor("persist jobs list to be empty", () -> persistJobs.isEmpty(), WaitForOptions.defaults().setTimeoutMs(5 * Constants.SECOND_MS)); Assert.assertEquals(PersistenceState.PERSISTED.toString(), fileInfo.getPersistenceState()); }
private void checkPersistenceInProgress(AlluxioURI testFile, long jobId) throws Exception { FileInfo fileInfo = mFileSystemMaster.getFileInfo(testFile, GET_STATUS_CONTEXT); Map<Long, PersistJob> persistJobs = getPersistJobs(); Assert.assertEquals(0, getPersistRequests().size()); Assert.assertEquals(1, persistJobs.size()); Assert.assertTrue(persistJobs.containsKey(fileInfo.getFileId())); PersistJob job = persistJobs.get(fileInfo.getFileId()); Assert.assertEquals(fileInfo.getFileId(), job.getFileId()); Assert.assertEquals(jobId, job.getId()); Assert.assertTrue(job.getTempUfsPath().contains(testFile.getPath())); Assert.assertEquals( PersistenceState.TO_BE_PERSISTED.toString(), fileInfo.getPersistenceState()); }
Assert.assertEquals(PersistenceState.NOT_PERSISTED.toString(), fileInfo.getPersistenceState());
Assert.assertEquals(PersistenceState.NOT_PERSISTED.toString(), fileInfo.getPersistenceState());
.getPersistenceState()); assertEquals(PersistenceState.NOT_PERSISTED.toString(), mFileSystemMaster.getFileInfo(parent1, GetStatusContext.defaults()).getPersistenceState()); assertEquals(PersistenceState.NOT_PERSISTED.toString(), mFileSystemMaster.getFileInfo(parent2, GetStatusContext.defaults()).getPersistenceState()); .getPersistenceState()); assertEquals(PersistenceState.PERSISTED.toString(), mFileSystemMaster.getFileInfo(parent1, GetStatusContext.defaults()).getPersistenceState()); assertEquals(PersistenceState.PERSISTED.toString(), mFileSystemMaster.getFileInfo(parent2, GetStatusContext.defaults()).getPersistenceState()); .getPersistenceState()); assertEquals(PersistenceState.PERSISTED.toString(), mFileSystemMaster.getFileInfo(parent1, GetStatusContext.defaults()).getPersistenceState()); assertEquals(PersistenceState.PERSISTED.toString(), mFileSystemMaster.getFileInfo(parent2, GetStatusContext.defaults()).getPersistenceState());
Assert.assertEquals(PersistenceState.NOT_PERSISTED.toString(), fileInfo.getPersistenceState()); Assert.assertEquals(PersistenceState.NOT_PERSISTED.toString(), fileInfo.getPersistenceState());
/** * Tests that lost files can successfully be detected. */ @Test public void lostFilesDetection() throws Exception { createFileWithSingleBlock(NESTED_FILE_URI); long fileId = mFileSystemMaster.getFileId(NESTED_FILE_URI); FileInfo fileInfo = mFileSystemMaster.getFileInfo(fileId); mBlockMaster.reportLostBlocks(fileInfo.getBlockIds()); assertEquals(PersistenceState.NOT_PERSISTED.name(), fileInfo.getPersistenceState()); // Check with getPersistenceState. assertEquals(PersistenceState.NOT_PERSISTED, mFileSystemMaster.getPersistenceState(fileId)); // run the detector HeartbeatScheduler.execute(HeartbeatContext.MASTER_LOST_FILES_DETECTION); fileInfo = mFileSystemMaster.getFileInfo(fileId); assertEquals(PersistenceState.LOST.name(), fileInfo.getPersistenceState()); // Check with getPersistenceState. assertEquals(PersistenceState.LOST, mFileSystemMaster.getPersistenceState(fileId)); }
CreateFileContext.defaults().setPersisted(false)); Assert.assertEquals(PersistenceState.NOT_PERSISTED.toString(), mFileSystemMaster.getFileInfo(fileId).getPersistenceState());
Assert.assertEquals(PersistenceState.NOT_PERSISTED.toString(), fileInfo.getPersistenceState());
/** * Tests that persist file requests are not forgotten across restarts. */ @Test public void replayPersistRequest() throws Exception { // Create a file and check the internal state. AlluxioURI testFile = createTestFile(); FileInfo fileInfo = mFileSystemMaster.getFileInfo(testFile, GET_STATUS_CONTEXT); Assert.assertEquals(PersistenceState.NOT_PERSISTED.toString(), fileInfo.getPersistenceState()); // Repeatedly schedule the async persistence, checking the internal state. { mFileSystemMaster.scheduleAsyncPersistence(testFile); checkPersistenceRequested(testFile); mFileSystemMaster.scheduleAsyncPersistence(testFile); checkPersistenceRequested(testFile); } // Simulate restart. stopServices(); startServices(); checkPersistenceRequested(testFile); }
.setLastModificationTimeMs(fileInfo.getLastModificationTimeMs()).setTtl(fileInfo.getTtl()) .setOwner(fileInfo.getOwner()).setGroup(fileInfo.getGroup()).setMode(fileInfo.getMode()) .setPersistenceState(fileInfo.getPersistenceState()).setMountPoint(fileInfo.isMountPoint()) .addAllFileBlockInfos(fileBlockInfos) .setTtlAction(fileInfo.getTtlAction()).setMountId(fileInfo.getMountId())
/** * @return the string representation of the persistence status, mutable */ // TODO(calvin): Consider returning the enum if it is moved to common public String getPersistenceState() { return mInfo.getPersistenceState(); }
Assert.assertEquals(a.getOwner(), b.getOwner()); Assert.assertEquals(a.getPath(), b.getPath()); Assert.assertEquals(a.getPersistenceState(), b.getPersistenceState()); Assert.assertEquals(a.getTtl(), b.getTtl()); Assert.assertEquals(a.getTtlAction(), b.getTtlAction());
/** * @return the string representation of the persistence status, mutable */ // TODO(calvin): Consider returning the enum if it is moved to common public String getPersistenceState() { return mInfo.getPersistenceState(); }
Assert.assertEquals(uriStatus.getMode(), fileInfo.getMode()); Assert.assertEquals(uriStatus.getPersistenceState(), fileInfo.getPersistenceState()); Assert.assertEquals(uriStatus.getTtl(), fileInfo.getTtl()); Assert.assertEquals(uriStatus.getTtlAction(), fileInfo.getTtlAction());