You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@graphar.apache.org by "acezen (via GitHub)" <gi...@apache.org> on 2024/08/01 06:04:21 UTC
[PR] fix(c++): Add FinalizeS3 function to release S3 resource [incubator-graphar]
acezen opened a new pull request, #571:
URL: https://github.com/apache/incubator-graphar/pull/571
<!--
Thanks for contributing to GraphAr.
If this is your first pull request you can find detailed information on [CONTRIBUTING.md](https://github.com/apache/graphar/blob/main/CONTRIBUTING.md)
The Apache GraphAr (incubating) community has restrictions on the naming of pr title. You can find instructions in
[CONTRIBUTING.md](https://github.com/apache/graphar/blob/main/CONTRIBUTING.md#title) too.
-->
### Reason for this PR
<!--
Why are you proposing this change? If this is already tracked in an issue, please link to the issue here.
Explaining clearly why this change is beneficial is important for the reviewers to understand the context.
-->
fix issue #566
### What changes are included in this PR?
<!--
There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR.
-->
Add a `FinalizeS3` method and related document for working AWS S3 storage with C++ SDK
### Are these changes tested?
<!--
We typically require tests for all PRs in order to:
1. Prevent the code from being accidentally broken by subsequent changes
2. Serve as another way to document the expected behavior of the code
If tests are not included in your PR, please explain why (for example, are they covered by existing tests)?
-->
yes
### Are there any user-facing changes?
<!--
If there are user-facing changes then we may require documentation to be updated before approving the PR.
-->
<!--
If there are any breaking changes to public APIs, please uncomment the line below and explain which changes are breaking.
-->
<!-- **BREAKING CHANGE: <description>** -->
no
<!--
Please uncomment the line below (and provide explanation) if the changes fix either
(a) a security vulnerability,
(b) a bug that caused incorrect or invalid data to be produced, or
(c) a bug that causes a crash (even when the API contract is upheld).
We use this to highlight fixes to issues that may affect users without their knowledge. For this reason, fixing bugs that cause errors don't count, since those are usually obvious.
-->
<!-- **Critical Fix: <description>** -->
--
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.
To unsubscribe, e-mail: commits-unsubscribe@graphar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@graphar.apache.org
For additional commands, e-mail: commits-help@graphar.apache.org
Re: [PR] fix(c++): Add FinalizeS3 function to release S3 resource [incubator-graphar]
Posted by "yecol (via GitHub)" <gi...@apache.org>.
yecol commented on code in PR #571:
URL: https://github.com/apache/incubator-graphar/pull/571#discussion_r1701105488
##########
cpp/src/graphar/filesystem.h:
##########
@@ -153,4 +153,15 @@ class FileSystem {
Result<std::shared_ptr<FileSystem>> FileSystemFromUriOrPath(
const std::string& uri, std::string* out_path = nullptr);
+/**
+ * @brief Shutdown the S3 APIs.
+ *
+ * This function should be called before the program exits to ensure that
+ * all S3 resources are properly released.
+ *
+ * This function calls arrow:fs::FinalizeS3() internally.
+ *
+ */
+Status FinalizeS3();
Review Comment:
I feel a little confused about this API design:
- users are asked to Finalize S3 **explicitly**, while this filesystem is not initialized by a function `InitS3()`, but got from a function `FileSystemFromUriOrPath` **implicitly**.
- IMO, why not put the finalizing code in `~FileSystem()`?
--
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.
To unsubscribe, e-mail: commits-unsubscribe@graphar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@graphar.apache.org
For additional commands, e-mail: commits-help@graphar.apache.org
Re: [PR] fix(c++): Add FinalizeS3 function to release S3 resource [incubator-graphar]
Posted by "lixueclaire (via GitHub)" <gi...@apache.org>.
lixueclaire commented on code in PR #571:
URL: https://github.com/apache/incubator-graphar/pull/571#discussion_r1703447212
##########
cpp/src/graphar/filesystem.h:
##########
@@ -153,4 +153,15 @@ class FileSystem {
Result<std::shared_ptr<FileSystem>> FileSystemFromUriOrPath(
const std::string& uri, std::string* out_path = nullptr);
+/**
+ * @brief Shutdown the S3 APIs.
+ *
+ * This function should be called before the program exits to ensure that
+ * all S3 resources are properly released.
+ *
+ * This function calls arrow:fs::FinalizeS3() internally.
+ *
+ */
+Status FinalizeS3();
Review Comment:
> I feel a little confused about this API design:
>
> * users are asked to Finalize S3 **explicitly**, while this filesystem is not initialized by a function `InitS3()`, but got from a function `FileSystemFromUriOrPath` **implicitly**.
> * IMO, why not put the finalizing code in `~FileSystem()`?
Agree, putting it in `~FileSystem()` may be more intuitive.
--
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.
To unsubscribe, e-mail: commits-unsubscribe@graphar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@graphar.apache.org
For additional commands, e-mail: commits-help@graphar.apache.org
Re: [PR] fix(c++): Add FinalizeS3 function to release S3 resource [incubator-graphar]
Posted by "acezen (via GitHub)" <gi...@apache.org>.
acezen commented on code in PR #571:
URL: https://github.com/apache/incubator-graphar/pull/571#discussion_r1703604347
##########
cpp/src/graphar/filesystem.h:
##########
@@ -153,4 +153,15 @@ class FileSystem {
Result<std::shared_ptr<FileSystem>> FileSystemFromUriOrPath(
const std::string& uri, std::string* out_path = nullptr);
+/**
+ * @brief Shutdown the S3 APIs.
+ *
+ * This function should be called before the program exits to ensure that
+ * all S3 resources are properly released.
+ *
+ * This function calls arrow:fs::FinalizeS3() internally.
+ *
+ */
+Status FinalizeS3();
Review Comment:
We can not put the `FinalizeS3` to the `~FileSystem`, since according arrow's design, the `InitializeS3` and `FinalizeS3` is not binding to a `FileSystem` object and just use to initialize and finalize the APIs of AWS S3 SDK[1][2]. So I add an `InitializeS3` API to let user to initialize S3 APIs explicitly.
[1]
https://github.com/apache/arrow/blob/bae2908b3142f1141941d740d42c5d403c01749f/cpp/src/arrow/filesystem/s3fs.h#L400-L408
[2]
https://github.com/apache/arrow/blob/bae2908b3142f1141941d740d42c5d403c01749f/cpp/src/arrow/filesystem/CMakeLists.txt#L94-L100
--
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.
To unsubscribe, e-mail: commits-unsubscribe@graphar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@graphar.apache.org
For additional commands, e-mail: commits-help@graphar.apache.org
Re: [PR] fix(c++): Add FinalizeS3 function to release S3 resource [incubator-graphar]
Posted by "acezen (via GitHub)" <gi...@apache.org>.
acezen merged PR #571:
URL: https://github.com/apache/incubator-graphar/pull/571
--
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.
To unsubscribe, e-mail: commits-unsubscribe@graphar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@graphar.apache.org
For additional commands, e-mail: commits-help@graphar.apache.org