[ https://issues.apache.org/jira/browse/HDFS-13815?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16592155#comment-16592155 ]
Brahma Reddy Battula commented on HDFS-13815: --------------------------------------------- Sorry for landing late. Currently both RouterAdmin#*addMount*(String[], int),RouterAdmin#*updateMount*(java.lang.String[], int) have same validation for params expect order ( HASH for addMount where updateMount isn't having. So,how about to extract to one class(inner) or Method..? So, that we can have all the params one place and maintenance will easy. I am thinking like below. Please correct me if I am wrong. {code:java} public boolean addMount(String[] parameters, int i) throws IOException { ValidateParams params = new ValidateParams(parameters, i,"addMount" ).invoke(); return addMount(params.getMount(), params.getNss(), params.getDest(), params.isReadOnly(), DestinationOrder.HASH, new ACLEntity(params.getOwner(), params.getGroup(), params.getMode())); } public boolean updateMount(String[] parameters, int i) throws IOException { ValidateParams params = new ValidateParams(parameters, i,"updateMount" ).invoke(); return updateMount(params.getMount(), params.getNss(), params.getDest(), params.isReadOnly(), params.getOrder(), new ACLEntity(params.getOwner(), params.getGroup(), params.getMode())); } {code} {code:java} private class ValidateParams { private String[] parameters; private int i; private String mount; private String[] nss; private String dest; private boolean readOnly; private String owner; private String group; private FsPermission mode; private DestinationOrder order; public ValidateParams(String[] parameters, int i, String cmd) { this.parameters = parameters; this.i = i; } public String getMount() { return mount; } public String[] getNss() { return nss; } public String getDest() { return dest; } public boolean isReadOnly() { return readOnly; } public String getOwner() { return owner; } public String getGroup() { return group; } public FsPermission getMode() { return mode; } public DestinationOrder getOrder() { return order; } public ValidateParams invoke() { // Mandatory parameters mount = parameters[i++]; nss = parameters[i++].split(","); dest = parameters[i++]; // Optional parameters readOnly = false; owner = null; group = null; mode = null; order = DestinationOrder.HASH; while (i < parameters.length) { if (parameters[i].equals("-readonly")) { readOnly = true; } else if (parameters[i].equals("-order")) { i++; try { order = DestinationOrder.valueOf(parameters[i]); } catch(Exception e) { System.err.println("Cannot parse order: " + parameters[i]); } } else if (parameters[i].equals("-owner")) { i++; owner = parameters[i]; } else if (parameters[i].equals("-group")) { i++; group = parameters[i]; } else if (parameters[i].equals("-mode")) { i++; short modeValue = Short.parseShort(parameters[i], 8); mode = new FsPermission(modeValue); }else{ printUsage(cmd); } i++; } return this; } {code} > RBF: Add check to order command > ------------------------------- > > Key: HDFS-13815 > URL: https://issues.apache.org/jira/browse/HDFS-13815 > Project: Hadoop HDFS > Issue Type: Bug > Components: federation > Affects Versions: 3.0.0 > Reporter: Soumyapn > Assignee: Ranith Sardar > Priority: Major > Attachments: HDFS-13815-001.patch, HDFS-13815-002.patch, > HDFS-13815-003.patch, HDFS-13815-004.patch > > > No check being done on order command. > It says successfully updated mount table if we don't specify order command > and it is not updated in mount table > Execute the dfsrouter update command with the below scenarios. > 1. ./hdfs dfsrouteradmin -update /apps3 hacluster,ns2 /tmp6 RANDOM > 2. ./hdfs dfsrouteradmin -update /apps3 hacluster,ns2 /tmp6 -or RANDOM > 3. ./hdfs dfsrouteradmin -update /apps3 hacluster,ns2 /tmp6 -ord RANDOM > 4. ./hdfs dfsrouteradmin -update /apps3 hacluster,ns2 /tmp6 -orde RANDOM > > The console message says, Successfully updated mount point. But it is not > updated in the mount table. > > Expected Result: > Exception on console as the order command is missing/not written properl -- This message was sent by Atlassian JIRA (v7.6.3#76005) --------------------------------------------------------------------- To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org