Skip to content
Permalink
Browse files

client side check for pinning error

  • Loading branch information...
yuzhu committed May 15, 2019
1 parent 1aa99fd commit 73f0bbbcf4311de16d2226fe3a69904bb3498601
@@ -412,8 +412,6 @@ private void applyUpdateInode(UpdateInodeEntry entry) {
for (String medium : entry.getMediumTypeList()) {
if (mediaList.contains(medium)) {
file.getMediumTypes().add(medium);
} else {
LOG.warn("pinned medium types contain invalid medium");
}
}
}
@@ -14,6 +14,7 @@
import alluxio.AlluxioURI;
import alluxio.cli.CommandUtils;
import alluxio.client.file.FileSystemContext;
import alluxio.conf.PropertyKey;
import alluxio.exception.AlluxioException;
import alluxio.exception.status.InvalidArgumentException;

@@ -49,8 +50,13 @@ protected void runPlainPath(AlluxioURI path, CommandLine cl)
throws AlluxioException, IOException {
String[] args = cl.getArgs();
// args[0] is the path, args[1] to args[end] is the list of possible media to pin
List<String> mediumTypes = Arrays.asList(Arrays.copyOfRange(args, 1, args.length));
FileSystemCommandUtils.setPinned(mFileSystem, path, true, mediumTypes);
List<String> pinnedMediumTypes = Arrays.asList(Arrays.copyOfRange(args, 1, args.length));
List<String> availableMediumList = mFsContext.getPathConf(path).getList(
PropertyKey.MASTER_TIERED_STORE_GLOBAL_MEDIUMTYPES, ",");
if (!availableMediumList.containsAll(pinnedMediumTypes)) {
throw new IllegalArgumentException("Invalid medium to pin the file");
}
FileSystemCommandUtils.setPinned(mFileSystem, path, true, pinnedMediumTypes);
System.out.println("File '" + path + "' was successfully pinned.");
}

0 comments on commit 73f0bbb

Please sign in to comment.
You can’t perform that action at this time.