mongo 2.19.1 → 2.21.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +40 -1
- data/Rakefile +83 -174
- data/lib/mongo/address.rb +22 -3
- data/lib/mongo/auth/aws/credentials_retriever.rb +70 -17
- data/lib/mongo/auth/base.rb +1 -1
- data/lib/mongo/bulk_write.rb +35 -2
- data/lib/mongo/client.rb +38 -6
- data/lib/mongo/client_encryption.rb +6 -3
- data/lib/mongo/cluster/reapers/cursor_reaper.rb +6 -1
- data/lib/mongo/cluster/sdam_flow.rb +20 -7
- data/lib/mongo/cluster/topology/base.rb +16 -0
- data/lib/mongo/cluster.rb +41 -5
- data/lib/mongo/collection/helpers.rb +1 -1
- data/lib/mongo/collection/view/aggregation/behavior.rb +131 -0
- data/lib/mongo/collection/view/aggregation.rb +33 -99
- data/lib/mongo/collection/view/builder/aggregation.rb +1 -7
- data/lib/mongo/collection/view/change_stream.rb +80 -27
- data/lib/mongo/collection/view/iterable.rb +92 -60
- data/lib/mongo/collection/view/map_reduce.rb +25 -8
- data/lib/mongo/collection/view/readable.rb +79 -30
- data/lib/mongo/collection/view/writable.rb +109 -48
- data/lib/mongo/collection/view.rb +44 -3
- data/lib/mongo/collection.rb +185 -26
- data/lib/mongo/config.rb +2 -2
- data/lib/mongo/crypt/auto_encrypter.rb +4 -6
- data/lib/mongo/crypt/binding.rb +4 -4
- data/lib/mongo/crypt/context.rb +20 -14
- data/lib/mongo/crypt/encryption_io.rb +56 -26
- data/lib/mongo/crypt/explicit_encrypter.rb +49 -20
- data/lib/mongo/crypt/explicit_encryption_context.rb +17 -11
- data/lib/mongo/crypt/kms/azure/credentials_retriever.rb +22 -6
- data/lib/mongo/crypt/kms/gcp/credentials_retriever.rb +29 -4
- data/lib/mongo/csot_timeout_holder.rb +119 -0
- data/lib/mongo/cursor/kill_spec.rb +5 -2
- data/lib/mongo/cursor/nontailable.rb +27 -0
- data/lib/mongo/cursor.rb +86 -24
- data/lib/mongo/cursor_host.rb +82 -0
- data/lib/mongo/database/view.rb +81 -14
- data/lib/mongo/database.rb +88 -18
- data/lib/mongo/error/operation_failure.rb +209 -204
- data/lib/mongo/error/server_timeout_error.rb +12 -0
- data/lib/mongo/error/socket_timeout_error.rb +3 -1
- data/lib/mongo/error/timeout_error.rb +23 -0
- data/lib/mongo/error/transactions_not_supported.rb +34 -0
- data/lib/mongo/error.rb +3 -0
- data/lib/mongo/grid/fs_bucket.rb +48 -9
- data/lib/mongo/grid/stream/read.rb +15 -1
- data/lib/mongo/grid/stream/write.rb +21 -4
- data/lib/mongo/index/view.rb +77 -16
- data/lib/mongo/monitoring/event/secure.rb +1 -1
- data/lib/mongo/operation/context.rb +40 -2
- data/lib/mongo/operation/create_search_indexes/op_msg.rb +31 -0
- data/lib/mongo/operation/create_search_indexes.rb +15 -0
- data/lib/mongo/operation/delete/op_msg.rb +2 -1
- data/lib/mongo/operation/drop_search_index/op_msg.rb +33 -0
- data/lib/mongo/operation/drop_search_index.rb +15 -0
- data/lib/mongo/operation/find/op_msg.rb +45 -0
- data/lib/mongo/operation/get_more/op_msg.rb +33 -0
- data/lib/mongo/operation/insert/op_msg.rb +3 -2
- data/lib/mongo/operation/insert/result.rb +4 -2
- data/lib/mongo/operation/list_collections/result.rb +1 -1
- data/lib/mongo/operation/map_reduce/result.rb +1 -1
- data/lib/mongo/operation/op_msg_base.rb +3 -1
- data/lib/mongo/operation/result.rb +26 -5
- data/lib/mongo/operation/shared/executable.rb +55 -28
- data/lib/mongo/operation/shared/op_msg_executable.rb +4 -1
- data/lib/mongo/operation/shared/response_handling.rb +25 -27
- data/lib/mongo/operation/shared/sessions_supported.rb +1 -1
- data/lib/mongo/operation/shared/specifiable.rb +7 -0
- data/lib/mongo/operation/shared/timed.rb +52 -0
- data/lib/mongo/operation/shared/write.rb +4 -1
- data/lib/mongo/operation/update/op_msg.rb +2 -1
- data/lib/mongo/operation/update_search_index/op_msg.rb +34 -0
- data/lib/mongo/operation/update_search_index.rb +15 -0
- data/lib/mongo/operation.rb +4 -0
- data/lib/mongo/protocol/message.rb +1 -4
- data/lib/mongo/protocol/msg.rb +2 -2
- data/lib/mongo/retryable/base_worker.rb +28 -3
- data/lib/mongo/retryable/read_worker.rb +78 -36
- data/lib/mongo/retryable/write_worker.rb +59 -25
- data/lib/mongo/retryable.rb +8 -2
- data/lib/mongo/search_index/view.rb +232 -0
- data/lib/mongo/server/app_metadata/environment.rb +64 -9
- data/lib/mongo/server/app_metadata.rb +5 -4
- data/lib/mongo/server/connection.rb +11 -5
- data/lib/mongo/server/connection_base.rb +22 -2
- data/lib/mongo/server/connection_pool.rb +32 -14
- data/lib/mongo/server/description/features.rb +2 -1
- data/lib/mongo/server/description.rb +18 -5
- data/lib/mongo/server/monitor.rb +7 -4
- data/lib/mongo/server/pending_connection.rb +25 -8
- data/lib/mongo/server/{round_trip_time_averager.rb → round_trip_time_calculator.rb} +25 -7
- data/lib/mongo/server.rb +11 -6
- data/lib/mongo/server_selector/base.rb +54 -12
- data/lib/mongo/session/server_session/dirtyable.rb +52 -0
- data/lib/mongo/session/server_session.rb +3 -0
- data/lib/mongo/session/session_pool.rb +12 -18
- data/lib/mongo/session.rb +110 -9
- data/lib/mongo/socket/ssl.rb +131 -18
- data/lib/mongo/socket/tcp.rb +40 -6
- data/lib/mongo/socket.rb +154 -25
- data/lib/mongo/uri/options_mapper.rb +1 -0
- data/lib/mongo/uri.rb +0 -4
- data/lib/mongo/version.rb +1 -5
- data/lib/mongo.rb +2 -0
- data/mongo.gemspec +9 -18
- data/spec/atlas/atlas_connectivity_spec.rb +9 -9
- data/spec/atlas/operations_spec.rb +5 -5
- data/spec/faas/ruby-sam-app/Gemfile +9 -0
- data/spec/faas/ruby-sam-app/mongodb/Gemfile +4 -0
- data/spec/faas/ruby-sam-app/mongodb/app.rb +149 -0
- data/spec/faas/ruby-sam-app/template.yaml +48 -0
- data/spec/integration/client_side_encryption/auto_encryption_mongocryptd_spawn_spec.rb +2 -1
- data/spec/integration/client_side_encryption/auto_encryption_spec.rb +494 -487
- data/spec/integration/client_side_encryption/corpus_spec.rb +10 -2
- data/spec/integration/client_side_encryption/on_demand_aws_credentials_spec.rb +1 -1
- data/spec/integration/client_side_encryption/range_explicit_encryption_prose_spec.rb +67 -20
- data/spec/integration/client_side_operations_timeout/encryption_prose_spec.rb +131 -0
- data/spec/integration/connection_pool_populator_spec.rb +2 -0
- data/spec/integration/cursor_pinning_spec.rb +15 -60
- data/spec/integration/cursor_reaping_spec.rb +1 -1
- data/spec/integration/docs_examples_spec.rb +1 -1
- data/spec/integration/find_options_spec.rb +227 -0
- data/spec/integration/operation_failure_code_spec.rb +1 -1
- data/spec/integration/operation_failure_message_spec.rb +3 -3
- data/spec/integration/retryable_errors_spec.rb +2 -2
- data/spec/integration/retryable_reads_errors_spec.rb +196 -31
- data/spec/integration/retryable_writes_errors_spec.rb +156 -0
- data/spec/integration/sdam_error_handling_spec.rb +4 -1
- data/spec/integration/search_indexes_prose_spec.rb +172 -0
- data/spec/integration/server_spec.rb +4 -3
- data/spec/integration/transactions_api_examples_spec.rb +2 -0
- data/spec/kerberos/kerberos_spec.rb +4 -0
- data/spec/lite_spec_helper.rb +34 -20
- data/spec/mongo/auth/user/view_spec.rb +1 -1
- data/spec/mongo/caching_cursor_spec.rb +1 -1
- data/spec/mongo/client_encryption_spec.rb +1 -0
- data/spec/mongo/client_spec.rb +158 -4
- data/spec/mongo/cluster_spec.rb +36 -0
- data/spec/mongo/collection/view/aggregation_spec.rb +20 -40
- data/spec/mongo/collection/view/change_stream_spec.rb +3 -3
- data/spec/mongo/collection/view/explainable_spec.rb +2 -0
- data/spec/mongo/collection_crud_spec.rb +2 -1
- data/spec/mongo/collection_spec.rb +5 -6
- data/spec/mongo/crypt/auto_encrypter_spec.rb +14 -12
- data/spec/mongo/crypt/data_key_context_spec.rb +3 -1
- data/spec/mongo/crypt/explicit_encryption_context_spec.rb +2 -2
- data/spec/mongo/crypt/handle_spec.rb +1 -1
- data/spec/mongo/cursor_spec.rb +26 -9
- data/spec/mongo/error/operation_failure_heavy_spec.rb +2 -2
- data/spec/mongo/operation/context_spec.rb +79 -0
- data/spec/mongo/operation/create/op_msg_spec.rb +106 -110
- data/spec/mongo/operation/delete/op_msg_spec.rb +6 -5
- data/spec/mongo/operation/find/op_msg_spec.rb +66 -0
- data/spec/mongo/operation/get_more/op_msg_spec.rb +65 -0
- data/spec/mongo/operation/insert/op_msg_spec.rb +128 -131
- data/spec/mongo/operation/insert_spec.rb +1 -1
- data/spec/mongo/operation/shared/csot/examples.rb +113 -0
- data/spec/mongo/query_cache_spec.rb +243 -225
- data/spec/mongo/retryable/write_worker_spec.rb +39 -0
- data/spec/mongo/retryable_spec.rb +1 -0
- data/spec/mongo/server/app_metadata/environment_spec.rb +135 -0
- data/spec/mongo/server/app_metadata_spec.rb +12 -2
- data/spec/mongo/server/connection_spec.rb +26 -0
- data/spec/mongo/server/round_trip_time_calculator_spec.rb +120 -0
- data/spec/mongo/session/session_pool_spec.rb +1 -16
- data/spec/mongo/session_transaction_spec.rb +15 -0
- data/spec/mongo/socket/ssl_spec.rb +0 -10
- data/spec/mongo/uri_spec.rb +0 -9
- data/spec/runners/change_streams/test.rb +2 -2
- data/spec/runners/crud/operation.rb +1 -1
- data/spec/runners/crud/test.rb +0 -8
- data/spec/runners/crud/verifier.rb +3 -1
- data/spec/runners/crud.rb +1 -1
- data/spec/runners/transactions/operation.rb +4 -6
- data/spec/runners/transactions/test.rb +12 -3
- data/spec/runners/unified/ambiguous_operations.rb +13 -0
- data/spec/runners/unified/assertions.rb +20 -3
- data/spec/runners/unified/change_stream_operations.rb +14 -24
- data/spec/runners/unified/crud_operations.rb +82 -47
- data/spec/runners/unified/ddl_operations.rb +38 -7
- data/spec/runners/unified/grid_fs_operations.rb +37 -2
- data/spec/runners/unified/search_index_operations.rb +63 -0
- data/spec/runners/unified/support_operations.rb +46 -9
- data/spec/runners/unified/test.rb +33 -12
- data/spec/runners/unified.rb +1 -1
- data/spec/solo/clean_exit_spec.rb +2 -0
- data/spec/spec_helper.rb +1 -1
- data/spec/spec_tests/client_side_operations_timeout_spec.rb +15 -0
- data/spec/spec_tests/data/change_streams_unified/change-streams-clusterTime.yml +3 -1
- data/spec/spec_tests/data/change_streams_unified/change-streams-disambiguatedPaths.yml +3 -1
- data/spec/spec_tests/data/change_streams_unified/change-streams-errors.yml +3 -1
- data/spec/spec_tests/data/change_streams_unified/change-streams-pre_and_post_images.yml +1 -1
- data/spec/spec_tests/data/change_streams_unified/change-streams-resume-allowlist.yml +1 -1
- data/spec/spec_tests/data/change_streams_unified/change-streams-resume-errorLabels.yml +1 -1
- data/spec/spec_tests/data/change_streams_unified/change-streams-showExpandedEvents.yml +1 -1
- data/spec/spec_tests/data/client_side_encryption/badQueries.yml +2 -1
- data/spec/spec_tests/data/client_side_encryption/explain.yml +2 -2
- data/spec/spec_tests/data/client_side_encryption/fle2v2-BypassQueryAnalysis.yml +1 -0
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Compact.yml +1 -0
- data/spec/spec_tests/data/client_side_encryption/fle2v2-CreateCollection.yml +1 -0
- data/spec/spec_tests/data/client_side_encryption/fle2v2-DecryptExistingData.yml +1 -0
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Delete.yml +1 -0
- data/spec/spec_tests/data/client_side_encryption/fle2v2-EncryptedFields-vs-EncryptedFieldsMap.yml +1 -0
- data/spec/spec_tests/data/client_side_encryption/fle2v2-EncryptedFields-vs-jsonSchema.yml +1 -0
- data/spec/spec_tests/data/client_side_encryption/fle2v2-EncryptedFieldsMap-defaults.yml +1 -0
- data/spec/spec_tests/data/client_side_encryption/fle2v2-FindOneAndUpdate.yml +1 -0
- data/spec/spec_tests/data/client_side_encryption/fle2v2-InsertFind-Indexed.yml +1 -0
- data/spec/spec_tests/data/client_side_encryption/fle2v2-InsertFind-Unindexed.yml +1 -0
- data/spec/spec_tests/data/client_side_encryption/fle2v2-MissingKey.yml +1 -0
- data/spec/spec_tests/data/client_side_encryption/fle2v2-NoEncryption.yml +1 -0
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Update.yml +1 -0
- data/spec/spec_tests/data/client_side_encryption/fle2v2-validatorAndPartialFieldExpression.yml +2 -1
- data/spec/spec_tests/data/client_side_encryption/timeoutMS.yml +67 -0
- data/spec/spec_tests/data/client_side_operations_timeout/bulkWrite.yml +87 -0
- data/spec/spec_tests/data/client_side_operations_timeout/change-streams.yml +358 -0
- data/spec/spec_tests/data/client_side_operations_timeout/close-cursors.yml +129 -0
- data/spec/spec_tests/data/client_side_operations_timeout/command-execution.yml +250 -0
- data/spec/spec_tests/data/client_side_operations_timeout/convenient-transactions.yml +113 -0
- data/spec/spec_tests/data/client_side_operations_timeout/cursors.yml +70 -0
- data/spec/spec_tests/data/client_side_operations_timeout/deprecated-options.yml +3982 -0
- data/spec/spec_tests/data/client_side_operations_timeout/error-transformations.yml +96 -0
- data/spec/spec_tests/data/client_side_operations_timeout/global-timeoutMS.yml +3236 -0
- data/spec/spec_tests/data/client_side_operations_timeout/gridfs-advanced.yml +207 -0
- data/spec/spec_tests/data/client_side_operations_timeout/gridfs-delete.yml +152 -0
- data/spec/spec_tests/data/client_side_operations_timeout/gridfs-download.yml +182 -0
- data/spec/spec_tests/data/client_side_operations_timeout/gridfs-find.yml +100 -0
- data/spec/spec_tests/data/client_side_operations_timeout/gridfs-upload.yml +249 -0
- data/spec/spec_tests/data/client_side_operations_timeout/legacy-timeouts.yml +204 -0
- data/spec/spec_tests/data/client_side_operations_timeout/non-tailable-cursors.yml +307 -0
- data/spec/spec_tests/data/client_side_operations_timeout/override-collection-timeoutMS.yml +1877 -0
- data/spec/spec_tests/data/client_side_operations_timeout/override-operation-timeoutMS.yml +1918 -0
- data/spec/spec_tests/data/client_side_operations_timeout/retryability-legacy-timeouts.yml +1676 -0
- data/spec/spec_tests/data/client_side_operations_timeout/retryability-timeoutMS.yml +2824 -0
- data/spec/spec_tests/data/client_side_operations_timeout/sessions-inherit-timeoutMS.yml +168 -0
- data/spec/spec_tests/data/client_side_operations_timeout/sessions-override-operation-timeoutMS.yml +171 -0
- data/spec/spec_tests/data/client_side_operations_timeout/sessions-override-timeoutMS.yml +168 -0
- data/spec/spec_tests/data/client_side_operations_timeout/tailable-awaitData.yml +247 -0
- data/spec/spec_tests/data/client_side_operations_timeout/tailable-non-awaitData.yml +181 -0
- data/spec/spec_tests/data/connection_string/invalid-uris.yml +0 -10
- data/spec/spec_tests/data/connection_string/valid-options.yml +13 -0
- data/spec/spec_tests/data/crud_unified/aggregate-write-readPreference.yml +6 -0
- data/spec/spec_tests/data/crud_unified/db-aggregate-write-readPreference.yml +6 -0
- data/spec/spec_tests/data/crud_unified/find-test-all-options.yml +377 -0
- data/spec/spec_tests/data/index_management/createSearchIndex.yml +64 -0
- data/spec/spec_tests/data/index_management/createSearchIndexes.yml +86 -0
- data/spec/spec_tests/data/index_management/dropSearchIndex.yml +43 -0
- data/spec/spec_tests/data/index_management/listSearchIndexes.yml +91 -0
- data/spec/spec_tests/data/index_management/updateSearchIndex.yml +46 -0
- data/spec/spec_tests/data/retryable_writes/unified/bulkWrite-serverErrors.yml +3 -6
- data/spec/spec_tests/data/retryable_writes/unified/insertOne-serverErrors.yml +3 -6
- data/spec/spec_tests/data/run_command_unified/runCommand.yml +319 -0
- data/spec/spec_tests/data/sessions_unified/driver-sessions-dirty-session-errors.yml +351 -0
- data/spec/spec_tests/data/unified/valid-pass/poc-crud.yml +1 -1
- data/spec/spec_tests/data/unified/valid-pass/poc-retryable-writes.yml +7 -7
- data/spec/spec_tests/data/unified/valid-pass/poc-sessions.yml +3 -4
- data/spec/spec_tests/data/unified/valid-pass/poc-transactions-convenient-api.yml +1 -1
- data/spec/spec_tests/data/unified/valid-pass/poc-transactions-mongos-pin-auto.yml +1 -1
- data/spec/spec_tests/data/unified/valid-pass/poc-transactions.yml +3 -3
- data/spec/spec_tests/index_management_unified_spec.rb +13 -0
- data/spec/spec_tests/run_command_unified_spec.rb +13 -0
- data/spec/spec_tests/sdam_unified_spec.rb +2 -0
- data/spec/spec_tests/server_selection_rtt_spec.rb +6 -6
- data/spec/spec_tests/transactions_unified_spec.rb +2 -1
- data/spec/support/certificates/atlas-ocsp-ca.crt +89 -79
- data/spec/support/certificates/atlas-ocsp.crt +117 -122
- data/spec/support/certificates/retrieve-atlas-cert +1 -1
- data/spec/support/cluster_tools.rb +3 -3
- data/spec/support/common_shortcuts.rb +2 -2
- data/spec/support/constraints.rb +6 -0
- data/spec/support/crypt/encrypted_fields/range-encryptedFields-Date.json +1 -1
- data/spec/support/crypt/encrypted_fields/range-encryptedFields-DecimalNoPrecision.json +1 -1
- data/spec/support/crypt/encrypted_fields/range-encryptedFields-DecimalPrecision.json +1 -1
- data/spec/support/crypt/encrypted_fields/range-encryptedFields-DoubleNoPrecision.json +1 -1
- data/spec/support/crypt/encrypted_fields/range-encryptedFields-DoublePrecision.json +1 -1
- data/spec/support/crypt/encrypted_fields/range-encryptedFields-Int.json +1 -1
- data/spec/support/crypt/encrypted_fields/range-encryptedFields-Long.json +1 -1
- data/spec/support/ocsp +1 -1
- data/spec/support/recording_logger.rb +27 -0
- data/spec/support/shared/session.rb +2 -2
- data/spec/support/spec_config.rb +5 -0
- data/spec/support/spec_setup.rb +2 -2
- data/spec/support/utils.rb +3 -1
- metadata +1329 -1368
- checksums.yaml.gz.sig +0 -0
- data/spec/mongo/server/round_trip_time_averager_spec.rb +0 -48
- data/spec/shared/LICENSE +0 -20
- data/spec/shared/bin/get-mongodb-download-url +0 -17
- data/spec/shared/bin/s3-copy +0 -45
- data/spec/shared/bin/s3-upload +0 -69
- data/spec/shared/lib/mrss/child_process_helper.rb +0 -80
- data/spec/shared/lib/mrss/cluster_config.rb +0 -231
- data/spec/shared/lib/mrss/constraints.rb +0 -378
- data/spec/shared/lib/mrss/docker_runner.rb +0 -295
- data/spec/shared/lib/mrss/eg_config_utils.rb +0 -51
- data/spec/shared/lib/mrss/event_subscriber.rb +0 -210
- data/spec/shared/lib/mrss/lite_constraints.rb +0 -238
- data/spec/shared/lib/mrss/server_version_registry.rb +0 -113
- data/spec/shared/lib/mrss/session_registry.rb +0 -69
- data/spec/shared/lib/mrss/session_registry_legacy.rb +0 -60
- data/spec/shared/lib/mrss/spec_organizer.rb +0 -179
- data/spec/shared/lib/mrss/utils.rb +0 -37
- data/spec/shared/share/Dockerfile.erb +0 -330
- data/spec/shared/share/haproxy-1.conf +0 -16
- data/spec/shared/share/haproxy-2.conf +0 -17
- data/spec/shared/shlib/config.sh +0 -27
- data/spec/shared/shlib/distro.sh +0 -74
- data/spec/shared/shlib/server.sh +0 -416
- data/spec/shared/shlib/set_env.sh +0 -169
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-Date-Aggregate.yml +0 -241
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-Date-Correctness.yml +0 -422
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-Date-Delete.yml +0 -182
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-Date-FindOneAndUpdate.yml +0 -239
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-Date-InsertFind.yml +0 -235
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-Date-Update.yml +0 -252
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-Decimal-Aggregate.yml +0 -1687
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-Decimal-Correctness.yml +0 -293
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-Decimal-Delete.yml +0 -905
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-Decimal-FindOneAndUpdate.yml +0 -1684
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-Decimal-InsertFind.yml +0 -1680
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-Decimal-Update.yml +0 -1697
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-DecimalPrecision-Aggregate.yml +0 -329
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-DecimalPrecision-Correctness.yml +0 -424
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-DecimalPrecision-Delete.yml +0 -226
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-DecimalPrecision-FindOneAndUpdate.yml +0 -327
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-DecimalPrecision-InsertFind.yml +0 -319
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-DecimalPrecision-Update.yml +0 -336
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-Double-Aggregate.yml +0 -913
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-Double-Correctness.yml +0 -292
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-Double-Delete.yml +0 -518
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-Double-FindOneAndUpdate.yml +0 -911
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-Double-InsertFind.yml +0 -907
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-Double-Update.yml +0 -924
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-DoublePrecision-Aggregate.yml +0 -325
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-DoublePrecision-Correctness.yml +0 -424
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-DoublePrecision-Delete.yml +0 -224
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-DoublePrecision-FindOneAndUpdate.yml +0 -323
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-DoublePrecision-InsertFind.yml +0 -319
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-DoublePrecision-Update.yml +0 -338
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-Int-Aggregate.yml +0 -241
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-Int-Correctness.yml +0 -423
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-Int-Delete.yml +0 -182
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-Int-FindOneAndUpdate.yml +0 -239
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-Int-InsertFind.yml +0 -235
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-Int-Update.yml +0 -254
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-Long-Aggregate.yml +0 -241
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-Long-Correctness.yml +0 -422
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-Long-Delete.yml +0 -182
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-Long-FindOneAndUpdate.yml +0 -239
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-Long-InsertFind.yml +0 -235
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-Long-Update.yml +0 -254
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-WrongType.yml +0 -43
- data/spec/spec_tests/data/cmap/pool-clear-interrupt-immediately.yml +0 -49
- data.tar.gz.sig +0 -0
- metadata.gz.sig +0 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5e7f3e9918313d274cc9e065268b75d760d24491b959f7b04cdad49dd0ff38f4
|
4
|
+
data.tar.gz: 5071ce689f3c0027ce39c93cd662b355235a2b1728f6308c716eecbaa7b55420
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d8c716a1754d4d2c704a3dd8ed6fcdc5815a0818168598fbe885886f6962f07182333ce8a68ada32cf0bd5d4664d102c301d97e611bac5a126201b6c3e986597
|
7
|
+
data.tar.gz: 1365727e6aa93fa15ab46c058f6d3d553a16e8f06b400f915f37c326f9a3393cbf90c6a585a37c8e9a5b9f8e625fcf8443adc487bb0b29b617ffdf71c9991b75
|
data/README.md
CHANGED
@@ -5,7 +5,43 @@ MongoDB Ruby Driver
|
|
5
5
|
|
6
6
|
The officially supported Ruby driver for [MongoDB](https://www.mongodb.org/).
|
7
7
|
|
8
|
-
The Ruby driver supports Ruby 2.
|
8
|
+
The Ruby driver supports Ruby 2.7-3.3 and JRuby 9.3-9.4.
|
9
|
+
|
10
|
+
## Installation
|
11
|
+
|
12
|
+
Install via RubyGems, either via the command-line for ad-hoc uses:
|
13
|
+
|
14
|
+
$ gem install mongo
|
15
|
+
|
16
|
+
Or via a Gemfile for more general use:
|
17
|
+
|
18
|
+
gem 'mongo'
|
19
|
+
|
20
|
+
### Release Integrity
|
21
|
+
|
22
|
+
Each release of the MongoDB Ruby driver after version 2.20.0 has been automatically built and signed using the team's GPG key.
|
23
|
+
|
24
|
+
To verify the driver's gem file:
|
25
|
+
|
26
|
+
1. [Download the GPG key](https://pgp.mongodb.com/ruby-driver.asc).
|
27
|
+
2. Import the key into your GPG keyring with `gpg --import ruby-driver.asc`.
|
28
|
+
3. Download the gem file (if you don't already have it). You can download it from RubyGems with `gem fetch mongo`, or you can download it from the [releases page](https://github.com/mongodb/mongo-ruby-driver/releases) on GitHub.
|
29
|
+
4. Download the corresponding detached signature file from the [same release](https://github.com/mongodb/mongo-ruby-driver/releases). Look at the bottom of the release that corresponds to the gem file, under the 'Assets' list, for a `.sig` file with the same version number as the gem you wish to install.
|
30
|
+
5. Verify the gem with `gpg --verify mongo-X.Y.Z.gem.sig mongo-X.Y.Z.gem` (replacing `X.Y.Z` with the actual version number).
|
31
|
+
|
32
|
+
You are looking for text like "Good signature from "MongoDB Ruby Driver Release Signing Key <packaging@mongodb.com>" in the output. If you see that, the signature was found to correspond to the given gem file.
|
33
|
+
|
34
|
+
(Note that other output, like "This key is not certified with a trusted signature!", is related to *web of trust* and depends on how strongly you, personally, trust the `ruby-driver.asc` key that you downloaded from us. To learn more, see https://www.gnupg.org/gph/en/manual/x334.html)
|
35
|
+
|
36
|
+
### Why not use RubyGems' gem-signing functionality?
|
37
|
+
|
38
|
+
RubyGems' own gem signing is problematic, most significantly because there is no established chain of trust related to the keys used to sign gems. RubyGems' own documentation admits that "this method of signing gems is not widely used" (see https://guides.rubygems.org/security/). Discussions about this in the RubyGems community have been off-and-on for more than a decade, and while a solution will eventually arrive, we have settled on using GPG instead for the following reasons:
|
39
|
+
|
40
|
+
1. Many of the other driver teams at MongoDB are using GPG to sign their product releases. Consistency with the other teams means that we can reuse existing tooling for our own product releases.
|
41
|
+
2. GPG is widely available and has existing tools and procedures for dealing with web of trust (though they are admittedly quite arcane and intimidating to the uninitiated, unfortunately).
|
42
|
+
|
43
|
+
Ultimately, most users do not bother to verify gems, and will not be impacted by our choice of GPG over RubyGems' native method.
|
44
|
+
|
9
45
|
|
10
46
|
## Documentation
|
11
47
|
|
@@ -17,6 +53,9 @@ API documentation for the most recent release can be found
|
|
17
53
|
To build API documentation for the master branch, check out the
|
18
54
|
repository locally and run `rake docs`.
|
19
55
|
|
56
|
+
High-level driver documentation including tutorials and the reference that were in the docs folder can now be found
|
57
|
+
at the docs-ruby repository, [here](https://github.com/mongodb/docs-ruby)
|
58
|
+
|
20
59
|
## Support
|
21
60
|
|
22
61
|
Commercial support for the driver is available through the
|
data/Rakefile
CHANGED
@@ -2,17 +2,12 @@
|
|
2
2
|
# rubocop:todo all
|
3
3
|
|
4
4
|
require 'bundler'
|
5
|
-
require 'bundler/gem_tasks'
|
6
5
|
require 'rspec/core/rake_task'
|
7
|
-
# TODO move the mongo require into the individual tasks that actually need it
|
8
|
-
require 'mongo'
|
9
6
|
|
10
7
|
ROOT = File.expand_path(File.join(File.dirname(__FILE__)))
|
11
8
|
|
12
9
|
$: << File.join(ROOT, 'spec/shared/lib')
|
13
10
|
|
14
|
-
require 'mrss/spec_organizer'
|
15
|
-
|
16
11
|
CLASSIFIERS = [
|
17
12
|
[%r,^mongo/server,, :unit_server],
|
18
13
|
[%r,^mongo,, :unit],
|
@@ -26,15 +21,12 @@ CLASSIFIERS = [
|
|
26
21
|
[%r,^spec_tests,, :spec],
|
27
22
|
]
|
28
23
|
|
29
|
-
RUN_PRIORITY = %
|
24
|
+
RUN_PRIORITY = (ENV['RUN_PRIORITY'] || %(
|
30
25
|
tx_examples
|
31
26
|
unit unit_server
|
32
27
|
integration sdam_integration cursor_reaping query_cache
|
33
28
|
spec spec_sdam_integration
|
34
|
-
)
|
35
|
-
|
36
|
-
tasks = Rake.application.instance_variable_get('@tasks')
|
37
|
-
tasks['release:do'] = tasks.delete('release')
|
29
|
+
)).split.map(&:to_sym)
|
38
30
|
|
39
31
|
RSpec::Core::RakeTask.new(:spec) do |t|
|
40
32
|
#t.rspec_opts = "--profile 5" if ENV['CI']
|
@@ -42,9 +34,61 @@ end
|
|
42
34
|
|
43
35
|
task :default => ['spec:prepare', :spec]
|
44
36
|
|
37
|
+
# stands in for the Bundler-provided `build` task, which builds the
|
38
|
+
# gem for this project. Our release process builds the gems in a
|
39
|
+
# particular way, in a GitHub action. This task is just to help remind
|
40
|
+
# developers of that fact.
|
41
|
+
task :build do
|
42
|
+
abort <<~WARNING
|
43
|
+
`rake build` does nothing in this project. The gem must be built via
|
44
|
+
the `Driver Release` action on GitHub, which is triggered manually when
|
45
|
+
a new release is ready.
|
46
|
+
WARNING
|
47
|
+
end
|
48
|
+
|
49
|
+
# `rake version` is used by the deployment system so get the release version
|
50
|
+
# of the product beng deployed. It must do nothing more than just print the
|
51
|
+
# product version number.
|
52
|
+
#
|
53
|
+
# See the mongodb-labs/driver-github-tools/ruby/publish Github action.
|
54
|
+
desc "Print the current value of Mongo::VERSION"
|
55
|
+
task :version do
|
56
|
+
require 'mongo/version'
|
57
|
+
|
58
|
+
puts Mongo::VERSION
|
59
|
+
end
|
60
|
+
|
61
|
+
# overrides the default Bundler-provided `release` task, which also
|
62
|
+
# builds the gem. Our release process assumes the gem has already
|
63
|
+
# been built (and signed via GPG), so we just need `rake release` to
|
64
|
+
# push the gem to rubygems.
|
65
|
+
task :release do
|
66
|
+
require 'mongo/version'
|
67
|
+
|
68
|
+
if ENV['GITHUB_ACTION'].nil?
|
69
|
+
abort <<~WARNING
|
70
|
+
`rake release` must be invoked from the `Driver Release` GitHub action,
|
71
|
+
and must not be invoked locally. This ensures the gem is properly signed
|
72
|
+
and distributed by the appropriate user.
|
73
|
+
|
74
|
+
Note that it is the `rubygems/release-gem@v1` step in the `Driver Release`
|
75
|
+
action that invokes this task. Do not rename or remove this task, or the
|
76
|
+
release-gem step will fail. Reimplement this task with caution.
|
77
|
+
|
78
|
+
mongo-#{Mongo::VERSION}.gem was NOT pushed to RubyGems.
|
79
|
+
WARNING
|
80
|
+
end
|
81
|
+
|
82
|
+
system 'gem', 'push', "mongo-#{Mongo::VERSION}.gem"
|
83
|
+
end
|
84
|
+
|
85
|
+
task :mongo do
|
86
|
+
require 'mongo'
|
87
|
+
end
|
88
|
+
|
45
89
|
namespace :spec do
|
46
90
|
desc 'Creates necessary user accounts in the cluster'
|
47
|
-
task :
|
91
|
+
task prepare: :mongo do
|
48
92
|
$: << File.join(File.dirname(__FILE__), 'spec')
|
49
93
|
|
50
94
|
require 'support/utils'
|
@@ -53,7 +97,7 @@ namespace :spec do
|
|
53
97
|
end
|
54
98
|
|
55
99
|
desc 'Waits for sessions to be available in the deployment'
|
56
|
-
task :
|
100
|
+
task wait_for_sessions: :mongo do
|
57
101
|
$: << File.join(File.dirname(__FILE__), 'spec')
|
58
102
|
|
59
103
|
require 'support/utils'
|
@@ -77,7 +121,7 @@ namespace :spec do
|
|
77
121
|
end
|
78
122
|
|
79
123
|
desc 'Prints configuration used by the test suite'
|
80
|
-
task :
|
124
|
+
task config: :mongo do
|
81
125
|
$: << File.join(File.dirname(__FILE__), 'spec')
|
82
126
|
|
83
127
|
# Since this task is usually used for troubleshooting of test suite
|
@@ -90,6 +134,8 @@ namespace :spec do
|
|
90
134
|
end
|
91
135
|
|
92
136
|
def spec_organizer
|
137
|
+
require 'mrss/spec_organizer'
|
138
|
+
|
93
139
|
Mrss::SpecOrganizer.new(
|
94
140
|
root: ROOT,
|
95
141
|
classifiers: CLASSIFIERS,
|
@@ -109,15 +155,31 @@ namespace :spec do
|
|
109
155
|
end
|
110
156
|
end
|
111
157
|
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
158
|
+
desc 'Build and validate the evergreen config'
|
159
|
+
task eg: %w[ eg:build eg:validate ]
|
160
|
+
|
161
|
+
# 'eg' == 'evergreen', but evergreen is too many letters for convenience
|
162
|
+
namespace :eg do
|
163
|
+
desc 'Builds the .evergreen/config.yml file from the templates'
|
164
|
+
task :build do
|
165
|
+
ruby '.evergreen/update-evergreen-configs'
|
166
|
+
end
|
167
|
+
|
168
|
+
desc 'Validates the .evergreen/config.yml file'
|
169
|
+
task :validate do
|
170
|
+
system 'evergreen validate --project mongo-ruby-driver .evergreen/config.yml'
|
117
171
|
end
|
118
|
-
end
|
119
172
|
|
120
|
-
|
173
|
+
desc 'Updates the evergreen executable to the latest available version'
|
174
|
+
task :update do
|
175
|
+
system 'evergreen get-update --install'
|
176
|
+
end
|
177
|
+
|
178
|
+
desc 'Runs the current branch as an evergreen patch'
|
179
|
+
task :patch do
|
180
|
+
system 'evergreen patch --uncommitted --project mongo-ruby-driver --browse --auto-description --yes'
|
181
|
+
end
|
182
|
+
end
|
121
183
|
|
122
184
|
desc "Generate all documentation"
|
123
185
|
task :docs => 'docs:yard'
|
@@ -131,157 +193,4 @@ namespace :docs do
|
|
131
193
|
end
|
132
194
|
end
|
133
195
|
|
134
|
-
|
135
|
-
|
136
|
-
# Some require data files, available from the drivers team. See the comments above each task for details."
|
137
|
-
namespace :benchmark do
|
138
|
-
desc "Run the driver benchmark tests."
|
139
|
-
|
140
|
-
namespace :micro do
|
141
|
-
desc "Run the common driver micro benchmarking tests"
|
142
|
-
|
143
|
-
namespace :flat do
|
144
|
-
desc "Benchmarking for flat bson documents."
|
145
|
-
|
146
|
-
# Requirement: A file in Mongo::Benchmarking::DATA_PATH, called flat_bson.json.
|
147
|
-
task :encode do
|
148
|
-
puts "MICRO BENCHMARK:: FLAT:: ENCODE"
|
149
|
-
Mongo::Benchmarking::Micro.run(:flat, :encode)
|
150
|
-
end
|
151
|
-
|
152
|
-
# Requirement: A file in Mongo::Benchmarking::DATA_PATH, called flat_bson.json.
|
153
|
-
task :decode do
|
154
|
-
puts "MICRO BENCHMARK:: FLAT:: DECODE"
|
155
|
-
Mongo::Benchmarking::Micro.run(:flat, :decode)
|
156
|
-
end
|
157
|
-
end
|
158
|
-
|
159
|
-
namespace :deep do
|
160
|
-
desc "Benchmarking for deep bson documents."
|
161
|
-
|
162
|
-
# Requirement: A file in Mongo::Benchmarking::DATA_PATH, called deep_bson.json.
|
163
|
-
task :encode do
|
164
|
-
puts "MICRO BENCHMARK:: DEEP:: ENCODE"
|
165
|
-
Mongo::Benchmarking::Micro.run(:deep, :encode)
|
166
|
-
end
|
167
|
-
|
168
|
-
# Requirement: A file in Mongo::Benchmarking::DATA_PATH, called deep_bson.json.
|
169
|
-
task :decode do
|
170
|
-
puts "MICRO BENCHMARK:: DEEP:: DECODE"
|
171
|
-
Mongo::Benchmarking::Micro.run(:deep, :decode)
|
172
|
-
end
|
173
|
-
end
|
174
|
-
|
175
|
-
namespace :full do
|
176
|
-
desc "Benchmarking for full bson documents."
|
177
|
-
|
178
|
-
# Requirement: A file in Mongo::Benchmarking::DATA_PATH, called full_bson.json.
|
179
|
-
task :encode do
|
180
|
-
puts "MICRO BENCHMARK:: FULL:: ENCODE"
|
181
|
-
Mongo::Benchmarking::Micro.run(:full, :encode)
|
182
|
-
end
|
183
|
-
|
184
|
-
# Requirement: A file in Mongo::Benchmarking::DATA_PATH, called full_bson.json.
|
185
|
-
task :decode do
|
186
|
-
puts "MICRO BENCHMARK:: FULL:: DECODE"
|
187
|
-
Mongo::Benchmarking::Micro.run(:full, :decode)
|
188
|
-
end
|
189
|
-
end
|
190
|
-
end
|
191
|
-
|
192
|
-
namespace :single_doc do
|
193
|
-
desc "Run the common driver single-document benchmarking tests"
|
194
|
-
task :command do
|
195
|
-
puts "SINGLE DOC BENCHMARK:: COMMAND"
|
196
|
-
Mongo::Benchmarking::SingleDoc.run(:command)
|
197
|
-
end
|
198
|
-
|
199
|
-
# Requirement: A file in Mongo::Benchmarking::DATA_PATH, called TWEET.json.
|
200
|
-
task :find_one do
|
201
|
-
puts "SINGLE DOC BENCHMARK:: FIND ONE BY ID"
|
202
|
-
Mongo::Benchmarking::SingleDoc.run(:find_one)
|
203
|
-
end
|
204
|
-
|
205
|
-
# Requirement: A file in Mongo::Benchmarking::DATA_PATH, called SMALL_DOC.json.
|
206
|
-
task :insert_one_small do
|
207
|
-
puts "SINGLE DOC BENCHMARK:: INSERT ONE SMALL DOCUMENT"
|
208
|
-
Mongo::Benchmarking::SingleDoc.run(:insert_one_small)
|
209
|
-
end
|
210
|
-
|
211
|
-
# Requirement: A file in Mongo::Benchmarking::DATA_PATH, called LARGE_DOC.json.
|
212
|
-
task :insert_one_large do
|
213
|
-
puts "SINGLE DOC BENCHMARK:: INSERT ONE LARGE DOCUMENT"
|
214
|
-
Mongo::Benchmarking::SingleDoc.run(:insert_one_large)
|
215
|
-
end
|
216
|
-
end
|
217
|
-
|
218
|
-
namespace :multi_doc do
|
219
|
-
desc "Run the common driver multi-document benchmarking tests"
|
220
|
-
|
221
|
-
# Requirement: A file in Mongo::Benchmarking::DATA_PATH, called TWEET.json.
|
222
|
-
task :find_many do
|
223
|
-
puts "MULTI DOCUMENT BENCHMARK:: FIND MANY"
|
224
|
-
Mongo::Benchmarking::MultiDoc.run(:find_many)
|
225
|
-
end
|
226
|
-
|
227
|
-
# Requirement: A file in Mongo::Benchmarking::DATA_PATH, called SMALL_DOC.json.
|
228
|
-
task :bulk_insert_small do
|
229
|
-
puts "MULTI DOCUMENT BENCHMARK:: BULK INSERT SMALL"
|
230
|
-
Mongo::Benchmarking::MultiDoc.run(:bulk_insert_small)
|
231
|
-
end
|
232
|
-
|
233
|
-
# Requirement: A file in Mongo::Benchmarking::DATA_PATH, called LARGE_DOC.json.
|
234
|
-
task :bulk_insert_large do
|
235
|
-
puts "MULTI DOCUMENT BENCHMARK:: BULK INSERT LARGE"
|
236
|
-
Mongo::Benchmarking::MultiDoc.run(:bulk_insert_large)
|
237
|
-
end
|
238
|
-
|
239
|
-
# Requirement: A file in Mongo::Benchmarking::DATA_PATH, called GRIDFS_LARGE.
|
240
|
-
task :gridfs_upload do
|
241
|
-
puts "MULTI DOCUMENT BENCHMARK:: GRIDFS UPLOAD"
|
242
|
-
Mongo::Benchmarking::MultiDoc.run(:gridfs_upload)
|
243
|
-
end
|
244
|
-
|
245
|
-
# Requirement: A file in Mongo::Benchmarking::DATA_PATH, called GRIDFS_LARGE.
|
246
|
-
task :gridfs_download do
|
247
|
-
puts "MULTI DOCUMENT BENCHMARK:: GRIDFS DOWNLOAD"
|
248
|
-
Mongo::Benchmarking::MultiDoc.run(:gridfs_download)
|
249
|
-
end
|
250
|
-
end
|
251
|
-
|
252
|
-
namespace :parallel do
|
253
|
-
desc "Run the common driver paralell ETL benchmarking tests"
|
254
|
-
|
255
|
-
# Requirement: A directory in Mongo::Benchmarking::DATA_PATH, called LDJSON_MULTI,
|
256
|
-
# with the files used in this task.
|
257
|
-
task :import do
|
258
|
-
puts "PARALLEL ETL BENCHMARK:: IMPORT"
|
259
|
-
Mongo::Benchmarking::Parallel.run(:import)
|
260
|
-
end
|
261
|
-
|
262
|
-
# Requirement: A directory in Mongo::Benchmarking::DATA_PATH, called LDJSON_MULTI,
|
263
|
-
# with the files used in this task.
|
264
|
-
# Requirement: Another directory in "#{Mongo::Benchmarking::DATA_PATH}/LDJSON_MULTI"
|
265
|
-
# called 'output'.
|
266
|
-
task :export do
|
267
|
-
puts "PARALLEL ETL BENCHMARK:: EXPORT"
|
268
|
-
Mongo::Benchmarking::Parallel.run(:export)
|
269
|
-
end
|
270
|
-
|
271
|
-
# Requirement: A directory in Mongo::Benchmarking::DATA_PATH, called GRIDFS_MULTI,
|
272
|
-
# with the files used in this task.
|
273
|
-
task :gridfs_upload do
|
274
|
-
puts "PARALLEL ETL BENCHMARK:: GRIDFS UPLOAD"
|
275
|
-
Mongo::Benchmarking::Parallel.run(:gridfs_upload)
|
276
|
-
end
|
277
|
-
|
278
|
-
# Requirement: A directory in Mongo::Benchmarking::DATA_PATH, called GRIDFS_MULTI,
|
279
|
-
# with the files used in this task.
|
280
|
-
# Requirement: Another directory in "#{Mongo::Benchmarking::DATA_PATH}/GRIDFS_MULTI"
|
281
|
-
# called 'output'.
|
282
|
-
task :gridfs_download do
|
283
|
-
puts "PARALLEL ETL BENCHMARK:: GRIDFS DOWNLOAD"
|
284
|
-
Mongo::Benchmarking::Parallel.run(:gridfs_download)
|
285
|
-
end
|
286
|
-
end
|
287
|
-
end
|
196
|
+
load 'profile/driver_bench/rake/tasks.rake'
|
data/lib/mongo/address.rb
CHANGED
@@ -178,6 +178,9 @@ module Mongo
|
|
178
178
|
# @param [ Hash ] opts The options.
|
179
179
|
#
|
180
180
|
# @option opts [ Float ] :connect_timeout Connect timeout.
|
181
|
+
# @option opts [ Boolean ] :csot Whether the client-side operation timeout
|
182
|
+
# should be considered when connecting the socket. This option influences
|
183
|
+
# only what errors will be raised if timeout expires.
|
181
184
|
# @option opts [ true | false ] :ssl Whether to use SSL.
|
182
185
|
# @option opts [ String ] :ssl_ca_cert
|
183
186
|
# Same as the corresponding Client/Socket::SSL option.
|
@@ -214,11 +217,12 @@ module Mongo
|
|
214
217
|
# @since 2.0.0
|
215
218
|
# @api private
|
216
219
|
def socket(socket_timeout, opts = {})
|
220
|
+
csot = !!opts[:csot]
|
217
221
|
opts = {
|
218
222
|
connect_timeout: Server::CONNECT_TIMEOUT,
|
219
223
|
}.update(options).update(Hash[opts.map { |k, v| [k.to_sym, v] }])
|
220
224
|
|
221
|
-
map_exceptions do
|
225
|
+
map_exceptions(csot) do
|
222
226
|
if seed.downcase =~ Unix::MATCH
|
223
227
|
specific_address = Unix.new(seed.downcase)
|
224
228
|
return specific_address.socket(socket_timeout, opts)
|
@@ -281,11 +285,26 @@ module Mongo
|
|
281
285
|
end
|
282
286
|
end
|
283
287
|
|
284
|
-
|
288
|
+
# Maps some errors to different ones, mostly low-level errors to driver
|
289
|
+
# level errors
|
290
|
+
#
|
291
|
+
# @param [ Boolean ] csot Whether the client-side operation timeout
|
292
|
+
# should be considered when connecting the socket.
|
293
|
+
def map_exceptions(csot)
|
285
294
|
begin
|
286
295
|
yield
|
287
296
|
rescue Errno::ETIMEDOUT => e
|
288
|
-
|
297
|
+
if csot
|
298
|
+
raise Error::TimeoutError, "#{e.class}: #{e} (for #{self})"
|
299
|
+
else
|
300
|
+
raise Error::SocketTimeoutError, "#{e.class}: #{e} (for #{self})"
|
301
|
+
end
|
302
|
+
rescue Error::SocketTimeoutError => e
|
303
|
+
if csot
|
304
|
+
raise Error::TimeoutError, "#{e.class}: #{e} (for #{self})"
|
305
|
+
else
|
306
|
+
raise e
|
307
|
+
end
|
289
308
|
rescue IOError, SystemCallError => e
|
290
309
|
raise Error::SocketError, "#{e.class}: #{e} (for #{self})"
|
291
310
|
rescue OpenSSL::SSL::SSLError => e
|
@@ -69,20 +69,24 @@ module Mongo
|
|
69
69
|
# Retrieves a valid set of credentials, if possible, or raises
|
70
70
|
# Auth::InvalidConfiguration.
|
71
71
|
#
|
72
|
+
# @param [ CsotTimeoutHolder | nil ] timeout_holder CSOT timeout, if any.
|
73
|
+
#
|
72
74
|
# @return [ Auth::Aws::Credentials ] A valid set of credentials.
|
73
75
|
#
|
74
76
|
# @raise Auth::InvalidConfiguration if a source contains an invalid set
|
75
77
|
# of credentials.
|
76
78
|
# @raise Auth::Aws::CredentialsNotFound if credentials could not be
|
77
79
|
# retrieved from any source.
|
78
|
-
|
80
|
+
# @raise Error::TimeoutError if credentials cannot be retrieved within
|
81
|
+
# the timeout defined on the operation context.
|
82
|
+
def credentials(timeout_holder = nil)
|
79
83
|
credentials = credentials_from_user(user)
|
80
84
|
return credentials unless credentials.nil?
|
81
85
|
|
82
86
|
credentials = credentials_from_environment
|
83
87
|
return credentials unless credentials.nil?
|
84
88
|
|
85
|
-
credentials = @credentials_cache.fetch { obtain_credentials_from_endpoints }
|
89
|
+
credentials = @credentials_cache.fetch { obtain_credentials_from_endpoints(timeout_holder) }
|
86
90
|
return credentials unless credentials.nil?
|
87
91
|
|
88
92
|
raise Auth::Aws::CredentialsNotFound
|
@@ -127,17 +131,21 @@ module Mongo
|
|
127
131
|
|
128
132
|
# Returns credentials from the AWS metadata endpoints.
|
129
133
|
#
|
134
|
+
# @param [ CsotTimeoutHolder ] timeout_holder CSOT timeout.
|
135
|
+
#
|
130
136
|
# @return [ Auth::Aws::Credentials | nil ] A set of credentials, or nil
|
131
137
|
# if retrieval failed or the obtained credentials are invalid.
|
132
138
|
#
|
133
139
|
# @raise Auth::InvalidConfiguration if a source contains an invalid set
|
134
140
|
# of credentials.
|
135
|
-
|
136
|
-
|
141
|
+
# @ raise Error::TimeoutError if credentials cannot be retrieved within
|
142
|
+
# the timeout defined on the operation context.
|
143
|
+
def obtain_credentials_from_endpoints(timeout_holder = nil)
|
144
|
+
if (credentials = web_identity_credentials(timeout_holder)) && credentials_valid?(credentials, 'Web identity token')
|
137
145
|
credentials
|
138
|
-
elsif (credentials = ecs_metadata_credentials) && credentials_valid?(credentials, 'ECS task metadata')
|
146
|
+
elsif (credentials = ecs_metadata_credentials(timeout_holder)) && credentials_valid?(credentials, 'ECS task metadata')
|
139
147
|
credentials
|
140
|
-
elsif (credentials = ec2_metadata_credentials) && credentials_valid?(credentials, 'EC2 instance metadata')
|
148
|
+
elsif (credentials = ec2_metadata_credentials(timeout_holder)) && credentials_valid?(credentials, 'EC2 instance metadata')
|
141
149
|
credentials
|
142
150
|
end
|
143
151
|
end
|
@@ -145,21 +153,26 @@ module Mongo
|
|
145
153
|
# Returns credentials from the EC2 metadata endpoint. The credentials
|
146
154
|
# could be empty, partial or invalid.
|
147
155
|
#
|
156
|
+
# @param [ CsotTimeoutHolder ] timeout_holder CSOT timeout.
|
157
|
+
#
|
148
158
|
# @return [ Auth::Aws::Credentials | nil ] A set of credentials, or nil
|
149
159
|
# if retrieval failed.
|
150
|
-
|
160
|
+
# @ raise Error::TimeoutError if credentials cannot be retrieved within
|
161
|
+
# the timeout.
|
162
|
+
def ec2_metadata_credentials(timeout_holder = nil)
|
163
|
+
timeout_holder&.check_timeout!
|
151
164
|
http = Net::HTTP.new('169.254.169.254')
|
152
165
|
req = Net::HTTP::Put.new('/latest/api/token',
|
153
166
|
# The TTL is required in order to obtain the metadata token.
|
154
167
|
{'x-aws-ec2-metadata-token-ttl-seconds' => '30'})
|
155
|
-
resp =
|
168
|
+
resp = with_timeout(timeout_holder) do
|
156
169
|
http.request(req)
|
157
170
|
end
|
158
171
|
if resp.code != '200'
|
159
172
|
return nil
|
160
173
|
end
|
161
174
|
metadata_token = resp.body
|
162
|
-
resp =
|
175
|
+
resp = with_timeout(timeout_holder) do
|
163
176
|
http_get(http, '/latest/meta-data/iam/security-credentials', metadata_token)
|
164
177
|
end
|
165
178
|
if resp.code != '200'
|
@@ -167,7 +180,7 @@ module Mongo
|
|
167
180
|
end
|
168
181
|
role_name = resp.body
|
169
182
|
escaped_role_name = CGI.escape(role_name).gsub('+', '%20')
|
170
|
-
resp =
|
183
|
+
resp = with_timeout(timeout_holder) do
|
171
184
|
http_get(http, "/latest/meta-data/iam/security-credentials/#{escaped_role_name}", metadata_token)
|
172
185
|
end
|
173
186
|
if resp.code != '200'
|
@@ -189,7 +202,17 @@ module Mongo
|
|
189
202
|
return nil
|
190
203
|
end
|
191
204
|
|
192
|
-
|
205
|
+
# Returns credentials from the ECS metadata endpoint. The credentials
|
206
|
+
# could be empty, partial or invalid.
|
207
|
+
#
|
208
|
+
# @param [ CsotTimeoutHolder | nil ] timeout_holder CSOT timeout.
|
209
|
+
#
|
210
|
+
# @return [ Auth::Aws::Credentials | nil ] A set of credentials, or nil
|
211
|
+
# if retrieval failed.
|
212
|
+
# @ raise Error::TimeoutError if credentials cannot be retrieved within
|
213
|
+
# the timeout defined on the operation context.
|
214
|
+
def ecs_metadata_credentials(timeout_holder = nil)
|
215
|
+
timeout_holder&.check_timeout!
|
193
216
|
relative_uri = ENV['AWS_CONTAINER_CREDENTIALS_RELATIVE_URI']
|
194
217
|
if relative_uri.nil? || relative_uri.empty?
|
195
218
|
return nil
|
@@ -203,7 +226,7 @@ module Mongo
|
|
203
226
|
# a leading slash must be added by the driver, but this is not
|
204
227
|
# in fact needed.
|
205
228
|
req = Net::HTTP::Get.new(relative_uri)
|
206
|
-
resp =
|
229
|
+
resp = with_timeout(timeout_holder) do
|
207
230
|
http.request(req)
|
208
231
|
end
|
209
232
|
if resp.code != '200'
|
@@ -225,13 +248,15 @@ module Mongo
|
|
225
248
|
# inside EKS. See https://docs.aws.amazon.com/eks/latest/userguide/iam-roles-for-service-accounts.html
|
226
249
|
# for further details.
|
227
250
|
#
|
251
|
+
# @param [ CsotTimeoutHolder | nil ] timeout_holder CSOT timeout.
|
252
|
+
#
|
228
253
|
# @return [ Auth::Aws::Credentials | nil ] A set of credentials, or nil
|
229
254
|
# if retrieval failed.
|
230
|
-
def web_identity_credentials
|
255
|
+
def web_identity_credentials(timeout_holder = nil)
|
231
256
|
web_identity_token, role_arn, role_session_name = prepare_web_identity_inputs
|
232
257
|
return nil if web_identity_token.nil?
|
233
258
|
response = request_web_identity_credentials(
|
234
|
-
web_identity_token, role_arn, role_session_name
|
259
|
+
web_identity_token, role_arn, role_session_name, timeout_holder
|
235
260
|
)
|
236
261
|
return if response.nil?
|
237
262
|
credentials_from_web_identity_response(response)
|
@@ -266,10 +291,15 @@ module Mongo
|
|
266
291
|
# that the caller is assuming.
|
267
292
|
# @param [ String ] role_session_name An identifier for the assumed
|
268
293
|
# role session.
|
294
|
+
# @param [ CsotTimeoutHolder | nil ] timeout_holder CSOT timeout.
|
269
295
|
#
|
270
296
|
# @return [ Net::HTTPResponse | nil ] AWS API response if successful,
|
271
297
|
# otherwise nil.
|
272
|
-
|
298
|
+
#
|
299
|
+
# @ raise Error::TimeoutError if credentials cannot be retrieved within
|
300
|
+
# the timeout defined on the operation context.
|
301
|
+
def request_web_identity_credentials(token, role_arn, role_session_name, timeout_holder)
|
302
|
+
timeout_holder&.check_timeout!
|
273
303
|
uri = URI('https://sts.amazonaws.com/')
|
274
304
|
params = {
|
275
305
|
'Action' => 'AssumeRoleWithWebIdentity',
|
@@ -281,8 +311,10 @@ module Mongo
|
|
281
311
|
uri.query = ::URI.encode_www_form(params)
|
282
312
|
req = Net::HTTP::Post.new(uri)
|
283
313
|
req['Accept'] = 'application/json'
|
284
|
-
resp =
|
285
|
-
|
314
|
+
resp = with_timeout(timeout_holder) do
|
315
|
+
Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |https|
|
316
|
+
https.request(req)
|
317
|
+
end
|
286
318
|
end
|
287
319
|
if resp.code != '200'
|
288
320
|
return nil
|
@@ -351,6 +383,27 @@ module Mongo
|
|
351
383
|
|
352
384
|
true
|
353
385
|
end
|
386
|
+
|
387
|
+
# Execute the given block considering the timeout defined on the context,
|
388
|
+
# or the default timeout value.
|
389
|
+
#
|
390
|
+
# We use +Timeout.timeout+ here because there is no other acceptable easy
|
391
|
+
# way to time limit http requests.
|
392
|
+
#
|
393
|
+
# @param [ CsotTimeoutHolder | nil ] timeout_holder CSOT timeout.
|
394
|
+
#
|
395
|
+
# @ raise Error::TimeoutError if deadline exceeded.
|
396
|
+
def with_timeout(timeout_holder)
|
397
|
+
timeout = timeout_holder&.remaining_timeout_sec! || METADATA_TIMEOUT
|
398
|
+
exception_class = if timeout_holder&.csot?
|
399
|
+
Error::TimeoutError
|
400
|
+
else
|
401
|
+
nil
|
402
|
+
end
|
403
|
+
::Timeout.timeout(timeout, exception_class) do
|
404
|
+
yield
|
405
|
+
end
|
406
|
+
end
|
354
407
|
end
|
355
408
|
end
|
356
409
|
end
|
data/lib/mongo/auth/base.rb
CHANGED
@@ -117,7 +117,7 @@ module Mongo
|
|
117
117
|
else
|
118
118
|
nil
|
119
119
|
end
|
120
|
-
result = Operation::Result.new(reply, connection.description, connection_global_id)
|
120
|
+
result = Operation::Result.new(reply, connection.description, connection_global_id, context: context)
|
121
121
|
connection.update_cluster_time(result)
|
122
122
|
reply_document
|
123
123
|
end
|