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

ASF GitHub Bot commented on ARROW-1902:
---------------------------------------

xhochy closed pull request #1402: ARROW-1902: [Python] Remove mkdir race 
condition from write_to_dataset
URL: https://github.com/apache/arrow/pull/1402
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/python/pyarrow/parquet.py b/python/pyarrow/parquet.py
index 9fb890c6e..d9f1bd2c3 100644
--- a/python/pyarrow/parquet.py
+++ b/python/pyarrow/parquet.py
@@ -1013,7 +1013,10 @@ def write_to_dataset(table, root_path, 
partition_cols=None,
         fs = _ensure_filesystem(filesystem)
 
     if fs._isfilestore() and not fs.exists(root_path):
-        fs.mkdir(root_path)
+        try:
+            fs.mkdir(root_path)
+        except OSError:
+            assert fs.exists(root_path)
 
     if partition_cols is not None and len(partition_cols) > 0:
         df = table.to_pandas()


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


> [Python] Remove mkdir race condition from write_to_dataset 
> -----------------------------------------------------------
>
>                 Key: ARROW-1902
>                 URL: https://issues.apache.org/jira/browse/ARROW-1902
>             Project: Apache Arrow
>          Issue Type: Improvement
>          Components: Python
>            Reporter: Uwe L. Korn
>            Assignee: Uwe L. Korn
>              Labels: pull-request-available
>             Fix For: 0.8.0
>
>
> If two processes create the same directory tree, one of them might see that a 
> directory does not exist but before the actual call to {{mkdir}} is done, the 
> second process already created the directory. In this case the former process 
> will raise an exception.



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

Reply via email to