@Override public FileSystemCommand workerHeartbeat(long workerId, List<Long> persistedFiles, WorkerHeartbeatContext context) throws IOException { List<String> persistedUfsFingerprints = context.getOptions().getPersistedFileFingerprintsList(); boolean hasPersistedFingerprints = persistedUfsFingerprints.size() == persistedFiles.size(); for (int i = 0; i < persistedFiles.size(); i++) { long fileId = persistedFiles.get(i); String ufsFingerprint = hasPersistedFingerprints ? persistedUfsFingerprints.get(i) : Constants.INVALID_UFS_FINGERPRINT; try { // Permission checking for each file is performed inside setAttribute setAttribute(getPath(fileId), SetAttributeContext .defaults(SetAttributePOptions.newBuilder().setPersisted(true)) .setUfsFingerprint(ufsFingerprint)); } catch (FileDoesNotExistException | AccessControlException | InvalidPathException e) { LOG.error("Failed to set file {} as persisted, because {}", fileId, e); } } // TODO(zac) Clean up master and worker code since this is taken care of by job service now. // Worker should not persist any files. Instead, files are persisted through job service. List<PersistFile> filesToPersist = new ArrayList<>(); FileSystemCommandOptions commandOptions = new FileSystemCommandOptions(); commandOptions.setPersistOptions(new PersistCommandOptions(filesToPersist)); return new FileSystemCommand(CommandType.Persist, commandOptions); }
setPersisted(other.getPersisted());
SetAttributeContext.defaults(SetAttributePOptions.newBuilder().setPersisted(true)));
private SetAttributePOptions verifySetState(TestUser user, String path, SetAttributePOptions options) throws Exception { try (Closeable r = new AuthenticatedUserRule(user.getUser(), ServerConfiguration.global()).toResource()) { mFileSystemMaster.setAttribute(new AlluxioURI(path), SetAttributeContext.defaults(options.toBuilder())); FileInfo fileInfo = mFileSystemMaster.getFileInfo(new AlluxioURI(path), GetStatusContext.defaults()); return FileSystemMasterOptions.setAttributesDefaults().toBuilder() .setPinned(fileInfo.isPinned()).setTtl(fileInfo.getTtl()) .setPersisted(fileInfo.isPersisted()).build(); } }
@Override public void apply(FileSystem fs) throws Exception { fs.createDirectory(DIR); Utils.createFile(fs, INNER_FILE); fs.setAttribute(INNER_FILE, SetAttributePOptions.newBuilder().setPersisted(true).build()); }