[
https://issues.apache.org/jira/browse/ARROW-12509?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17466915#comment-17466915
]
Antoine Pitrou commented on ARROW-12509:
----------------------------------------
Hmm, I'm trying to implement this using {{ifGenerationMatch}} and
{{ifGenerationNotMatch}}, but apparently the POST request always succeeds with
the GCS testbench, it's the subsequent PUT request that fails:
With {{IfGenerationMatch=0}} and an existing file:
{code}
INFO:werkzeug:127.0.0.1 - - [30/Dec/2021 15:10:25] "POST
/upload/storage/v1/b/l95tbwi5ar9y4ehsikntmu00gokcjrd7/o?ifGenerationMatch=0&uploadType=resumable&name=if-exists.txt
HTTP/1.1" 200 -
INFO:werkzeug:127.0.0.1 - - [30/Dec/2021 15:10:25] "PUT
/upload/storage/v1/b/l95tbwi5ar9y4ehsikntmu00gokcjrd7/o?uploadType=resumable&upload_id=25d866cf8542df6abaec31f6367c50d26ee4765ef66244a0e6c2a7d9c2009dc3
HTTP/1.1" 412 -
{code}
With {{IfGenerationNotMatch=0}} and a non-existing file:
{code}
INFO:werkzeug:127.0.0.1 - - [30/Dec/2021 15:10:25] "POST
/upload/storage/v1/b/fb90qwvinqshydbu5qbv2q6vibaegkbd/o?ifGenerationNotMatch=0&uploadType=resumable&name=if-not-exists.txt
HTTP/1.1" 200 -
INFO:werkzeug:127.0.0.1 - - [30/Dec/2021 15:10:25] "PUT
/upload/storage/v1/b/fb90qwvinqshydbu5qbv2q6vibaegkbd/o?uploadType=resumable&upload_id=a98b676e239654fa2050f7fb24dfdd192e062711bb69c53ba0d358d168766bbb
HTTP/1.1" 304 -
{code}
Does the actual Google Cloud implementation have the same behaviour, or is it a
quirk/bug in the testbench?
> [C++] More fine-grained control of file creation in filesystem layer
> --------------------------------------------------------------------
>
> Key: ARROW-12509
> URL: https://issues.apache.org/jira/browse/ARROW-12509
> Project: Apache Arrow
> Issue Type: Improvement
> Components: C++
> Reporter: Antoine Pitrou
> Assignee: Antoine Pitrou
> Priority: Major
>
> {{FileSystem::OpenOutputStream}} silently truncates an existing file.
> It would be better to give more control to the user. Ideally, one could
> choose between several options: "always overwrite and fail if doesn't exist",
> "overwrite if exists, otherwise create", "creates if doesn't exist, otherwise
> fails".
> One should research whether e.g. S3 supports such control.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)