You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "mapleFU (via GitHub)" <gi...@apache.org> on 2024/03/22 03:26:55 UTC

[PR] GH-40731: [C++][Parquet] Minor enhancement code of encryption [arrow]

mapleFU opened a new pull request, #40732:
URL: https://github.com/apache/arrow/pull/40732

   <!--
   Thanks for opening a pull request!
   If this is your first pull request you can find detailed information on how 
   to contribute here:
     * [New Contributor's Guide](https://arrow.apache.org/docs/dev/developers/guide/step_by_step/pr_lifecycle.html#reviews-and-merge-of-the-pull-request)
     * [Contributing Overview](https://arrow.apache.org/docs/dev/developers/overview.html)
   
   
   If this is not a [minor PR](https://github.com/apache/arrow/blob/main/CONTRIBUTING.md#Minor-Fixes). Could you open an issue for this pull request on GitHub? https://github.com/apache/arrow/issues/new/choose
   
   Opening GitHub issues ahead of time contributes to the [Openness](http://theapacheway.com/open/#:~:text=Openness%20allows%20new%20users%20the,must%20happen%20in%20the%20open.) of the Apache Arrow project.
   
   Then could you also rename the pull request title in the following format?
   
       GH-${GITHUB_ISSUE_ID}: [${COMPONENT}] ${SUMMARY}
   
   or
   
       MINOR: [${COMPONENT}] ${SUMMARY}
   
   In the case of PARQUET issues on JIRA the title also supports:
   
       PARQUET-${JIRA_ISSUE_ID}: [${COMPONENT}] ${SUMMARY}
   
   -->
   
   ### Rationale for this change
   
   <!--
    Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed.
    Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes.  
   -->
   
   * Applying more `std::move` in encryption
   * Trying to use `NULLPTR` rather than `NULL`.
   
   ### 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.
   -->
   
   Applying more `std::move` in encryption
   
   ### Are these changes tested?
   
   No need
   
   <!--
   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)?
   -->
   
   ### Are there any user-facing changes?
   
   No
   
   <!--
   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.
   -->
   <!-- **This PR includes breaking changes to public APIs.** -->
   
   <!--
   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.
   -->
   <!-- **This PR contains a "Critical Fix".** -->


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-40731: [C++][Parquet] Minor enhancement code of encryption [arrow]

Posted by "adamreeve (via GitHub)" <gi...@apache.org>.
adamreeve commented on code in PR #40732:
URL: https://github.com/apache/arrow/pull/40732#discussion_r1535243502


##########
cpp/src/parquet/encryption/file_key_unwrapper.cc:
##########
@@ -30,33 +30,37 @@ FileKeyUnwrapper::FileKeyUnwrapper(
     const std::string& file_path,
     const std::shared_ptr<::arrow::fs::FileSystem>& file_system)
     : FileKeyUnwrapper(std::move(key_toolkit), /*key_toolkit=*/nullptr,
-                       kms_connection_config, cache_lifetime_seconds, file_path,
-                       file_system) {}
+                       kms_connection_config, cache_lifetime_seconds,
+                       /*key_material_store=*/nullptr, file_path, file_system) {}
 
 FileKeyUnwrapper::FileKeyUnwrapper(
     KeyToolkit* key_toolkit, const KmsConnectionConfig& kms_connection_config,
     double cache_lifetime_seconds, const std::string& file_path,
     const std::shared_ptr<::arrow::fs::FileSystem>& file_system)
     : FileKeyUnwrapper(/*key_toolkit_owner=*/nullptr, key_toolkit, kms_connection_config,
-                       cache_lifetime_seconds, file_path, file_system) {}
+                       cache_lifetime_seconds, /*key_material_store=*/nullptr, file_path,
+                       file_system) {}
 
 FileKeyUnwrapper::FileKeyUnwrapper(
     KeyToolkit* key_toolkit, const KmsConnectionConfig& kms_connection_config,
     double cache_lifetime_seconds,
     std::shared_ptr<FileKeyMaterialStore> key_material_store)
     : FileKeyUnwrapper(/*key_toolkit_owner=*/nullptr, key_toolkit, kms_connection_config,
-                       cache_lifetime_seconds, /*file_path=*/"",
+                       cache_lifetime_seconds, std::move(key_material_store),

Review Comment:
   Oh actually it looks like the constructor parameter was being used prior to #40329, I didn't notice an extra commit was added to that PR to refactor the constructor parameters making it no longer used (https://github.com/apache/arrow/pull/40329/commits/7547c79b05e0657f6cd3961d01226c4fc84053af). But even though it was being used to set `key_material_store_` before, that was never actually used and the extra constructor overload wasn't needed.



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-40731: [C++][Parquet] Minor enhancement code of encryption [arrow]

Posted by "conbench-apache-arrow[bot] (via GitHub)" <gi...@apache.org>.
conbench-apache-arrow[bot] commented on PR #40732:
URL: https://github.com/apache/arrow/pull/40732#issuecomment-2020821517

   After merging your PR, Conbench analyzed the 7 benchmarking runs that have been run so far on merge-commit 145c4d35b273fd1a6cfa7c7adad23e6c02ae9a61.
   
   There was 1 benchmark result with an error:
   
   - Commit Run on `ursa-i9-9960x` at [2024-03-26 10:34:08Z](https://conbench.ursa.dev/compare/runs/74cc7f445b9a475696e38311c1cc3e41...9677400f28474afa97bdef1a851d10d7/)
     - [`tpch` (R) with engine=arrow, format=native, language=R, memory_map=False, query_id=TPCH-13, scale_factor=10](https://conbench.ursa.dev/benchmark-results/06602b9f82e774828000c8ca652cb920)
   
   There were no benchmark performance regressions. 🎉
   
   The [full Conbench report](https://github.com/apache/arrow/runs/23112619023) has more details. It also includes information about 26 possible false positives for unstable benchmarks that are known to sometimes produce them.


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-40731: [C++][Parquet] Minor enhancement code of encryption [arrow]

Posted by "mapleFU (via GitHub)" <gi...@apache.org>.
mapleFU commented on code in PR #40732:
URL: https://github.com/apache/arrow/pull/40732#discussion_r1535001401


##########
cpp/src/parquet/encryption/file_key_unwrapper.cc:
##########
@@ -30,33 +30,37 @@ FileKeyUnwrapper::FileKeyUnwrapper(
     const std::string& file_path,
     const std::shared_ptr<::arrow::fs::FileSystem>& file_system)
     : FileKeyUnwrapper(std::move(key_toolkit), /*key_toolkit=*/nullptr,
-                       kms_connection_config, cache_lifetime_seconds, file_path,
-                       file_system) {}
+                       kms_connection_config, cache_lifetime_seconds,
+                       /*key_material_store=*/nullptr, file_path, file_system) {}
 
 FileKeyUnwrapper::FileKeyUnwrapper(
     KeyToolkit* key_toolkit, const KmsConnectionConfig& kms_connection_config,
     double cache_lifetime_seconds, const std::string& file_path,
     const std::shared_ptr<::arrow::fs::FileSystem>& file_system)
     : FileKeyUnwrapper(/*key_toolkit_owner=*/nullptr, key_toolkit, kms_connection_config,
-                       cache_lifetime_seconds, file_path, file_system) {}
+                       cache_lifetime_seconds, /*key_material_store=*/nullptr, file_path,
+                       file_system) {}
 
 FileKeyUnwrapper::FileKeyUnwrapper(
     KeyToolkit* key_toolkit, const KmsConnectionConfig& kms_connection_config,
     double cache_lifetime_seconds,
     std::shared_ptr<FileKeyMaterialStore> key_material_store)
     : FileKeyUnwrapper(/*key_toolkit_owner=*/nullptr, key_toolkit, kms_connection_config,
-                       cache_lifetime_seconds, /*file_path=*/"",
+                       cache_lifetime_seconds, std::move(key_material_store),

Review Comment:
   @adamreeve I found previously this `key_material_store` is not used. Is this expected?



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-40731: [C++][Parquet] Minor enhancement code of encryption [arrow]

Posted by "mapleFU (via GitHub)" <gi...@apache.org>.
mapleFU commented on code in PR #40732:
URL: https://github.com/apache/arrow/pull/40732#discussion_r1538875789


##########
cpp/src/parquet/encryption/file_key_unwrapper.cc:
##########
@@ -30,33 +30,37 @@ FileKeyUnwrapper::FileKeyUnwrapper(
     const std::string& file_path,
     const std::shared_ptr<::arrow::fs::FileSystem>& file_system)
     : FileKeyUnwrapper(std::move(key_toolkit), /*key_toolkit=*/nullptr,
-                       kms_connection_config, cache_lifetime_seconds, file_path,
-                       file_system) {}
+                       kms_connection_config, cache_lifetime_seconds,
+                       /*key_material_store=*/nullptr, file_path, file_system) {}
 
 FileKeyUnwrapper::FileKeyUnwrapper(
     KeyToolkit* key_toolkit, const KmsConnectionConfig& kms_connection_config,
     double cache_lifetime_seconds, const std::string& file_path,
     const std::shared_ptr<::arrow::fs::FileSystem>& file_system)
     : FileKeyUnwrapper(/*key_toolkit_owner=*/nullptr, key_toolkit, kms_connection_config,
-                       cache_lifetime_seconds, file_path, file_system) {}
+                       cache_lifetime_seconds, /*key_material_store=*/nullptr, file_path,
+                       file_system) {}
 
 FileKeyUnwrapper::FileKeyUnwrapper(
     KeyToolkit* key_toolkit, const KmsConnectionConfig& kms_connection_config,
     double cache_lifetime_seconds,
     std::shared_ptr<FileKeyMaterialStore> key_material_store)
     : FileKeyUnwrapper(/*key_toolkit_owner=*/nullptr, key_toolkit, kms_connection_config,
-                       cache_lifetime_seconds, /*file_path=*/"",
+                       cache_lifetime_seconds, std::move(key_material_store),

Review Comment:
   Sure



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-40731: [C++][Parquet] Minor enhancement code of encryption [arrow]

Posted by "wgtmac (via GitHub)" <gi...@apache.org>.
wgtmac commented on code in PR #40732:
URL: https://github.com/apache/arrow/pull/40732#discussion_r1535013937


##########
cpp/src/parquet/encryption/file_key_unwrapper.cc:
##########
@@ -30,33 +30,37 @@ FileKeyUnwrapper::FileKeyUnwrapper(
     const std::string& file_path,
     const std::shared_ptr<::arrow::fs::FileSystem>& file_system)
     : FileKeyUnwrapper(std::move(key_toolkit), /*key_toolkit=*/nullptr,
-                       kms_connection_config, cache_lifetime_seconds, file_path,
-                       file_system) {}
+                       kms_connection_config, cache_lifetime_seconds,
+                       /*key_material_store=*/nullptr, file_path, file_system) {}
 
 FileKeyUnwrapper::FileKeyUnwrapper(
     KeyToolkit* key_toolkit, const KmsConnectionConfig& kms_connection_config,
     double cache_lifetime_seconds, const std::string& file_path,
     const std::shared_ptr<::arrow::fs::FileSystem>& file_system)
     : FileKeyUnwrapper(/*key_toolkit_owner=*/nullptr, key_toolkit, kms_connection_config,
-                       cache_lifetime_seconds, file_path, file_system) {}
+                       cache_lifetime_seconds, /*key_material_store=*/nullptr, file_path,
+                       file_system) {}
 
 FileKeyUnwrapper::FileKeyUnwrapper(
     KeyToolkit* key_toolkit, const KmsConnectionConfig& kms_connection_config,
     double cache_lifetime_seconds,
     std::shared_ptr<FileKeyMaterialStore> key_material_store)
     : FileKeyUnwrapper(/*key_toolkit_owner=*/nullptr, key_toolkit, kms_connection_config,
-                       cache_lifetime_seconds, /*file_path=*/"",
+                       cache_lifetime_seconds, std::move(key_material_store),

Review Comment:
   It seems that FileKeyMaterialStore is only required when master key rotation is used. Otherwise it is null and created internally based on file path and file system.



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-40731: [C++][Parquet] Minor enhancement code of encryption [arrow]

Posted by "adamreeve (via GitHub)" <gi...@apache.org>.
adamreeve commented on code in PR #40732:
URL: https://github.com/apache/arrow/pull/40732#discussion_r1536106074


##########
cpp/src/parquet/encryption/file_key_unwrapper.cc:
##########
@@ -30,33 +30,37 @@ FileKeyUnwrapper::FileKeyUnwrapper(
     const std::string& file_path,
     const std::shared_ptr<::arrow::fs::FileSystem>& file_system)
     : FileKeyUnwrapper(std::move(key_toolkit), /*key_toolkit=*/nullptr,
-                       kms_connection_config, cache_lifetime_seconds, file_path,
-                       file_system) {}
+                       kms_connection_config, cache_lifetime_seconds,
+                       /*key_material_store=*/nullptr, file_path, file_system) {}
 
 FileKeyUnwrapper::FileKeyUnwrapper(
     KeyToolkit* key_toolkit, const KmsConnectionConfig& kms_connection_config,
     double cache_lifetime_seconds, const std::string& file_path,
     const std::shared_ptr<::arrow::fs::FileSystem>& file_system)
     : FileKeyUnwrapper(/*key_toolkit_owner=*/nullptr, key_toolkit, kms_connection_config,
-                       cache_lifetime_seconds, file_path, file_system) {}
+                       cache_lifetime_seconds, /*key_material_store=*/nullptr, file_path,
+                       file_system) {}
 
 FileKeyUnwrapper::FileKeyUnwrapper(
     KeyToolkit* key_toolkit, const KmsConnectionConfig& kms_connection_config,
     double cache_lifetime_seconds,
     std::shared_ptr<FileKeyMaterialStore> key_material_store)
     : FileKeyUnwrapper(/*key_toolkit_owner=*/nullptr, key_toolkit, kms_connection_config,
-                       cache_lifetime_seconds, /*file_path=*/"",
+                       cache_lifetime_seconds, std::move(key_material_store),

Review Comment:
   Yeah I think it depends on whether removing the overload is likely to affect any users. Your change is correct, but @pitrou's change not breaking anything exposed that the extra overload wasn't really needed by `KeyToolkit::RotateMasterKeys`. I guess it doesn't hurt to keep it as is, but it might be nice to remove the overload to simplify things.



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-40731: [C++][Parquet] Minor enhancement code of encryption [arrow]

Posted by "pitrou (via GitHub)" <gi...@apache.org>.
pitrou merged PR #40732:
URL: https://github.com/apache/arrow/pull/40732


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-40731: [C++][Parquet] Minor enhancement code of encryption [arrow]

Posted by "mapleFU (via GitHub)" <gi...@apache.org>.
mapleFU commented on PR #40732:
URL: https://github.com/apache/arrow/pull/40732#issuecomment-2014771168

   Also cc @pitrou 


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-40731: [C++][Parquet] Minor enhancement code of encryption [arrow]

Posted by "wgtmac (via GitHub)" <gi...@apache.org>.
wgtmac commented on code in PR #40732:
URL: https://github.com/apache/arrow/pull/40732#discussion_r1535014722


##########
cpp/src/parquet/encryption/file_key_unwrapper.cc:
##########
@@ -30,33 +30,37 @@ FileKeyUnwrapper::FileKeyUnwrapper(
     const std::string& file_path,
     const std::shared_ptr<::arrow::fs::FileSystem>& file_system)
     : FileKeyUnwrapper(std::move(key_toolkit), /*key_toolkit=*/nullptr,
-                       kms_connection_config, cache_lifetime_seconds, file_path,
-                       file_system) {}
+                       kms_connection_config, cache_lifetime_seconds,
+                       /*key_material_store=*/nullptr, file_path, file_system) {}
 
 FileKeyUnwrapper::FileKeyUnwrapper(
     KeyToolkit* key_toolkit, const KmsConnectionConfig& kms_connection_config,
     double cache_lifetime_seconds, const std::string& file_path,
     const std::shared_ptr<::arrow::fs::FileSystem>& file_system)
     : FileKeyUnwrapper(/*key_toolkit_owner=*/nullptr, key_toolkit, kms_connection_config,
-                       cache_lifetime_seconds, file_path, file_system) {}
+                       cache_lifetime_seconds, /*key_material_store=*/nullptr, file_path,
+                       file_system) {}
 
 FileKeyUnwrapper::FileKeyUnwrapper(
     KeyToolkit* key_toolkit, const KmsConnectionConfig& kms_connection_config,
     double cache_lifetime_seconds,
     std::shared_ptr<FileKeyMaterialStore> key_material_store)
     : FileKeyUnwrapper(/*key_toolkit_owner=*/nullptr, key_toolkit, kms_connection_config,
-                       cache_lifetime_seconds, /*file_path=*/"",
+                       cache_lifetime_seconds, std::move(key_material_store),

Review Comment:
   It would be good for @adamreeve to double check if this is required. If not, we probably should remove the parameter to reduce confusion.



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-40731: [C++][Parquet] Minor enhancement code of encryption [arrow]

Posted by "pitrou (via GitHub)" <gi...@apache.org>.
pitrou commented on code in PR #40732:
URL: https://github.com/apache/arrow/pull/40732#discussion_r1538871061


##########
cpp/src/parquet/encryption/file_key_unwrapper.cc:
##########
@@ -30,33 +30,37 @@ FileKeyUnwrapper::FileKeyUnwrapper(
     const std::string& file_path,
     const std::shared_ptr<::arrow::fs::FileSystem>& file_system)
     : FileKeyUnwrapper(std::move(key_toolkit), /*key_toolkit=*/nullptr,
-                       kms_connection_config, cache_lifetime_seconds, file_path,
-                       file_system) {}
+                       kms_connection_config, cache_lifetime_seconds,
+                       /*key_material_store=*/nullptr, file_path, file_system) {}
 
 FileKeyUnwrapper::FileKeyUnwrapper(
     KeyToolkit* key_toolkit, const KmsConnectionConfig& kms_connection_config,
     double cache_lifetime_seconds, const std::string& file_path,
     const std::shared_ptr<::arrow::fs::FileSystem>& file_system)
     : FileKeyUnwrapper(/*key_toolkit_owner=*/nullptr, key_toolkit, kms_connection_config,
-                       cache_lifetime_seconds, file_path, file_system) {}
+                       cache_lifetime_seconds, /*key_material_store=*/nullptr, file_path,
+                       file_system) {}
 
 FileKeyUnwrapper::FileKeyUnwrapper(
     KeyToolkit* key_toolkit, const KmsConnectionConfig& kms_connection_config,
     double cache_lifetime_seconds,
     std::shared_ptr<FileKeyMaterialStore> key_material_store)
     : FileKeyUnwrapper(/*key_toolkit_owner=*/nullptr, key_toolkit, kms_connection_config,
-                       cache_lifetime_seconds, /*file_path=*/"",
+                       cache_lifetime_seconds, std::move(key_material_store),

Review Comment:
   Can you open an issue for exploring whether the overload can be removed? In the meantime we can merge this PR.



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-40731: [C++][Parquet] Minor enhancement code of encryption [arrow]

Posted by "mapleFU (via GitHub)" <gi...@apache.org>.
mapleFU commented on code in PR #40732:
URL: https://github.com/apache/arrow/pull/40732#discussion_r1535321204


##########
cpp/src/parquet/encryption/file_key_unwrapper.cc:
##########
@@ -30,33 +30,37 @@ FileKeyUnwrapper::FileKeyUnwrapper(
     const std::string& file_path,
     const std::shared_ptr<::arrow::fs::FileSystem>& file_system)
     : FileKeyUnwrapper(std::move(key_toolkit), /*key_toolkit=*/nullptr,
-                       kms_connection_config, cache_lifetime_seconds, file_path,
-                       file_system) {}
+                       kms_connection_config, cache_lifetime_seconds,
+                       /*key_material_store=*/nullptr, file_path, file_system) {}
 
 FileKeyUnwrapper::FileKeyUnwrapper(
     KeyToolkit* key_toolkit, const KmsConnectionConfig& kms_connection_config,
     double cache_lifetime_seconds, const std::string& file_path,
     const std::shared_ptr<::arrow::fs::FileSystem>& file_system)
     : FileKeyUnwrapper(/*key_toolkit_owner=*/nullptr, key_toolkit, kms_connection_config,
-                       cache_lifetime_seconds, file_path, file_system) {}
+                       cache_lifetime_seconds, /*key_material_store=*/nullptr, file_path,
+                       file_system) {}
 
 FileKeyUnwrapper::FileKeyUnwrapper(
     KeyToolkit* key_toolkit, const KmsConnectionConfig& kms_connection_config,
     double cache_lifetime_seconds,
     std::shared_ptr<FileKeyMaterialStore> key_material_store)
     : FileKeyUnwrapper(/*key_toolkit_owner=*/nullptr, key_toolkit, kms_connection_config,
-                       cache_lifetime_seconds, /*file_path=*/"",
+                       cache_lifetime_seconds, std::move(key_material_store),

Review Comment:
   So my edit is correct? Or I should removing this? I'm not sure would legacy user using this



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-40731: [C++][Parquet] Minor enhancement code of encryption [arrow]

Posted by "mapleFU (via GitHub)" <gi...@apache.org>.
mapleFU commented on code in PR #40732:
URL: https://github.com/apache/arrow/pull/40732#discussion_r1535321204


##########
cpp/src/parquet/encryption/file_key_unwrapper.cc:
##########
@@ -30,33 +30,37 @@ FileKeyUnwrapper::FileKeyUnwrapper(
     const std::string& file_path,
     const std::shared_ptr<::arrow::fs::FileSystem>& file_system)
     : FileKeyUnwrapper(std::move(key_toolkit), /*key_toolkit=*/nullptr,
-                       kms_connection_config, cache_lifetime_seconds, file_path,
-                       file_system) {}
+                       kms_connection_config, cache_lifetime_seconds,
+                       /*key_material_store=*/nullptr, file_path, file_system) {}
 
 FileKeyUnwrapper::FileKeyUnwrapper(
     KeyToolkit* key_toolkit, const KmsConnectionConfig& kms_connection_config,
     double cache_lifetime_seconds, const std::string& file_path,
     const std::shared_ptr<::arrow::fs::FileSystem>& file_system)
     : FileKeyUnwrapper(/*key_toolkit_owner=*/nullptr, key_toolkit, kms_connection_config,
-                       cache_lifetime_seconds, file_path, file_system) {}
+                       cache_lifetime_seconds, /*key_material_store=*/nullptr, file_path,
+                       file_system) {}
 
 FileKeyUnwrapper::FileKeyUnwrapper(
     KeyToolkit* key_toolkit, const KmsConnectionConfig& kms_connection_config,
     double cache_lifetime_seconds,
     std::shared_ptr<FileKeyMaterialStore> key_material_store)
     : FileKeyUnwrapper(/*key_toolkit_owner=*/nullptr, key_toolkit, kms_connection_config,
-                       cache_lifetime_seconds, /*file_path=*/"",
+                       cache_lifetime_seconds, std::move(key_material_store),

Review Comment:
   So my edit is correct? Or I should removing this?



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-40731: [C++][Parquet] Minor enhancement code of encryption [arrow]

Posted by "wgtmac (via GitHub)" <gi...@apache.org>.
wgtmac commented on code in PR #40732:
URL: https://github.com/apache/arrow/pull/40732#discussion_r1538508126


##########
cpp/src/parquet/encryption/file_key_unwrapper.cc:
##########
@@ -30,33 +30,37 @@ FileKeyUnwrapper::FileKeyUnwrapper(
     const std::string& file_path,
     const std::shared_ptr<::arrow::fs::FileSystem>& file_system)
     : FileKeyUnwrapper(std::move(key_toolkit), /*key_toolkit=*/nullptr,
-                       kms_connection_config, cache_lifetime_seconds, file_path,
-                       file_system) {}
+                       kms_connection_config, cache_lifetime_seconds,
+                       /*key_material_store=*/nullptr, file_path, file_system) {}
 
 FileKeyUnwrapper::FileKeyUnwrapper(
     KeyToolkit* key_toolkit, const KmsConnectionConfig& kms_connection_config,
     double cache_lifetime_seconds, const std::string& file_path,
     const std::shared_ptr<::arrow::fs::FileSystem>& file_system)
     : FileKeyUnwrapper(/*key_toolkit_owner=*/nullptr, key_toolkit, kms_connection_config,
-                       cache_lifetime_seconds, file_path, file_system) {}
+                       cache_lifetime_seconds, /*key_material_store=*/nullptr, file_path,
+                       file_system) {}
 
 FileKeyUnwrapper::FileKeyUnwrapper(
     KeyToolkit* key_toolkit, const KmsConnectionConfig& kms_connection_config,
     double cache_lifetime_seconds,
     std::shared_ptr<FileKeyMaterialStore> key_material_store)
     : FileKeyUnwrapper(/*key_toolkit_owner=*/nullptr, key_toolkit, kms_connection_config,
-                       cache_lifetime_seconds, /*file_path=*/"",
+                       cache_lifetime_seconds, std::move(key_material_store),

Review Comment:
   I agree with the current change to fix the missing argument instead of removing a public function.



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-40731: [C++][Parquet] Minor enhancement code of encryption [arrow]

Posted by "adamreeve (via GitHub)" <gi...@apache.org>.
adamreeve commented on code in PR #40732:
URL: https://github.com/apache/arrow/pull/40732#discussion_r1535224399


##########
cpp/src/parquet/encryption/file_key_unwrapper.cc:
##########
@@ -30,33 +30,37 @@ FileKeyUnwrapper::FileKeyUnwrapper(
     const std::string& file_path,
     const std::shared_ptr<::arrow::fs::FileSystem>& file_system)
     : FileKeyUnwrapper(std::move(key_toolkit), /*key_toolkit=*/nullptr,
-                       kms_connection_config, cache_lifetime_seconds, file_path,
-                       file_system) {}
+                       kms_connection_config, cache_lifetime_seconds,
+                       /*key_material_store=*/nullptr, file_path, file_system) {}
 
 FileKeyUnwrapper::FileKeyUnwrapper(
     KeyToolkit* key_toolkit, const KmsConnectionConfig& kms_connection_config,
     double cache_lifetime_seconds, const std::string& file_path,
     const std::shared_ptr<::arrow::fs::FileSystem>& file_system)
     : FileKeyUnwrapper(/*key_toolkit_owner=*/nullptr, key_toolkit, kms_connection_config,
-                       cache_lifetime_seconds, file_path, file_system) {}
+                       cache_lifetime_seconds, /*key_material_store=*/nullptr, file_path,
+                       file_system) {}
 
 FileKeyUnwrapper::FileKeyUnwrapper(
     KeyToolkit* key_toolkit, const KmsConnectionConfig& kms_connection_config,
     double cache_lifetime_seconds,
     std::shared_ptr<FileKeyMaterialStore> key_material_store)
     : FileKeyUnwrapper(/*key_toolkit_owner=*/nullptr, key_toolkit, kms_connection_config,
-                       cache_lifetime_seconds, /*file_path=*/"",
+                       cache_lifetime_seconds, std::move(key_material_store),

Review Comment:
   This is unexpected. It looks like during the process of working on #34181 I refactored things so that this parameter was no longer used but didn't realise this. The `FileKeyUnwrapper` created in `KeyToolkit::RotateMasterKeys` is only ever used to call `GetDataEncryptionKey`, which takes a `KeyMaterial` parameter so bypasses the `key_material_store_` completely, and there's no reason it should need to be passed in to the constructor.
   
   I also added an incorrect comment about this constructor overload in `file_key_unwrapper.h`, saying, "This is useful for key rotation to allow accessing the key material store after it is used." I guess I got myself confused with the use of the `temp_key_material_store` passed to the `FileKeyWrapper`.
   
   It seems to me that this overload can be removed completely, and `KeyToolkit::RotateMasterKeys` can use the other constructor. The `file_path` and `filesystem` could be provided but won't be used.



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-40731: [C++][Parquet] Minor enhancement code of encryption [arrow]

Posted by "adamreeve (via GitHub)" <gi...@apache.org>.
adamreeve commented on code in PR #40732:
URL: https://github.com/apache/arrow/pull/40732#discussion_r1535243502


##########
cpp/src/parquet/encryption/file_key_unwrapper.cc:
##########
@@ -30,33 +30,37 @@ FileKeyUnwrapper::FileKeyUnwrapper(
     const std::string& file_path,
     const std::shared_ptr<::arrow::fs::FileSystem>& file_system)
     : FileKeyUnwrapper(std::move(key_toolkit), /*key_toolkit=*/nullptr,
-                       kms_connection_config, cache_lifetime_seconds, file_path,
-                       file_system) {}
+                       kms_connection_config, cache_lifetime_seconds,
+                       /*key_material_store=*/nullptr, file_path, file_system) {}
 
 FileKeyUnwrapper::FileKeyUnwrapper(
     KeyToolkit* key_toolkit, const KmsConnectionConfig& kms_connection_config,
     double cache_lifetime_seconds, const std::string& file_path,
     const std::shared_ptr<::arrow::fs::FileSystem>& file_system)
     : FileKeyUnwrapper(/*key_toolkit_owner=*/nullptr, key_toolkit, kms_connection_config,
-                       cache_lifetime_seconds, file_path, file_system) {}
+                       cache_lifetime_seconds, /*key_material_store=*/nullptr, file_path,
+                       file_system) {}
 
 FileKeyUnwrapper::FileKeyUnwrapper(
     KeyToolkit* key_toolkit, const KmsConnectionConfig& kms_connection_config,
     double cache_lifetime_seconds,
     std::shared_ptr<FileKeyMaterialStore> key_material_store)
     : FileKeyUnwrapper(/*key_toolkit_owner=*/nullptr, key_toolkit, kms_connection_config,
-                       cache_lifetime_seconds, /*file_path=*/"",
+                       cache_lifetime_seconds, std::move(key_material_store),

Review Comment:
   Oh actually it looks like the constructor parameter was being used prior to #40329, I didn't notice an extra commit was added to that PR to refactor the constructor parameters making it no longer used (https://github.com/apache/arrow/pull/40329/commits/7547c79b05e0657f6cd3961d01226c4fc84053af). But even though it was being used to set `key_material_store_` before, that was never actually required for `KeyToolkit::RotateMasterKeys` and the extra constructor overload wasn't needed.



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-40731: [C++][Parquet] Minor enhancement code of encryption [arrow]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #40732:
URL: https://github.com/apache/arrow/pull/40732#issuecomment-2014280974

   :warning: GitHub issue #40731 **has been automatically assigned in GitHub** to PR creator.


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org