[ https://issues.apache.org/jira/browse/HDFS-13787?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16847040#comment-16847040 ]
Ayush Saxena commented on HDFS-13787: ------------------------------------- Thanx for the patch. Couple of comments : * The quota check in the locations can be avoided, No need to verify quota for unrelated operations(On default it checks, Pass explicitly false). * {code:java} + /** + * Merge the outputs from multiple namespaces. + * + * @param <T> The type of the objects to merge. + * @param list Namespace to output array. + * @param clazz Class of the values. + * @return Array with the outputs. + */ + protected static <T> T[] merge(List<T[]> list, Class<T> clazz) { + + // Put all results into a set to avoid repeats + Set<T> ret = new LinkedHashSet<>(); + for (T[] values : list) { + for (T val : values) { + ret.add(val); + } + } + return toArray(ret, clazz); + } + + /** + * Convert a set of values into an array. + * @param <T> The type of the return objects. + * @param set Input set. + * @param clazz Class of the values. + * @return Array with the values in set. + */ + private static <T> T[] toArray(Collection<T> set, Class<T> clazz) { + @SuppressWarnings("unchecked") + T[] combinedData = (T[]) Array.newInstance(clazz, set.size()); + combinedData = set.toArray(combinedData); + return combinedData; + } {code} This is already in {{RouterRpcServer}}, it can be used from there only, rather than rewriting the same code. * Instead of {{isPathAll}} I think {{isInvokeConcurrent}} should be used in {{getSnapshotDiffReportListing}} * {code:java} + RemoteLocation loc0 = locations.get(0); + return (SnapshotDiffReportListing) rpcClient.invokeSingle( + loc0, remoteMethod); + } {code} Why not {{invokeSequential}} ? * {code:java} + private final ActiveNamenodeResolver namenodeResolver; + + + public RouterSnapshot(RouterRpcServer server) { {code} Avoid extra line. > RBF: Add Snapshot related ClientProtocol APIs > --------------------------------------------- > > Key: HDFS-13787 > URL: https://issues.apache.org/jira/browse/HDFS-13787 > Project: Hadoop HDFS > Issue Type: Sub-task > Components: federation > Reporter: Ranith Sardar > Assignee: Ranith Sardar > Priority: Major > Labels: RBF > Attachments: HDFS-13787-HDFS-13891.003.patch, > HDFS-13787-HDFS-13891.004.patch, HDFS-13787-HDFS-13891.005.patch, > HDFS-13787-HDFS-13891.006.patch, HDFS-13787-HDFS-13891.007.patch, > HDFS-13787.001.patch, HDFS-13787.002.patch > > > Currently, allowSnapshot, disallowSnapshot, renameSnapshot, createSnapshot, > deleteSnapshot , SnapshottableDirectoryStatus, getSnapshotDiffReport and > getSnapshotDiffReportListing are not implemented in RouterRpcServer. -- 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