mongo 2.5.3 → 2.6.0
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 +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
@@ -0,0 +1,208 @@
|
|
1
|
+
database_name: &database_name "ruby-driver"
|
2
|
+
collection_name: &collection_name "transactions-tests"
|
3
|
+
|
4
|
+
data: []
|
5
|
+
|
6
|
+
tests:
|
7
|
+
- description: increment txnNumber
|
8
|
+
|
9
|
+
clientOptions:
|
10
|
+
retryWrites: true
|
11
|
+
|
12
|
+
operations:
|
13
|
+
- name: startTransaction
|
14
|
+
object: session0
|
15
|
+
- name: insertOne
|
16
|
+
object: collection
|
17
|
+
arguments:
|
18
|
+
session: session0
|
19
|
+
document:
|
20
|
+
_id: 1
|
21
|
+
result:
|
22
|
+
insertedId: 1
|
23
|
+
- name: commitTransaction
|
24
|
+
object: session0
|
25
|
+
# Retryable write should include the next txnNumber
|
26
|
+
- name: insertOne
|
27
|
+
object: collection
|
28
|
+
arguments:
|
29
|
+
session: session0
|
30
|
+
document:
|
31
|
+
_id: 2
|
32
|
+
result:
|
33
|
+
insertedId: 2
|
34
|
+
# Next transaction should include the next txnNumber
|
35
|
+
- name: startTransaction
|
36
|
+
object: session0
|
37
|
+
- name: insertOne
|
38
|
+
object: collection
|
39
|
+
arguments:
|
40
|
+
session: session0
|
41
|
+
document:
|
42
|
+
_id: 3
|
43
|
+
result:
|
44
|
+
insertedId: 3
|
45
|
+
- name: abortTransaction
|
46
|
+
object: session0
|
47
|
+
# Retryable write should include the next txnNumber
|
48
|
+
- name: insertMany
|
49
|
+
object: collection
|
50
|
+
arguments:
|
51
|
+
documents:
|
52
|
+
- _id: 4
|
53
|
+
- _id: 5
|
54
|
+
session: session0
|
55
|
+
result:
|
56
|
+
insertedIds: {0: 4, 1: 5}
|
57
|
+
|
58
|
+
expectations:
|
59
|
+
- command_started_event:
|
60
|
+
command:
|
61
|
+
insert: *collection_name
|
62
|
+
documents:
|
63
|
+
- _id: 1
|
64
|
+
ordered: true
|
65
|
+
readConcern:
|
66
|
+
lsid: session0
|
67
|
+
txnNumber:
|
68
|
+
$numberLong: "1"
|
69
|
+
startTransaction: true
|
70
|
+
autocommit: false
|
71
|
+
writeConcern:
|
72
|
+
command_name: insert
|
73
|
+
database_name: *database_name
|
74
|
+
- command_started_event:
|
75
|
+
command:
|
76
|
+
commitTransaction: 1
|
77
|
+
lsid: session0
|
78
|
+
txnNumber:
|
79
|
+
$numberLong: "1"
|
80
|
+
startTransaction:
|
81
|
+
autocommit: false
|
82
|
+
writeConcern:
|
83
|
+
command_name: commitTransaction
|
84
|
+
database_name: admin
|
85
|
+
- command_started_event:
|
86
|
+
command:
|
87
|
+
insert: *collection_name
|
88
|
+
documents:
|
89
|
+
- _id: 2
|
90
|
+
ordered: true
|
91
|
+
readConcern:
|
92
|
+
lsid: session0
|
93
|
+
txnNumber:
|
94
|
+
$numberLong: "2"
|
95
|
+
startTransaction:
|
96
|
+
autocommit:
|
97
|
+
writeConcern:
|
98
|
+
command_name: insert
|
99
|
+
database_name: *database_name
|
100
|
+
- command_started_event:
|
101
|
+
command:
|
102
|
+
insert: *collection_name
|
103
|
+
documents:
|
104
|
+
- _id: 3
|
105
|
+
ordered: true
|
106
|
+
readConcern:
|
107
|
+
afterClusterTime: 42
|
108
|
+
lsid: session0
|
109
|
+
txnNumber:
|
110
|
+
$numberLong: "3"
|
111
|
+
startTransaction: true
|
112
|
+
autocommit: false
|
113
|
+
writeConcern:
|
114
|
+
command_name: insert
|
115
|
+
database_name: *database_name
|
116
|
+
- command_started_event:
|
117
|
+
command:
|
118
|
+
abortTransaction: 1
|
119
|
+
lsid: session0
|
120
|
+
txnNumber:
|
121
|
+
$numberLong: "3"
|
122
|
+
startTransaction:
|
123
|
+
autocommit: false
|
124
|
+
writeConcern:
|
125
|
+
command_name: abortTransaction
|
126
|
+
database_name: admin
|
127
|
+
- command_started_event:
|
128
|
+
command:
|
129
|
+
insert: *collection_name
|
130
|
+
documents:
|
131
|
+
- _id: 4
|
132
|
+
- _id: 5
|
133
|
+
ordered: true
|
134
|
+
readConcern:
|
135
|
+
lsid: session0
|
136
|
+
txnNumber:
|
137
|
+
$numberLong: "4"
|
138
|
+
startTransaction:
|
139
|
+
autocommit:
|
140
|
+
writeConcern:
|
141
|
+
command_name: insert
|
142
|
+
database_name: *database_name
|
143
|
+
|
144
|
+
outcome:
|
145
|
+
collection:
|
146
|
+
data:
|
147
|
+
- _id: 1
|
148
|
+
- _id: 2
|
149
|
+
- _id: 4
|
150
|
+
- _id: 5
|
151
|
+
|
152
|
+
- description: writes are not retried
|
153
|
+
|
154
|
+
clientOptions:
|
155
|
+
retryWrites: true
|
156
|
+
|
157
|
+
failPoint:
|
158
|
+
configureFailPoint: failCommand
|
159
|
+
mode: { times: 1 }
|
160
|
+
data:
|
161
|
+
failCommands: ["insert"]
|
162
|
+
closeConnection: true
|
163
|
+
|
164
|
+
operations:
|
165
|
+
- name: startTransaction
|
166
|
+
object: session0
|
167
|
+
- name: insertOne
|
168
|
+
object: collection
|
169
|
+
arguments:
|
170
|
+
session: session0
|
171
|
+
document:
|
172
|
+
_id: 1
|
173
|
+
result:
|
174
|
+
errorLabelsContain: ["TransientTransactionError"]
|
175
|
+
- name: abortTransaction
|
176
|
+
object: session0
|
177
|
+
|
178
|
+
expectations:
|
179
|
+
- command_started_event:
|
180
|
+
command:
|
181
|
+
insert: *collection_name
|
182
|
+
documents:
|
183
|
+
- _id: 1
|
184
|
+
ordered: true
|
185
|
+
readConcern:
|
186
|
+
lsid: session0
|
187
|
+
txnNumber:
|
188
|
+
$numberLong: "1"
|
189
|
+
startTransaction: true
|
190
|
+
autocommit: false
|
191
|
+
writeConcern:
|
192
|
+
command_name: insert
|
193
|
+
database_name: *database_name
|
194
|
+
- command_started_event:
|
195
|
+
command:
|
196
|
+
abortTransaction: 1
|
197
|
+
lsid: session0
|
198
|
+
txnNumber:
|
199
|
+
$numberLong: "1"
|
200
|
+
startTransaction:
|
201
|
+
autocommit: false
|
202
|
+
writeConcern:
|
203
|
+
command_name: abortTransaction
|
204
|
+
database_name: admin
|
205
|
+
|
206
|
+
outcome:
|
207
|
+
collection:
|
208
|
+
data: []
|
@@ -0,0 +1,189 @@
|
|
1
|
+
database_name: &database_name "ruby-driver"
|
2
|
+
collection_name: &collection_name "transactions-tests"
|
3
|
+
|
4
|
+
data: []
|
5
|
+
|
6
|
+
tests:
|
7
|
+
- description: run command with default read preference
|
8
|
+
|
9
|
+
operations:
|
10
|
+
- name: startTransaction
|
11
|
+
object: session0
|
12
|
+
- name: runCommand
|
13
|
+
object: database
|
14
|
+
command_name: insert
|
15
|
+
arguments:
|
16
|
+
session: session0
|
17
|
+
command:
|
18
|
+
insert: *collection_name
|
19
|
+
documents:
|
20
|
+
- _id : 1
|
21
|
+
result:
|
22
|
+
n: 1
|
23
|
+
- name: commitTransaction
|
24
|
+
object: session0
|
25
|
+
|
26
|
+
expectations:
|
27
|
+
- command_started_event:
|
28
|
+
command:
|
29
|
+
insert: *collection_name
|
30
|
+
documents:
|
31
|
+
- _id : 1
|
32
|
+
readConcern:
|
33
|
+
lsid: session0
|
34
|
+
txnNumber:
|
35
|
+
$numberLong: "1"
|
36
|
+
startTransaction: true
|
37
|
+
autocommit: false
|
38
|
+
writeConcern:
|
39
|
+
command_name: insert
|
40
|
+
database_name: *database_name
|
41
|
+
- command_started_event:
|
42
|
+
command:
|
43
|
+
commitTransaction: 1
|
44
|
+
lsid: session0
|
45
|
+
txnNumber:
|
46
|
+
$numberLong: "1"
|
47
|
+
startTransaction:
|
48
|
+
autocommit: false
|
49
|
+
writeConcern:
|
50
|
+
command_name: commitTransaction
|
51
|
+
database_name: admin
|
52
|
+
|
53
|
+
- description: run command with secondary read preference in client option and primary read preference in transaction options
|
54
|
+
|
55
|
+
clientOptions:
|
56
|
+
readPreference: secondary
|
57
|
+
|
58
|
+
operations:
|
59
|
+
- name: startTransaction
|
60
|
+
object: session0
|
61
|
+
arguments:
|
62
|
+
options:
|
63
|
+
readPreference:
|
64
|
+
mode: Primary
|
65
|
+
- name: runCommand
|
66
|
+
object: database
|
67
|
+
command_name: insert
|
68
|
+
arguments:
|
69
|
+
session: session0
|
70
|
+
command:
|
71
|
+
insert: *collection_name
|
72
|
+
documents:
|
73
|
+
- _id : 1
|
74
|
+
result:
|
75
|
+
n: 1
|
76
|
+
- name: commitTransaction
|
77
|
+
object: session0
|
78
|
+
|
79
|
+
expectations:
|
80
|
+
- command_started_event:
|
81
|
+
command:
|
82
|
+
insert: *collection_name
|
83
|
+
documents:
|
84
|
+
- _id : 1
|
85
|
+
readConcern:
|
86
|
+
lsid: session0
|
87
|
+
txnNumber:
|
88
|
+
$numberLong: "1"
|
89
|
+
startTransaction: true
|
90
|
+
autocommit: false
|
91
|
+
writeConcern:
|
92
|
+
command_name: insert
|
93
|
+
database_name: *database_name
|
94
|
+
- command_started_event:
|
95
|
+
command:
|
96
|
+
commitTransaction: 1
|
97
|
+
lsid: session0
|
98
|
+
txnNumber:
|
99
|
+
$numberLong: "1"
|
100
|
+
startTransaction:
|
101
|
+
autocommit: false
|
102
|
+
writeConcern:
|
103
|
+
command_name: commitTransaction
|
104
|
+
database_name: admin
|
105
|
+
|
106
|
+
- description: run command with explicit primary read preference
|
107
|
+
|
108
|
+
operations:
|
109
|
+
- name: startTransaction
|
110
|
+
object: session0
|
111
|
+
- name: runCommand
|
112
|
+
object: database
|
113
|
+
command_name: insert
|
114
|
+
arguments:
|
115
|
+
session: session0
|
116
|
+
command:
|
117
|
+
insert: *collection_name
|
118
|
+
documents:
|
119
|
+
- _id : 1
|
120
|
+
readPreference:
|
121
|
+
mode: Primary
|
122
|
+
result:
|
123
|
+
n: 1
|
124
|
+
- name: commitTransaction
|
125
|
+
object: session0
|
126
|
+
|
127
|
+
expectations:
|
128
|
+
- command_started_event:
|
129
|
+
command:
|
130
|
+
insert: *collection_name
|
131
|
+
documents:
|
132
|
+
- _id : 1
|
133
|
+
readConcern:
|
134
|
+
lsid: session0
|
135
|
+
txnNumber:
|
136
|
+
$numberLong: "1"
|
137
|
+
startTransaction: true
|
138
|
+
autocommit: false
|
139
|
+
writeConcern:
|
140
|
+
command_name: insert
|
141
|
+
database_name: *database_name
|
142
|
+
- command_started_event:
|
143
|
+
command:
|
144
|
+
commitTransaction: 1
|
145
|
+
lsid: session0
|
146
|
+
txnNumber:
|
147
|
+
$numberLong: "1"
|
148
|
+
startTransaction:
|
149
|
+
autocommit: false
|
150
|
+
writeConcern:
|
151
|
+
command_name: commitTransaction
|
152
|
+
database_name: admin
|
153
|
+
|
154
|
+
- description: run command fails with explicit secondary read preference
|
155
|
+
|
156
|
+
operations:
|
157
|
+
- name: startTransaction
|
158
|
+
object: session0
|
159
|
+
- name: runCommand
|
160
|
+
object: database
|
161
|
+
command_name: find
|
162
|
+
arguments:
|
163
|
+
session: session0
|
164
|
+
command:
|
165
|
+
find: *collection_name
|
166
|
+
readPreference:
|
167
|
+
mode: Secondary
|
168
|
+
result:
|
169
|
+
errorContains: read preference in a transaction must be primary
|
170
|
+
|
171
|
+
- description: run command fails with secondary read preference from transaction options
|
172
|
+
|
173
|
+
operations:
|
174
|
+
- name: startTransaction
|
175
|
+
object: session0
|
176
|
+
arguments:
|
177
|
+
options:
|
178
|
+
readPreference:
|
179
|
+
mode: Secondary
|
180
|
+
- name: runCommand
|
181
|
+
object: database
|
182
|
+
command_name: find
|
183
|
+
arguments:
|
184
|
+
session: session0
|
185
|
+
command:
|
186
|
+
find: *collection_name
|
187
|
+
result:
|
188
|
+
errorContains: read preference in a transaction must be primary
|
189
|
+
|
@@ -0,0 +1,877 @@
|
|
1
|
+
database_name: &database_name "ruby-driver"
|
2
|
+
collection_name: &collection_name "transactions-tests"
|
3
|
+
|
4
|
+
data: []
|
5
|
+
|
6
|
+
tests:
|
7
|
+
- description: no transaction options set
|
8
|
+
|
9
|
+
operations: &commitAbortOperations
|
10
|
+
- name: startTransaction
|
11
|
+
object: session0
|
12
|
+
- name: insertOne
|
13
|
+
object: collection
|
14
|
+
arguments:
|
15
|
+
session: session0
|
16
|
+
document:
|
17
|
+
_id: 1
|
18
|
+
result:
|
19
|
+
insertedId: 1
|
20
|
+
- name: commitTransaction
|
21
|
+
object: session0
|
22
|
+
# Now test abort.
|
23
|
+
- name: startTransaction
|
24
|
+
object: session0
|
25
|
+
- name: insertOne
|
26
|
+
object: collection
|
27
|
+
arguments:
|
28
|
+
session: session0
|
29
|
+
document:
|
30
|
+
_id: 2
|
31
|
+
result:
|
32
|
+
insertedId: 2
|
33
|
+
- name: abortTransaction
|
34
|
+
object: session0
|
35
|
+
|
36
|
+
expectations:
|
37
|
+
- command_started_event:
|
38
|
+
command:
|
39
|
+
insert: *collection_name
|
40
|
+
documents:
|
41
|
+
- _id: 1
|
42
|
+
ordered: true
|
43
|
+
lsid: session0
|
44
|
+
txnNumber:
|
45
|
+
$numberLong: "1"
|
46
|
+
startTransaction: true
|
47
|
+
autocommit: false
|
48
|
+
readConcern:
|
49
|
+
writeConcern:
|
50
|
+
command_name: insert
|
51
|
+
database_name: *database_name
|
52
|
+
- command_started_event:
|
53
|
+
command:
|
54
|
+
commitTransaction: 1
|
55
|
+
lsid: session0
|
56
|
+
txnNumber:
|
57
|
+
$numberLong: "1"
|
58
|
+
startTransaction:
|
59
|
+
autocommit: false
|
60
|
+
readConcern:
|
61
|
+
writeConcern:
|
62
|
+
command_name: commitTransaction
|
63
|
+
database_name: admin
|
64
|
+
- command_started_event:
|
65
|
+
command:
|
66
|
+
insert: *collection_name
|
67
|
+
documents:
|
68
|
+
- _id: 2
|
69
|
+
ordered: true
|
70
|
+
lsid: session0
|
71
|
+
txnNumber:
|
72
|
+
$numberLong: "2"
|
73
|
+
startTransaction: true
|
74
|
+
autocommit: false
|
75
|
+
readConcern:
|
76
|
+
afterClusterTime: 42
|
77
|
+
writeConcern:
|
78
|
+
command_name: insert
|
79
|
+
database_name: *database_name
|
80
|
+
- command_started_event:
|
81
|
+
command:
|
82
|
+
abortTransaction: 1
|
83
|
+
lsid: session0
|
84
|
+
txnNumber:
|
85
|
+
$numberLong: "2"
|
86
|
+
startTransaction:
|
87
|
+
autocommit: false
|
88
|
+
readConcern:
|
89
|
+
writeConcern:
|
90
|
+
command_name: abortTransaction
|
91
|
+
database_name: admin
|
92
|
+
|
93
|
+
outcome: &outcome
|
94
|
+
collection:
|
95
|
+
data:
|
96
|
+
- _id: 1
|
97
|
+
|
98
|
+
- description: transaction options inherited from client
|
99
|
+
|
100
|
+
clientOptions:
|
101
|
+
w: 1
|
102
|
+
readConcernLevel: local
|
103
|
+
|
104
|
+
operations: *commitAbortOperations
|
105
|
+
|
106
|
+
expectations:
|
107
|
+
- command_started_event:
|
108
|
+
command:
|
109
|
+
insert: *collection_name
|
110
|
+
documents:
|
111
|
+
- _id: 1
|
112
|
+
ordered: true
|
113
|
+
lsid: session0
|
114
|
+
txnNumber:
|
115
|
+
$numberLong: "1"
|
116
|
+
startTransaction: true
|
117
|
+
autocommit: false
|
118
|
+
readConcern:
|
119
|
+
level: local
|
120
|
+
writeConcern:
|
121
|
+
command_name: insert
|
122
|
+
database_name: *database_name
|
123
|
+
- command_started_event:
|
124
|
+
command:
|
125
|
+
commitTransaction: 1
|
126
|
+
lsid: session0
|
127
|
+
txnNumber:
|
128
|
+
$numberLong: "1"
|
129
|
+
startTransaction:
|
130
|
+
autocommit: false
|
131
|
+
readConcern:
|
132
|
+
writeConcern:
|
133
|
+
w: 1
|
134
|
+
command_name: commitTransaction
|
135
|
+
database_name: admin
|
136
|
+
- command_started_event:
|
137
|
+
command:
|
138
|
+
insert: *collection_name
|
139
|
+
documents:
|
140
|
+
- _id: 2
|
141
|
+
ordered: true
|
142
|
+
lsid: session0
|
143
|
+
txnNumber:
|
144
|
+
$numberLong: "2"
|
145
|
+
startTransaction: true
|
146
|
+
autocommit: false
|
147
|
+
readConcern:
|
148
|
+
level: local
|
149
|
+
afterClusterTime: 42
|
150
|
+
writeConcern:
|
151
|
+
command_name: insert
|
152
|
+
database_name: *database_name
|
153
|
+
- command_started_event:
|
154
|
+
command:
|
155
|
+
abortTransaction: 1
|
156
|
+
lsid: session0
|
157
|
+
txnNumber:
|
158
|
+
$numberLong: "2"
|
159
|
+
startTransaction:
|
160
|
+
autocommit: false
|
161
|
+
readConcern:
|
162
|
+
writeConcern:
|
163
|
+
w: 1
|
164
|
+
command_name: abortTransaction
|
165
|
+
database_name: admin
|
166
|
+
|
167
|
+
outcome: *outcome
|
168
|
+
|
169
|
+
- description: transaction options inherited from defaultTransactionOptions
|
170
|
+
|
171
|
+
sessionOptions:
|
172
|
+
session0:
|
173
|
+
defaultTransactionOptions:
|
174
|
+
readConcern:
|
175
|
+
level: snapshot
|
176
|
+
writeConcern:
|
177
|
+
w: 1
|
178
|
+
|
179
|
+
operations: *commitAbortOperations
|
180
|
+
|
181
|
+
expectations:
|
182
|
+
- command_started_event:
|
183
|
+
command:
|
184
|
+
insert: *collection_name
|
185
|
+
documents:
|
186
|
+
- _id: 1
|
187
|
+
ordered: true
|
188
|
+
lsid: session0
|
189
|
+
txnNumber:
|
190
|
+
$numberLong: "1"
|
191
|
+
startTransaction: true
|
192
|
+
autocommit: false
|
193
|
+
readConcern:
|
194
|
+
level: snapshot
|
195
|
+
writeConcern:
|
196
|
+
command_name: insert
|
197
|
+
database_name: *database_name
|
198
|
+
- command_started_event:
|
199
|
+
command:
|
200
|
+
commitTransaction: 1
|
201
|
+
lsid: session0
|
202
|
+
txnNumber:
|
203
|
+
$numberLong: "1"
|
204
|
+
startTransaction:
|
205
|
+
autocommit: false
|
206
|
+
readConcern:
|
207
|
+
writeConcern:
|
208
|
+
w: 1
|
209
|
+
command_name: commitTransaction
|
210
|
+
database_name: admin
|
211
|
+
- command_started_event:
|
212
|
+
command:
|
213
|
+
insert: *collection_name
|
214
|
+
documents:
|
215
|
+
- _id: 2
|
216
|
+
ordered: true
|
217
|
+
lsid: session0
|
218
|
+
txnNumber:
|
219
|
+
$numberLong: "2"
|
220
|
+
startTransaction: true
|
221
|
+
autocommit: false
|
222
|
+
readConcern:
|
223
|
+
level: snapshot
|
224
|
+
afterClusterTime: 42
|
225
|
+
writeConcern:
|
226
|
+
command_name: insert
|
227
|
+
database_name: *database_name
|
228
|
+
- command_started_event:
|
229
|
+
command:
|
230
|
+
abortTransaction: 1
|
231
|
+
lsid: session0
|
232
|
+
txnNumber:
|
233
|
+
$numberLong: "2"
|
234
|
+
startTransaction:
|
235
|
+
autocommit: false
|
236
|
+
readConcern:
|
237
|
+
writeConcern:
|
238
|
+
w: 1
|
239
|
+
command_name: abortTransaction
|
240
|
+
database_name: admin
|
241
|
+
|
242
|
+
outcome: *outcome
|
243
|
+
|
244
|
+
- description: startTransaction options override defaults
|
245
|
+
|
246
|
+
clientOptions:
|
247
|
+
readConcernLevel: local
|
248
|
+
w: 1
|
249
|
+
|
250
|
+
sessionOptions:
|
251
|
+
session0:
|
252
|
+
defaultTransactionOptions:
|
253
|
+
readConcern:
|
254
|
+
level: majority
|
255
|
+
writeConcern:
|
256
|
+
w: 1
|
257
|
+
|
258
|
+
operations:
|
259
|
+
- name: startTransaction
|
260
|
+
object: session0
|
261
|
+
arguments:
|
262
|
+
options:
|
263
|
+
readConcern:
|
264
|
+
level: snapshot
|
265
|
+
writeConcern:
|
266
|
+
w: majority
|
267
|
+
- name: insertOne
|
268
|
+
object: collection
|
269
|
+
arguments:
|
270
|
+
session: session0
|
271
|
+
document:
|
272
|
+
_id: 1
|
273
|
+
result:
|
274
|
+
insertedId: 1
|
275
|
+
- name: commitTransaction
|
276
|
+
object: session0
|
277
|
+
- name: startTransaction
|
278
|
+
object: session0
|
279
|
+
arguments:
|
280
|
+
options:
|
281
|
+
readConcern:
|
282
|
+
level: snapshot
|
283
|
+
writeConcern:
|
284
|
+
w: majority
|
285
|
+
- name: insertOne
|
286
|
+
object: collection
|
287
|
+
arguments:
|
288
|
+
session: session0
|
289
|
+
document:
|
290
|
+
_id: 2
|
291
|
+
result:
|
292
|
+
insertedId: 2
|
293
|
+
- name: abortTransaction
|
294
|
+
object: session0
|
295
|
+
|
296
|
+
expectations:
|
297
|
+
- command_started_event:
|
298
|
+
command:
|
299
|
+
insert: *collection_name
|
300
|
+
documents:
|
301
|
+
- _id: 1
|
302
|
+
ordered: true
|
303
|
+
lsid: session0
|
304
|
+
txnNumber:
|
305
|
+
$numberLong: "1"
|
306
|
+
startTransaction: true
|
307
|
+
autocommit: false
|
308
|
+
readConcern:
|
309
|
+
level: snapshot
|
310
|
+
writeConcern:
|
311
|
+
command_name: insert
|
312
|
+
database_name: *database_name
|
313
|
+
- command_started_event:
|
314
|
+
command:
|
315
|
+
commitTransaction: 1
|
316
|
+
lsid: session0
|
317
|
+
txnNumber:
|
318
|
+
$numberLong: "1"
|
319
|
+
startTransaction:
|
320
|
+
autocommit: false
|
321
|
+
readConcern:
|
322
|
+
writeConcern:
|
323
|
+
w: majority
|
324
|
+
command_name: commitTransaction
|
325
|
+
database_name: admin
|
326
|
+
- command_started_event:
|
327
|
+
command:
|
328
|
+
insert: *collection_name
|
329
|
+
documents:
|
330
|
+
- _id: 2
|
331
|
+
ordered: true
|
332
|
+
lsid: session0
|
333
|
+
txnNumber:
|
334
|
+
$numberLong: "2"
|
335
|
+
startTransaction: true
|
336
|
+
autocommit: false
|
337
|
+
readConcern:
|
338
|
+
level: snapshot
|
339
|
+
afterClusterTime: 42
|
340
|
+
writeConcern:
|
341
|
+
command_name: insert
|
342
|
+
database_name: *database_name
|
343
|
+
- command_started_event:
|
344
|
+
command:
|
345
|
+
abortTransaction: 1
|
346
|
+
lsid: session0
|
347
|
+
txnNumber:
|
348
|
+
$numberLong: "2"
|
349
|
+
startTransaction:
|
350
|
+
autocommit: false
|
351
|
+
readConcern:
|
352
|
+
writeConcern:
|
353
|
+
w: majority
|
354
|
+
command_name: abortTransaction
|
355
|
+
database_name: admin
|
356
|
+
|
357
|
+
outcome: *outcome
|
358
|
+
|
359
|
+
- description: defaultTransactionOptions override client options
|
360
|
+
|
361
|
+
clientOptions:
|
362
|
+
readConcernLevel: local
|
363
|
+
w: 1
|
364
|
+
|
365
|
+
sessionOptions:
|
366
|
+
session0:
|
367
|
+
defaultTransactionOptions:
|
368
|
+
readConcern:
|
369
|
+
level: snapshot
|
370
|
+
writeConcern:
|
371
|
+
w: majority
|
372
|
+
|
373
|
+
operations: *commitAbortOperations
|
374
|
+
|
375
|
+
expectations:
|
376
|
+
- command_started_event:
|
377
|
+
command:
|
378
|
+
insert: *collection_name
|
379
|
+
documents:
|
380
|
+
- _id: 1
|
381
|
+
ordered: true
|
382
|
+
lsid: session0
|
383
|
+
txnNumber:
|
384
|
+
$numberLong: "1"
|
385
|
+
startTransaction: true
|
386
|
+
autocommit: false
|
387
|
+
readConcern:
|
388
|
+
level: snapshot
|
389
|
+
writeConcern:
|
390
|
+
command_name: insert
|
391
|
+
database_name: *database_name
|
392
|
+
- command_started_event:
|
393
|
+
command:
|
394
|
+
commitTransaction: 1
|
395
|
+
lsid: session0
|
396
|
+
txnNumber:
|
397
|
+
$numberLong: "1"
|
398
|
+
startTransaction:
|
399
|
+
autocommit: false
|
400
|
+
readConcern:
|
401
|
+
writeConcern:
|
402
|
+
w: majority
|
403
|
+
command_name: commitTransaction
|
404
|
+
database_name: admin
|
405
|
+
- command_started_event:
|
406
|
+
command:
|
407
|
+
insert: *collection_name
|
408
|
+
documents:
|
409
|
+
- _id: 2
|
410
|
+
ordered: true
|
411
|
+
lsid: session0
|
412
|
+
txnNumber:
|
413
|
+
$numberLong: "2"
|
414
|
+
startTransaction: true
|
415
|
+
autocommit: false
|
416
|
+
readConcern:
|
417
|
+
level: snapshot
|
418
|
+
afterClusterTime: 42
|
419
|
+
writeConcern:
|
420
|
+
command_name: insert
|
421
|
+
database_name: *database_name
|
422
|
+
- command_started_event:
|
423
|
+
command:
|
424
|
+
abortTransaction: 1
|
425
|
+
lsid: session0
|
426
|
+
txnNumber:
|
427
|
+
$numberLong: "2"
|
428
|
+
startTransaction:
|
429
|
+
autocommit: false
|
430
|
+
readConcern:
|
431
|
+
writeConcern:
|
432
|
+
w: majority
|
433
|
+
command_name: abortTransaction
|
434
|
+
database_name: admin
|
435
|
+
|
436
|
+
outcome: *outcome
|
437
|
+
|
438
|
+
- description: readConcern local in defaultTransactionOptions
|
439
|
+
|
440
|
+
clientOptions:
|
441
|
+
w: 1
|
442
|
+
|
443
|
+
sessionOptions:
|
444
|
+
session0:
|
445
|
+
defaultTransactionOptions:
|
446
|
+
readConcern:
|
447
|
+
level: local
|
448
|
+
|
449
|
+
operations: *commitAbortOperations
|
450
|
+
|
451
|
+
expectations:
|
452
|
+
- command_started_event:
|
453
|
+
command:
|
454
|
+
insert: *collection_name
|
455
|
+
documents:
|
456
|
+
- _id: 1
|
457
|
+
ordered: true
|
458
|
+
lsid: session0
|
459
|
+
txnNumber:
|
460
|
+
$numberLong: "1"
|
461
|
+
startTransaction: true
|
462
|
+
autocommit: false
|
463
|
+
readConcern:
|
464
|
+
level: local
|
465
|
+
writeConcern:
|
466
|
+
command_name: insert
|
467
|
+
database_name: *database_name
|
468
|
+
- command_started_event:
|
469
|
+
command:
|
470
|
+
commitTransaction: 1
|
471
|
+
lsid: session0
|
472
|
+
txnNumber:
|
473
|
+
$numberLong: "1"
|
474
|
+
startTransaction:
|
475
|
+
autocommit: false
|
476
|
+
readConcern:
|
477
|
+
writeConcern:
|
478
|
+
w: 1
|
479
|
+
command_name: commitTransaction
|
480
|
+
database_name: admin
|
481
|
+
- command_started_event:
|
482
|
+
command:
|
483
|
+
insert: *collection_name
|
484
|
+
documents:
|
485
|
+
- _id: 2
|
486
|
+
ordered: true
|
487
|
+
lsid: session0
|
488
|
+
txnNumber:
|
489
|
+
$numberLong: "2"
|
490
|
+
startTransaction: true
|
491
|
+
autocommit: false
|
492
|
+
readConcern:
|
493
|
+
level: local
|
494
|
+
afterClusterTime: 42
|
495
|
+
writeConcern:
|
496
|
+
command_name: insert
|
497
|
+
database_name: *database_name
|
498
|
+
- command_started_event:
|
499
|
+
command:
|
500
|
+
abortTransaction: 1
|
501
|
+
lsid: session0
|
502
|
+
txnNumber:
|
503
|
+
$numberLong: "2"
|
504
|
+
startTransaction:
|
505
|
+
autocommit: false
|
506
|
+
readConcern:
|
507
|
+
writeConcern:
|
508
|
+
w: 1
|
509
|
+
command_name: abortTransaction
|
510
|
+
database_name: admin
|
511
|
+
|
512
|
+
outcome: *outcome
|
513
|
+
|
514
|
+
- description: readConcern local in startTransaction options
|
515
|
+
|
516
|
+
sessionOptions:
|
517
|
+
session0:
|
518
|
+
defaultTransactionOptions:
|
519
|
+
readConcern:
|
520
|
+
level: majority # Overridden.
|
521
|
+
|
522
|
+
operations:
|
523
|
+
- name: startTransaction
|
524
|
+
object: session0
|
525
|
+
arguments:
|
526
|
+
options:
|
527
|
+
readConcern:
|
528
|
+
level: snapshot
|
529
|
+
- name: insertOne
|
530
|
+
object: collection
|
531
|
+
arguments:
|
532
|
+
session: session0
|
533
|
+
document:
|
534
|
+
_id: 1
|
535
|
+
result:
|
536
|
+
insertedId: 1
|
537
|
+
- name: commitTransaction
|
538
|
+
object: session0
|
539
|
+
# Now test abort.
|
540
|
+
- name: startTransaction
|
541
|
+
object: session0
|
542
|
+
arguments:
|
543
|
+
options:
|
544
|
+
readConcern:
|
545
|
+
level: snapshot
|
546
|
+
- name: insertOne
|
547
|
+
object: collection
|
548
|
+
arguments:
|
549
|
+
session: session0
|
550
|
+
document:
|
551
|
+
_id: 2
|
552
|
+
result:
|
553
|
+
insertedId: 2
|
554
|
+
- name: abortTransaction
|
555
|
+
object: session0
|
556
|
+
|
557
|
+
expectations:
|
558
|
+
- command_started_event:
|
559
|
+
command:
|
560
|
+
insert: *collection_name
|
561
|
+
documents:
|
562
|
+
- _id: 1
|
563
|
+
ordered: true
|
564
|
+
lsid: session0
|
565
|
+
txnNumber:
|
566
|
+
$numberLong: "1"
|
567
|
+
startTransaction: true
|
568
|
+
autocommit: false
|
569
|
+
readConcern:
|
570
|
+
level: snapshot
|
571
|
+
writeConcern:
|
572
|
+
command_name: insert
|
573
|
+
database_name: *database_name
|
574
|
+
- command_started_event:
|
575
|
+
command:
|
576
|
+
commitTransaction: 1
|
577
|
+
lsid: session0
|
578
|
+
txnNumber:
|
579
|
+
$numberLong: "1"
|
580
|
+
startTransaction:
|
581
|
+
autocommit: false
|
582
|
+
readConcern:
|
583
|
+
writeConcern:
|
584
|
+
command_name: commitTransaction
|
585
|
+
database_name: admin
|
586
|
+
- command_started_event:
|
587
|
+
command:
|
588
|
+
insert: *collection_name
|
589
|
+
documents:
|
590
|
+
- _id: 2
|
591
|
+
ordered: true
|
592
|
+
lsid: session0
|
593
|
+
txnNumber:
|
594
|
+
$numberLong: "2"
|
595
|
+
startTransaction: true
|
596
|
+
autocommit: false
|
597
|
+
readConcern:
|
598
|
+
level: snapshot
|
599
|
+
afterClusterTime: 42
|
600
|
+
writeConcern:
|
601
|
+
command_name: insert
|
602
|
+
database_name: *database_name
|
603
|
+
- command_started_event:
|
604
|
+
command:
|
605
|
+
abortTransaction: 1
|
606
|
+
lsid: session0
|
607
|
+
txnNumber:
|
608
|
+
$numberLong: "2"
|
609
|
+
startTransaction:
|
610
|
+
autocommit: false
|
611
|
+
readConcern:
|
612
|
+
writeConcern:
|
613
|
+
command_name: abortTransaction
|
614
|
+
database_name: admin
|
615
|
+
|
616
|
+
outcome: *outcome
|
617
|
+
|
618
|
+
- description: client writeConcern ignored for bulk
|
619
|
+
|
620
|
+
clientOptions:
|
621
|
+
w: majority
|
622
|
+
|
623
|
+
operations:
|
624
|
+
- name: startTransaction
|
625
|
+
object: session0
|
626
|
+
arguments:
|
627
|
+
options:
|
628
|
+
writeConcern:
|
629
|
+
w: 1
|
630
|
+
- name: bulkWrite
|
631
|
+
object: collection
|
632
|
+
arguments:
|
633
|
+
requests:
|
634
|
+
- name: insertOne
|
635
|
+
arguments:
|
636
|
+
document: {_id: 1}
|
637
|
+
session: session0
|
638
|
+
result:
|
639
|
+
deletedCount: 0
|
640
|
+
insertedIds: {0: 1}
|
641
|
+
matchedCount: 0
|
642
|
+
modifiedCount: 0
|
643
|
+
upsertedCount: 0
|
644
|
+
upsertedIds: {}
|
645
|
+
- name: commitTransaction
|
646
|
+
object: session0
|
647
|
+
|
648
|
+
expectations:
|
649
|
+
- command_started_event:
|
650
|
+
command:
|
651
|
+
insert: *collection_name
|
652
|
+
documents:
|
653
|
+
- _id: 1
|
654
|
+
ordered: true
|
655
|
+
readConcern:
|
656
|
+
lsid: session0
|
657
|
+
txnNumber:
|
658
|
+
$numberLong: "1"
|
659
|
+
startTransaction: true
|
660
|
+
autocommit: false
|
661
|
+
# No writeConcern.
|
662
|
+
writeConcern:
|
663
|
+
command_name: insert
|
664
|
+
database_name: *database_name
|
665
|
+
- command_started_event:
|
666
|
+
command:
|
667
|
+
commitTransaction: 1
|
668
|
+
lsid: session0
|
669
|
+
txnNumber:
|
670
|
+
$numberLong: "1"
|
671
|
+
startTransaction:
|
672
|
+
autocommit: false
|
673
|
+
writeConcern:
|
674
|
+
w: 1
|
675
|
+
command_name: commitTransaction
|
676
|
+
database_name: admin
|
677
|
+
|
678
|
+
outcome: *outcome
|
679
|
+
|
680
|
+
- description: readPreference inherited from client
|
681
|
+
|
682
|
+
clientOptions:
|
683
|
+
readPreference: secondary
|
684
|
+
|
685
|
+
operations:
|
686
|
+
- name: startTransaction
|
687
|
+
object: session0
|
688
|
+
- name: insertOne
|
689
|
+
object: collection
|
690
|
+
arguments:
|
691
|
+
session: session0
|
692
|
+
document:
|
693
|
+
_id: 1
|
694
|
+
result:
|
695
|
+
insertedId: 1
|
696
|
+
- name: find
|
697
|
+
object: collection
|
698
|
+
arguments:
|
699
|
+
session: session0
|
700
|
+
filter:
|
701
|
+
_id: 1
|
702
|
+
result:
|
703
|
+
errorContains: read preference in a transaction must be primary
|
704
|
+
- name: commitTransaction
|
705
|
+
object: session0
|
706
|
+
|
707
|
+
expectations:
|
708
|
+
- command_started_event:
|
709
|
+
command:
|
710
|
+
insert: *collection_name
|
711
|
+
documents:
|
712
|
+
- _id: 1
|
713
|
+
ordered: true
|
714
|
+
lsid: session0
|
715
|
+
txnNumber:
|
716
|
+
$numberLong: "1"
|
717
|
+
startTransaction: true
|
718
|
+
autocommit: false
|
719
|
+
readConcern:
|
720
|
+
writeConcern:
|
721
|
+
command_name: insert
|
722
|
+
database_name: *database_name
|
723
|
+
- command_started_event:
|
724
|
+
command:
|
725
|
+
commitTransaction: 1
|
726
|
+
lsid: session0
|
727
|
+
txnNumber:
|
728
|
+
$numberLong: "1"
|
729
|
+
startTransaction:
|
730
|
+
autocommit: false
|
731
|
+
readConcern:
|
732
|
+
writeConcern:
|
733
|
+
command_name: commitTransaction
|
734
|
+
database_name: admin
|
735
|
+
|
736
|
+
outcome:
|
737
|
+
collection:
|
738
|
+
data:
|
739
|
+
- _id: 1
|
740
|
+
|
741
|
+
- description: readPreference inherited from defaultTransactionOptions
|
742
|
+
|
743
|
+
clientOptions:
|
744
|
+
readPreference: primary
|
745
|
+
|
746
|
+
sessionOptions:
|
747
|
+
session0:
|
748
|
+
defaultTransactionOptions:
|
749
|
+
readPreference:
|
750
|
+
mode: Secondary
|
751
|
+
|
752
|
+
operations:
|
753
|
+
- name: startTransaction
|
754
|
+
object: session0
|
755
|
+
- name: insertOne
|
756
|
+
object: collection
|
757
|
+
arguments:
|
758
|
+
session: session0
|
759
|
+
document:
|
760
|
+
_id: 1
|
761
|
+
result:
|
762
|
+
insertedId: 1
|
763
|
+
- name: find
|
764
|
+
object: collection
|
765
|
+
arguments:
|
766
|
+
session: session0
|
767
|
+
filter:
|
768
|
+
_id: 1
|
769
|
+
result:
|
770
|
+
errorContains: read preference in a transaction must be primary
|
771
|
+
- name: commitTransaction
|
772
|
+
object: session0
|
773
|
+
|
774
|
+
expectations:
|
775
|
+
- command_started_event:
|
776
|
+
command:
|
777
|
+
insert: *collection_name
|
778
|
+
documents:
|
779
|
+
- _id: 1
|
780
|
+
ordered: true
|
781
|
+
lsid: session0
|
782
|
+
txnNumber:
|
783
|
+
$numberLong: "1"
|
784
|
+
startTransaction: true
|
785
|
+
autocommit: false
|
786
|
+
readConcern:
|
787
|
+
writeConcern:
|
788
|
+
command_name: insert
|
789
|
+
database_name: *database_name
|
790
|
+
- command_started_event:
|
791
|
+
command:
|
792
|
+
commitTransaction: 1
|
793
|
+
lsid: session0
|
794
|
+
txnNumber:
|
795
|
+
$numberLong: "1"
|
796
|
+
startTransaction:
|
797
|
+
autocommit: false
|
798
|
+
readConcern:
|
799
|
+
writeConcern:
|
800
|
+
command_name: commitTransaction
|
801
|
+
database_name: admin
|
802
|
+
|
803
|
+
outcome:
|
804
|
+
collection:
|
805
|
+
data:
|
806
|
+
- _id: 1
|
807
|
+
|
808
|
+
- description: startTransaction overrides readPreference
|
809
|
+
|
810
|
+
clientOptions:
|
811
|
+
readPreference: primary
|
812
|
+
|
813
|
+
sessionOptions:
|
814
|
+
session0:
|
815
|
+
defaultTransactionOptions:
|
816
|
+
readPreference:
|
817
|
+
mode: Primary
|
818
|
+
|
819
|
+
operations:
|
820
|
+
- name: startTransaction
|
821
|
+
object: session0
|
822
|
+
arguments:
|
823
|
+
options:
|
824
|
+
readPreference:
|
825
|
+
mode: Secondary
|
826
|
+
- name: insertOne
|
827
|
+
object: collection
|
828
|
+
arguments:
|
829
|
+
session: session0
|
830
|
+
document:
|
831
|
+
_id: 1
|
832
|
+
result:
|
833
|
+
insertedId: 1
|
834
|
+
- name: find
|
835
|
+
object: collection
|
836
|
+
arguments:
|
837
|
+
session: session0
|
838
|
+
filter:
|
839
|
+
_id: 1
|
840
|
+
result:
|
841
|
+
errorContains: read preference in a transaction must be primary
|
842
|
+
- name: commitTransaction
|
843
|
+
object: session0
|
844
|
+
|
845
|
+
expectations:
|
846
|
+
- command_started_event:
|
847
|
+
command:
|
848
|
+
insert: *collection_name
|
849
|
+
documents:
|
850
|
+
- _id: 1
|
851
|
+
ordered: true
|
852
|
+
lsid: session0
|
853
|
+
txnNumber:
|
854
|
+
$numberLong: "1"
|
855
|
+
startTransaction: true
|
856
|
+
autocommit: false
|
857
|
+
readConcern:
|
858
|
+
writeConcern:
|
859
|
+
command_name: insert
|
860
|
+
database_name: *database_name
|
861
|
+
- command_started_event:
|
862
|
+
command:
|
863
|
+
commitTransaction: 1
|
864
|
+
lsid: session0
|
865
|
+
txnNumber:
|
866
|
+
$numberLong: "1"
|
867
|
+
startTransaction:
|
868
|
+
autocommit: false
|
869
|
+
readConcern:
|
870
|
+
writeConcern:
|
871
|
+
command_name: commitTransaction
|
872
|
+
database_name: admin
|
873
|
+
|
874
|
+
outcome:
|
875
|
+
collection:
|
876
|
+
data:
|
877
|
+
- _id: 1
|