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

ASF GitHub Bot commented on HADOOP-19450:
-----------------------------------------

bhattmanish98 commented on code in PR #7364:
URL: https://github.com/apache/hadoop/pull/7364#discussion_r1958018325


##########
hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/services/AbfsDfsClient.java:
##########
@@ -402,11 +406,32 @@ public AbfsRestOperation createPath(final String path,
       if (!op.hasResult()) {
         throw ex;
       }
-      if (!isFile && op.getResult().getStatusCode() == 
HttpURLConnection.HTTP_CONFLICT) {
-        String existingResource =
-            op.getResult().getResponseHeader(X_MS_EXISTING_RESOURCE_TYPE);
-        if (existingResource != null && existingResource.equals(DIRECTORY)) {
-          return op; //don't throw ex on mkdirs for existing directory
+      if (!isFile) {
+        if (op.getResult().getStatusCode() == HttpURLConnection.HTTP_CONFLICT) 
{
+          String existingResource =
+              op.getResult().getResponseHeader(X_MS_EXISTING_RESOURCE_TYPE);
+          if (existingResource != null && existingResource.equals(DIRECTORY)) {
+            return op; //don't throw ex on mkdirs for existing directory
+          }
+        }
+      } else {
+        // recovery using client transaction id only if it is a retried 
request.
+        if (op.isARetriedRequest() && clientTransactionId != null
+            && (op.getResult().getStatusCode() == 
HttpURLConnection.HTTP_CONFLICT
+            || op.getResult().getStatusCode() == 
HttpURLConnection.HTTP_PRECON_FAILED)) {
+          try {
+            final AbfsHttpOperation getPathStatusOp =
+                getPathStatus(path, false,
+                    tracingContext, null).getResult();
+            if (clientTransactionId.equals(
+                getPathStatusOp.getResponseHeader(
+                    X_MS_CLIENT_TRANSACTION_ID))) {
+              return op;
+            }
+          } catch (AzureBlobFileSystemException ignored) {
+            // In case of get path status failure,

Review Comment:
   Yes, in case we get exception on getPathStatus, we are raising original 
exception.





> [ABFS] Rename/Create path idempotency client-level resolution
> -------------------------------------------------------------
>
>                 Key: HADOOP-19450
>                 URL: https://issues.apache.org/jira/browse/HADOOP-19450
>             Project: Hadoop Common
>          Issue Type: Task
>          Components: fs/azure
>    Affects Versions: 3.5.0
>            Reporter: Manish Bhatt
>            Assignee: Manish Bhatt
>            Priority: Major
>              Labels: pull-request-available
>
> CreatePath and RenamePath APIs are idempotent as subsequent retries on same 
> resource don’t change the server state. However, when client experiences 
> connection break on the CreatePath and the RenamePath APIs, client cannot 
> make sense if the request is accepted by the server or not. 
> On connection failure, the client retries the request. The server might 
> return 404 (sourceNotFound) in case of RenamePath API and 409 
> (pathAlreadyExists) in case of CreatePath (overwrite=false) API. Now the 
> client doesn’t have a path forward. Reason being, in case of CreatePath, 
> client doesn’t know if the path was created on the original request or the 
> path was already there for some other request, in case of RenamePath, client 
> doesn’t know if the source was removed because of the original-try or it was 
> not there on the first place. 
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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

Reply via email to