[ 
https://issues.apache.org/jira/browse/HADOOP-16948?focusedWorklogId=567015&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-567015
 ]

ASF GitHub Bot logged work on HADOOP-16948:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 16/Mar/21 15:02
            Start Date: 16/Mar/21 15:02
    Worklog Time Spent: 10m 
      Work Description: billierinaldi commented on a change in pull request 
#1925:
URL: https://github.com/apache/hadoop/pull/1925#discussion_r595255693



##########
File path: 
hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/AzureBlobFileSystemStore.java
##########
@@ -702,15 +735,72 @@ public OutputStream openFileForWrite(final Path path, 
final FileSystem.Statistic
         isAppendBlob = true;
       }
 
+      SelfRenewingLease lease = maybeCreateLease(relativePath);
+
       return new AbfsOutputStream(
           client,
           statistics,
           relativePath,
           offset,
-          populateAbfsOutputStreamContext(isAppendBlob));
+          populateAbfsOutputStreamContext(isAppendBlob, lease));
     }
   }
 
+  /**
+   * Acquire a lease on an ABFS file for a specified duration. This requires 
the file to exist.
+   *
+   * @param path file name
+   * @param duration time lease will be held before expiring
+   * @return the acquired lease ID
+   * @throws AzureBlobFileSystemException on any exception while acquiring the 
lease
+   */
+  public String acquireLease(final Path path, final int duration) throws 
AzureBlobFileSystemException {
+    LOG.debug("lease path: {}", path);
+
+    final AbfsRestOperation op =
+        client.acquireLease(getRelativePath(path), duration);
+
+    return 
op.getResult().getResponseHeader(HttpHeaderConfigurations.X_MS_LEASE_ID);
+  }
+
+  /**

Review comment:
       I'm not sure what you mean. Do you mean that we shouldn't have an 
acquireLease method in the store because leases will be acquired automatically?




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 567015)
    Time Spent: 5h 40m  (was: 5.5h)

> ABFS: Support single writer dirs
> --------------------------------
>
>                 Key: HADOOP-16948
>                 URL: https://issues.apache.org/jira/browse/HADOOP-16948
>             Project: Hadoop Common
>          Issue Type: Sub-task
>            Reporter: Billie Rinaldi
>            Assignee: Billie Rinaldi
>            Priority: Minor
>              Labels: abfsactive, pull-request-available
>          Time Spent: 5h 40m
>  Remaining Estimate: 0h
>
> This would allow some directories to be configured as single writer 
> directories. The ABFS driver would obtain a lease when creating or opening a 
> file for writing and would automatically renew the lease and release the 
> lease when closing the file.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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

Reply via email to