snvijaya commented on a change in pull request #3026:
URL: https://github.com/apache/hadoop/pull/3026#discussion_r643842683



##########
File path: 
hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/services/AbfsClient.java
##########
@@ -585,6 +589,26 @@ public AbfsRestOperation append(final String path, final 
byte[] buffer,
       }
     }
 
+    if (lease != null && lease.getLeaseID() != null && 
!lease.getLeaseID().isEmpty()) {

Review comment:
       Add below member functions to AbfsLease : 
   1. boolean hasValidLease() - which will return value of ( lease.getLeaseID() 
!= null && !lease.getLeaseID().isEmpty())
   2. AddLeaseHeaders(List<AbfsHttpHeader> requestHeaders) - and move the 
requestHeader conditional header add logic into it

##########
File path: 
hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/services/AbfsClient.java
##########
@@ -648,16 +672,33 @@ public boolean appendSuccessCheckOp(AbfsRestOperation op, 
final String path,
   }
 
   public AbfsRestOperation flush(final String path, final long position, 
boolean retainUncommittedData,
-                                 boolean isClose, final String cachedSasToken, 
final String leaseId)
+                                 boolean isClose, final String cachedSasToken, 
AbfsLease lease)
       throws AzureBlobFileSystemException {
     final List<AbfsHttpHeader> requestHeaders = createDefaultHeaders();
     addCustomerProvidedKeyHeaders(requestHeaders);
     // JDK7 does not support PATCH, so to workaround the issue we will use
     // PUT and specify the real method in the X-Http-Method-Override header.
     requestHeaders.add(new AbfsHttpHeader(X_HTTP_METHOD_OVERRIDE,
             HTTP_METHOD_PATCH));
-    if (leaseId != null) {
-      requestHeaders.add(new AbfsHttpHeader(X_MS_LEASE_ID, leaseId));
+
+    if (lease != null && lease.getLeaseID() != null && 
!lease.getLeaseID().isEmpty()) {

Review comment:
       Same as above




-- 
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:
us...@infra.apache.org



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

Reply via email to