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

Íñigo Goiri commented on HDFS-12875:
------------------------------------

[~linyiqun], actually the logic we have internally for this is a mount table 
where we can only read and not write.
Basically, in {{RouterRpcServer#getLocationsForPath}}, we have logic to control 
read only and locked paths:
{code}
      // We may block some write operations
      if (opCategory.get() == OperationCategory.WRITE) {
        // Check if the path is in a read only mount point
        if (isPathReadOnly(path)) {
          if (this.rpcMonitor != null) {
            this.rpcMonitor.routerFailureReadOnly();
          }
          throw new IOException(path + " is in a read only mount point");
        }
        // Check if the path is locked
        if (isPathLocked(path)) {
          if (this.rpcMonitor != null) {
            this.rpcMonitor.routerFailureLocked();
          }
          throw new IOException(path + " is locked");
        }
      }
{code}

Which uses:
{code}
  /**
   * Check if a path is in a read only mount point.
   *
   * @param path Path to check.
   * @return If the path is in a read only mount point.
   */
  private boolean isPathReadOnly(final String path) {
    if (subclusterResolver instanceof MountTableResolver) {
      try {
        MountTableResolver mountTable = (MountTableResolver)subclusterResolver;
        MountTable entry = mountTable.getMountPoint(path);
        if (entry != null && entry.isReadOnly()) {
          return true;
        }
      } catch (IOException e) {
        LOG.error("Cannot get mount point: {}", e.getMessage());
      }
    }
    return false;
  }

  /**
   * Check if the path is locked.
   *
   * @param path Path to check.
   * @return If the path is locked.
   * @throws IOException If the State Store is not available.
   */
  private boolean isPathLocked(final String path) throws IOException {
    return this.pathLockStore != null && this.pathLockStore.isLocked(path);
  }
{code}

The use case you propose is more like ACLs in the Mount Table management.
I think that is valuable.
What about adding full ACLs to the Mount Table management and other 
dfsrouteradmin options in this JIRA and I file another one for the the read 
only mount entries?

> RBF: Complete logic for -readonly option of dfsrouteradmin add command
> ----------------------------------------------------------------------
>
>                 Key: HDFS-12875
>                 URL: https://issues.apache.org/jira/browse/HDFS-12875
>             Project: Hadoop HDFS
>          Issue Type: Sub-task
>    Affects Versions: 3.0.0-alpha3
>            Reporter: Yiqun Lin
>            Assignee: Yiqun Lin
>              Labels: RBF
>         Attachments: HDFS-12875.001.patch
>
>
> Currently the option -readonly of command {{dfsrouteradmin -add}} doesn't 
> make any sense.The desired behavior is that read-only mount table that be set 
> in add command cannot be removed.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org

Reply via email to