Skip to content

Cxx 2496 #907

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 31 commits into from
Dec 20, 2022
Merged

Cxx 2496 #907

merged 31 commits into from
Dec 20, 2022

Conversation

kkloberdanz
Copy link
Contributor

@kkloberdanz kkloberdanz commented Dec 7, 2022

CXX-2496

Add FLE 2 behavior for CreateCollection() and Collection.Drop()

  • Sync the fle2-CreateCollection.yml CSFLE test.
  • Add encryptedFieldsMap option to AutoEncryptionOpts
  • Add encryptedFields options to CreateCollection and Collection.Drop()
  • Update behavior of CreateCollection and Collection.Drop() when the target collection has encryptedFields.

@codecov-commenter
Copy link

codecov-commenter commented Dec 8, 2022

Codecov Report

Merging #907 (526ca26) into master (a10c3f0) will decrease coverage by 17.05%.
The diff coverage is 13.04%.

❗ Current head 526ca26 differs from pull request most recent head 3a35d1b. Consider uploading reports for the commit 3a35d1b to get more accurate results

@@             Coverage Diff             @@
##           master     #907       +/-   ##
===========================================
- Coverage   91.28%   74.22%   -17.06%     
===========================================
  Files         384      384               
  Lines       23275    23310       +35     
===========================================
- Hits        21246    17302     -3944     
- Misses       2029     6008     +3979     
Impacted Files Coverage Δ
src/mongocxx/collection.hpp 100.00% <ø> (ø)
src/mongocxx/options/auto_encryption.hpp 100.00% <ø> (ø)
src/mongocxx/test/spec/operation.cpp 66.01% <0.00%> (-21.01%) ⬇️
src/mongocxx/options/auto_encryption.cpp 61.72% <11.11%> (-6.33%) ⬇️
src/mongocxx/test/spec/client_side_encryption.cpp 97.42% <33.33%> (-1.01%) ⬇️
src/mongocxx/collection.cpp 90.46% <50.00%> (-5.06%) ⬇️
src/mongocxx/private/libmongoc_symbols.hh 100.00% <100.00%> (ø)
examples/mongocxx/pool.cpp 0.00% <0.00%> (-100.00%) ⬇️
examples/mongocxx/create.cpp 0.00% <0.00%> (-100.00%) ⬇️
examples/mongocxx/gridfs.cpp 0.00% <0.00%> (-100.00%) ⬇️
... and 89 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@kkloberdanz
Copy link
Contributor Author

Not sure what could be causing this warning from the POWER build:

