goiri commented on code in PR #5554: URL: https://github.com/apache/hadoop/pull/5554#discussion_r1165888263
########## hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/store/protocol/AddAllMountTableEntryRequest.java: ########## @@ -0,0 +1,51 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hadoop.hdfs.server.federation.store.protocol; + +import java.util.List; + +import org.apache.hadoop.classification.InterfaceAudience; +import org.apache.hadoop.classification.InterfaceStability; +import org.apache.hadoop.hdfs.server.federation.store.driver.StateStoreSerializer; +import org.apache.hadoop.hdfs.server.federation.store.records.MountTable; + +/** + * API request for adding all mount table entries to the state store. + */ +public abstract class AddAllMountTableEntryRequest { Review Comment: I'm not sure "All" is the right concept. It looks more like `AddMountTableEntriesRequest` ########## hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/tools/federation/RouterAdmin.java: ########## @@ -462,6 +481,111 @@ public int run(String[] argv) throws Exception { return exitCode; } + private boolean addAllMount(String[] parameters, int i) throws IOException { + List<AddMountAttributes> addMountAttributesList = new ArrayList<>(); + while (i < parameters.length) { + // Mandatory parameters + String mount = parameters[i++]; + String[] nss = parameters[i++].split(","); + String dest = parameters[i++]; + + // Optional parameters + boolean readOnly = false; + boolean faultTolerant = false; + String owner = null; + String group = null; + FsPermission mode = null; + DestinationOrder order = DestinationOrder.HASH; + while (i < parameters.length && !",".equals(parameters[i])) { Review Comment: A lot of this parsing is similar to adding a single entry. Can we refactor this code so we use the other chunk? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
