Source:
public TaskResult validate(Map<String, String> optionsMap) throws InterruptedException { InstancedConfiguration conf = InstancedConfiguration.defaults(); String path = conf.get(PropertyKey.WORKER_TIERED_STORE_LEVEL0_DIRS_PATH); String alias = conf.get(PropertyKey.WORKER_TIERED_STORE_LEVEL0_ALIAS); if (!alias.equals("MEM")) { System.out.println("Top tier storage is not memory, skip validation."); return TaskResult.SKIPPED; } if (!OSUtils.isLinux()) { System.out.println("OS is not Linux, skip validation."); return TaskResult.SKIPPED; } if (path.isEmpty()) { System.err.println("Mount path is empty."); return TaskResult.FAILED; } if (path.split(",").length > 1) { System.out.println("Multiple storage paths for memory tier found. Skip validation."); return TaskResult.SKIPPED; } try { path = new AlluxioURI(path).getPath(); File file = new File(path); if (file.exists()) { if (!file.isDirectory()) { System.err.format("Path %s is not a directory.%n", path); return TaskResult.FAILED; } if (ShellUtils.isMountingPoint(path, new String[]{"ramfs", "tmpfs"})) { if (!file.canWrite()) { System.err.format("RAM disk at %s is not writable.%n", path); return TaskResult.FAILED; } System.out.format("RAM disk is mounted at %s, skip validation.%n", path); return TaskResult.SKIPPED; } } if (!checkSudoPrivilege()) { System.err.println("No sudo privilege to mount ramfs. " + "If you would like to run Alluxio worker without sudo privilege, please visit " + "<LINK_0>" + "can-i-still-try-alluxio-on-linux-without-sudo-privileges"); return TaskResult.FAILED; } } catch (IOException e) { System.err.format("Failed to validate ram disk mounting privilege at %s: %s.%n", path, e.getMessage()); return TaskResult.FAILED; } return TaskResult.OK; }

Target:
public TaskResult validate(Map<String, String> optionsMap) throws InterruptedException { String path = mConf.get(PropertyKey.WORKER_TIERED_STORE_LEVEL0_DIRS_PATH); String alias = mConf.get(PropertyKey.WORKER_TIERED_STORE_LEVEL0_ALIAS); if (!alias.equals("MEM")) { System.out.println("Top tier storage is not memory, skip validation."); return TaskResult.SKIPPED; } if (!OSUtils.isLinux()) { System.out.println("OS is not Linux, skip validation."); return TaskResult.SKIPPED; } if (path.isEmpty()) { System.err.println("Mount path is empty."); return TaskResult.FAILED; } if (path.split(",").length > 1) { System.out.println("Multiple storage paths for memory tier found. Skip validation."); return TaskResult.SKIPPED; } try { path = new AlluxioURI(path).getPath(); File file = new File(path); if (file.exists()) { if (!file.isDirectory()) { System.err.format("Path %s is not a directory.%n", path); return TaskResult.FAILED; } if (ShellUtils.isMountingPoint(path, new String[]{"ramfs", "tmpfs"})) { if (!file.canWrite()) { System.err.format("RAM disk at %s is not writable.%n", path); return TaskResult.FAILED; } System.out.format("RAM disk is mounted at %s, skip validation.%n", path); return TaskResult.SKIPPED; } } if (!checkSudoPrivilege()) { System.err.println("No sudo privilege to mount ramfs. " + "If you would like to run Alluxio worker without sudo privilege, please visit " + "<LINK_0>" + "can-i-still-try-alluxio-on-linux-without-sudo-privileges"); return TaskResult.FAILED; } } catch (IOException e) { System.err.format("Failed to validate ram disk mounting privilege at %s: %s.%n", path, e.getMessage()); return TaskResult.FAILED; } return TaskResult.OK; }