[2022/12/14 21:07:19.847] cd /data/mci/0776864d158095bf494026871536bc9c/mongo-cxx-driver/build/src/mongocxx/test && /usr/bin/c++  -DBSONCXX_TESTING -DMONGOCXX_TESTING -DMONGO_CXX_DRIVER_COMPILING -I/data/mci/0776864d158095bf494026871536bc9c/mongo-cxx-driver/src/third_party/catch/include -I/include -I/data/mci/0776864d158095bf494026871536bc9c/mongo-cxx-driver/src/mongocxx/.. -I/data/mci/0776864d158095bf494026871536bc9c/mongo-cxx-driver/build/src/mongocxx/.. -I/data/mci/0776864d158095bf494026871536bc9c/mongo-cxx-driver/build/src/bsoncxx/third_party/EP_mnmlstc_core-prefix/src/EP_mnmlstc_core/include -I/data/mci/0776864d158095bf494026871536bc9c/mongo-cxx-driver/build/install/include/bsoncxx/v_noabi -I/data/mci/0776864d158095bf494026871536bc9c/mongo-cxx-driver/src/bsoncxx/.. -I/data/mci/0776864d158095bf494026871536bc9c/mongo-cxx-driver/build/src/bsoncxx/.. -isystem /data/mci/0776864d158095bf494026871536bc9c/mongoc/include/libmongoc-1.0 -isystem /data/mci/0776864d158095bf494026871536bc9c/mongoc/include/libbson-1.0  -Wall -Wextra -Wconversion -Wnarrowing -Wno-expansion-to-defined -pedantic -Werror -Wno-missing-field-initializers -Wno-aligned-new -O3 -DNDEBUG   -Wno-maybe-uninitialized -std=c++11 -o CMakeFiles/test_driver.dir/write_concern.cpp.o -c /data/mci/0776864d158095bf494026871536bc9c/mongo-cxx-driver/src/mongocxx/test/write_concern.cpp
[2022/12/14 21:07:30.829] found libmongoc version 1.23.0-pre
[2022/12/14 21:07:30.829] In file included from /data/mci/0776864d158095bf494026871536bc9c/mongo-cxx-driver/src/mongocxx/../bsoncxx/stdx/optional.hpp:22,
[2022/12/14 21:07:30.829]                  from /data/mci/0776864d158095bf494026871536bc9c/mongo-cxx-driver/src/mongocxx/../bsoncxx/view_or_value.hpp:19,
[2022/12/14 21:07:30.829]                  from /data/mci/0776864d158095bf494026871536bc9c/mongo-cxx-driver/src/mongocxx/../bsoncxx/array/view_or_value.hpp:20,
[2022/12/14 21:07:30.829]                  from /data/mci/0776864d158095bf494026871536bc9c/mongo-cxx-driver/src/mongocxx/../bsoncxx/types/bson_value/value.hpp:21,
[2022/12/14 21:07:30.829]                  from /data/mci/0776864d158095bf494026871536bc9c/mongo-cxx-driver/src/mongocxx/test/spec/unified_tests/entity.hh:20,
[2022/12/14 21:07:30.829]                  from /data/mci/0776864d158095bf494026871536bc9c/mongo-cxx-driver/src/mongocxx/test/spec/unified_tests/assert.hh:17,
[2022/12/14 21:07:30.829]                  from /data/mci/0776864d158095bf494026871536bc9c/mongo-cxx-driver/src/mongocxx/test/spec/unified_tests/runner.cpp:21:
[2022/12/14 21:07:30.829] /data/mci/0776864d158095bf494026871536bc9c/mongo-cxx-driver/build/src/bsoncxx/third_party/EP_mnmlstc_core-prefix/src/EP_mnmlstc_core/include/core/optional.hpp: In function ‘bool {anonymous}::add_to_map(const bsoncxx::v_noabi::array::element&)’:
[2022/12/14 21:07:30.829] /data/mci/0776864d158095bf494026871536bc9c/mongo-cxx-driver/build/src/bsoncxx/third_party/EP_mnmlstc_core-prefix/src/EP_mnmlstc_core/include/core/optional.hpp:108:5: error: ‘*((void*)& __tmp +6)’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
[2022/12/14 21:07:30.829]      ::new(::std::addressof(this->val)) value_type {
[2022/12/14 21:07:30.829]      ^~
[2022/12/14 21:07:30.829] In file included from /usr/include/c++/8/bits/nested_exception.h:40,
[2022/12/14 21:07:30.829]                  from /usr/include/c++/8/exception:144,
[2022/12/14 21:07:30.830]                  from /usr/include/c++/8/ios:39,
[2022/12/14 21:07:30.830]                  from /usr/include/c++/8/istream:38,
[2022/12/14 21:07:30.830]                  from /usr/include/c++/8/fstream:38,
[2022/12/14 21:07:30.830]                  from /data/mci/0776864d158095bf494026871536bc9c/mongo-cxx-driver/src/mongocxx/test/spec/unified_tests/runner.cpp:15:
[2022/12/14 21:07:30.830] /usr/include/c++/8/bits/move.h:193:11: note: ‘*((void*)& __tmp +6)’ was declared here
[2022/12/14 21:07:30.830]        _Tp __tmp = _GLIBCXX_MOVE(__a);
[2022/12/14 21:07:30.830]            ^~~~~
[2022/12/14 21:07:32.860] cc1plus: all warnings being treated as errors

@kkloberdanz kkloberdanz marked this pull request as ready for review December 14, 2022 21:34
Copy link
Contributor

@rcsanchez97 rcsanchez97 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM (though C++ is far from my strong suit, so take this with a grain of salt).

@rcsanchez97
Copy link
Contributor

Not sure what could be causing this warning from the POWER build:

I poked around at this for a bit and it isn't clear to me why this is an error on just this particular platform. If you'd like it, I can try to help dig deeper. Let me know.

@kkloberdanz
Copy link
Contributor Author

Not sure what could be causing this warning from the POWER build:

I poked around at this for a bit and it isn't clear to me why this is an error on just this particular platform. If you'd like it, I can try to help dig deeper. Let me know.

Thanks! I appreciate it! I'm not quite sure what's causing it.

@kkloberdanz kkloberdanz marked this pull request as draft December 16, 2022 16:32
CMakeLists.txt Outdated
Comment on lines 43 to 45
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "ppc64le")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-maybe-uninitialized")
endif()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm open to suggestions on where is the best place to put this check.

@rcsanchez97
Copy link
Contributor

rcsanchez97 commented Dec 16, 2022 via email

CMakeLists.txt Outdated
@@ -40,6 +40,10 @@ else()
message(WARNING "Unknown compiler... recklessly proceeding without a version check")
endif()

if(CMAKE_SYSTEM_PROCESSOR STREQUAL "ppc64le")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-maybe-uninitialized")
endif()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This warning seems more dependent on our test environment, rather than something intrinsic to all builds.

Suggest adding to the cmake_flags of .mci.yml. .mci.yml is the configuration for Evergreen.

        # power8_cmake_flags includes -Wno-maybe-uninitialized to ignore a warning from the std::optional implementation of MNMLSTC.
        power8_cmake_flags: &power8_cmake_flags -DCMAKE_C_FLAGS="-Wall -Wextra -Wno-attributes -Werror -Wno-missing-field-initializers $ignore_deprecated" -DCMAKE_CXX_FLAGS="-Wall -Wextra -Wconversion -Wnarrowing -Wno-expansion-to-defined -pedantic -Werror -Wno-missing-field-initializers -Wno-aligned-new $ignore_deprecated -Wno-maybe-uninitialized"

And use power8_cmake_flags on the Power8 variants.

/// @note
/// Needed for FLE 2 Support.
///
void drop(bsoncxx::document::view_or_value collection_options);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest removing this overload, and adding collection_options as optional argument to the two existing drop overloads as follows:

void drop(const bsoncxx::stdx::optional<mongocxx::write_concern>& write_concern = {},
          bsoncxx::document::view_or_value collection_options = {});

void drop(const client_session& session,
          const bsoncxx::stdx::optional<mongocxx::write_concern>& write_concern = {},
          bsoncxx::document::view_or_value collection_options = {});

That matches the pattern of overloads for database::create_collection

@kkloberdanz kkloberdanz marked this pull request as ready for review December 19, 2022 15:41
Copy link
Collaborator

@kevinAlbs kevinAlbs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nicely done. LGTM

@eramongodb eramongodb removed their request for review December 19, 2022 18:43
Copy link
Contributor

@vector-of-bool vector-of-bool left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kkloberdanz kkloberdanz merged commit 4b7add4 into mongodb:master Dec 20, 2022
@kkloberdanz kkloberdanz deleted the CXX-2496 branch December 20, 2022 20:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants