mongo 2.5.3 → 2.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/LICENSE +1 -1
- data/README.md +3 -2
- data/lib/mongo.rb +2 -2
- data/lib/mongo/address.rb +10 -2
- data/lib/mongo/address/ipv4.rb +1 -1
- data/lib/mongo/address/ipv6.rb +26 -5
- data/lib/mongo/address/unix.rb +1 -1
- data/lib/mongo/auth.rb +10 -3
- data/lib/mongo/auth/cr.rb +4 -1
- data/lib/mongo/auth/cr/conversation.rb +4 -1
- data/lib/mongo/auth/ldap.rb +1 -1
- data/lib/mongo/auth/ldap/conversation.rb +1 -1
- data/lib/mongo/auth/roles.rb +1 -1
- data/lib/mongo/auth/scram.rb +24 -7
- data/lib/mongo/auth/scram/conversation.rb +52 -19
- data/lib/mongo/auth/stringprep.rb +114 -0
- data/lib/mongo/auth/stringprep/profiles/sasl.rb +73 -0
- data/lib/mongo/auth/stringprep/tables.rb +3232 -0
- data/lib/mongo/auth/stringprep/unicode_normalize/normalize.rb +174 -0
- data/lib/mongo/auth/stringprep/unicode_normalize/tables.rb +1170 -0
- data/lib/mongo/auth/user.rb +14 -3
- data/lib/mongo/auth/user/view.rb +1 -1
- data/lib/mongo/auth/x509.rb +1 -1
- data/lib/mongo/auth/x509/conversation.rb +1 -1
- data/lib/mongo/bson.rb +1 -1
- data/lib/mongo/bulk_write.rb +8 -8
- data/lib/mongo/bulk_write/combineable.rb +1 -1
- data/lib/mongo/bulk_write/ordered_combiner.rb +1 -1
- data/lib/mongo/bulk_write/result.rb +1 -1
- data/lib/mongo/bulk_write/result_combiner.rb +4 -4
- data/lib/mongo/bulk_write/transformable.rb +1 -1
- data/lib/mongo/bulk_write/unordered_combiner.rb +1 -1
- data/lib/mongo/bulk_write/validatable.rb +1 -1
- data/lib/mongo/client.rb +115 -24
- data/lib/mongo/cluster.rb +17 -10
- data/lib/mongo/cluster/app_metadata.rb +7 -1
- data/lib/mongo/cluster/periodic_executor.rb +1 -1
- data/lib/mongo/cluster/reapers/socket_reaper.rb +1 -1
- data/lib/mongo/cluster/topology.rb +12 -2
- data/lib/mongo/cluster/topology/replica_set.rb +9 -1
- data/lib/mongo/cluster/topology/sharded.rb +1 -1
- data/lib/mongo/cluster/topology/single.rb +1 -1
- data/lib/mongo/cluster/topology/unknown.rb +1 -1
- data/lib/mongo/collection.rb +75 -19
- data/lib/mongo/collection/view.rb +1 -1
- data/lib/mongo/collection/view/aggregation.rb +1 -1
- data/lib/mongo/collection/view/builder.rb +1 -1
- data/lib/mongo/collection/view/builder/aggregation.rb +3 -3
- data/lib/mongo/collection/view/builder/find_command.rb +1 -1
- data/lib/mongo/collection/view/builder/flags.rb +1 -1
- data/lib/mongo/collection/view/builder/map_reduce.rb +1 -1
- data/lib/mongo/collection/view/builder/modifiers.rb +1 -1
- data/lib/mongo/collection/view/builder/op_query.rb +1 -1
- data/lib/mongo/collection/view/change_stream.rb +193 -17
- data/lib/mongo/collection/view/change_stream/retryable.rb +3 -20
- data/lib/mongo/collection/view/explainable.rb +1 -1
- data/lib/mongo/collection/view/immutable.rb +1 -1
- data/lib/mongo/collection/view/iterable.rb +2 -2
- data/lib/mongo/collection/view/map_reduce.rb +1 -1
- data/lib/mongo/collection/view/readable.rb +108 -29
- data/lib/mongo/collection/view/writable.rb +3 -3
- data/lib/mongo/cursor.rb +44 -4
- data/lib/mongo/cursor/builder.rb +1 -1
- data/lib/mongo/cursor/builder/get_more_command.rb +1 -1
- data/lib/mongo/cursor/builder/kill_cursors_command.rb +1 -1
- data/lib/mongo/cursor/builder/op_get_more.rb +1 -1
- data/lib/mongo/cursor/builder/op_kill_cursors.rb +1 -1
- data/lib/mongo/database.rb +46 -3
- data/lib/mongo/database/view.rb +11 -11
- data/lib/mongo/dbref.rb +1 -1
- data/lib/mongo/error.rb +57 -1
- data/lib/mongo/error/bulk_write_error.rb +2 -2
- data/lib/mongo/error/change_stream_resumable.rb +37 -0
- data/lib/mongo/error/closed_stream.rb +1 -1
- data/lib/mongo/error/extra_file_chunk.rb +1 -1
- data/lib/mongo/error/failed_stringprep_validation.rb +38 -0
- data/lib/mongo/error/file_not_found.rb +1 -1
- data/lib/mongo/error/insufficient_iteration_count.rb +38 -0
- data/lib/mongo/error/invalid_application_name.rb +1 -1
- data/lib/mongo/error/invalid_bulk_operation.rb +1 -1
- data/lib/mongo/error/invalid_bulk_operation_type.rb +1 -1
- data/lib/mongo/error/invalid_collection_name.rb +1 -1
- data/lib/mongo/error/invalid_database_name.rb +1 -1
- data/lib/mongo/error/invalid_document.rb +1 -1
- data/lib/mongo/error/invalid_file.rb +1 -1
- data/lib/mongo/error/invalid_file_revision.rb +1 -1
- data/lib/mongo/error/invalid_min_pool_size.rb +1 -1
- data/lib/mongo/error/invalid_nonce.rb +1 -1
- data/lib/mongo/error/invalid_read_option.rb +35 -0
- data/lib/mongo/error/invalid_replacement_document.rb +1 -1
- data/lib/mongo/error/invalid_server_preference.rb +1 -1
- data/lib/mongo/error/invalid_session.rb +1 -1
- data/lib/mongo/error/invalid_signature.rb +1 -1
- data/lib/mongo/error/invalid_transaction_operation.rb +82 -0
- data/lib/mongo/error/invalid_txt_record.rb +1 -1
- data/lib/mongo/error/invalid_update_document.rb +1 -1
- data/lib/mongo/error/invalid_uri.rb +1 -1
- data/lib/mongo/error/invalid_write_concern.rb +1 -1
- data/lib/mongo/error/max_bson_size.rb +1 -1
- data/lib/mongo/error/max_message_size.rb +1 -1
- data/lib/mongo/error/mismatched_domain.rb +1 -1
- data/lib/mongo/error/missing_file_chunk.rb +1 -1
- data/lib/mongo/error/missing_resume_token.rb +1 -1
- data/lib/mongo/error/multi_index_drop.rb +1 -1
- data/lib/mongo/error/need_primary_server.rb +1 -1
- data/lib/mongo/error/no_server_available.rb +1 -1
- data/lib/mongo/error/no_srv_records.rb +1 -1
- data/lib/mongo/error/operation_failure.rb +108 -14
- data/lib/mongo/error/parser.rb +50 -1
- data/lib/mongo/error/socket_error.rb +5 -2
- data/lib/mongo/error/socket_timeout_error.rb +5 -2
- data/lib/mongo/error/unchangeable_collection_option.rb +1 -1
- data/lib/mongo/error/unexpected_chunk_length.rb +1 -1
- data/lib/mongo/error/unexpected_response.rb +1 -1
- data/lib/mongo/error/unknown_payload_type.rb +1 -1
- data/lib/mongo/error/unsupported_array_filters.rb +1 -1
- data/lib/mongo/error/unsupported_collation.rb +1 -1
- data/lib/mongo/error/unsupported_features.rb +1 -1
- data/lib/mongo/error/unsupported_message_type.rb +1 -1
- data/lib/mongo/error/write_retryable.rb +27 -0
- data/lib/mongo/event.rb +10 -9
- data/lib/mongo/event/base.rb +33 -0
- data/lib/mongo/event/description_changed.rb +2 -2
- data/lib/mongo/event/listeners.rb +1 -1
- data/lib/mongo/event/member_discovered.rb +4 -2
- data/lib/mongo/event/primary_elected.rb +2 -2
- data/lib/mongo/event/publisher.rb +1 -1
- data/lib/mongo/event/standalone_discovered.rb +2 -2
- data/lib/mongo/event/subscriber.rb +1 -1
- data/lib/mongo/grid.rb +1 -1
- data/lib/mongo/grid/file.rb +1 -1
- data/lib/mongo/grid/file/chunk.rb +3 -3
- data/lib/mongo/grid/file/info.rb +26 -3
- data/lib/mongo/grid/fs_bucket.rb +1 -1
- data/lib/mongo/grid/stream.rb +1 -1
- data/lib/mongo/grid/stream/read.rb +1 -1
- data/lib/mongo/grid/stream/write.rb +1 -1
- data/lib/mongo/index.rb +1 -1
- data/lib/mongo/index/view.rb +1 -1
- data/lib/mongo/loggable.rb +1 -1
- data/lib/mongo/logger.rb +1 -1
- data/lib/mongo/monitoring.rb +99 -62
- data/lib/mongo/monitoring/command_log_subscriber.rb +2 -2
- data/lib/mongo/monitoring/event.rb +2 -1
- data/lib/mongo/monitoring/event/command_failed.rb +19 -6
- data/lib/mongo/monitoring/event/command_started.rb +14 -3
- data/lib/mongo/monitoring/event/command_succeeded.rb +5 -3
- data/lib/mongo/monitoring/event/secure.rb +1 -1
- data/lib/mongo/monitoring/event/server_closed.rb +2 -2
- data/lib/mongo/monitoring/event/server_description_changed.rb +2 -2
- data/lib/mongo/monitoring/event/server_opening.rb +11 -2
- data/lib/mongo/monitoring/event/topology_changed.rb +13 -2
- data/lib/mongo/monitoring/event/topology_closed.rb +2 -2
- data/lib/mongo/monitoring/event/topology_opening.rb +11 -2
- data/lib/mongo/monitoring/publishable.rb +10 -6
- data/lib/mongo/monitoring/sdam_log_subscriber.rb +1 -1
- data/lib/mongo/monitoring/server_closed_log_subscriber.rb +1 -1
- data/lib/mongo/monitoring/server_description_changed_log_subscriber.rb +1 -1
- data/lib/mongo/monitoring/server_opening_log_subscriber.rb +1 -1
- data/lib/mongo/monitoring/topology_changed_log_subscriber.rb +1 -1
- data/lib/mongo/monitoring/topology_opening_log_subscriber.rb +1 -1
- data/lib/mongo/operation/aggregate/op_msg.rb +3 -0
- data/lib/mongo/operation/create/op_msg.rb +9 -0
- data/lib/mongo/operation/create_index/op_msg.rb +9 -0
- data/lib/mongo/operation/create_user/command.rb +1 -1
- data/lib/mongo/operation/create_user/op_msg.rb +10 -1
- data/lib/mongo/operation/delete/op_msg.rb +3 -0
- data/lib/mongo/operation/distinct/op_msg.rb +9 -0
- data/lib/mongo/operation/drop/op_msg.rb +9 -0
- data/lib/mongo/operation/drop_database/op_msg.rb +9 -0
- data/lib/mongo/operation/drop_index/op_msg.rb +9 -0
- data/lib/mongo/operation/explain/op_msg.rb +3 -0
- data/lib/mongo/operation/find/op_msg.rb +3 -0
- data/lib/mongo/operation/get_more.rb +1 -1
- data/lib/mongo/operation/get_more/command.rb +1 -1
- data/lib/mongo/operation/get_more/legacy.rb +1 -1
- data/lib/mongo/operation/get_more/op_msg.rb +3 -0
- data/lib/mongo/operation/indexes/op_msg.rb +3 -0
- data/lib/mongo/operation/indexes/result.rb +1 -1
- data/lib/mongo/operation/insert/bulk_result.rb +32 -2
- data/lib/mongo/operation/insert/op_msg.rb +3 -0
- data/lib/mongo/operation/insert/result.rb +1 -1
- data/lib/mongo/operation/kill_cursors/op_msg.rb +9 -0
- data/lib/mongo/operation/list_collections/op_msg.rb +3 -0
- data/lib/mongo/operation/list_collections/result.rb +5 -1
- data/lib/mongo/operation/map_reduce/op_msg.rb +3 -0
- data/lib/mongo/operation/map_reduce/result.rb +1 -1
- data/lib/mongo/operation/parallel_scan/op_msg.rb +3 -0
- data/lib/mongo/operation/remove_user/op_msg.rb +9 -0
- data/lib/mongo/operation/result.rb +27 -14
- data/lib/mongo/operation/shared/executable.rb +1 -0
- data/lib/mongo/operation/shared/sessions_supported.rb +78 -7
- data/lib/mongo/operation/shared/specifiable.rb +18 -2
- data/lib/mongo/operation/shared/write_concern_supported.rb +1 -1
- data/lib/mongo/operation/update/op_msg.rb +3 -0
- data/lib/mongo/operation/update_user/command.rb +1 -1
- data/lib/mongo/operation/update_user/op_msg.rb +10 -1
- data/lib/mongo/operation/users_info/op_msg.rb +3 -0
- data/lib/mongo/options.rb +1 -1
- data/lib/mongo/options/mapper.rb +1 -1
- data/lib/mongo/options/redacted.rb +1 -1
- data/lib/mongo/protocol/bit_vector.rb +1 -1
- data/lib/mongo/protocol/compressed.rb +1 -1
- data/lib/mongo/protocol/delete.rb +1 -1
- data/lib/mongo/protocol/get_more.rb +7 -7
- data/lib/mongo/protocol/insert.rb +1 -1
- data/lib/mongo/protocol/kill_cursors.rb +1 -1
- data/lib/mongo/protocol/message.rb +5 -5
- data/lib/mongo/protocol/msg.rb +9 -7
- data/lib/mongo/protocol/query.rb +1 -1
- data/lib/mongo/protocol/registry.rb +1 -1
- data/lib/mongo/protocol/reply.rb +10 -10
- data/lib/mongo/protocol/serializers.rb +1 -1
- data/lib/mongo/protocol/update.rb +1 -1
- data/lib/mongo/retryable.rb +22 -14
- data/lib/mongo/server.rb +1 -1
- data/lib/mongo/server/connectable.rb +1 -1
- data/lib/mongo/server/connection.rb +16 -4
- data/lib/mongo/server/connection_pool.rb +1 -1
- data/lib/mongo/server/connection_pool/queue.rb +1 -1
- data/lib/mongo/server/context.rb +1 -1
- data/lib/mongo/server/description.rb +14 -2
- data/lib/mongo/server/description/features.rb +10 -9
- data/lib/mongo/server/description/inspector.rb +1 -1
- data/lib/mongo/server/description/inspector/description_changed.rb +1 -1
- data/lib/mongo/server/description/inspector/member_discovered.rb +1 -1
- data/lib/mongo/server/description/inspector/primary_elected.rb +1 -1
- data/lib/mongo/server/description/inspector/standalone_discovered.rb +1 -1
- data/lib/mongo/server/monitor.rb +15 -3
- data/lib/mongo/server/monitor/connection.rb +1 -1
- data/lib/mongo/server_selector.rb +1 -1
- data/lib/mongo/server_selector/nearest.rb +1 -1
- data/lib/mongo/server_selector/primary.rb +1 -1
- data/lib/mongo/server_selector/primary_preferred.rb +1 -1
- data/lib/mongo/server_selector/secondary.rb +1 -1
- data/lib/mongo/server_selector/secondary_preferred.rb +1 -1
- data/lib/mongo/server_selector/selectable.rb +7 -2
- data/lib/mongo/session.rb +389 -12
- data/lib/mongo/session/server_session.rb +7 -2
- data/lib/mongo/session/session_pool.rb +1 -1
- data/lib/mongo/socket.rb +1 -1
- data/lib/mongo/socket/ssl.rb +1 -1
- data/lib/mongo/socket/tcp.rb +1 -1
- data/lib/mongo/socket/unix.rb +1 -1
- data/lib/mongo/uri.rb +6 -4
- data/lib/mongo/uri/srv_protocol.rb +1 -1
- data/lib/mongo/version.rb +2 -2
- data/lib/mongo/write_concern.rb +1 -1
- data/lib/mongo/write_concern/acknowledged.rb +1 -1
- data/lib/mongo/write_concern/normalizable.rb +1 -1
- data/lib/mongo/write_concern/unacknowledged.rb +1 -1
- data/mongo.gemspec +4 -1
- data/spec/atlas/atlas_connectivity_spec.rb +54 -0
- data/spec/integration/bulk_insert_spec.rb +78 -0
- data/spec/integration/change_stream_spec.rb +365 -0
- data/spec/integration/command_monitoring_spec.rb +92 -0
- data/spec/lite_spec_helper.rb +63 -0
- data/spec/mongo/address/ipv6_spec.rb +29 -1
- data/spec/mongo/address_spec.rb +34 -0
- data/spec/mongo/auth/scram/conversation_spec.rb +326 -120
- data/spec/mongo/auth/scram/negotiation_spec.rb +574 -0
- data/spec/mongo/auth/scram_spec.rb +107 -38
- data/spec/mongo/auth/stringprep/profiles/sasl_spec.rb +113 -0
- data/spec/mongo/auth/stringprep_spec.rb +188 -0
- data/spec/mongo/auth/user/view_spec.rb +5 -2
- data/spec/mongo/auth/user_spec.rb +1 -1
- data/spec/mongo/bulk_write/result_spec.rb +120 -0
- data/spec/mongo/bulk_write_spec.rb +42 -2
- data/spec/mongo/client_spec.rb +121 -9
- data/spec/mongo/cluster/app_metadata_spec.rb +14 -1
- data/spec/mongo/cluster/topology_spec.rb +1 -23
- data/spec/mongo/collection/view/change_stream_spec.rb +62 -180
- data/spec/mongo/collection_spec.rb +45 -12
- data/spec/mongo/cursor/builder/get_more_command_spec.rb +7 -7
- data/spec/mongo/cursor_spec.rb +2 -2
- data/spec/mongo/database_spec.rb +3 -3
- data/spec/mongo/docs_examples_spec.rb +194 -0
- data/spec/mongo/error/operation_failure_spec.rb +152 -0
- data/spec/mongo/error/parser_spec.rb +127 -0
- data/spec/mongo/grid/fs_bucket_spec.rb +32 -0
- data/spec/mongo/grid/stream/write_spec.rb +40 -1
- data/spec/mongo/monitoring/event/command_failed_spec.rb +30 -0
- data/spec/mongo/monitoring/event/command_started_spec.rb +26 -4
- data/spec/mongo/monitoring/event/command_succeeded_spec.rb +29 -7
- data/spec/mongo/monitoring_spec.rb +28 -3
- data/spec/mongo/protocol/get_more_spec.rb +2 -2
- data/spec/mongo/retryable_spec.rb +252 -34
- data/spec/mongo/retryable_writes_spec.rb +468 -544
- data/spec/mongo/server/connection_spec.rb +5 -5
- data/spec/mongo/server/description_spec.rb +23 -6
- data/spec/mongo/session/server_session_spec.rb +2 -2
- data/spec/mongo/session/session_pool_spec.rb +2 -2
- data/spec/mongo/transactions_examples_spec.rb +227 -0
- data/spec/mongo/transactions_spec.rb +44 -0
- data/spec/spec_helper.rb +135 -49
- data/spec/spec_tests/change_streams_spec.rb +42 -0
- data/spec/{mongo → spec_tests}/command_monitoring_spec.rb +8 -2
- data/spec/{mongo → spec_tests}/connection_string_spec.rb +1 -1
- data/spec/{mongo → spec_tests}/crud_spec.rb +5 -7
- data/spec/{mongo → spec_tests}/dns_seedlist_discovery_spec.rb +1 -1
- data/spec/{mongo → spec_tests}/gridfs_spec.rb +0 -0
- data/spec/{mongo → spec_tests}/max_staleness_spec.rb +0 -0
- data/spec/spec_tests/retryable_writes_spec.rb +78 -0
- data/spec/{mongo → spec_tests}/sdam_monitoring_spec.rb +4 -3
- data/spec/{mongo → spec_tests}/sdam_spec.rb +7 -7
- data/spec/{mongo → spec_tests}/server_selection_rtt_spec.rb +0 -0
- data/spec/{mongo → spec_tests}/server_selection_spec.rb +0 -0
- data/spec/support/authorization.rb +18 -6
- data/spec/support/change_streams.rb +265 -0
- data/spec/support/change_streams/operation.rb +62 -0
- data/spec/support/change_streams_tests/change-streams-errors.yml +53 -0
- data/spec/support/change_streams_tests/change-streams.yml +299 -0
- data/spec/support/command_monitoring.rb +1 -1
- data/spec/support/command_monitoring/bulkWrite.yml +4 -28
- data/spec/support/command_monitoring/command.yml +19 -0
- data/spec/support/command_monitoring/find.yml +17 -19
- data/spec/support/command_monitoring/insertMany.yml +2 -8
- data/spec/support/command_monitoring/unacknowledgedBulkWrite.yml +34 -0
- data/spec/support/connection_string.rb +1 -1
- data/spec/support/constraints.rb +56 -0
- data/spec/support/crud.rb +9 -4
- data/spec/support/crud/read.rb +24 -3
- data/spec/support/crud/write.rb +7 -2
- data/spec/support/crud_tests/read/count-collation.yml +12 -2
- data/spec/support/crud_tests/read/count.yml +43 -5
- data/spec/support/gridfs.rb +1 -1
- data/spec/support/primary_socket.rb +21 -0
- data/spec/support/retryable_writes_tests/bulkWrite-serverErrors.yml +90 -0
- data/spec/support/retryable_writes_tests/bulkWrite.yml +99 -1
- data/spec/support/retryable_writes_tests/deleteOne-serverErrors.yml +50 -0
- data/spec/support/retryable_writes_tests/deleteOne.yml +10 -1
- data/spec/support/retryable_writes_tests/findOneAndDelete-serverErrors.yml +50 -0
- data/spec/support/retryable_writes_tests/findOneAndDelete.yml +39 -30
- data/spec/support/retryable_writes_tests/findOneAndReplace-serverErrors.yml +54 -0
- data/spec/support/retryable_writes_tests/findOneAndReplace.yml +9 -0
- data/spec/support/retryable_writes_tests/findOneAndUpdate-serverErrors.yml +54 -0
- data/spec/support/retryable_writes_tests/findOneAndUpdate.yml +9 -0
- data/spec/support/retryable_writes_tests/insertMany-serverErrors.yml +59 -0
- data/spec/support/retryable_writes_tests/insertMany.yml +11 -6
- data/spec/support/retryable_writes_tests/insertOne-serverErrors.yml +471 -0
- data/spec/support/retryable_writes_tests/insertOne.yml +9 -0
- data/spec/support/retryable_writes_tests/replaceOne-serverErrors.yml +58 -0
- data/spec/support/retryable_writes_tests/replaceOne.yml +9 -0
- data/spec/support/retryable_writes_tests/updateOne-serverErrors.yml +58 -0
- data/spec/support/retryable_writes_tests/updateOne.yml +71 -53
- data/spec/support/sdam/rs/normalize_case_me.yml +100 -0
- data/spec/support/sdam/sharded/compatible.yml +38 -0
- data/spec/support/sdam/sharded/mongos_disconnect.yml +9 -3
- data/spec/support/sdam/sharded/multiple_mongoses.yml +6 -2
- data/spec/support/sdam/sharded/non_mongos_removed.yml +6 -2
- data/spec/support/sdam/sharded/too_new.yml +36 -0
- data/spec/support/sdam/sharded/too_old.yml +36 -0
- data/spec/support/sdam/single/compatible.yml +26 -0
- data/spec/support/sdam/single/direct_connection_external_ip.yml +3 -1
- data/spec/support/sdam/single/direct_connection_mongos.yml +3 -1
- data/spec/support/sdam/single/direct_connection_rsarbiter.yml +3 -1
- data/spec/support/sdam/single/direct_connection_rsprimary.yml +3 -1
- data/spec/support/sdam/single/direct_connection_rssecondary.yml +3 -1
- data/spec/support/sdam/single/direct_connection_slave.yml +3 -1
- data/spec/support/sdam/single/direct_connection_standalone.yml +3 -1
- data/spec/support/sdam/single/not_ok_response.yml +6 -2
- data/spec/support/sdam/single/standalone_removed.yml +3 -1
- data/spec/support/sdam/single/too_new.yml +26 -0
- data/spec/support/sdam/single/too_old.yml +24 -0
- data/spec/support/shared/session.rb +107 -0
- data/spec/support/transactions.rb +391 -0
- data/spec/support/transactions/operation.rb +373 -0
- data/spec/support/transactions_tests/abort.yml +403 -0
- data/spec/support/transactions_tests/bulk.yml +267 -0
- data/spec/support/transactions_tests/causal-consistency.yml +173 -0
- data/spec/support/transactions_tests/commit.yml +593 -0
- data/spec/support/transactions_tests/delete.yml +184 -0
- data/spec/support/transactions_tests/error-labels.yml +948 -0
- data/spec/support/transactions_tests/errors.yml +125 -0
- data/spec/support/transactions_tests/findOneAndDelete.yml +126 -0
- data/spec/support/transactions_tests/findOneAndReplace.yml +140 -0
- data/spec/support/transactions_tests/findOneAndUpdate.yml +228 -0
- data/spec/support/transactions_tests/insert.yml +264 -0
- data/spec/support/transactions_tests/isolation.yml +125 -0
- data/spec/support/transactions_tests/read-pref.yml +340 -0
- data/spec/support/transactions_tests/reads.yml +298 -0
- data/spec/support/transactions_tests/retryable-abort.yml +1292 -0
- data/spec/support/transactions_tests/retryable-commit.yml +1332 -0
- data/spec/support/transactions_tests/retryable-writes.yml +208 -0
- data/spec/support/transactions_tests/run-command.yml +189 -0
- data/spec/support/transactions_tests/transaction-options.yml +877 -0
- data/spec/support/transactions_tests/update.yml +246 -0
- data/spec/support/transactions_tests/write-concern.yml +236 -0
- metadata +494 -359
- metadata.gz.sig +0 -0
- data/lib/csasl/csasl.bundle +0 -0
data/spec/support/gridfs.rb
CHANGED
@@ -0,0 +1,21 @@
|
|
1
|
+
module PrimarySocket
|
2
|
+
def self.included(base)
|
3
|
+
base.class_eval do
|
4
|
+
|
5
|
+
let(:primary_server) do
|
6
|
+
client.cluster.next_primary
|
7
|
+
end
|
8
|
+
|
9
|
+
let(:primary_connection) do
|
10
|
+
connection = primary_server.pool.checkout
|
11
|
+
connection.connect!
|
12
|
+
primary_server.pool.checkin(connection)
|
13
|
+
connection
|
14
|
+
end
|
15
|
+
|
16
|
+
let(:primary_socket) do
|
17
|
+
primary_connection.send(:socket)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,90 @@
|
|
1
|
+
data:
|
2
|
+
- { _id: 1, x: 11 }
|
3
|
+
- { _id: 2, x: 22 }
|
4
|
+
|
5
|
+
# TODO: this should change to 4.0 once 4.0.0 is released.
|
6
|
+
minServerVersion: '3.99'
|
7
|
+
|
8
|
+
tests:
|
9
|
+
-
|
10
|
+
description: "BulkWrite succeeds after PrimarySteppedDown"
|
11
|
+
clientOptions:
|
12
|
+
retryWrites: true
|
13
|
+
failPoint:
|
14
|
+
configureFailPoint: failCommand
|
15
|
+
mode: { times: 1 }
|
16
|
+
data:
|
17
|
+
failCommands: ["update"]
|
18
|
+
errorCode: 189
|
19
|
+
operation:
|
20
|
+
name: "bulkWrite"
|
21
|
+
arguments:
|
22
|
+
requests:
|
23
|
+
-
|
24
|
+
name: "deleteOne"
|
25
|
+
arguments:
|
26
|
+
filter: { _id: 1 }
|
27
|
+
-
|
28
|
+
name: "insertOne"
|
29
|
+
arguments:
|
30
|
+
document: { _id: 3, x: 33 }
|
31
|
+
-
|
32
|
+
name: "updateOne"
|
33
|
+
arguments:
|
34
|
+
filter: { _id: 2 }
|
35
|
+
update: { $inc: { x : 1 }}
|
36
|
+
options: { ordered: true }
|
37
|
+
outcome:
|
38
|
+
result:
|
39
|
+
deletedCount: 1
|
40
|
+
insertedIds: { 1: 3 }
|
41
|
+
matchedCount: 1
|
42
|
+
modifiedCount: 1
|
43
|
+
upsertedCount: 0
|
44
|
+
upsertedIds: { }
|
45
|
+
collection:
|
46
|
+
data:
|
47
|
+
- { _id: 2, x: 23 }
|
48
|
+
- { _id: 3, x: 33 }
|
49
|
+
-
|
50
|
+
description: "BulkWrite succeeds after WriteConcernError ShutdownInProgress"
|
51
|
+
clientOptions:
|
52
|
+
retryWrites: true
|
53
|
+
failPoint:
|
54
|
+
configureFailPoint: failCommand
|
55
|
+
mode: { times: 1 }
|
56
|
+
data:
|
57
|
+
failCommands: ["insert"]
|
58
|
+
writeConcernError:
|
59
|
+
code: 91
|
60
|
+
errmsg: Replication is being shut down
|
61
|
+
operation:
|
62
|
+
name: "bulkWrite"
|
63
|
+
arguments:
|
64
|
+
requests:
|
65
|
+
-
|
66
|
+
name: "deleteOne"
|
67
|
+
arguments:
|
68
|
+
filter: { _id: 1 }
|
69
|
+
-
|
70
|
+
name: "insertOne"
|
71
|
+
arguments:
|
72
|
+
document: { _id: 3, x: 33 }
|
73
|
+
-
|
74
|
+
name: "updateOne"
|
75
|
+
arguments:
|
76
|
+
filter: { _id: 2 }
|
77
|
+
update: { $inc: { x : 1 }}
|
78
|
+
options: { ordered: true }
|
79
|
+
outcome:
|
80
|
+
result:
|
81
|
+
deletedCount: 1
|
82
|
+
insertedIds: { 1: 3 }
|
83
|
+
matchedCount: 1
|
84
|
+
modifiedCount: 1
|
85
|
+
upsertedCount: 0
|
86
|
+
upsertedIds: { }
|
87
|
+
collection:
|
88
|
+
data:
|
89
|
+
- { _id: 2, x: 23 }
|
90
|
+
- { _id: 3, x: 33 }
|
@@ -6,7 +6,10 @@ minServerVersion: '3.6'
|
|
6
6
|
tests:
|
7
7
|
-
|
8
8
|
description: "First command is retried"
|
9
|
+
clientOptions:
|
10
|
+
retryWrites: true
|
9
11
|
failPoint:
|
12
|
+
configureFailPoint: onPrimaryTransactionalWrite
|
10
13
|
mode: { times: 1 }
|
11
14
|
operation:
|
12
15
|
name: "bulkWrite"
|
@@ -42,7 +45,10 @@ tests:
|
|
42
45
|
# that each write command consists of a single statement, which will
|
43
46
|
# fail on the first attempt and succeed on the second, retry attempt.
|
44
47
|
description: "All commands are retried"
|
48
|
+
clientOptions:
|
49
|
+
retryWrites: true
|
45
50
|
failPoint:
|
51
|
+
configureFailPoint: onPrimaryTransactionalWrite
|
46
52
|
mode: { times: 7 }
|
47
53
|
operation:
|
48
54
|
name: "bulkWrite"
|
@@ -97,7 +103,10 @@ tests:
|
|
97
103
|
- { _id: 5, x: 55 }
|
98
104
|
-
|
99
105
|
description: "Both commands are retried after their first statement fails"
|
106
|
+
clientOptions:
|
107
|
+
retryWrites: true
|
100
108
|
failPoint:
|
109
|
+
configureFailPoint: onPrimaryTransactionalWrite
|
101
110
|
mode: { times: 2 }
|
102
111
|
operation:
|
103
112
|
name: "bulkWrite"
|
@@ -132,7 +141,10 @@ tests:
|
|
132
141
|
- { _id: 2, x: 23 }
|
133
142
|
-
|
134
143
|
description: "Second command is retried after its second statement fails"
|
144
|
+
clientOptions:
|
145
|
+
retryWrites: true
|
135
146
|
failPoint:
|
147
|
+
configureFailPoint: onPrimaryTransactionalWrite
|
136
148
|
mode: { skip: 2 }
|
137
149
|
operation:
|
138
150
|
name: "bulkWrite"
|
@@ -167,7 +179,10 @@ tests:
|
|
167
179
|
- { _id: 2, x: 23 }
|
168
180
|
-
|
169
181
|
description: "BulkWrite with unordered execution"
|
182
|
+
clientOptions:
|
183
|
+
retryWrites: true
|
170
184
|
failPoint:
|
185
|
+
configureFailPoint: onPrimaryTransactionalWrite
|
171
186
|
mode: { times: 1 }
|
172
187
|
operation:
|
173
188
|
name: "bulkWrite"
|
@@ -197,7 +212,10 @@ tests:
|
|
197
212
|
- { _id: 3, x: 33 }
|
198
213
|
-
|
199
214
|
description: "First insertOne is never committed"
|
215
|
+
clientOptions:
|
216
|
+
retryWrites: true
|
200
217
|
failPoint:
|
218
|
+
configureFailPoint: onPrimaryTransactionalWrite
|
201
219
|
mode: { times: 2 }
|
202
220
|
data: { failBeforeCommitExceptionCode: 1 }
|
203
221
|
operation:
|
@@ -232,7 +250,10 @@ tests:
|
|
232
250
|
- { _id: 1, x: 11 }
|
233
251
|
-
|
234
252
|
description: "Second updateOne is never committed"
|
253
|
+
clientOptions:
|
254
|
+
retryWrites: true
|
235
255
|
failPoint:
|
256
|
+
configureFailPoint: onPrimaryTransactionalWrite
|
236
257
|
mode: { skip: 1 }
|
237
258
|
data: { failBeforeCommitExceptionCode: 1 }
|
238
259
|
operation:
|
@@ -268,7 +289,10 @@ tests:
|
|
268
289
|
- { _id: 2, x: 22 }
|
269
290
|
-
|
270
291
|
description: "Third updateOne is never committed"
|
292
|
+
clientOptions:
|
293
|
+
retryWrites: true
|
271
294
|
failPoint:
|
295
|
+
configureFailPoint: onPrimaryTransactionalWrite
|
272
296
|
mode: { skip: 2 }
|
273
297
|
data: { failBeforeCommitExceptionCode: 1 }
|
274
298
|
operation:
|
@@ -294,7 +318,81 @@ tests:
|
|
294
318
|
error: true
|
295
319
|
result:
|
296
320
|
deletedCount: 0
|
297
|
-
insertedIds: {
|
321
|
+
insertedIds: { 1: 2 }
|
322
|
+
matchedCount: 1
|
323
|
+
modifiedCount: 1
|
324
|
+
upsertedCount: 0
|
325
|
+
upsertedIds: { }
|
326
|
+
collection:
|
327
|
+
data:
|
328
|
+
- { _id: 1, x: 12 }
|
329
|
+
- { _id: 2, x: 22 }
|
330
|
+
-
|
331
|
+
# The onPrimaryTransactionalWrite fail point only triggers for write
|
332
|
+
# operations that include a transaction ID. Therefore, it will not
|
333
|
+
# affect the initial deleteMany and will trigger once (and only once)
|
334
|
+
# for the first insertOne attempt.
|
335
|
+
description: "Single-document write following deleteMany is retried"
|
336
|
+
clientOptions:
|
337
|
+
retryWrites: true
|
338
|
+
failPoint:
|
339
|
+
configureFailPoint: onPrimaryTransactionalWrite
|
340
|
+
mode: { times: 1 }
|
341
|
+
data: { failBeforeCommitExceptionCode: 1 }
|
342
|
+
operation:
|
343
|
+
name: "bulkWrite"
|
344
|
+
arguments:
|
345
|
+
requests:
|
346
|
+
-
|
347
|
+
name: "deleteMany"
|
348
|
+
arguments:
|
349
|
+
filter: { x: 11 }
|
350
|
+
-
|
351
|
+
name: "insertOne"
|
352
|
+
arguments:
|
353
|
+
document: { _id: 2, x: 22 }
|
354
|
+
options: { ordered: true }
|
355
|
+
outcome:
|
356
|
+
result:
|
357
|
+
deletedCount: 1
|
358
|
+
insertedIds: { 1: 2 }
|
359
|
+
matchedCount: 0
|
360
|
+
modifiedCount: 0
|
361
|
+
upsertedCount: 0
|
362
|
+
upsertedIds: { }
|
363
|
+
collection:
|
364
|
+
data:
|
365
|
+
- { _id: 2, x: 22 }
|
366
|
+
-
|
367
|
+
# The onPrimaryTransactionalWrite fail point only triggers for write
|
368
|
+
# operations that include a transaction ID. Therefore, it will not
|
369
|
+
# affect the initial updateMany and will trigger once (and only once)
|
370
|
+
# for the first insertOne attempt.
|
371
|
+
description: "Single-document write following updateMany is retried"
|
372
|
+
clientOptions:
|
373
|
+
retryWrites: true
|
374
|
+
failPoint:
|
375
|
+
configureFailPoint: onPrimaryTransactionalWrite
|
376
|
+
mode: { times: 1 }
|
377
|
+
data: { failBeforeCommitExceptionCode: 1 }
|
378
|
+
operation:
|
379
|
+
name: "bulkWrite"
|
380
|
+
arguments:
|
381
|
+
requests:
|
382
|
+
-
|
383
|
+
name: "updateMany"
|
384
|
+
arguments:
|
385
|
+
filter: { x: 11 }
|
386
|
+
update: { $inc: { x : 1 }}
|
387
|
+
-
|
388
|
+
name: "insertOne"
|
389
|
+
arguments:
|
390
|
+
document: { _id: 2, x: 22 }
|
391
|
+
options: { ordered: true }
|
392
|
+
outcome:
|
393
|
+
result:
|
394
|
+
deletedCount: 0
|
395
|
+
insertedIds: { 1: 2 }
|
298
396
|
matchedCount: 1
|
299
397
|
modifiedCount: 1
|
300
398
|
upsertedCount: 0
|
@@ -0,0 +1,50 @@
|
|
1
|
+
data:
|
2
|
+
- { _id: 1, x: 11 }
|
3
|
+
- { _id: 2, x: 22 }
|
4
|
+
|
5
|
+
# TODO: this should change to 4.0 once 4.0.0 is released.
|
6
|
+
minServerVersion: '3.99'
|
7
|
+
|
8
|
+
tests:
|
9
|
+
-
|
10
|
+
description: "DeleteOne succeeds after PrimarySteppedDown"
|
11
|
+
clientOptions:
|
12
|
+
retryWrites: true
|
13
|
+
failPoint:
|
14
|
+
configureFailPoint: failCommand
|
15
|
+
mode: { times: 1 }
|
16
|
+
data:
|
17
|
+
failCommands: ["delete"]
|
18
|
+
errorCode: 189
|
19
|
+
operation:
|
20
|
+
name: "deleteOne"
|
21
|
+
arguments:
|
22
|
+
filter: { _id: 1 }
|
23
|
+
outcome:
|
24
|
+
result:
|
25
|
+
deletedCount: 1
|
26
|
+
collection:
|
27
|
+
data:
|
28
|
+
- { _id: 2, x: 22 }
|
29
|
+
-
|
30
|
+
description: "DeleteOne succeeds after WriteConcernError ShutdownInProgress"
|
31
|
+
clientOptions:
|
32
|
+
retryWrites: true
|
33
|
+
failPoint:
|
34
|
+
configureFailPoint: failCommand
|
35
|
+
mode: { times: 1 }
|
36
|
+
data:
|
37
|
+
failCommands: ["delete"]
|
38
|
+
writeConcernError:
|
39
|
+
code: 91
|
40
|
+
errmsg: Replication is being shut down
|
41
|
+
operation:
|
42
|
+
name: "deleteOne"
|
43
|
+
arguments:
|
44
|
+
filter: { _id: 1 }
|
45
|
+
outcome:
|
46
|
+
result:
|
47
|
+
deletedCount: 1
|
48
|
+
collection:
|
49
|
+
data:
|
50
|
+
- { _id: 2, x: 22 }
|
@@ -7,7 +7,10 @@ minServerVersion: '3.6'
|
|
7
7
|
tests:
|
8
8
|
-
|
9
9
|
description: "DeleteOne is committed on first attempt"
|
10
|
+
clientOptions:
|
11
|
+
retryWrites: true
|
10
12
|
failPoint:
|
13
|
+
configureFailPoint: onPrimaryTransactionalWrite
|
11
14
|
mode: { times: 1 }
|
12
15
|
operation:
|
13
16
|
name: "deleteOne"
|
@@ -21,7 +24,10 @@ tests:
|
|
21
24
|
- { _id: 2, x: 22 }
|
22
25
|
-
|
23
26
|
description: "DeleteOne is not committed on first attempt"
|
27
|
+
clientOptions:
|
28
|
+
retryWrites: true
|
24
29
|
failPoint:
|
30
|
+
configureFailPoint: onPrimaryTransactionalWrite
|
25
31
|
mode: { times: 1 }
|
26
32
|
data: { failBeforeCommitExceptionCode: 1 }
|
27
33
|
operation:
|
@@ -36,7 +42,10 @@ tests:
|
|
36
42
|
- { _id: 2, x: 22 }
|
37
43
|
-
|
38
44
|
description: "DeleteOne is never committed"
|
45
|
+
clientOptions:
|
46
|
+
retryWrites: true
|
39
47
|
failPoint:
|
48
|
+
configureFailPoint: onPrimaryTransactionalWrite
|
40
49
|
mode: { times: 2 }
|
41
50
|
data: { failBeforeCommitExceptionCode: 1 }
|
42
51
|
operation:
|
@@ -48,4 +57,4 @@ tests:
|
|
48
57
|
collection:
|
49
58
|
data:
|
50
59
|
- { _id: 1, x: 11 }
|
51
|
-
- { _id: 2, x: 22 }
|
60
|
+
- { _id: 2, x: 22 }
|
@@ -0,0 +1,50 @@
|
|
1
|
+
data:
|
2
|
+
- { _id: 1, x: 11 }
|
3
|
+
- { _id: 2, x: 22 }
|
4
|
+
|
5
|
+
# TODO: this should change to 4.0 once 4.0.0 is released.
|
6
|
+
minServerVersion: '3.99'
|
7
|
+
|
8
|
+
tests:
|
9
|
+
-
|
10
|
+
description: "FindOneAndDelete succeeds after PrimarySteppedDown"
|
11
|
+
clientOptions:
|
12
|
+
retryWrites: true
|
13
|
+
failPoint:
|
14
|
+
configureFailPoint: failCommand
|
15
|
+
mode: { times: 1 }
|
16
|
+
data:
|
17
|
+
failCommands: ["findAndModify"]
|
18
|
+
errorCode: 189
|
19
|
+
operation:
|
20
|
+
name: "findOneAndDelete"
|
21
|
+
arguments:
|
22
|
+
filter: { x: { $gte: 11 }}
|
23
|
+
sort: { x: 1 }
|
24
|
+
outcome:
|
25
|
+
result: { _id: 1, x: 11 }
|
26
|
+
collection:
|
27
|
+
data:
|
28
|
+
- { _id: 2, x: 22 }
|
29
|
+
-
|
30
|
+
description: "FindOneAndDelete succeeds after WriteConcernError ShutdownInProgress"
|
31
|
+
clientOptions:
|
32
|
+
retryWrites: true
|
33
|
+
failPoint:
|
34
|
+
configureFailPoint: failCommand
|
35
|
+
mode: { times: 1 }
|
36
|
+
data:
|
37
|
+
failCommands: ["findAndModify"]
|
38
|
+
writeConcernError:
|
39
|
+
code: 91
|
40
|
+
errmsg: Replication is being shut down
|
41
|
+
operation:
|
42
|
+
name: "findOneAndDelete"
|
43
|
+
arguments:
|
44
|
+
filter: { x: { $gte: 11 }}
|
45
|
+
sort: { x: 1 }
|
46
|
+
outcome:
|
47
|
+
result: { _id: 1, x: 11 }
|
48
|
+
collection:
|
49
|
+
data:
|
50
|
+
- { _id: 2, x: 22 }
|
@@ -5,38 +5,47 @@ data:
|
|
5
5
|
minServerVersion: '3.6'
|
6
6
|
|
7
7
|
tests:
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
8
|
+
-
|
9
|
+
description: "FindOneAndDelete is committed on first attempt"
|
10
|
+
clientOptions:
|
11
|
+
retryWrites: true
|
12
|
+
failPoint:
|
13
|
+
configureFailPoint: onPrimaryTransactionalWrite
|
14
|
+
mode: { times: 1 }
|
15
|
+
operation:
|
16
|
+
name: "findOneAndDelete"
|
17
|
+
arguments:
|
18
|
+
filter: { x: { $gte: 11 }}
|
19
|
+
sort: { x: 1 }
|
20
|
+
outcome:
|
21
|
+
result: { _id: 1, x: 11 }
|
22
|
+
collection:
|
23
|
+
data:
|
24
|
+
- { _id: 2, x: 22 }
|
25
|
+
-
|
26
|
+
description: "FindOneAndDelete is not committed on first attempt"
|
27
|
+
clientOptions:
|
28
|
+
retryWrites: true
|
29
|
+
failPoint:
|
30
|
+
configureFailPoint: onPrimaryTransactionalWrite
|
31
|
+
mode: { times: 1 }
|
32
|
+
data: { failBeforeCommitExceptionCode: 1 }
|
33
|
+
operation:
|
34
|
+
name: "findOneAndDelete"
|
35
|
+
arguments:
|
36
|
+
filter: { x: { $gte: 11 }}
|
37
|
+
sort: { x: 1 }
|
38
|
+
outcome:
|
39
|
+
result: { _id: 1, x: 11 }
|
40
|
+
collection:
|
41
|
+
data:
|
42
|
+
- { _id: 2, x: 22 }
|
37
43
|
-
|
38
44
|
description: "FindOneAndDelete is never committed"
|
45
|
+
clientOptions:
|
46
|
+
retryWrites: true
|
39
47
|
failPoint:
|
48
|
+
configureFailPoint: onPrimaryTransactionalWrite
|
40
49
|
mode: { times: 2 }
|
41
50
|
data: { failBeforeCommitExceptionCode: 1 }
|
42
51
|
operation:
|
@@ -49,4 +58,4 @@ tests:
|
|
49
58
|
collection:
|
50
59
|
data:
|
51
60
|
- { _id: 1, x: 11 }
|
52
|
-
- { _id: 2, x: 22 }
|
61
|
+
- { _id: 2, x: 22 }
|