mongo 2.15.0 → 2.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/README.md +22 -38
- data/lib/mongo/auth/aws/request.rb +0 -1
- data/lib/mongo/auth/base.rb +8 -1
- data/lib/mongo/auth.rb +12 -1
- data/lib/mongo/bulk_write/result.rb +10 -1
- data/lib/mongo/bulk_write/result_combiner.rb +2 -4
- data/lib/mongo/bulk_write.rb +115 -29
- data/lib/mongo/client.rb +182 -22
- data/lib/mongo/client_encryption.rb +113 -10
- data/lib/mongo/cluster/periodic_executor.rb +4 -3
- data/lib/mongo/cluster/reapers/cursor_reaper.rb +98 -43
- data/lib/mongo/cluster/sdam_flow.rb +9 -3
- data/lib/mongo/cluster/topology/base.rb +13 -9
- data/lib/mongo/cluster/topology/load_balanced.rb +102 -0
- data/lib/mongo/cluster/topology.rb +28 -8
- data/lib/mongo/cluster.rb +162 -79
- data/lib/mongo/collection/helpers.rb +43 -0
- data/lib/mongo/collection/queryable_encryption.rb +122 -0
- data/lib/mongo/collection/view/aggregation.rb +68 -22
- data/lib/mongo/collection/view/builder/aggregation.rb +16 -17
- data/lib/mongo/collection/view/builder/map_reduce.rb +15 -49
- data/lib/mongo/collection/view/builder.rb +0 -4
- data/lib/mongo/collection/view/change_stream.rb +66 -20
- data/lib/mongo/collection/view/explainable.rb +1 -1
- data/lib/mongo/collection/view/iterable.rb +64 -30
- data/lib/mongo/collection/view/map_reduce.rb +72 -24
- data/lib/mongo/collection/view/readable.rb +106 -70
- data/lib/mongo/collection/view/writable.rb +296 -177
- data/lib/mongo/collection/view.rb +15 -21
- data/lib/mongo/collection.rb +141 -53
- data/lib/mongo/config/options.rb +62 -0
- data/lib/mongo/config/validators/option.rb +26 -0
- data/lib/mongo/config.rb +42 -0
- data/lib/mongo/crypt/auto_encrypter.rb +136 -14
- data/lib/mongo/crypt/binding.rb +513 -144
- data/lib/mongo/crypt/context.rb +5 -2
- data/lib/mongo/crypt/data_key_context.rb +12 -104
- data/lib/mongo/crypt/encryption_io.rb +94 -60
- data/lib/mongo/crypt/explicit_encrypter.rb +143 -26
- data/lib/mongo/crypt/explicit_encryption_context.rb +25 -2
- data/lib/mongo/crypt/handle.rb +160 -86
- data/lib/mongo/crypt/hooks.rb +25 -2
- data/lib/mongo/crypt/kms/aws.rb +136 -0
- data/lib/mongo/crypt/kms/azure.rb +144 -0
- data/lib/mongo/crypt/kms/credentials.rb +81 -0
- data/lib/mongo/crypt/kms/gcp.rb +189 -0
- data/lib/mongo/crypt/kms/kmip.rb +116 -0
- data/lib/mongo/crypt/kms/local.rb +82 -0
- data/lib/mongo/crypt/kms/master_key_document.rb +65 -0
- data/lib/mongo/crypt/kms.rb +117 -0
- data/lib/mongo/crypt/rewrap_many_data_key_context.rb +46 -0
- data/lib/mongo/crypt/rewrap_many_data_key_result.rb +37 -0
- data/lib/mongo/crypt/status.rb +8 -2
- data/lib/mongo/crypt.rb +3 -0
- data/lib/mongo/cursor/kill_spec.rb +76 -0
- data/lib/mongo/cursor.rb +92 -36
- data/lib/mongo/database/view.rb +11 -6
- data/lib/mongo/database.rb +63 -19
- data/lib/mongo/dbref.rb +1 -105
- data/lib/mongo/error/bad_load_balancer_target.rb +26 -0
- data/lib/mongo/error/bulk_write_error.rb +31 -4
- data/lib/mongo/error/invalid_config_option.rb +20 -0
- data/lib/mongo/error/invalid_replacement_document.rb +27 -9
- data/lib/mongo/error/invalid_update_document.rb +27 -7
- data/lib/mongo/error/labelable.rb +72 -0
- data/lib/mongo/error/missing_connection.rb +25 -0
- data/lib/mongo/error/missing_file_chunk.rb +8 -2
- data/lib/mongo/error/missing_service_id.rb +26 -0
- data/lib/mongo/error/no_service_connection_available.rb +49 -0
- data/lib/mongo/error/notable.rb +14 -0
- data/lib/mongo/error/operation_failure.rb +34 -86
- data/lib/mongo/error/read_write_retryable.rb +108 -0
- data/lib/mongo/error/session_not_materialized.rb +29 -0
- data/lib/mongo/error/snapshot_session_invalid_server_version.rb +31 -0
- data/lib/mongo/error/snapshot_session_transaction_prohibited.rb +30 -0
- data/lib/mongo/error.rb +10 -37
- data/lib/mongo/grid/fs_bucket.rb +21 -2
- data/lib/mongo/grid/stream/read.rb +6 -0
- data/lib/mongo/id.rb +7 -5
- data/lib/mongo/index/view.rb +45 -48
- data/lib/mongo/monitoring/event/cmap/pool_cleared.rb +7 -4
- data/lib/mongo/monitoring/event/command_failed.rb +9 -3
- data/lib/mongo/monitoring/event/command_started.rb +3 -1
- data/lib/mongo/monitoring/event/command_succeeded.rb +9 -2
- data/lib/mongo/monitoring/publishable.rb +11 -7
- data/lib/mongo/operation/aggregate/command.rb +8 -0
- data/lib/mongo/operation/collections_info/result.rb +5 -2
- data/lib/mongo/operation/command/op_msg.rb +6 -0
- data/lib/mongo/operation/context.rb +37 -1
- data/lib/mongo/operation/count/command.rb +6 -0
- data/lib/mongo/operation/count/op_msg.rb +9 -0
- data/lib/mongo/operation/create/command.rb +7 -1
- data/lib/mongo/operation/create/op_msg.rb +10 -0
- data/lib/mongo/operation/create_index/command.rb +17 -1
- data/lib/mongo/operation/create_index/op_msg.rb +18 -4
- data/lib/mongo/operation/delete/command.rb +6 -3
- data/lib/mongo/operation/delete/op_msg.rb +10 -1
- data/lib/mongo/operation/delete.rb +0 -1
- data/lib/mongo/operation/distinct/command.rb +6 -0
- data/lib/mongo/operation/distinct/op_msg.rb +10 -0
- data/lib/mongo/operation/drop_index/op_msg.rb +5 -1
- data/lib/mongo/operation/explain/command.rb +13 -1
- data/lib/mongo/operation/explain/legacy.rb +12 -5
- data/lib/mongo/operation/explain/op_msg.rb +9 -1
- data/lib/mongo/operation/find/builder/command.rb +111 -0
- data/lib/mongo/{collection/view → operation/find}/builder/flags.rb +10 -14
- data/lib/mongo/operation/find/builder/legacy.rb +123 -0
- data/lib/mongo/{collection/view → operation/find}/builder/modifiers.rb +31 -25
- data/lib/mongo/{cursor → operation/find}/builder.rb +4 -4
- data/lib/mongo/operation/find/command.rb +9 -0
- data/lib/mongo/operation/find/legacy.rb +10 -1
- data/lib/mongo/operation/find/op_msg.rb +12 -0
- data/lib/mongo/operation/find.rb +1 -0
- data/lib/mongo/operation/get_more/command.rb +1 -0
- data/lib/mongo/operation/get_more/command_builder.rb +42 -0
- data/lib/mongo/operation/get_more/op_msg.rb +1 -0
- data/lib/mongo/operation/get_more.rb +1 -0
- data/lib/mongo/operation/insert/bulk_result.rb +5 -1
- data/lib/mongo/operation/insert/command.rb +0 -4
- data/lib/mongo/operation/insert/op_msg.rb +6 -3
- data/lib/mongo/operation/insert/result.rb +6 -3
- data/lib/mongo/operation/insert.rb +0 -1
- data/lib/mongo/operation/kill_cursors/command.rb +8 -0
- data/lib/mongo/operation/kill_cursors/{legacy.rb → command_builder.rb} +6 -11
- data/lib/mongo/operation/kill_cursors/op_msg.rb +10 -0
- data/lib/mongo/operation/kill_cursors.rb +1 -1
- data/lib/mongo/operation/list_collections/op_msg.rb +4 -1
- data/lib/mongo/operation/map_reduce/command.rb +8 -0
- data/lib/mongo/operation/map_reduce/op_msg.rb +1 -1
- data/lib/mongo/operation/map_reduce/result.rb +16 -0
- data/lib/mongo/operation/result.rb +27 -5
- data/lib/mongo/operation/shared/executable.rb +36 -3
- data/lib/mongo/operation/shared/polymorphic_operation.rb +15 -3
- data/lib/mongo/operation/shared/read_preference_supported.rb +3 -1
- data/lib/mongo/operation/shared/response_handling.rb +7 -5
- data/lib/mongo/operation/shared/sessions_supported.rb +35 -15
- data/lib/mongo/operation/shared/specifiable.rb +11 -29
- data/lib/mongo/operation/shared/validatable.rb +87 -0
- data/lib/mongo/operation/shared/write.rb +18 -12
- data/lib/mongo/operation/update/command.rb +6 -3
- data/lib/mongo/operation/update/op_msg.rb +9 -4
- data/lib/mongo/operation/update.rb +0 -1
- data/lib/mongo/operation/{delete/legacy.rb → write_command/command.rb} +17 -23
- data/lib/mongo/operation/write_command/op_msg.rb +43 -0
- data/lib/mongo/operation/write_command.rb +32 -0
- data/lib/mongo/operation.rb +10 -0
- data/lib/mongo/protocol/caching_hash.rb +69 -0
- data/lib/mongo/protocol/msg.rb +21 -1
- data/lib/mongo/protocol/query.rb +35 -18
- data/lib/mongo/protocol.rb +1 -0
- data/lib/mongo/query_cache.rb +27 -2
- data/lib/mongo/retryable.rb +78 -30
- data/lib/mongo/server/connection.rb +58 -3
- data/lib/mongo/server/connection_base.rb +14 -1
- data/lib/mongo/server/connection_common.rb +41 -1
- data/lib/mongo/server/connection_pool/generation_manager.rb +71 -0
- data/lib/mongo/server/connection_pool.rb +144 -43
- data/lib/mongo/server/description/features.rb +22 -17
- data/lib/mongo/server/description/load_balancer.rb +33 -0
- data/lib/mongo/server/description.rb +90 -6
- data/lib/mongo/server/monitor/connection.rb +16 -10
- data/lib/mongo/server/monitor.rb +27 -14
- data/lib/mongo/server/pending_connection.rb +47 -31
- data/lib/mongo/server/push_monitor.rb +21 -2
- data/lib/mongo/server.rb +78 -27
- data/lib/mongo/server_selector/base.rb +31 -5
- data/lib/mongo/session/session_pool.rb +19 -0
- data/lib/mongo/session.rb +142 -27
- data/lib/mongo/socket/ocsp_cache.rb +2 -3
- data/lib/mongo/socket/ocsp_verifier.rb +7 -39
- data/lib/mongo/socket/tcp.rb +3 -0
- data/lib/mongo/socket.rb +1 -5
- data/lib/mongo/srv/resolver.rb +24 -3
- data/lib/mongo/uri/options_mapper.rb +3 -0
- data/lib/mongo/uri/srv_protocol.rb +7 -9
- data/lib/mongo/uri.rb +38 -0
- data/lib/mongo/utils.rb +0 -13
- data/lib/mongo/version.rb +1 -1
- data/lib/mongo.rb +22 -0
- data/mongo.gemspec +11 -5
- data/spec/README.md +23 -5
- data/spec/integration/auth_spec.rb +31 -1
- data/spec/integration/awaited_ismaster_spec.rb +1 -1
- data/spec/integration/aws_lambda_examples_spec.rb +68 -0
- data/spec/integration/bulk_write_error_message_spec.rb +32 -0
- data/spec/integration/bulk_write_spec.rb +17 -1
- data/spec/integration/change_stream_spec.rb +9 -8
- data/spec/integration/client_construction_spec.rb +128 -8
- data/spec/integration/client_side_encryption/auto_encryption_bulk_writes_spec.rb +10 -10
- data/spec/integration/client_side_encryption/auto_encryption_command_monitoring_spec.rb +169 -169
- data/spec/integration/client_side_encryption/auto_encryption_mongocryptd_spawn_spec.rb +0 -1
- data/spec/integration/client_side_encryption/auto_encryption_reconnect_spec.rb +31 -0
- data/spec/integration/client_side_encryption/auto_encryption_spec.rb +108 -1
- data/spec/integration/client_side_encryption/bson_size_limit_spec.rb +3 -3
- data/spec/integration/client_side_encryption/bypass_mongocryptd_spawn_spec.rb +2 -2
- data/spec/integration/client_side_encryption/client_close_spec.rb +1 -1
- data/spec/integration/client_side_encryption/corpus_spec.rb +64 -35
- data/spec/integration/client_side_encryption/custom_endpoint_spec.rb +39 -42
- data/spec/integration/client_side_encryption/data_key_spec.rb +98 -8
- data/spec/integration/client_side_encryption/decryption_events_prose_spec.rb +158 -0
- data/spec/integration/client_side_encryption/explicit_encryption_spec.rb +59 -0
- data/spec/integration/client_side_encryption/explicit_queryable_encryption_spec.rb +147 -0
- data/spec/integration/client_side_encryption/external_key_vault_spec.rb +6 -6
- data/spec/integration/client_side_encryption/kms_tls_options_spec.rb +436 -0
- data/spec/integration/client_side_encryption/kms_tls_spec.rb +92 -0
- data/spec/integration/client_side_encryption/queryable_encryption_examples_spec.rb +111 -0
- data/spec/integration/client_side_encryption/unique_index_on_key_alt_names_prose_spec.rb +85 -0
- data/spec/integration/client_side_encryption/views_spec.rb +1 -1
- data/spec/integration/client_spec.rb +2 -0
- data/spec/integration/client_update_spec.rb +2 -2
- data/spec/integration/command_monitoring_spec.rb +1 -1
- data/spec/integration/command_spec.rb +1 -1
- data/spec/integration/connection_spec.rb +52 -35
- data/spec/integration/crud_spec.rb +186 -1
- data/spec/integration/cursor_pinning_spec.rb +121 -0
- data/spec/integration/cursor_reaping_spec.rb +8 -4
- data/spec/integration/fork_reconnect_spec.rb +16 -13
- data/spec/integration/get_more_spec.rb +1 -1
- data/spec/integration/grid_fs_bucket_spec.rb +3 -3
- data/spec/integration/heartbeat_events_spec.rb +1 -1
- data/spec/integration/map_reduce_spec.rb +77 -0
- data/spec/integration/ocsp_verifier_spec.rb +3 -0
- data/spec/integration/query_cache_spec.rb +240 -32
- data/spec/integration/query_cache_transactions_spec.rb +1 -1
- data/spec/integration/read_concern_spec.rb +1 -1
- data/spec/integration/read_preference_spec.rb +17 -13
- data/spec/integration/reconnect_spec.rb +32 -12
- data/spec/integration/retryable_errors_spec.rb +1 -1
- data/spec/integration/retryable_writes/retryable_writes_36_and_older_spec.rb +2 -2
- data/spec/integration/retryable_writes/retryable_writes_40_and_newer_spec.rb +1 -1
- data/spec/integration/sdam_error_handling_spec.rb +5 -3
- data/spec/integration/sdam_events_spec.rb +75 -19
- data/spec/integration/sdam_prose_spec.rb +1 -1
- data/spec/integration/server_monitor_spec.rb +3 -1
- data/spec/integration/server_selector_spec.rb +22 -5
- data/spec/integration/server_spec.rb +2 -0
- data/spec/integration/size_limit_spec.rb +4 -1
- data/spec/integration/snapshot_query_examples_spec.rb +127 -0
- data/spec/integration/srv_monitoring_spec.rb +39 -1
- data/spec/integration/srv_spec.rb +1 -0
- data/spec/integration/step_down_spec.rb +21 -5
- data/spec/integration/transaction_pinning_spec.rb +120 -0
- data/spec/integration/versioned_api_examples_spec.rb +52 -1
- data/spec/integration/x509_auth_spec.rb +1 -1
- data/spec/lite_spec_helper.rb +27 -11
- data/spec/mongo/address/ipv6_spec.rb +7 -0
- data/spec/mongo/address/unix_spec.rb +1 -0
- data/spec/mongo/address_spec.rb +7 -0
- data/spec/mongo/auth/cr_spec.rb +2 -3
- data/spec/mongo/auth/ldap_spec.rb +2 -3
- data/spec/mongo/auth/scram/conversation_spec.rb +23 -23
- data/spec/mongo/auth/scram256/conversation_spec.rb +20 -20
- data/spec/mongo/auth/scram_negotiation_spec.rb +1 -0
- data/spec/mongo/auth/scram_spec.rb +2 -3
- data/spec/mongo/auth/user/view_spec.rb +1 -1
- data/spec/mongo/auth/x509_spec.rb +2 -3
- data/spec/mongo/bulk_write/result_spec.rb +15 -1
- data/spec/mongo/bulk_write_spec.rb +144 -23
- data/spec/mongo/client_construction_spec.rb +443 -35
- data/spec/mongo/client_encryption_spec.rb +10 -22
- data/spec/mongo/client_spec.rb +303 -5
- data/spec/mongo/cluster/cursor_reaper_spec.rb +63 -23
- data/spec/mongo/cluster/periodic_executor_spec.rb +3 -1
- data/spec/mongo/cluster_spec.rb +33 -36
- data/spec/mongo/collection/view/aggregation_spec.rb +178 -83
- data/spec/mongo/collection/view/builder/find_command_spec.rb +4 -0
- data/spec/mongo/collection/view/builder/op_query_spec.rb +4 -0
- data/spec/mongo/collection/view/change_stream_spec.rb +2 -2
- data/spec/mongo/collection/view/map_reduce_spec.rb +31 -2
- data/spec/mongo/collection/view/readable_spec.rb +661 -1
- data/spec/mongo/collection/view/writable_spec.rb +144 -32
- data/spec/mongo/collection_crud_spec.rb +70 -15
- data/spec/mongo/collection_ddl_spec.rb +1 -1
- data/spec/mongo/collection_spec.rb +33 -1
- data/spec/mongo/config/options_spec.rb +75 -0
- data/spec/mongo/config_spec.rb +73 -0
- data/spec/mongo/crypt/auto_decryption_context_spec.rb +17 -1
- data/spec/mongo/crypt/auto_encrypter_spec.rb +256 -5
- data/spec/mongo/crypt/auto_encryption_context_spec.rb +17 -1
- data/spec/mongo/crypt/binding/context_spec.rb +67 -17
- data/spec/mongo/crypt/binding/mongocrypt_spec.rb +17 -46
- data/spec/mongo/crypt/binding/version_spec.rb +33 -0
- data/spec/mongo/crypt/binding_unloaded_spec.rb +14 -0
- data/spec/mongo/crypt/data_key_context_spec.rb +42 -114
- data/spec/mongo/crypt/encryption_io_spec.rb +2 -0
- data/spec/mongo/crypt/explicit_decryption_context_spec.rb +32 -1
- data/spec/mongo/crypt/explicit_encryption_context_spec.rb +94 -1
- data/spec/mongo/crypt/handle_spec.rb +172 -156
- data/spec/mongo/crypt/hooks_spec.rb +30 -0
- data/spec/mongo/crypt/kms/credentials_spec.rb +357 -0
- data/spec/mongo/crypt/kms_spec.rb +59 -0
- data/spec/mongo/cursor/builder/get_more_command_spec.rb +4 -0
- data/spec/mongo/cursor/builder/op_get_more_spec.rb +4 -0
- data/spec/mongo/cursor_spec.rb +104 -7
- data/spec/mongo/database_spec.rb +81 -16
- data/spec/mongo/error/operation_failure_heavy_spec.rb +50 -1
- data/spec/mongo/grid/fs_bucket_spec.rb +18 -12
- data/spec/mongo/grid/stream/write_spec.rb +3 -9
- data/spec/mongo/grid/stream_spec.rb +1 -1
- data/spec/mongo/index/view_spec.rb +127 -2
- data/spec/mongo/operation/create/op_msg_spec.rb +244 -0
- data/spec/mongo/operation/delete/op_msg_spec.rb +14 -5
- data/spec/mongo/operation/delete_spec.rb +0 -30
- data/spec/mongo/{collection/view → operation/find}/builder/flags_spec.rb +2 -2
- data/spec/mongo/{collection/view → operation/find}/builder/modifiers_spec.rb +2 -2
- data/spec/mongo/operation/find/legacy_spec.rb +1 -0
- data/spec/mongo/operation/insert/bulk_spec.rb +1 -1
- data/spec/mongo/operation/insert/op_msg_spec.rb +19 -11
- data/spec/mongo/operation/insert_spec.rb +0 -32
- data/spec/mongo/operation/read_preference_legacy_spec.rb +4 -0
- data/spec/mongo/operation/read_preference_op_msg_spec.rb +26 -1
- data/spec/mongo/operation/result_spec.rb +20 -0
- data/spec/mongo/operation/update/bulk_spec.rb +1 -1
- data/spec/mongo/operation/update/op_msg_spec.rb +14 -5
- data/spec/mongo/operation/update_spec.rb +0 -29
- data/spec/mongo/protocol/caching_hash_spec.rb +82 -0
- data/spec/mongo/protocol/msg_spec.rb +41 -0
- data/spec/mongo/query_cache_spec.rb +172 -2
- data/spec/mongo/retryable_spec.rb +32 -3
- data/spec/mongo/server/connection_auth_spec.rb +3 -1
- data/spec/mongo/server/connection_common_spec.rb +76 -13
- data/spec/mongo/server/connection_pool_spec.rb +178 -45
- data/spec/mongo/server/connection_spec.rb +186 -200
- data/spec/mongo/server/description/features_spec.rb +24 -0
- data/spec/mongo/server/description_spec.rb +1 -1
- data/spec/mongo/server/monitor/connection_spec.rb +22 -0
- data/spec/mongo/server/monitor_spec.rb +4 -3
- data/spec/mongo/server/push_monitor_spec.rb +95 -0
- data/spec/mongo/server_selector_spec.rb +136 -15
- data/spec/mongo/session/session_pool_spec.rb +42 -10
- data/spec/mongo/session_spec.rb +26 -6
- data/spec/mongo/session_transaction_spec.rb +15 -29
- data/spec/mongo/socket/ssl_spec.rb +42 -63
- data/spec/mongo/socket/unix_spec.rb +1 -0
- data/spec/mongo/uri/srv_protocol_spec.rb +101 -2
- data/spec/mongo/uri_option_parsing_spec.rb +38 -5
- data/spec/mongo/uri_spec.rb +25 -0
- data/spec/mongo/utils_spec.rb +0 -14
- data/spec/runners/auth.rb +1 -1
- data/spec/runners/change_streams/spec.rb +1 -1
- data/spec/runners/change_streams/test.rb +1 -1
- data/spec/runners/cmap.rb +2 -2
- data/spec/runners/command_monitoring.rb +1 -1
- data/spec/runners/connection_string.rb +16 -4
- data/spec/runners/crud/operation.rb +17 -6
- data/spec/runners/crud/requirement.rb +10 -4
- data/spec/runners/crud/spec.rb +6 -3
- data/spec/runners/crud/test.rb +1 -1
- data/spec/runners/crud/verifier.rb +7 -2
- data/spec/runners/crud.rb +1 -1
- data/spec/runners/gridfs.rb +1 -1
- data/spec/runners/read_write_concern_document.rb +1 -1
- data/spec/runners/sdam.rb +3 -2
- data/spec/runners/server_selection.rb +1 -1
- data/spec/runners/server_selection_rtt.rb +1 -1
- data/spec/runners/transactions/spec.rb +2 -2
- data/spec/runners/transactions/test.rb +21 -18
- data/spec/runners/transactions.rb +11 -8
- data/spec/runners/unified/assertions.rb +95 -15
- data/spec/runners/unified/change_stream_operations.rb +12 -0
- data/spec/runners/unified/client_side_encryption_operations.rb +83 -0
- data/spec/runners/unified/crud_operations.rb +143 -26
- data/spec/runners/unified/ddl_operations.rb +74 -1
- data/spec/runners/unified/entity_map.rb +3 -3
- data/spec/runners/unified/error.rb +2 -1
- data/spec/runners/unified/event_subscriber.rb +2 -2
- data/spec/runners/unified/grid_fs_operations.rb +21 -0
- data/spec/runners/unified/support_operations.rb +21 -5
- data/spec/runners/unified/test.rb +96 -8
- data/spec/runners/unified/test_group.rb +1 -1
- data/spec/runners/unified.rb +10 -3
- data/spec/shared/lib/mrss/cluster_config.rb +6 -1
- data/spec/shared/lib/mrss/constraints.rb +21 -22
- data/spec/shared/lib/mrss/docker_runner.rb +23 -3
- data/spec/shared/lib/mrss/eg_config_utils.rb +51 -0
- data/spec/shared/lib/mrss/event_subscriber.rb +210 -0
- data/spec/shared/lib/mrss/lite_constraints.rb +40 -1
- data/spec/shared/lib/mrss/server_version_registry.rb +17 -12
- data/spec/shared/lib/mrss/session_registry.rb +69 -0
- data/spec/shared/lib/mrss/session_registry_legacy.rb +60 -0
- data/spec/shared/share/Dockerfile.erb +61 -58
- data/spec/shared/shlib/config.sh +27 -0
- data/spec/shared/shlib/distro.sh +2 -1
- data/spec/shared/shlib/server.sh +114 -39
- data/spec/shared/shlib/set_env.sh +43 -5
- data/spec/solo/clean_exit_spec.rb +5 -0
- data/spec/spec_helper.rb +0 -1
- data/spec/spec_tests/client_side_encryption_spec.rb +1 -1
- data/spec/spec_tests/client_side_encryption_unified_spec.rb +16 -0
- data/spec/spec_tests/cmap_spec.rb +4 -1
- data/spec/spec_tests/crud_spec.rb +0 -10
- data/spec/spec_tests/data/change_streams_unified/change-streams-errors.yml +124 -0
- data/spec/spec_tests/data/change_streams_unified/change-streams-pre_and_post_images.yml +351 -0
- data/spec/spec_tests/data/change_streams_unified/change-streams-resume-allowlist.yml +1171 -0
- data/spec/spec_tests/data/change_streams_unified/change-streams-resume-errorLabels.yml +1071 -0
- data/spec/spec_tests/data/change_streams_unified/change-streams-showExpandedEvents.yml +298 -0
- data/spec/spec_tests/data/change_streams_unified/change-streams.yml +859 -4
- data/spec/spec_tests/data/client_side_encryption/aggregate.yml +3 -17
- data/spec/spec_tests/data/client_side_encryption/azureKMS.yml +46 -0
- data/spec/spec_tests/data/client_side_encryption/badQueries.yml +12 -2
- data/spec/spec_tests/data/client_side_encryption/basic.yml +3 -17
- data/spec/spec_tests/data/client_side_encryption/bulk.yml +1 -8
- data/spec/spec_tests/data/client_side_encryption/bypassAutoEncryption.yml +2 -2
- data/spec/spec_tests/data/client_side_encryption/count.yml +1 -8
- data/spec/spec_tests/data/client_side_encryption/countDocuments.yml +1 -8
- data/spec/spec_tests/data/client_side_encryption/create-and-createIndexes.yml +58 -0
- data/spec/spec_tests/data/client_side_encryption/delete.yml +2 -16
- data/spec/spec_tests/data/client_side_encryption/distinct.yml +1 -8
- data/spec/spec_tests/data/client_side_encryption/explain.yml +1 -8
- data/spec/spec_tests/data/client_side_encryption/find.yml +2 -16
- data/spec/spec_tests/data/client_side_encryption/findOneAndDelete.yml +1 -8
- data/spec/spec_tests/data/client_side_encryption/findOneAndReplace.yml +1 -8
- data/spec/spec_tests/data/client_side_encryption/findOneAndUpdate.yml +1 -8
- data/spec/spec_tests/data/client_side_encryption/fle2-BypassQueryAnalysis.yml +101 -0
- data/spec/spec_tests/data/client_side_encryption/fle2-Compact.yml +80 -0
- data/spec/spec_tests/data/client_side_encryption/fle2-CreateCollection.yml +1263 -0
- data/spec/spec_tests/data/client_side_encryption/fle2-DecryptExistingData.yml +64 -0
- data/spec/spec_tests/data/client_side_encryption/fle2-Delete.yml +107 -0
- data/spec/spec_tests/data/client_side_encryption/fle2-EncryptedFields-vs-EncryptedFieldsMap.yml +80 -0
- data/spec/spec_tests/data/client_side_encryption/fle2-EncryptedFields-vs-jsonSchema.yml +90 -0
- data/spec/spec_tests/data/client_side_encryption/fle2-EncryptedFieldsMap-defaults.yml +57 -0
- data/spec/spec_tests/data/client_side_encryption/fle2-FindOneAndUpdate.yml +213 -0
- data/spec/spec_tests/data/client_side_encryption/fle2-InsertFind-Indexed.yml +86 -0
- data/spec/spec_tests/data/client_side_encryption/fle2-InsertFind-Unindexed.yml +83 -0
- data/spec/spec_tests/data/client_side_encryption/fle2-MissingKey.yml +41 -0
- data/spec/spec_tests/data/client_side_encryption/fle2-NoEncryption.yml +42 -0
- data/spec/spec_tests/data/client_side_encryption/fle2-Update.yml +221 -0
- data/spec/spec_tests/data/client_side_encryption/fle2-validatorAndPartialFieldExpression.yml +168 -0
- data/spec/spec_tests/data/client_side_encryption/gcpKMS.yml +46 -0
- data/spec/spec_tests/data/client_side_encryption/getMore.yml +1 -8
- data/spec/spec_tests/data/client_side_encryption/insert.yml +2 -16
- data/spec/spec_tests/data/client_side_encryption/keyAltName.yml +1 -8
- data/spec/spec_tests/data/client_side_encryption/localKMS.yml +1 -8
- data/spec/spec_tests/data/client_side_encryption/localSchema.yml +1 -8
- data/spec/spec_tests/data/client_side_encryption/maxWireVersion.yml +2 -0
- data/spec/spec_tests/data/client_side_encryption/missingKey.yml +2 -9
- data/spec/spec_tests/data/client_side_encryption/noSchema.yml +39 -0
- data/spec/spec_tests/data/client_side_encryption/replaceOne.yml +1 -8
- data/spec/spec_tests/data/client_side_encryption/types.yml +44 -70
- data/spec/spec_tests/data/client_side_encryption/unified/addKeyAltName.yml +194 -0
- data/spec/spec_tests/data/client_side_encryption/unified/createDataKey-kms_providers-invalid.yml +67 -0
- data/spec/spec_tests/data/client_side_encryption/unified/createDataKey.yml +309 -0
- data/spec/spec_tests/data/client_side_encryption/unified/deleteKey.yml +159 -0
- data/spec/spec_tests/data/client_side_encryption/unified/getKey.yml +105 -0
- data/spec/spec_tests/data/client_side_encryption/unified/getKeyByAltName.yml +104 -0
- data/spec/spec_tests/data/client_side_encryption/unified/getKeys.yml +122 -0
- data/spec/spec_tests/data/client_side_encryption/unified/removeKeyAltName.yml +157 -0
- data/spec/spec_tests/data/client_side_encryption/unified/rewrapManyDataKey-decrypt_failure.yml +69 -0
- data/spec/spec_tests/data/client_side_encryption/unified/rewrapManyDataKey-encrypt_failure.yml +122 -0
- data/spec/spec_tests/data/client_side_encryption/unified/rewrapManyDataKey.yml +432 -0
- data/spec/spec_tests/data/client_side_encryption/updateMany.yml +1 -8
- data/spec/spec_tests/data/client_side_encryption/updateOne.yml +1 -8
- data/spec/spec_tests/data/client_side_encryption/validatorAndPartialFieldExpression.yml +166 -0
- data/spec/spec_tests/data/collection_management/clustered-indexes.yml +135 -0
- data/spec/spec_tests/data/collection_management/createCollection-pre_and_post_images.yml +50 -0
- data/spec/spec_tests/data/collection_management/modifyCollection-pre_and_post_images.yml +58 -0
- data/spec/spec_tests/data/command_monitoring_unified/bulkWrite.yml +68 -0
- data/spec/spec_tests/data/command_monitoring_unified/command.yml +50 -0
- data/spec/spec_tests/data/command_monitoring_unified/deleteMany.yml +79 -0
- data/spec/spec_tests/data/command_monitoring_unified/deleteOne.yml +79 -0
- data/spec/spec_tests/data/command_monitoring_unified/find.yml +254 -0
- data/spec/spec_tests/data/command_monitoring_unified/insertMany.yml +79 -0
- data/spec/spec_tests/data/command_monitoring_unified/insertOne.yml +77 -0
- data/spec/spec_tests/data/command_monitoring_unified/pre-42-server-connection-id.yml +56 -0
- data/spec/spec_tests/data/command_monitoring_unified/server-connection-id.yml +56 -0
- data/spec/spec_tests/data/command_monitoring_unified/unacknowledgedBulkWrite.yml +55 -0
- data/spec/spec_tests/data/command_monitoring_unified/updateMany.yml +87 -0
- data/spec/spec_tests/data/command_monitoring_unified/updateOne.yml +118 -0
- data/spec/spec_tests/data/crud/read/aggregate-collation.yml +2 -1
- data/spec/spec_tests/data/crud/read/aggregate-out.yml +1 -0
- data/spec/spec_tests/data/crud/read/count-collation.yml +2 -1
- data/spec/spec_tests/data/crud/read/distinct-collation.yml +2 -1
- data/spec/spec_tests/data/crud/read/find-collation.yml +2 -1
- data/spec/spec_tests/data/crud/write/bulkWrite-collation.yml +2 -1
- data/spec/spec_tests/data/crud/write/deleteMany-collation.yml +2 -1
- data/spec/spec_tests/data/crud/write/deleteOne-collation.yml +2 -1
- data/spec/spec_tests/data/crud/write/findOneAndDelete-collation.yml +3 -2
- data/spec/spec_tests/data/crud/write/findOneAndReplace-collation.yml +2 -1
- data/spec/spec_tests/data/crud/write/findOneAndUpdate-collation.yml +3 -2
- data/spec/spec_tests/data/crud/write/replaceOne-collation.yml +3 -2
- data/spec/spec_tests/data/crud/write/updateMany-collation.yml +2 -1
- data/spec/spec_tests/data/crud/write/updateOne-collation.yml +2 -1
- data/spec/spec_tests/data/crud_unified/aggregate-allowdiskuse.yml +75 -0
- data/spec/spec_tests/data/crud_unified/aggregate-let.yml +138 -0
- data/spec/spec_tests/data/crud_unified/aggregate-merge.yml +185 -0
- data/spec/spec_tests/data/crud_unified/aggregate-out-readConcern.yml +171 -0
- data/spec/spec_tests/data/crud_unified/aggregate-write-readPreference.yml +155 -0
- data/spec/spec_tests/data/crud_unified/aggregate.yml +215 -0
- data/spec/spec_tests/data/crud_unified/bulkWrite-arrayFilters-clientError.yml +98 -0
- data/spec/spec_tests/data/crud_unified/bulkWrite-arrayFilters.yml +174 -0
- data/spec/spec_tests/data/crud_unified/bulkWrite-comment.yml +189 -0
- data/spec/spec_tests/data/crud_unified/bulkWrite-delete-hint-clientError.yml +113 -0
- data/spec/spec_tests/data/crud_unified/bulkWrite-delete-hint-serverError.yml +142 -0
- data/spec/spec_tests/data/crud_unified/bulkWrite-delete-hint.yml +154 -0
- data/spec/spec_tests/data/crud_unified/bulkWrite-deleteMany-hint-unacknowledged.yml +98 -0
- data/spec/spec_tests/data/crud_unified/bulkWrite-deleteMany-let.yml +86 -0
- data/spec/spec_tests/data/crud_unified/bulkWrite-deleteOne-hint-unacknowledged.yml +97 -0
- data/spec/spec_tests/data/crud_unified/bulkWrite-deleteOne-let.yml +86 -0
- data/spec/spec_tests/data/crud_unified/bulkWrite-insertOne-dots_and_dollars.yml +138 -0
- data/spec/spec_tests/data/crud_unified/bulkWrite-replaceOne-dots_and_dollars.yml +165 -0
- data/spec/spec_tests/data/crud_unified/bulkWrite-replaceOne-hint-unacknowledged.yml +103 -0
- data/spec/spec_tests/data/crud_unified/bulkWrite-replaceOne-let.yml +93 -0
- data/spec/spec_tests/data/crud_unified/bulkWrite-update-hint-clientError.yml +148 -0
- data/spec/spec_tests/data/crud_unified/bulkWrite-update-hint-serverError.yml +239 -0
- data/spec/spec_tests/data/crud_unified/bulkWrite-update-hint.yml +256 -0
- data/spec/spec_tests/data/crud_unified/bulkWrite-update-validation.yml +73 -0
- data/spec/spec_tests/data/crud_unified/bulkWrite-updateMany-dots_and_dollars.yml +150 -0
- data/spec/spec_tests/data/crud_unified/bulkWrite-updateMany-hint-unacknowledged.yml +104 -0
- data/spec/spec_tests/data/crud_unified/bulkWrite-updateMany-let.yml +96 -0
- data/spec/spec_tests/data/crud_unified/bulkWrite-updateOne-dots_and_dollars.yml +150 -0
- data/spec/spec_tests/data/crud_unified/bulkWrite-updateOne-hint-unacknowledged.yml +103 -0
- data/spec/spec_tests/data/crud_unified/bulkWrite-updateOne-let.yml +95 -0
- data/spec/spec_tests/data/crud_unified/countDocuments-comment.yml +92 -0
- data/spec/spec_tests/data/crud_unified/db-aggregate-write-readPreference.yml +151 -0
- data/spec/spec_tests/data/crud_unified/db-aggregate.yml +73 -0
- data/spec/spec_tests/data/crud_unified/deleteMany-comment.yml +97 -0
- data/spec/spec_tests/data/crud_unified/deleteMany-hint-clientError.yml +87 -0
- data/spec/spec_tests/data/crud_unified/deleteMany-hint-serverError.yml +107 -0
- data/spec/spec_tests/data/crud_unified/deleteMany-hint-unacknowledged.yml +90 -0
- data/spec/spec_tests/data/crud_unified/deleteMany-hint.yml +99 -0
- data/spec/spec_tests/data/crud_unified/deleteMany-let.yml +93 -0
- data/spec/spec_tests/data/crud_unified/deleteOne-comment.yml +98 -0
- data/spec/spec_tests/data/crud_unified/deleteOne-hint-clientError.yml +80 -0
- data/spec/spec_tests/data/crud_unified/deleteOne-hint-serverError.yml +100 -0
- data/spec/spec_tests/data/crud_unified/deleteOne-hint-unacknowledged.yml +89 -0
- data/spec/spec_tests/data/crud_unified/deleteOne-hint.yml +95 -0
- data/spec/spec_tests/data/crud_unified/deleteOne-let.yml +91 -0
- data/spec/spec_tests/data/crud_unified/distinct-comment.yml +98 -0
- data/spec/spec_tests/data/crud_unified/estimatedDocumentCount-comment.yml +95 -0
- data/spec/spec_tests/data/crud_unified/estimatedDocumentCount.yml +5 -135
- data/spec/spec_tests/data/crud_unified/find-allowdiskuse-clientError.yml +55 -0
- data/spec/spec_tests/data/crud_unified/find-allowdiskuse-serverError.yml +68 -0
- data/spec/spec_tests/data/crud_unified/find-allowdiskuse.yml +79 -0
- data/spec/spec_tests/data/crud_unified/find-comment.yml +166 -0
- data/spec/spec_tests/data/crud_unified/find-let.yml +71 -0
- data/spec/spec_tests/data/crud_unified/find.yml +68 -0
- data/spec/spec_tests/data/crud_unified/findOneAndDelete-comment.yml +96 -0
- data/spec/spec_tests/data/crud_unified/findOneAndDelete-hint-clientError.yml +91 -0
- data/spec/spec_tests/data/crud_unified/findOneAndDelete-hint-serverError.yml +107 -0
- data/spec/spec_tests/data/crud_unified/findOneAndDelete-hint-unacknowledged.yml +88 -0
- data/spec/spec_tests/data/crud_unified/findOneAndDelete-hint.yml +102 -0
- data/spec/spec_tests/data/crud_unified/findOneAndDelete-let.yml +86 -0
- data/spec/spec_tests/data/crud_unified/findOneAndReplace-comment.yml +101 -0
- data/spec/spec_tests/data/crud_unified/findOneAndReplace-dots_and_dollars.yml +140 -0
- data/spec/spec_tests/data/crud_unified/findOneAndReplace-hint-clientError.yml +83 -0
- data/spec/spec_tests/data/crud_unified/findOneAndReplace-hint-serverError.yml +99 -0
- data/spec/spec_tests/data/crud_unified/findOneAndReplace-hint-unacknowledged.yml +96 -0
- data/spec/spec_tests/data/crud_unified/findOneAndReplace-hint.yml +98 -0
- data/spec/spec_tests/data/crud_unified/findOneAndReplace-let.yml +94 -0
- data/spec/spec_tests/data/crud_unified/findOneAndUpdate-comment.yml +95 -0
- data/spec/spec_tests/data/crud_unified/findOneAndUpdate-dots_and_dollars.yml +127 -0
- data/spec/spec_tests/data/crud_unified/findOneAndUpdate-hint-clientError.yml +84 -0
- data/spec/spec_tests/data/crud_unified/findOneAndUpdate-hint-serverError.yml +100 -0
- data/spec/spec_tests/data/crud_unified/findOneAndUpdate-hint-unacknowledged.yml +92 -0
- data/spec/spec_tests/data/crud_unified/findOneAndUpdate-hint.yml +99 -0
- data/spec/spec_tests/data/crud_unified/findOneAndUpdate-let.yml +96 -0
- data/spec/spec_tests/data/crud_unified/insertMany-comment.yml +93 -0
- data/spec/spec_tests/data/crud_unified/insertMany-dots_and_dollars.yml +128 -0
- data/spec/spec_tests/data/crud_unified/insertOne-comment.yml +91 -0
- data/spec/spec_tests/data/crud_unified/insertOne-dots_and_dollars.yml +238 -0
- data/spec/spec_tests/data/crud_unified/replaceOne-comment.yml +105 -0
- data/spec/spec_tests/data/crud_unified/replaceOne-dots_and_dollars.yml +180 -0
- data/spec/spec_tests/data/crud_unified/replaceOne-hint-unacknowledged.yml +95 -0
- data/spec/spec_tests/data/crud_unified/replaceOne-hint.yml +108 -0
- data/spec/spec_tests/data/crud_unified/replaceOne-let.yml +98 -0
- data/spec/spec_tests/data/crud_unified/replaceOne-validation.yml +37 -0
- data/spec/spec_tests/data/crud_unified/updateMany-comment.yml +104 -0
- data/spec/spec_tests/data/crud_unified/updateMany-dots_and_dollars.yml +138 -0
- data/spec/spec_tests/data/crud_unified/updateMany-hint-clientError.yml +91 -0
- data/spec/spec_tests/data/crud_unified/updateMany-hint-serverError.yml +115 -0
- data/spec/spec_tests/data/crud_unified/updateMany-hint-unacknowledged.yml +96 -0
- data/spec/spec_tests/data/crud_unified/updateMany-hint.yml +115 -0
- data/spec/spec_tests/data/crud_unified/updateMany-let.yml +107 -0
- data/spec/spec_tests/data/crud_unified/updateMany-validation.yml +39 -0
- data/spec/spec_tests/data/crud_unified/updateOne-comment.yml +104 -0
- data/spec/spec_tests/data/crud_unified/updateOne-dots_and_dollars.yml +138 -0
- data/spec/spec_tests/data/crud_unified/updateOne-hint-clientError.yml +85 -0
- data/spec/spec_tests/data/crud_unified/updateOne-hint-serverError.yml +109 -0
- data/spec/spec_tests/data/crud_unified/updateOne-hint-unacknowledged.yml +95 -0
- data/spec/spec_tests/data/crud_unified/updateOne-hint.yml +109 -0
- data/spec/spec_tests/data/crud_unified/updateOne-let.yml +102 -0
- data/spec/spec_tests/data/crud_unified/updateOne-validation.yml +37 -0
- data/spec/spec_tests/data/crud_unified/updateWithPipelines.yml +8 -14
- data/spec/spec_tests/data/gridfs_unified/delete.yml +198 -0
- data/spec/spec_tests/data/gridfs_unified/download.yml +241 -0
- data/spec/spec_tests/data/gridfs_unified/downloadByName.yml +159 -0
- data/spec/spec_tests/data/gridfs_unified/upload-disableMD5.yml +92 -0
- data/spec/spec_tests/data/gridfs_unified/upload.yml +288 -0
- data/spec/spec_tests/data/load_balancers/event-monitoring.yml +99 -0
- data/spec/spec_tests/data/load_balancers/lb-connection-establishment.yml +36 -0
- data/spec/spec_tests/data/load_balancers/non-lb-connection-establishment.yml +56 -0
- data/spec/spec_tests/data/load_balancers/server-selection.yml +50 -0
- data/spec/spec_tests/data/max_staleness/ReplicaSetNoPrimary/DefaultNoMaxStaleness.yml +2 -2
- data/spec/spec_tests/data/max_staleness/ReplicaSetNoPrimary/LastUpdateTime.yml +3 -3
- data/spec/spec_tests/data/max_staleness/ReplicaSetNoPrimary/Nearest.yml +3 -3
- data/spec/spec_tests/data/max_staleness/ReplicaSetNoPrimary/Nearest2.yml +3 -3
- data/spec/spec_tests/data/max_staleness/ReplicaSetNoPrimary/PrimaryPreferred.yml +2 -2
- data/spec/spec_tests/data/max_staleness/ReplicaSetNoPrimary/PrimaryPreferred_tags.yml +2 -2
- data/spec/spec_tests/data/max_staleness/ReplicaSetNoPrimary/Secondary.yml +4 -4
- data/spec/spec_tests/data/max_staleness/ReplicaSetNoPrimary/SecondaryPreferred.yml +2 -2
- data/spec/spec_tests/data/max_staleness/ReplicaSetNoPrimary/SecondaryPreferred_tags.yml +4 -4
- data/spec/spec_tests/data/max_staleness/ReplicaSetNoPrimary/ZeroMaxStaleness.yml +2 -2
- data/spec/spec_tests/data/max_staleness/ReplicaSetWithPrimary/DefaultNoMaxStaleness.yml +2 -2
- data/spec/spec_tests/data/max_staleness/ReplicaSetWithPrimary/LastUpdateTime.yml +3 -3
- data/spec/spec_tests/data/max_staleness/ReplicaSetWithPrimary/LongHeartbeat.yml +2 -2
- data/spec/spec_tests/data/max_staleness/ReplicaSetWithPrimary/LongHeartbeat2.yml +2 -2
- data/spec/spec_tests/data/max_staleness/ReplicaSetWithPrimary/MaxStalenessTooSmall.yml +2 -2
- data/spec/spec_tests/data/max_staleness/ReplicaSetWithPrimary/MaxStalenessWithModePrimary.yml +2 -2
- data/spec/spec_tests/data/max_staleness/ReplicaSetWithPrimary/Nearest.yml +3 -3
- data/spec/spec_tests/data/max_staleness/ReplicaSetWithPrimary/Nearest2.yml +3 -3
- data/spec/spec_tests/data/max_staleness/ReplicaSetWithPrimary/Nearest_tags.yml +2 -2
- data/spec/spec_tests/data/max_staleness/ReplicaSetWithPrimary/PrimaryPreferred.yml +2 -2
- data/spec/spec_tests/data/max_staleness/ReplicaSetWithPrimary/SecondaryPreferred.yml +2 -2
- data/spec/spec_tests/data/max_staleness/ReplicaSetWithPrimary/SecondaryPreferred_tags.yml +5 -5
- data/spec/spec_tests/data/max_staleness/ReplicaSetWithPrimary/SecondaryPreferred_tags2.yml +3 -3
- data/spec/spec_tests/data/max_staleness/ReplicaSetWithPrimary/Secondary_tags.yml +5 -5
- data/spec/spec_tests/data/max_staleness/ReplicaSetWithPrimary/Secondary_tags2.yml +3 -3
- data/spec/spec_tests/data/max_staleness/ReplicaSetWithPrimary/ZeroMaxStaleness.yml +2 -2
- data/spec/spec_tests/data/max_staleness/Sharded/SmallMaxStaleness.yml +2 -2
- data/spec/spec_tests/data/max_staleness/Single/SmallMaxStaleness.yml +1 -1
- data/spec/spec_tests/data/max_staleness/Unknown/SmallMaxStaleness.yml +1 -1
- data/spec/spec_tests/data/retryable_reads/{changeStreams-client.watch-serverErrors.yml → legacy/changeStreams-client.watch-serverErrors.yml} +1 -1
- data/spec/spec_tests/data/retryable_reads/{changeStreams-client.watch.yml → legacy/changeStreams-client.watch.yml} +1 -1
- data/spec/spec_tests/data/retryable_reads/{changeStreams-db.coll.watch-serverErrors.yml → legacy/changeStreams-db.coll.watch-serverErrors.yml} +1 -1
- data/spec/spec_tests/data/retryable_reads/{changeStreams-db.coll.watch.yml → legacy/changeStreams-db.coll.watch.yml} +1 -1
- data/spec/spec_tests/data/retryable_reads/{changeStreams-db.watch-serverErrors.yml → legacy/changeStreams-db.watch-serverErrors.yml} +1 -1
- data/spec/spec_tests/data/retryable_reads/{changeStreams-db.watch.yml → legacy/changeStreams-db.watch.yml} +1 -1
- data/spec/spec_tests/data/retryable_reads/{estimatedDocumentCount-serverErrors-pre4.9.yml → legacy/estimatedDocumentCount-serverErrors.yml} +0 -2
- data/spec/spec_tests/data/retryable_reads/{estimatedDocumentCount-pre4.9.yml → legacy/estimatedDocumentCount.yml} +0 -2
- data/spec/spec_tests/data/retryable_reads/{mapReduce.yml → legacy/mapReduce.yml} +3 -1
- data/spec/spec_tests/data/retryable_reads/unified/handshakeError.yml +129 -0
- data/spec/spec_tests/data/retryable_writes/{bulkWrite-serverErrors.yml → legacy/bulkWrite-serverErrors.yml} +1 -1
- data/spec/spec_tests/data/retryable_writes/{deleteOne-serverErrors.yml → legacy/deleteOne-serverErrors.yml} +1 -1
- data/spec/spec_tests/data/retryable_writes/{findOneAndDelete-serverErrors.yml → legacy/findOneAndDelete-serverErrors.yml} +1 -1
- data/spec/spec_tests/data/retryable_writes/{findOneAndReplace-serverErrors.yml → legacy/findOneAndReplace-serverErrors.yml} +1 -1
- data/spec/spec_tests/data/retryable_writes/{findOneAndUpdate-serverErrors.yml → legacy/findOneAndUpdate-serverErrors.yml} +1 -1
- data/spec/spec_tests/data/retryable_writes/{insertMany-serverErrors.yml → legacy/insertMany-serverErrors.yml} +1 -1
- data/spec/spec_tests/data/retryable_writes/{insertOne-serverErrors.yml → legacy/insertOne-serverErrors.yml} +5 -5
- data/spec/spec_tests/data/retryable_writes/{replaceOne-serverErrors.yml → legacy/replaceOne-serverErrors.yml} +1 -1
- data/spec/spec_tests/data/retryable_writes/{updateOne-serverErrors.yml → legacy/updateOne-serverErrors.yml} +1 -1
- data/spec/spec_tests/data/retryable_writes/unified/bulkWrite-serverErrors.yml +96 -0
- data/spec/spec_tests/data/retryable_writes/unified/handshakeError.yml +137 -0
- data/spec/spec_tests/data/retryable_writes/unified/insertOne-serverErrors.yml +78 -0
- data/spec/spec_tests/data/sdam/errors/prefer-error-code.yml +2 -2
- data/spec/spec_tests/data/sdam/load-balanced/discover_load_balancer.yml +25 -0
- data/spec/spec_tests/data/sdam_integration/find-network-error.yml +2 -0
- data/spec/spec_tests/data/sdam_integration/find-shutdown-error.yml +2 -0
- data/spec/spec_tests/data/sdam_integration/hello-command-error.yml +9 -15
- data/spec/spec_tests/data/sdam_integration/hello-network-error.yml +7 -15
- data/spec/spec_tests/data/sdam_integration/hello-timeout.yml +10 -14
- data/spec/spec_tests/data/sdam_integration/insert-network-error.yml +2 -0
- data/spec/spec_tests/data/sdam_integration/insert-shutdown-error.yml +2 -0
- data/spec/spec_tests/data/sdam_monitoring/load_balancer.yml +65 -0
- data/spec/spec_tests/data/seed_list_discovery/load-balanced/loadBalanced-directConnection.yml +13 -0
- data/spec/spec_tests/data/seed_list_discovery/load-balanced/loadBalanced-no-results.yml +5 -0
- data/spec/spec_tests/data/seed_list_discovery/load-balanced/loadBalanced-replicaSet-errors.yml +6 -0
- data/spec/spec_tests/data/seed_list_discovery/load-balanced/loadBalanced-true-multiple-hosts.yml +5 -0
- data/spec/spec_tests/data/seed_list_discovery/load-balanced/loadBalanced-true-txt.yml +10 -0
- data/spec/spec_tests/data/seed_list_discovery/load-balanced/srvMaxHosts-conflicts_with_loadBalanced-true-txt.yml +5 -0
- data/spec/spec_tests/data/seed_list_discovery/load-balanced/srvMaxHosts-conflicts_with_loadBalanced-true.yml +5 -0
- data/spec/spec_tests/data/seed_list_discovery/load-balanced/srvMaxHosts-zero-txt.yml +10 -0
- data/spec/spec_tests/data/seed_list_discovery/load-balanced/srvMaxHosts-zero.yml +10 -0
- data/spec/spec_tests/data/seed_list_discovery/replica-set/encoded-userinfo-and-db.yml +15 -0
- data/spec/spec_tests/data/seed_list_discovery/replica-set/loadBalanced-false-txt.yml +10 -0
- data/spec/spec_tests/data/seed_list_discovery/replica-set/srv-service-name.yml +11 -0
- data/spec/spec_tests/data/seed_list_discovery/replica-set/srvMaxHosts-conflicts_with_replicaSet-txt.yml +5 -0
- data/spec/spec_tests/data/seed_list_discovery/replica-set/srvMaxHosts-conflicts_with_replicaSet.yml +5 -0
- data/spec/spec_tests/data/seed_list_discovery/replica-set/srvMaxHosts-equal_to_srv_records.yml +16 -0
- data/spec/spec_tests/data/seed_list_discovery/replica-set/srvMaxHosts-greater_than_srv_records.yml +15 -0
- data/spec/spec_tests/data/seed_list_discovery/replica-set/srvMaxHosts-less_than_srv_records.yml +15 -0
- data/spec/spec_tests/data/seed_list_discovery/replica-set/srvMaxHosts-zero-txt.yml +15 -0
- data/spec/spec_tests/data/seed_list_discovery/replica-set/srvMaxHosts-zero.yml +15 -0
- data/spec/spec_tests/data/seed_list_discovery/replica-set/uri-with-admin-database.yml +13 -0
- data/spec/spec_tests/data/seed_list_discovery/replica-set/uri-with-auth.yml +12 -0
- data/spec/spec_tests/data/seed_list_discovery/sharded/srvMaxHosts-equal_to_srv_records.yml +13 -0
- data/spec/spec_tests/data/seed_list_discovery/sharded/srvMaxHosts-greater_than_srv_records.yml +12 -0
- data/spec/spec_tests/data/seed_list_discovery/sharded/srvMaxHosts-less_than_srv_records.yml +10 -0
- data/spec/spec_tests/data/seed_list_discovery/sharded/srvMaxHosts-zero.yml +11 -0
- data/spec/spec_tests/data/server_selection/Unknown/read/ghost.yml +11 -0
- data/spec/spec_tests/data/server_selection/Unknown/write/ghost.yml +11 -0
- data/spec/spec_tests/data/sessions_unified/driver-sessions-server-support.yml +123 -0
- data/spec/spec_tests/data/sessions_unified/snapshot-sessions-not-supported-client-error.yml +75 -0
- data/spec/spec_tests/data/sessions_unified/snapshot-sessions-not-supported-server-error.yml +102 -0
- data/spec/spec_tests/data/sessions_unified/snapshot-sessions-unsupported-ops.yml +258 -0
- data/spec/spec_tests/data/sessions_unified/snapshot-sessions.yml +482 -0
- data/spec/spec_tests/data/transactions/error-labels.yml +1 -1
- data/spec/spec_tests/data/transactions/errors-client.yml +8 -9
- data/spec/spec_tests/data/transactions/mongos-recovery-token.yml +1 -1
- data/spec/spec_tests/data/transactions/retryable-abort.yml +7 -7
- data/spec/spec_tests/data/transactions/retryable-commit.yml +7 -7
- data/spec/spec_tests/data/transactions_unified/do-not-retry-read-in-transaction.yml +64 -0
- data/spec/spec_tests/data/transactions_unified/retryable-abort-handshake.yml +118 -0
- data/spec/spec_tests/data/transactions_unified/retryable-commit-handshake.yml +118 -0
- data/spec/spec_tests/data/unified/invalid/expectedEventsForClient-ignoreExtraEvents-type.yml +15 -0
- data/spec/spec_tests/data/unified/valid-fail/operation-unsupported.yml +13 -0
- data/spec/spec_tests/data/unified/valid-pass/expectedEventsForClient-ignoreExtraEvents.yml +78 -0
- data/spec/spec_tests/data/unified/valid-pass/poc-change-streams.yml +4 -1
- data/spec/spec_tests/data/unified/valid-pass/poc-command-monitoring.yml +3 -3
- data/spec/spec_tests/data/unified/valid-pass/poc-transactions.yml +3 -2
- data/spec/spec_tests/data/uri_options/connection-options.yml +60 -0
- data/spec/spec_tests/data/uri_options/srv-options.yml +96 -0
- data/spec/spec_tests/data/versioned_api/crud-api-version-1-strict.yml +6 -4
- data/spec/spec_tests/data/versioned_api/crud-api-version-1.yml +7 -5
- data/spec/spec_tests/gridfs_unified_spec.rb +13 -0
- data/spec/spec_tests/load_balancers_spec.rb +15 -0
- data/spec/spec_tests/retryable_reads_spec.rb +6 -3
- data/spec/spec_tests/retryable_reads_unified_spec.rb +22 -0
- data/spec/spec_tests/retryable_writes_spec.rb +5 -2
- data/spec/spec_tests/retryable_writes_unified_spec.rb +21 -0
- data/spec/spec_tests/sdam_integration_spec.rb +1 -1
- data/spec/spec_tests/sdam_monitoring_spec.rb +10 -5
- data/spec/spec_tests/sdam_spec.rb +1 -1
- data/spec/spec_tests/seed_list_discovery_spec.rb +127 -0
- data/spec/spec_tests/sessions_unified_spec.rb +13 -0
- data/spec/spec_tests/unified_spec.rb +6 -1
- data/spec/spec_tests/uri_options_spec.rb +4 -4
- data/spec/stress/connection_pool_timing_spec.rb +3 -2
- data/spec/stress/fork_reconnect_stress_spec.rb +4 -7
- data/spec/stress/push_monitor_close_spec.rb +44 -0
- data/spec/support/authorization.rb +1 -1
- data/spec/support/background_thread_registry.rb +3 -13
- data/spec/support/certificates/atlas-ocsp-ca.crt +81 -96
- data/spec/support/certificates/atlas-ocsp.crt +125 -125
- data/spec/support/certificates/retrieve-atlas-cert +38 -0
- data/spec/support/cluster_tools.rb +1 -1
- data/spec/support/common_shortcuts.rb +24 -3
- data/spec/support/crypt/corpus/corpus-encrypted.json +9515 -0
- data/spec/support/crypt/corpus/corpus-key-aws.json +32 -32
- data/spec/support/crypt/corpus/corpus-key-azure.json +33 -0
- data/spec/support/crypt/corpus/corpus-key-gcp.json +35 -0
- data/spec/support/crypt/corpus/corpus-key-kmip.json +32 -0
- data/spec/support/crypt/corpus/corpus-key-local.json +30 -30
- data/spec/support/crypt/corpus/corpus-schema.json +4399 -121
- data/spec/support/crypt/corpus/corpus.json +4999 -37
- data/spec/support/crypt/data_keys/key_document_azure.json +33 -0
- data/spec/support/crypt/data_keys/key_document_gcp.json +37 -0
- data/spec/support/crypt/data_keys/key_document_kmip.json +32 -0
- data/spec/support/crypt/encryptedFields.json +33 -0
- data/spec/support/crypt/keys/key1-document.json +30 -0
- data/spec/support/crypt/schema_maps/schema_map_azure.json +17 -0
- data/spec/support/crypt/schema_maps/schema_map_azure_key_alt_names.json +12 -0
- data/spec/support/crypt/schema_maps/schema_map_gcp.json +17 -0
- data/spec/support/crypt/schema_maps/schema_map_gcp_key_alt_names.json +12 -0
- data/spec/support/crypt/schema_maps/schema_map_kmip.json +17 -0
- data/spec/support/crypt/schema_maps/schema_map_kmip_key_alt_names.json +12 -0
- data/spec/support/crypt.rb +258 -13
- data/spec/support/macros.rb +28 -0
- data/spec/support/matchers.rb +13 -0
- data/spec/support/mongos_macros.rb +17 -0
- data/spec/support/shared/auth_context.rb +16 -0
- data/spec/support/shared/scram_conversation.rb +2 -1
- data/spec/support/shared/session.rb +15 -9
- data/spec/support/spec_config.rb +100 -12
- data/spec/support/using_hash.rb +31 -0
- data/spec/support/utils.rb +57 -5
- data.tar.gz.sig +0 -0
- metadata +778 -381
- metadata.gz.sig +0 -0
- data/lib/mongo/collection/view/builder/find_command.rb +0 -173
- data/lib/mongo/collection/view/builder/op_query.rb +0 -94
- data/lib/mongo/cursor/builder/get_more_command.rb +0 -80
- data/lib/mongo/cursor/builder/kill_cursors_command.rb +0 -111
- data/lib/mongo/cursor/builder/op_get_more.rb +0 -64
- data/lib/mongo/cursor/builder/op_kill_cursors.rb +0 -106
- data/lib/mongo/operation/insert/legacy.rb +0 -68
- data/lib/mongo/operation/update/legacy/result.rb +0 -112
- data/lib/mongo/operation/update/legacy.rb +0 -68
- data/lib/mongo/server/context.rb +0 -72
- data/spec/mongo/cursor/builder/op_kill_cursors_spec.rb +0 -66
- data/spec/mongo/dbref_spec.rb +0 -152
- data/spec/mongo/operation/kill_cursors_spec.rb +0 -44
- data/spec/runners/unified/using_hash.rb +0 -34
- data/spec/spec_tests/change_streams_spec.rb +0 -93
- data/spec/spec_tests/command_monitoring_spec.rb +0 -71
- data/spec/spec_tests/data/change_streams/change-streams-errors.yml +0 -101
- data/spec/spec_tests/data/change_streams/change-streams-resume-allowlist.yml +0 -1173
- data/spec/spec_tests/data/change_streams/change-streams-resume-errorLabels.yml +0 -1105
- data/spec/spec_tests/data/change_streams/change-streams.yml +0 -535
- data/spec/spec_tests/data/command_monitoring/bulkWrite.yml +0 -49
- data/spec/spec_tests/data/command_monitoring/command.yml +0 -61
- data/spec/spec_tests/data/command_monitoring/deleteMany.yml +0 -55
- data/spec/spec_tests/data/command_monitoring/deleteOne.yml +0 -55
- data/spec/spec_tests/data/command_monitoring/find.yml +0 -266
- data/spec/spec_tests/data/command_monitoring/insertMany.yml +0 -75
- data/spec/spec_tests/data/command_monitoring/insertOne.yml +0 -51
- data/spec/spec_tests/data/command_monitoring/unacknowledgedBulkWrite.yml +0 -34
- data/spec/spec_tests/data/command_monitoring/updateMany.yml +0 -65
- data/spec/spec_tests/data/command_monitoring/updateOne.yml +0 -90
- data/spec/spec_tests/data/crud_v2/aggregate-merge.yml +0 -103
- data/spec/spec_tests/data/crud_v2/aggregate-out-readConcern.yml +0 -111
- data/spec/spec_tests/data/crud_v2/bulkWrite-arrayFilters.yml +0 -103
- data/spec/spec_tests/data/crud_v2/bulkWrite-delete-hint-clientError.yml +0 -63
- data/spec/spec_tests/data/crud_v2/bulkWrite-delete-hint-serverError.yml +0 -92
- data/spec/spec_tests/data/crud_v2/bulkWrite-delete-hint.yml +0 -103
- data/spec/spec_tests/data/crud_v2/bulkWrite-update-hint-clientError.yml +0 -90
- data/spec/spec_tests/data/crud_v2/bulkWrite-update-hint-serverError.yml +0 -147
- data/spec/spec_tests/data/crud_v2/bulkWrite-update-hint.yml +0 -164
- data/spec/spec_tests/data/crud_v2/db-aggregate.yml +0 -39
- data/spec/spec_tests/data/crud_v2/deleteMany-hint-clientError.yml +0 -43
- data/spec/spec_tests/data/crud_v2/deleteMany-hint-serverError.yml +0 -62
- data/spec/spec_tests/data/crud_v2/deleteMany-hint.yml +0 -58
- data/spec/spec_tests/data/crud_v2/deleteOne-hint-clientError.yml +0 -41
- data/spec/spec_tests/data/crud_v2/deleteOne-hint-serverError.yml +0 -60
- data/spec/spec_tests/data/crud_v2/deleteOne-hint.yml +0 -57
- data/spec/spec_tests/data/crud_v2/find-allowdiskuse-clientError.yml +0 -28
- data/spec/spec_tests/data/crud_v2/find-allowdiskuse-serverError.yml +0 -44
- data/spec/spec_tests/data/crud_v2/find-allowdiskuse.yml +0 -50
- data/spec/spec_tests/data/crud_v2/findOneAndDelete-hint-clientError.yml +0 -45
- data/spec/spec_tests/data/crud_v2/findOneAndDelete-hint-serverError.yml +0 -60
- data/spec/spec_tests/data/crud_v2/findOneAndDelete-hint.yml +0 -56
- data/spec/spec_tests/data/crud_v2/findOneAndReplace-hint-clientError.yml +0 -40
- data/spec/spec_tests/data/crud_v2/findOneAndReplace-hint-serverError.yml +0 -59
- data/spec/spec_tests/data/crud_v2/findOneAndReplace-hint.yml +0 -55
- data/spec/spec_tests/data/crud_v2/findOneAndUpdate-hint-clientError.yml +0 -40
- data/spec/spec_tests/data/crud_v2/findOneAndUpdate-hint-serverError.yml +0 -58
- data/spec/spec_tests/data/crud_v2/findOneAndUpdate-hint.yml +0 -55
- data/spec/spec_tests/data/crud_v2/replaceOne-hint.yml +0 -61
- data/spec/spec_tests/data/crud_v2/unacknowledged-bulkWrite-delete-hint-clientError.yml +0 -60
- data/spec/spec_tests/data/crud_v2/unacknowledged-bulkWrite-update-hint-clientError.yml +0 -88
- data/spec/spec_tests/data/crud_v2/unacknowledged-deleteMany-hint-clientError.yml +0 -40
- data/spec/spec_tests/data/crud_v2/unacknowledged-deleteOne-hint-clientError.yml +0 -38
- data/spec/spec_tests/data/crud_v2/unacknowledged-findOneAndDelete-hint-clientError.yml +0 -42
- data/spec/spec_tests/data/crud_v2/unacknowledged-findOneAndReplace-hint-clientError.yml +0 -40
- data/spec/spec_tests/data/crud_v2/unacknowledged-findOneAndUpdate-hint-clientError.yml +0 -40
- data/spec/spec_tests/data/crud_v2/unacknowledged-replaceOne-hint-clientError.yml +0 -40
- data/spec/spec_tests/data/crud_v2/unacknowledged-updateMany-hint-clientError.yml +0 -43
- data/spec/spec_tests/data/crud_v2/unacknowledged-updateOne-hint-clientError.yml +0 -40
- data/spec/spec_tests/data/crud_v2/updateMany-hint-clientError.yml +0 -45
- data/spec/spec_tests/data/crud_v2/updateMany-hint-serverError.yml +0 -66
- data/spec/spec_tests/data/crud_v2/updateMany-hint.yml +0 -65
- data/spec/spec_tests/data/crud_v2/updateOne-hint-clientError.yml +0 -43
- data/spec/spec_tests/data/crud_v2/updateOne-hint-serverError.yml +0 -62
- data/spec/spec_tests/data/crud_v2/updateOne-hint.yml +0 -61
- data/spec/spec_tests/data/crud_v2/updateWithPipelines.yml +0 -157
- data/spec/spec_tests/data/retryable_reads/estimatedDocumentCount-4.9.yml +0 -60
- data/spec/spec_tests/data/retryable_reads/estimatedDocumentCount-serverErrors-4.9.yml +0 -146
- data/spec/spec_tests/dns_seedlist_discovery_spec.rb +0 -79
- data/spec/support/crypt/corpus/corpus_encrypted.json +0 -4152
- data/spec/support/event_subscriber.rb +0 -221
- data/spec/support/session_registry.rb +0 -55
- /data/spec/spec_tests/data/retryable_reads/{aggregate-merge.yml → legacy/aggregate-merge.yml} +0 -0
- /data/spec/spec_tests/data/retryable_reads/{aggregate-serverErrors.yml → legacy/aggregate-serverErrors.yml} +0 -0
- /data/spec/spec_tests/data/retryable_reads/{aggregate.yml → legacy/aggregate.yml} +0 -0
- /data/spec/spec_tests/data/retryable_reads/{count-serverErrors.yml → legacy/count-serverErrors.yml} +0 -0
- /data/spec/spec_tests/data/retryable_reads/{count.yml → legacy/count.yml} +0 -0
- /data/spec/spec_tests/data/retryable_reads/{countDocuments-serverErrors.yml → legacy/countDocuments-serverErrors.yml} +0 -0
- /data/spec/spec_tests/data/retryable_reads/{countDocuments.yml → legacy/countDocuments.yml} +0 -0
- /data/spec/spec_tests/data/retryable_reads/{distinct-serverErrors.yml → legacy/distinct-serverErrors.yml} +0 -0
- /data/spec/spec_tests/data/retryable_reads/{distinct.yml → legacy/distinct.yml} +0 -0
- /data/spec/spec_tests/data/retryable_reads/{find-serverErrors.yml → legacy/find-serverErrors.yml} +0 -0
- /data/spec/spec_tests/data/retryable_reads/{find.yml → legacy/find.yml} +0 -0
- /data/spec/spec_tests/data/retryable_reads/{findOne-serverErrors.yml → legacy/findOne-serverErrors.yml} +0 -0
- /data/spec/spec_tests/data/retryable_reads/{findOne.yml → legacy/findOne.yml} +0 -0
- /data/spec/spec_tests/data/retryable_reads/{gridfs-download-serverErrors.yml → legacy/gridfs-download-serverErrors.yml} +0 -0
- /data/spec/spec_tests/data/retryable_reads/{gridfs-download.yml → legacy/gridfs-download.yml} +0 -0
- /data/spec/spec_tests/data/retryable_reads/{gridfs-downloadByName-serverErrors.yml → legacy/gridfs-downloadByName-serverErrors.yml} +0 -0
- /data/spec/spec_tests/data/retryable_reads/{gridfs-downloadByName.yml → legacy/gridfs-downloadByName.yml} +0 -0
- /data/spec/spec_tests/data/retryable_reads/{listCollectionNames-serverErrors.yml → legacy/listCollectionNames-serverErrors.yml} +0 -0
- /data/spec/spec_tests/data/retryable_reads/{listCollectionNames.yml → legacy/listCollectionNames.yml} +0 -0
- /data/spec/spec_tests/data/retryable_reads/{listCollectionObjects-serverErrors.yml → legacy/listCollectionObjects-serverErrors.yml} +0 -0
- /data/spec/spec_tests/data/retryable_reads/{listCollectionObjects.yml → legacy/listCollectionObjects.yml} +0 -0
- /data/spec/spec_tests/data/retryable_reads/{listCollections-serverErrors.yml → legacy/listCollections-serverErrors.yml} +0 -0
- /data/spec/spec_tests/data/retryable_reads/{listCollections.yml → legacy/listCollections.yml} +0 -0
- /data/spec/spec_tests/data/retryable_reads/{listDatabaseNames-serverErrors.yml → legacy/listDatabaseNames-serverErrors.yml} +0 -0
- /data/spec/spec_tests/data/retryable_reads/{listDatabaseNames.yml → legacy/listDatabaseNames.yml} +0 -0
- /data/spec/spec_tests/data/retryable_reads/{listDatabaseObjects-serverErrors.yml → legacy/listDatabaseObjects-serverErrors.yml} +0 -0
- /data/spec/spec_tests/data/retryable_reads/{listDatabaseObjects.yml → legacy/listDatabaseObjects.yml} +0 -0
- /data/spec/spec_tests/data/retryable_reads/{listDatabases-serverErrors.yml → legacy/listDatabases-serverErrors.yml} +0 -0
- /data/spec/spec_tests/data/retryable_reads/{listDatabases.yml → legacy/listDatabases.yml} +0 -0
- /data/spec/spec_tests/data/retryable_reads/{listIndexNames-serverErrors.yml → legacy/listIndexNames-serverErrors.yml} +0 -0
- /data/spec/spec_tests/data/retryable_reads/{listIndexNames.yml → legacy/listIndexNames.yml} +0 -0
- /data/spec/spec_tests/data/retryable_reads/{listIndexes-serverErrors.yml → legacy/listIndexes-serverErrors.yml} +0 -0
- /data/spec/spec_tests/data/retryable_reads/{listIndexes.yml → legacy/listIndexes.yml} +0 -0
- /data/spec/spec_tests/data/retryable_writes/{bulkWrite-errorLabels.yml → legacy/bulkWrite-errorLabels.yml} +0 -0
- /data/spec/spec_tests/data/retryable_writes/{bulkWrite.yml → legacy/bulkWrite.yml} +0 -0
- /data/spec/spec_tests/data/retryable_writes/{deleteMany.yml → legacy/deleteMany.yml} +0 -0
- /data/spec/spec_tests/data/retryable_writes/{deleteOne-errorLabels.yml → legacy/deleteOne-errorLabels.yml} +0 -0
- /data/spec/spec_tests/data/retryable_writes/{deleteOne.yml → legacy/deleteOne.yml} +0 -0
- /data/spec/spec_tests/data/retryable_writes/{findOneAndDelete-errorLabels.yml → legacy/findOneAndDelete-errorLabels.yml} +0 -0
- /data/spec/spec_tests/data/retryable_writes/{findOneAndDelete.yml → legacy/findOneAndDelete.yml} +0 -0
- /data/spec/spec_tests/data/retryable_writes/{findOneAndReplace-errorLabels.yml → legacy/findOneAndReplace-errorLabels.yml} +0 -0
- /data/spec/spec_tests/data/retryable_writes/{findOneAndReplace.yml → legacy/findOneAndReplace.yml} +0 -0
- /data/spec/spec_tests/data/retryable_writes/{findOneAndUpdate-errorLabels.yml → legacy/findOneAndUpdate-errorLabels.yml} +0 -0
- /data/spec/spec_tests/data/retryable_writes/{findOneAndUpdate.yml → legacy/findOneAndUpdate.yml} +0 -0
- /data/spec/spec_tests/data/retryable_writes/{insertMany-errorLabels.yml → legacy/insertMany-errorLabels.yml} +0 -0
- /data/spec/spec_tests/data/retryable_writes/{insertMany.yml → legacy/insertMany.yml} +0 -0
- /data/spec/spec_tests/data/retryable_writes/{insertOne-errorLabels.yml → legacy/insertOne-errorLabels.yml} +0 -0
- /data/spec/spec_tests/data/retryable_writes/{insertOne.yml → legacy/insertOne.yml} +0 -0
- /data/spec/spec_tests/data/retryable_writes/{replaceOne-errorLabels.yml → legacy/replaceOne-errorLabels.yml} +0 -0
- /data/spec/spec_tests/data/retryable_writes/{replaceOne.yml → legacy/replaceOne.yml} +0 -0
- /data/spec/spec_tests/data/retryable_writes/{updateMany.yml → legacy/updateMany.yml} +0 -0
- /data/spec/spec_tests/data/retryable_writes/{updateOne-errorLabels.yml → legacy/updateOne-errorLabels.yml} +0 -0
- /data/spec/spec_tests/data/retryable_writes/{updateOne.yml → legacy/updateOne.yml} +0 -0
- /data/spec/spec_tests/data/{dns_seedlist_discovery → seed_list_discovery/replica-set}/direct-connection-false.yml +0 -0
- /data/spec/spec_tests/data/{dns_seedlist_discovery → seed_list_discovery/replica-set}/direct-connection-true.yml +0 -0
- /data/spec/spec_tests/data/{dns_seedlist_discovery → seed_list_discovery/replica-set}/longer-parent-in-return.yml +0 -0
- /data/spec/spec_tests/data/{dns_seedlist_discovery → seed_list_discovery/replica-set}/misformatted-option.yml +0 -0
- /data/spec/spec_tests/data/{dns_seedlist_discovery → seed_list_discovery/replica-set}/no-results.yml +0 -0
- /data/spec/spec_tests/data/{dns_seedlist_discovery → seed_list_discovery/replica-set}/not-enough-parts.yml +0 -0
- /data/spec/spec_tests/data/{dns_seedlist_discovery → seed_list_discovery/replica-set}/one-result-default-port.yml +0 -0
- /data/spec/spec_tests/data/{dns_seedlist_discovery → seed_list_discovery/replica-set}/one-txt-record-multiple-strings.yml +0 -0
- /data/spec/spec_tests/data/{dns_seedlist_discovery → seed_list_discovery/replica-set}/one-txt-record.yml +0 -0
- /data/spec/spec_tests/data/{dns_seedlist_discovery → seed_list_discovery/replica-set}/parent-part-mismatch1.yml +0 -0
- /data/spec/spec_tests/data/{dns_seedlist_discovery → seed_list_discovery/replica-set}/parent-part-mismatch2.yml +0 -0
- /data/spec/spec_tests/data/{dns_seedlist_discovery → seed_list_discovery/replica-set}/parent-part-mismatch3.yml +0 -0
- /data/spec/spec_tests/data/{dns_seedlist_discovery → seed_list_discovery/replica-set}/parent-part-mismatch4.yml +0 -0
- /data/spec/spec_tests/data/{dns_seedlist_discovery → seed_list_discovery/replica-set}/parent-part-mismatch5.yml +0 -0
- /data/spec/spec_tests/data/{dns_seedlist_discovery → seed_list_discovery/replica-set}/returned-parent-too-short.yml +0 -0
- /data/spec/spec_tests/data/{dns_seedlist_discovery → seed_list_discovery/replica-set}/returned-parent-wrong.yml +0 -0
- /data/spec/spec_tests/data/{dns_seedlist_discovery → seed_list_discovery/replica-set}/two-results-default-port.yml +0 -0
- /data/spec/spec_tests/data/{dns_seedlist_discovery → seed_list_discovery/replica-set}/two-results-nonstandard-port.yml +0 -0
- /data/spec/spec_tests/data/{dns_seedlist_discovery → seed_list_discovery/replica-set}/two-txt-records.yml +0 -0
- /data/spec/spec_tests/data/{dns_seedlist_discovery → seed_list_discovery/replica-set}/txt-record-not-allowed-option.yml +0 -0
- /data/spec/spec_tests/data/{dns_seedlist_discovery → seed_list_discovery/replica-set}/txt-record-with-overridden-ssl-option.yml +0 -0
- /data/spec/spec_tests/data/{dns_seedlist_discovery → seed_list_discovery/replica-set}/txt-record-with-overridden-uri-option.yml +0 -0
- /data/spec/spec_tests/data/{dns_seedlist_discovery → seed_list_discovery/replica-set}/txt-record-with-unallowed-option.yml +0 -0
- /data/spec/spec_tests/data/{dns_seedlist_discovery → seed_list_discovery/replica-set}/uri-with-port.yml +0 -0
- /data/spec/spec_tests/data/{dns_seedlist_discovery → seed_list_discovery/replica-set}/uri-with-two-hosts.yml +0 -0
data/lib/mongo/server.rb
CHANGED
@@ -54,6 +54,9 @@ module Mongo
|
|
54
54
|
# done by this server. Note: setting this option to false will make
|
55
55
|
# the server non-functional. It is intended for use in tests which
|
56
56
|
# manually invoke SDAM state transitions.
|
57
|
+
# @option options [ true | false ] :load_balancer Whether this server
|
58
|
+
# is a load balancer.
|
59
|
+
# @option options [ String ] :connect The client connection mode.
|
57
60
|
#
|
58
61
|
# @since 2.0.0
|
59
62
|
def initialize(address, cluster, monitoring, event_listeners, options = {})
|
@@ -69,7 +72,10 @@ module Mongo
|
|
69
72
|
end
|
70
73
|
@scan_semaphore = DistinguishingSemaphore.new
|
71
74
|
@round_trip_time_averager = RoundTripTimeAverager.new
|
72
|
-
@description = Description.new(address, {}
|
75
|
+
@description = Description.new(address, {},
|
76
|
+
load_balancer: !!@options[:load_balancer],
|
77
|
+
force_load_balancer: force_load_balancer?,
|
78
|
+
)
|
73
79
|
@last_scan = nil
|
74
80
|
@last_scan_monotime = nil
|
75
81
|
unless options[:monitoring_io] == false
|
@@ -107,6 +113,15 @@ module Mongo
|
|
107
113
|
# description the monitor refreshes.
|
108
114
|
attr_reader :description
|
109
115
|
|
116
|
+
# Returns whether this server is forced to be a load balancer.
|
117
|
+
#
|
118
|
+
# @return [ true | false ] Whether this server is forced to be a load balancer.
|
119
|
+
#
|
120
|
+
# @api private
|
121
|
+
def force_load_balancer?
|
122
|
+
options[:connect] == :load_balanced
|
123
|
+
end
|
124
|
+
|
110
125
|
# @return [ Time | nil ] last_scan The time when the last server scan
|
111
126
|
# completed, or nil if the server has not been scanned yet.
|
112
127
|
#
|
@@ -180,6 +195,7 @@ module Mongo
|
|
180
195
|
:secondary?,
|
181
196
|
:standalone?,
|
182
197
|
:unknown?,
|
198
|
+
:load_balancer?,
|
183
199
|
:last_write_date,
|
184
200
|
:logical_session_timeout
|
185
201
|
|
@@ -222,20 +238,6 @@ module Mongo
|
|
222
238
|
address == other.address
|
223
239
|
end
|
224
240
|
|
225
|
-
# Get a new context for this server in which to send messages.
|
226
|
-
#
|
227
|
-
# @example Get the server context.
|
228
|
-
# server.context
|
229
|
-
#
|
230
|
-
# @return [ Mongo::Server::Context ] context The server context.
|
231
|
-
#
|
232
|
-
# @since 2.0.0
|
233
|
-
#
|
234
|
-
# @deprecated Will be removed in version 3.0
|
235
|
-
def context
|
236
|
-
Context.new(self)
|
237
|
-
end
|
238
|
-
|
239
241
|
# Determine if a connection to the server is able to be established and
|
240
242
|
# messages can be sent to it.
|
241
243
|
#
|
@@ -301,13 +303,20 @@ module Mongo
|
|
301
303
|
#
|
302
304
|
# @api private
|
303
305
|
def start_monitoring
|
306
|
+
publish_opening_event
|
307
|
+
if options[:monitoring_io] != false
|
308
|
+
monitor.run!
|
309
|
+
end
|
310
|
+
end
|
311
|
+
|
312
|
+
# Publishes the server opening event.
|
313
|
+
#
|
314
|
+
# @api private
|
315
|
+
def publish_opening_event
|
304
316
|
publish_sdam_event(
|
305
317
|
Monitoring::SERVER_OPENING,
|
306
318
|
Monitoring::Event::ServerOpening.new(address, cluster.topology)
|
307
319
|
)
|
308
|
-
if options[:monitoring_io] != false
|
309
|
-
monitor.run!
|
310
|
-
end
|
311
320
|
end
|
312
321
|
|
313
322
|
# Get a pretty printed server inspection.
|
@@ -327,6 +336,8 @@ module Mongo
|
|
327
336
|
# @api private
|
328
337
|
def status
|
329
338
|
case
|
339
|
+
when load_balancer?
|
340
|
+
'LB'
|
330
341
|
when primary?
|
331
342
|
'PRIMARY'
|
332
343
|
when secondary?
|
@@ -433,8 +444,8 @@ module Mongo
|
|
433
444
|
# @return [ Object ] The result of the block execution.
|
434
445
|
#
|
435
446
|
# @since 2.3.0
|
436
|
-
def with_connection(&block)
|
437
|
-
pool.with_connection(&block)
|
447
|
+
def with_connection(connection_global_id: nil, &block)
|
448
|
+
pool.with_connection(connection_global_id: connection_global_id, &block)
|
438
449
|
end
|
439
450
|
|
440
451
|
# Handle handshake failure.
|
@@ -444,7 +455,11 @@ module Mongo
|
|
444
455
|
def handle_handshake_failure!
|
445
456
|
yield
|
446
457
|
rescue Mongo::Error::SocketError, Mongo::Error::SocketTimeoutError => e
|
447
|
-
unknown!(
|
458
|
+
unknown!(
|
459
|
+
generation: e.generation,
|
460
|
+
service_id: e.service_id,
|
461
|
+
stop_push_monitor: true,
|
462
|
+
)
|
448
463
|
raise
|
449
464
|
end
|
450
465
|
|
@@ -467,7 +482,11 @@ module Mongo
|
|
467
482
|
raise
|
468
483
|
rescue Mongo::Error::SocketError => e
|
469
484
|
# non-timeout network error
|
470
|
-
unknown!(
|
485
|
+
unknown!(
|
486
|
+
generation: e.generation,
|
487
|
+
service_id: e.service_id,
|
488
|
+
stop_push_monitor: true,
|
489
|
+
)
|
471
490
|
raise
|
472
491
|
rescue Auth::Unauthorized
|
473
492
|
# auth error, keep server description and topology as they are
|
@@ -492,9 +511,15 @@ module Mongo
|
|
492
511
|
# @note Retryable writes are only available on server versions 3.6+ and with
|
493
512
|
# sharded clusters or replica sets.
|
494
513
|
#
|
514
|
+
# @note Some of the conditions in this method automatically return false for
|
515
|
+
# for load balanced topologies. The conditions in this method should
|
516
|
+
# always be true, since load-balanced topologies are only available on
|
517
|
+
# MongoDB 5.0+, and not for standalone topologies. Therefore, we can
|
518
|
+
# assume that retry writes are enabled.
|
519
|
+
#
|
495
520
|
# @since 2.5.0
|
496
521
|
def retry_writes?
|
497
|
-
!!(features.sessions_enabled? && logical_session_timeout && !standalone?)
|
522
|
+
!!(features.sessions_enabled? && logical_session_timeout && !standalone?) || load_balancer?
|
498
523
|
end
|
499
524
|
|
500
525
|
# Marks server unknown and publishes the associated SDAM event
|
@@ -517,9 +542,27 @@ module Mongo
|
|
517
542
|
# of the error response that is causing the server to be marked unknown.
|
518
543
|
# @option options [ true | false ] :stop_push_monitor Whether to stop
|
519
544
|
# the PushMonitor associated with the server, if any.
|
545
|
+
# @option options [ Object ] :service_id Discard state for the specified
|
546
|
+
# service id only.
|
520
547
|
#
|
521
548
|
# @since 2.4.0, SDAM events are sent as of version 2.7.0
|
522
549
|
def unknown!(options = {})
|
550
|
+
if load_balancer?
|
551
|
+
# When the client is in load-balanced topology, servers (the one and
|
552
|
+
# only that can be) starts out as a load balancer and stays as a
|
553
|
+
# load balancer indefinitely. As such it is not marked unknown.
|
554
|
+
#
|
555
|
+
# However, this method also clears connection pool for the server
|
556
|
+
# when the latter is marked unknown, and this part needs to happen
|
557
|
+
# when the server is a load balancer.
|
558
|
+
if service_id = options[:service_id]
|
559
|
+
pool.disconnect!(service_id: service_id)
|
560
|
+
elsif Lint.enabled?
|
561
|
+
raise Error::LintError, 'Load balancer was asked to be marked unknown without a service id'
|
562
|
+
end
|
563
|
+
return
|
564
|
+
end
|
565
|
+
|
523
566
|
if options[:generation] && options[:generation] < pool.generation
|
524
567
|
return
|
525
568
|
end
|
@@ -537,10 +580,16 @@ module Mongo
|
|
537
580
|
# SDAM flow will update description on the server without in-place
|
538
581
|
# mutations and invoke SDAM transitions as needed.
|
539
582
|
config = {}
|
583
|
+
if options[:service_id]
|
584
|
+
config['serviceId'] = options[:service_id]
|
585
|
+
end
|
540
586
|
if options[:topology_version]
|
541
587
|
config['topologyVersion'] = options[:topology_version]
|
542
588
|
end
|
543
|
-
new_description = Description.new(address, config
|
589
|
+
new_description = Description.new(address, config,
|
590
|
+
load_balancer: load_balancer?,
|
591
|
+
force_load_balancer: options[:connect] == :load_balanced,
|
592
|
+
)
|
544
593
|
cluster.run_sdam_flow(description, new_description, options)
|
545
594
|
end
|
546
595
|
|
@@ -549,11 +598,14 @@ module Mongo
|
|
549
598
|
@description = description
|
550
599
|
end
|
551
600
|
|
601
|
+
# @param [ Object ] :service_id Close connections with the specified
|
602
|
+
# service id only.
|
603
|
+
#
|
552
604
|
# @api private
|
553
|
-
def clear_connection_pool
|
605
|
+
def clear_connection_pool(service_id: nil)
|
554
606
|
@pool_lock.synchronize do
|
555
607
|
if @pool
|
556
|
-
@pool.disconnect!
|
608
|
+
@pool.disconnect!(service_id: service_id)
|
557
609
|
end
|
558
610
|
end
|
559
611
|
end
|
@@ -577,7 +629,6 @@ require 'mongo/server/connection_base'
|
|
577
629
|
require 'mongo/server/pending_connection'
|
578
630
|
require 'mongo/server/connection'
|
579
631
|
require 'mongo/server/connection_pool'
|
580
|
-
require 'mongo/server/context'
|
581
632
|
require 'mongo/server/description'
|
582
633
|
require 'mongo/server/monitor'
|
583
634
|
require 'mongo/server/round_trip_time_averager'
|
@@ -162,6 +162,8 @@ module Mongo
|
|
162
162
|
# Deprecated and ignored.
|
163
163
|
# @param [ Session | nil ] session Optional session to take into account
|
164
164
|
# for mongos pinning. Added in version 2.10.0.
|
165
|
+
# @param [ true | false ] write_aggregation Whether we need a server that
|
166
|
+
# supports writing aggregations (e.g. with $merge/$out) on secondaries.
|
165
167
|
#
|
166
168
|
# @return [ Mongo::Server ] A server matching the server preference.
|
167
169
|
#
|
@@ -172,7 +174,11 @@ module Mongo
|
|
172
174
|
# lint mode is enabled.
|
173
175
|
#
|
174
176
|
# @since 2.0.0
|
175
|
-
def select_server(cluster, ping = nil, session = nil)
|
177
|
+
def select_server(cluster, ping = nil, session = nil, write_aggregation: false)
|
178
|
+
if cluster.topology.is_a?(Cluster::Topology::LoadBalanced)
|
179
|
+
return cluster.servers.first
|
180
|
+
end
|
181
|
+
|
176
182
|
server_selection_timeout = cluster.options[:server_selection_timeout] || SERVER_SELECTION_TIMEOUT
|
177
183
|
|
178
184
|
# Special handling for zero timeout: if we have to select a server,
|
@@ -239,7 +245,7 @@ module Mongo
|
|
239
245
|
=end
|
240
246
|
|
241
247
|
loop do
|
242
|
-
server = try_select_server(cluster)
|
248
|
+
server = try_select_server(cluster, write_aggregation: write_aggregation)
|
243
249
|
|
244
250
|
if server
|
245
251
|
unless cluster.topology.compatible?
|
@@ -247,7 +253,7 @@ module Mongo
|
|
247
253
|
end
|
248
254
|
|
249
255
|
if session && session.starting_transaction? && cluster.sharded?
|
250
|
-
session.
|
256
|
+
session.pin_to_server(server)
|
251
257
|
end
|
252
258
|
|
253
259
|
return server
|
@@ -290,11 +296,31 @@ module Mongo
|
|
290
296
|
# Tries to find a suitable server, returns the server if one is available
|
291
297
|
# or nil if there isn't a suitable server.
|
292
298
|
#
|
299
|
+
# @param [ Mongo::Cluster ] cluster The cluster from which to select
|
300
|
+
# an eligible server.
|
301
|
+
# @param [ true | false ] write_aggregation Whether we need a server that
|
302
|
+
# supports writing aggregations (e.g. with $merge/$out) on secondaries.
|
303
|
+
#
|
293
304
|
# @return [ Server | nil ] A suitable server, if one exists.
|
294
305
|
#
|
295
306
|
# @api private
|
296
|
-
def try_select_server(cluster)
|
297
|
-
servers =
|
307
|
+
def try_select_server(cluster, write_aggregation: false)
|
308
|
+
servers = if write_aggregation && cluster.replica_set?
|
309
|
+
# 1. Check if ALL servers in cluster support secondary writes.
|
310
|
+
is_write_supported = cluster.servers.reduce(true) do |res, server|
|
311
|
+
res && server.features.merge_out_on_secondary_enabled?
|
312
|
+
end
|
313
|
+
|
314
|
+
if is_write_supported
|
315
|
+
# 2. If all servers support secondary writes, we respect read preference.
|
316
|
+
suitable_servers(cluster)
|
317
|
+
else
|
318
|
+
# 3. Otherwise we fallback to primary for replica set.
|
319
|
+
[cluster.servers.detect(&:primary?)]
|
320
|
+
end
|
321
|
+
else
|
322
|
+
suitable_servers(cluster)
|
323
|
+
end
|
298
324
|
|
299
325
|
# This list of servers may be ordered in a specific way
|
300
326
|
# by the selector (e.g. for secondary preferred, the first
|
@@ -99,6 +99,10 @@ module Mongo
|
|
99
99
|
#
|
100
100
|
# @since 2.5.0
|
101
101
|
def checkin(session)
|
102
|
+
if session.nil?
|
103
|
+
raise ArgumentError, 'session cannot be nil'
|
104
|
+
end
|
105
|
+
|
102
106
|
@mutex.synchronize do
|
103
107
|
prune!
|
104
108
|
unless about_to_expire?(session)
|
@@ -133,6 +137,17 @@ module Mongo
|
|
133
137
|
private
|
134
138
|
|
135
139
|
def about_to_expire?(session)
|
140
|
+
if session.nil?
|
141
|
+
raise ArgumentError, 'session cannot be nil'
|
142
|
+
end
|
143
|
+
|
144
|
+
# Load balancers spec explicitly requires to ignore the logical session
|
145
|
+
# timeout value.
|
146
|
+
# No rationale is provided as of the time of this writing.
|
147
|
+
if @cluster.load_balanced?
|
148
|
+
return false
|
149
|
+
end
|
150
|
+
|
136
151
|
logical_session_timeout = @cluster.logical_session_timeout
|
137
152
|
|
138
153
|
if logical_session_timeout
|
@@ -142,6 +157,10 @@ module Mongo
|
|
142
157
|
end
|
143
158
|
|
144
159
|
def prune!
|
160
|
+
# Load balancers spec explicitly requires not to prune sessions.
|
161
|
+
# No rationale is provided as of the time of this writing.
|
162
|
+
return if @cluster.load_balanced?
|
163
|
+
|
145
164
|
while !@queue.empty?
|
146
165
|
if about_to_expire?(@queue[-1])
|
147
166
|
@queue.pop
|
data/lib/mongo/session.rb
CHANGED
@@ -35,12 +35,23 @@ module Mongo
|
|
35
35
|
|
36
36
|
# Initialize a Session.
|
37
37
|
#
|
38
|
-
#
|
38
|
+
# A session can be explicit or implicit. Lifetime of explicit sessions is
|
39
|
+
# managed by the application - applications explicitry create such sessions
|
40
|
+
# and explicitly end them. Implicit sessions are created automatically by
|
41
|
+
# the driver when sending operations to servers that support sessions
|
42
|
+
# (3.6+), and their lifetime is managed by the driver.
|
43
|
+
#
|
44
|
+
# When an implicit session is created, it cannot have a server session
|
45
|
+
# associated with it. The server session will be checked out of the
|
46
|
+
# session pool when an operation using this session is actually executed.
|
47
|
+
# When an explicit session is created, it must reference a server session
|
48
|
+
# that is already allocated.
|
39
49
|
#
|
40
|
-
# @
|
41
|
-
#
|
50
|
+
# @note Applications should use Client#start_session to begin a session.
|
51
|
+
# This constructor is for internal driver use only.
|
42
52
|
#
|
43
|
-
# @param [ ServerSession ] server_session The server session this session is associated with.
|
53
|
+
# @param [ ServerSession | nil ] server_session The server session this session is associated with.
|
54
|
+
# If the :implicit option is true, this must be nil.
|
44
55
|
# @param [ Client ] client The client through which this session is created.
|
45
56
|
# @param [ Hash ] options The options for this session.
|
46
57
|
#
|
@@ -50,21 +61,39 @@ module Mongo
|
|
50
61
|
# to start_transaction by default, can contain any of the options that
|
51
62
|
# start_transaction accepts.
|
52
63
|
# @option options [ true|false ] :implicit For internal driver use only -
|
53
|
-
# specifies whether the session is implicit.
|
64
|
+
# specifies whether the session is implicit. If this is true, the server_session
|
65
|
+
# will be nil. This is done so that the server session is only checked
|
66
|
+
# out after the connection is checked out.
|
54
67
|
# @option options [ Hash ] :read_preference The read preference options hash,
|
55
68
|
# with the following optional keys:
|
56
69
|
# - *:mode* -- the read preference as a string or symbol; valid values are
|
57
70
|
# *:primary*, *:primary_preferred*, *:secondary*, *:secondary_preferred*
|
58
71
|
# and *:nearest*.
|
72
|
+
# @option options [ true | false ] :snapshot Set up the session for
|
73
|
+
# snapshot reads.
|
59
74
|
#
|
60
75
|
# @since 2.5.0
|
61
76
|
# @api private
|
62
77
|
def initialize(server_session, client, options = {})
|
78
|
+
if options[:causal_consistency] && options[:snapshot]
|
79
|
+
raise ArgumentError, ':causal_consistency and :snapshot options cannot be both set on a session'
|
80
|
+
end
|
81
|
+
|
82
|
+
if options[:implicit]
|
83
|
+
unless server_session.nil?
|
84
|
+
raise ArgumentError, 'Implicit session cannot reference server session during construction'
|
85
|
+
end
|
86
|
+
else
|
87
|
+
if server_session.nil?
|
88
|
+
raise ArgumentError, 'Explicit session must reference server session during construction'
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
63
92
|
@server_session = server_session
|
64
93
|
options = options.dup
|
65
94
|
|
66
95
|
@client = client.use(:admin)
|
67
|
-
@options = options.freeze
|
96
|
+
@options = options.dup.freeze
|
68
97
|
@cluster_time = nil
|
69
98
|
@state = NO_TRANSACTION_STATE
|
70
99
|
end
|
@@ -83,6 +112,12 @@ module Mongo
|
|
83
112
|
@client.cluster
|
84
113
|
end
|
85
114
|
|
115
|
+
# @return [ true | false ] Whether the session is configured for snapshot
|
116
|
+
# reads.
|
117
|
+
def snapshot?
|
118
|
+
!!options[:snapshot]
|
119
|
+
end
|
120
|
+
|
86
121
|
# @return [ BSON::Timestamp ] The latest seen operation time for this session.
|
87
122
|
#
|
88
123
|
# @since 2.5.0
|
@@ -148,11 +183,11 @@ module Mongo
|
|
148
183
|
# @return [ true, false ] If writes will be retried.
|
149
184
|
#
|
150
185
|
# @note Retryable writes are only available on server versions at least 3.6
|
151
|
-
# and with sharded clusters or
|
186
|
+
# and with sharded clusters, replica sets, or load-balanced topologies.
|
152
187
|
#
|
153
188
|
# @since 2.5.0
|
154
189
|
def retry_writes?
|
155
|
-
!!client.options[:retry_writes] && (cluster.replica_set? || cluster.sharded?)
|
190
|
+
!!client.options[:retry_writes] && (cluster.replica_set? || cluster.sharded? || cluster.load_balanced?)
|
156
191
|
end
|
157
192
|
|
158
193
|
# Get the read preference the session will use in the currently
|
@@ -182,23 +217,33 @@ module Mongo
|
|
182
217
|
#
|
183
218
|
# @since 2.5.0
|
184
219
|
def ended?
|
185
|
-
|
220
|
+
!!@ended
|
186
221
|
end
|
187
222
|
|
188
|
-
# Get the server session id of this session, if the session
|
189
|
-
# If the session
|
190
|
-
#
|
191
|
-
# @example Get the session id.
|
192
|
-
# session.session_id
|
223
|
+
# Get the server session id of this session, if the session has not been
|
224
|
+
# ended. If the session had been ended, raises Error::SessionEnded.
|
193
225
|
#
|
194
226
|
# @return [ BSON::Document ] The server session id.
|
195
227
|
#
|
228
|
+
# @raise [ Error::SessionEnded ] If the session had been ended.
|
229
|
+
#
|
196
230
|
# @since 2.5.0
|
197
231
|
def session_id
|
198
232
|
if ended?
|
199
233
|
raise Error::SessionEnded
|
200
234
|
end
|
201
235
|
|
236
|
+
# An explicit session will always have a session_id, because during
|
237
|
+
# construction a server session must be provided. An implicit session
|
238
|
+
# will not have a session_id until materialized, thus calls to
|
239
|
+
# session_id might fail. An application should not have an opportunity
|
240
|
+
# to experience this failure because an implicit session shouldn't be
|
241
|
+
# accessible to applications due to its lifetime being constrained to
|
242
|
+
# operation execution, which is done entirely by the driver.
|
243
|
+
unless materialized?
|
244
|
+
raise Error::SessionNotMaterialized
|
245
|
+
end
|
246
|
+
|
202
247
|
@server_session.session_id
|
203
248
|
end
|
204
249
|
|
@@ -208,6 +253,12 @@ module Mongo
|
|
208
253
|
# @api private
|
209
254
|
attr_reader :pinned_server
|
210
255
|
|
256
|
+
# @return [ Integer | nil ] The connection global id that this session is pinned to,
|
257
|
+
# if any.
|
258
|
+
#
|
259
|
+
# @api private
|
260
|
+
attr_reader :pinned_connection_global_id
|
261
|
+
|
211
262
|
# @return [ BSON::Document | nil ] Recovery token for the sharded
|
212
263
|
# transaction being executed on this session, if any.
|
213
264
|
#
|
@@ -307,10 +358,13 @@ module Mongo
|
|
307
358
|
rescue Mongo::Error, Error::AuthError
|
308
359
|
end
|
309
360
|
end
|
310
|
-
@
|
361
|
+
if @server_session
|
362
|
+
@client.cluster.session_pool.checkin(@server_session)
|
363
|
+
end
|
311
364
|
end
|
312
365
|
ensure
|
313
366
|
@server_session = nil
|
367
|
+
@ended = true
|
314
368
|
end
|
315
369
|
|
316
370
|
# Executes the provided block in a transaction, retrying as necessary.
|
@@ -430,6 +484,7 @@ module Mongo
|
|
430
484
|
transaction_in_progress = false
|
431
485
|
raise
|
432
486
|
end
|
487
|
+
@state = NO_TRANSACTION_STATE
|
433
488
|
next
|
434
489
|
else
|
435
490
|
transaction_in_progress = false
|
@@ -499,6 +554,10 @@ module Mongo
|
|
499
554
|
=end
|
500
555
|
end
|
501
556
|
|
557
|
+
if snapshot?
|
558
|
+
raise Mongo::Error::SnapshotSessionTransactionProhibited
|
559
|
+
end
|
560
|
+
|
502
561
|
check_if_ended!
|
503
562
|
|
504
563
|
if within_states?(STARTING_TRANSACTION_STATE, TRANSACTION_IN_PROGRESS_STATE)
|
@@ -568,8 +627,12 @@ module Mongo
|
|
568
627
|
if write_concern && !write_concern.is_a?(WriteConcern::Base)
|
569
628
|
write_concern = WriteConcern.get(write_concern)
|
570
629
|
end
|
571
|
-
|
572
|
-
|
630
|
+
|
631
|
+
context = Operation::Context.new(client: @client, session: self)
|
632
|
+
write_with_retry(write_concern, ending_transaction: true,
|
633
|
+
context: context,
|
634
|
+
) do |connection, txn_num, context|
|
635
|
+
if context.retry?
|
573
636
|
if write_concern
|
574
637
|
wco = write_concern.options.merge(w: :majority)
|
575
638
|
wco[:wtimeout] ||= 10000
|
@@ -585,7 +648,7 @@ module Mongo
|
|
585
648
|
txn_num: txn_num,
|
586
649
|
write_concern: write_concern,
|
587
650
|
}
|
588
|
-
Operation::Command.new(spec).
|
651
|
+
Operation::Command.new(spec).execute_with_connection(connection, context: context)
|
589
652
|
end
|
590
653
|
end
|
591
654
|
ensure
|
@@ -626,14 +689,17 @@ module Mongo
|
|
626
689
|
begin
|
627
690
|
unless starting_transaction?
|
628
691
|
@aborting_transaction = true
|
629
|
-
|
692
|
+
context = Operation::Context.new(client: @client, session: self)
|
693
|
+
write_with_retry(txn_options[:write_concern],
|
694
|
+
ending_transaction: true, context: context,
|
695
|
+
) do |connection, txn_num, context|
|
630
696
|
begin
|
631
697
|
Operation::Command.new(
|
632
698
|
selector: { abortTransaction: 1 },
|
633
699
|
db_name: 'admin',
|
634
700
|
session: self,
|
635
701
|
txn_num: txn_num
|
636
|
-
).
|
702
|
+
).execute_with_connection(connection, context: context)
|
637
703
|
ensure
|
638
704
|
unpin
|
639
705
|
end
|
@@ -695,7 +761,7 @@ module Mongo
|
|
695
761
|
# @param [ Server ] server The server to pin this session to.
|
696
762
|
#
|
697
763
|
# @api private
|
698
|
-
def
|
764
|
+
def pin_to_server(server)
|
699
765
|
if server.nil?
|
700
766
|
raise ArgumentError, 'Cannot pin to a nil server'
|
701
767
|
end
|
@@ -707,14 +773,32 @@ module Mongo
|
|
707
773
|
@pinned_server = server
|
708
774
|
end
|
709
775
|
|
710
|
-
#
|
776
|
+
# Pins this session to the specified connection.
|
777
|
+
#
|
778
|
+
# @param [ Integer ] connection_global_id The global id of connection to pin
|
779
|
+
# this session to.
|
711
780
|
#
|
712
781
|
# @api private
|
713
|
-
def
|
782
|
+
def pin_to_connection(connection_global_id)
|
783
|
+
if connection_global_id.nil?
|
784
|
+
raise ArgumentError, 'Cannot pin to a nil connection id'
|
785
|
+
end
|
786
|
+
@pinned_connection_global_id = connection_global_id
|
787
|
+
end
|
788
|
+
|
789
|
+
# Unpins this session from the pinned server or connection,
|
790
|
+
# if the session was pinned.
|
791
|
+
#
|
792
|
+
# @param [ Connection | nil ] connection Connection to unpin from.
|
793
|
+
#
|
794
|
+
# @api private
|
795
|
+
def unpin(connection = nil)
|
714
796
|
@pinned_server = nil
|
797
|
+
@pinned_connection_global_id = nil
|
798
|
+
connection.unpin unless connection.nil?
|
715
799
|
end
|
716
800
|
|
717
|
-
# Unpins this session from the pinned server, if the session was pinned
|
801
|
+
# Unpins this session from the pinned server or connection, if the session was pinned
|
718
802
|
# and the specified exception instance and the session's transaction state
|
719
803
|
# require it to be unpinned.
|
720
804
|
#
|
@@ -722,19 +806,20 @@ module Mongo
|
|
722
806
|
# (both client- and server-side generated ones).
|
723
807
|
#
|
724
808
|
# @param [ Error ] error The exception instance to process.
|
809
|
+
# @param [ Connection | nil ] connection Connection to unpin from.
|
725
810
|
#
|
726
811
|
# @api private
|
727
|
-
def unpin_maybe(error)
|
812
|
+
def unpin_maybe(error, connection = nil)
|
728
813
|
if !within_states?(Session::NO_TRANSACTION_STATE) &&
|
729
814
|
error.label?('TransientTransactionError')
|
730
815
|
then
|
731
|
-
unpin
|
816
|
+
unpin(connection)
|
732
817
|
end
|
733
818
|
|
734
819
|
if committing_transaction? &&
|
735
820
|
error.label?('UnknownTransactionCommitResult')
|
736
821
|
then
|
737
|
-
unpin
|
822
|
+
unpin(connection)
|
738
823
|
end
|
739
824
|
end
|
740
825
|
|
@@ -971,6 +1056,33 @@ module Mongo
|
|
971
1056
|
end
|
972
1057
|
end
|
973
1058
|
|
1059
|
+
# If not already set, populate a session objects's server_session by
|
1060
|
+
# checking out a session from the session pool.
|
1061
|
+
#
|
1062
|
+
# @return [ Session ] Self.
|
1063
|
+
#
|
1064
|
+
# @api private
|
1065
|
+
def materialize_if_needed
|
1066
|
+
if ended?
|
1067
|
+
raise Error::SessionEnded
|
1068
|
+
end
|
1069
|
+
|
1070
|
+
return unless implicit? && !@server_session
|
1071
|
+
|
1072
|
+
@server_session = cluster.session_pool.checkout
|
1073
|
+
|
1074
|
+
self
|
1075
|
+
end
|
1076
|
+
|
1077
|
+
# @api private
|
1078
|
+
def materialized?
|
1079
|
+
if ended?
|
1080
|
+
raise Error::SessionEnded
|
1081
|
+
end
|
1082
|
+
|
1083
|
+
!@server_session.nil?
|
1084
|
+
end
|
1085
|
+
|
974
1086
|
# Increment and return the next transaction number.
|
975
1087
|
#
|
976
1088
|
# @example Get the next transaction number.
|
@@ -1004,6 +1116,9 @@ module Mongo
|
|
1004
1116
|
@server_session.txn_num
|
1005
1117
|
end
|
1006
1118
|
|
1119
|
+
# @api private
|
1120
|
+
attr_accessor :snapshot_timestamp
|
1121
|
+
|
1007
1122
|
private
|
1008
1123
|
|
1009
1124
|
# Get the read concern the session will use when starting a transaction.
|
@@ -21,8 +21,7 @@ module Mongo
|
|
21
21
|
# This module caches OCSP responses for their indicated validity time.
|
22
22
|
#
|
23
23
|
# The key is the CertificateId used for the OCSP request.
|
24
|
-
# The value is the SingleResponse
|
25
|
-
# emulation of it on Ruby 2.3.
|
24
|
+
# The value is the SingleResponse.
|
26
25
|
#
|
27
26
|
# @api private
|
28
27
|
module OcspCache
|
@@ -40,7 +39,7 @@ module Mongo
|
|
40
39
|
# expire by the time caller uses them. The caller should not perform
|
41
40
|
# update time checks on the returned response.
|
42
41
|
#
|
43
|
-
# @return [ OpenSSL::OCSP::SingleResponse
|
42
|
+
# @return [ OpenSSL::OCSP::SingleResponse ] The previously
|
44
43
|
# retrieved response.
|
45
44
|
module_function def get(cert_id)
|
46
45
|
resp = responses.detect do |resp|
|