[ 
https://issues.apache.org/jira/browse/HDFS-13602?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16494202#comment-16494202
 ] 

Chao Sun edited comment on HDFS-13602 at 5/29/18 8:28 PM:
----------------------------------------------------------

Also, it seems {{renewLease}} is checking the wrong operation type:
{code:java}
  /**
   * Renew the lease(s) held by the given client
   */
  void renewLease(String holder) throws IOException {
    checkOperation(OperationCategory.WRITE);
    readLock();
    try {
      checkOperation(OperationCategory.WRITE);
      checkNameNodeSafeMode("Cannot renew lease for " + holder);
      leaseManager.renewLease(holder);
    } finally {
      readUnlock("renewLease");
    }
  }
{code}
Shouldn't it be {{checkOperation(OperationCategory.READ);}}?


was (Author: csun):
Also, it seems {{renewLease}} is checking the wrong operation type:
{code}
  /**
   * Renew the lease(s) held by the given client
   */
  void renewLease(String holder) throws IOException {
    checkOperation(OperationCategory.WRITE);
    readLock();
    try {
      checkOperation(OperationCategory.WRITE);
      checkNameNodeSafeMode("Cannot renew lease for " + holder);
      leaseManager.renewLease(holder);
    } finally {
      readUnlock("renewLease");
    }
  }
{code}

Shouldn't it be {{checkOperation(OperationCategory.READ);}}

> Add checkOperation(WRITE) checks in FSNamesystem
> ------------------------------------------------
>
>                 Key: HDFS-13602
>                 URL: https://issues.apache.org/jira/browse/HDFS-13602
>             Project: Hadoop HDFS
>          Issue Type: Improvement
>          Components: ha, namenode
>            Reporter: Erik Krogen
>            Assignee: Chao Sun
>            Priority: Major
>         Attachments: HDFS-13602.000.patch, HDFS-13602.001.patch
>
>
> Similar to the work done in HDFS-4591 to avoid having to take a write lock 
> before checking if an operation category is allowed, we can do the same for 
> the write lock that is taken sometimes (when updating access time) within 
> getBlockLocations.
> This is particularly useful when using the standby read feature (HDFS-12943), 
> as it will be the case on an observer node that the operationCategory(READ) 
> check succeeds but the operationCategory(WRITE) check fails. It would be 
> ideal to fail this check _before_ acquiring the write lock.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to