[ https://issues.apache.org/jira/browse/HDFS-14777?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16918809#comment-16918809 ]
Íñigo Goiri commented on HDFS-14777: ------------------------------------ I have to say that all the ifs related to quotas are getting unreadable. The main one is: {code} if (mountTable != null && router.isQuotaEnabled() && (nsQuota != mountTable.getQuota().getQuota() || ssQuota != mountTable .getQuota().getSpaceQuota())) { synchronizeQuota(mountTable.getSourcePath(), mountTable.getQuota() .getQuota(), mountTable.getQuota().getSpaceQuota()); } {code} I think it would be more readable to do: if (mountTable != null && router.isQuotaEnabled()) { RouterQuotaUsage mountQuota = mountTable.getQuota(); if (nsQuota != mountQuota.getQuota() || ssQuota != mountQuota.getSpaceQuota()) { synchronizeQuota(mountTable.getSourcePath(), mountQuota.getQuota(), mountQuota.getSpaceQuota()); } } {code} We could even go further and use a function for {{nsQuota != mountQuota.getQuota() || ssQuota != mountQuota.getSpaceQuota()}}. We could also do a function for: {code} private RouterQuotaUsage getQuota() { ... // If not available return emptyQuota; ... MountTable entry = mResolver.getMountPoint(path); return entry.getQuota(); } {code} Anyway, take a pass to this and see if we can make it easier to read. For the log, let's take the chance to fix the toString() with: {code} LOG.warn("Unable to reset quota at the destinations for {}: {}", request.getEntry(), e.getMessage()); {code} > RBF: Set ReadOnly is failing for mount Table but actually readonly succed to > set > -------------------------------------------------------------------------------- > > Key: HDFS-14777 > URL: https://issues.apache.org/jira/browse/HDFS-14777 > Project: Hadoop HDFS > Issue Type: Bug > Reporter: Ranith Sardar > Assignee: Ranith Sardar > Priority: Major > Attachments: HDFS-14777.001.patch, HDFS-14777.002.patch > > > # hdfs dfsrouteradmin -update /test hacluster /test -readonly /opt/client # > hdfs dfsrouteradmin -update /test hacluster /test -readonly update: /test is > in a read only mount > pointorg.apache.hadoop.ipc.RemoteException(java.io.IOException): /test is in > a read only mount point at > org.apache.hadoop.hdfs.server.federation.router.RouterRpcServer.getLocationsForPath(RouterRpcServer.java:1419) > at > org.apache.hadoop.hdfs.server.federation.router.Quota.getQuotaRemoteLocations(Quota.java:217) > at > org.apache.hadoop.hdfs.server.federation.router.Quota.setQuota(Quota.java:75) > at > org.apache.hadoop.hdfs.server.federation.router.RouterAdminServer.synchronizeQuota(RouterAdminServer.java:288) > at > org.apache.hadoop.hdfs.server.federation.router.RouterAdminServer.updateMountTableEntry(RouterAdminServer.java:267) -- This message was sent by Atlassian Jira (v8.3.2#803003) --------------------------------------------------------------------- To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org