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.
Files changed (394) hide show
  1. checksums.yaml +5 -5
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/LICENSE +1 -1
  5. data/README.md +3 -2
  6. data/lib/mongo.rb +2 -2
  7. data/lib/mongo/address.rb +10 -2
  8. data/lib/mongo/address/ipv4.rb +1 -1
  9. data/lib/mongo/address/ipv6.rb +26 -5
  10. data/lib/mongo/address/unix.rb +1 -1
  11. data/lib/mongo/auth.rb +10 -3
  12. data/lib/mongo/auth/cr.rb +4 -1
  13. data/lib/mongo/auth/cr/conversation.rb +4 -1
  14. data/lib/mongo/auth/ldap.rb +1 -1
  15. data/lib/mongo/auth/ldap/conversation.rb +1 -1
  16. data/lib/mongo/auth/roles.rb +1 -1
  17. data/lib/mongo/auth/scram.rb +24 -7
  18. data/lib/mongo/auth/scram/conversation.rb +52 -19
  19. data/lib/mongo/auth/stringprep.rb +114 -0
  20. data/lib/mongo/auth/stringprep/profiles/sasl.rb +73 -0
  21. data/lib/mongo/auth/stringprep/tables.rb +3232 -0
  22. data/lib/mongo/auth/stringprep/unicode_normalize/normalize.rb +174 -0
  23. data/lib/mongo/auth/stringprep/unicode_normalize/tables.rb +1170 -0
  24. data/lib/mongo/auth/user.rb +14 -3
  25. data/lib/mongo/auth/user/view.rb +1 -1
  26. data/lib/mongo/auth/x509.rb +1 -1
  27. data/lib/mongo/auth/x509/conversation.rb +1 -1
  28. data/lib/mongo/bson.rb +1 -1
  29. data/lib/mongo/bulk_write.rb +8 -8
  30. data/lib/mongo/bulk_write/combineable.rb +1 -1
  31. data/lib/mongo/bulk_write/ordered_combiner.rb +1 -1
  32. data/lib/mongo/bulk_write/result.rb +1 -1
  33. data/lib/mongo/bulk_write/result_combiner.rb +4 -4
  34. data/lib/mongo/bulk_write/transformable.rb +1 -1
  35. data/lib/mongo/bulk_write/unordered_combiner.rb +1 -1
  36. data/lib/mongo/bulk_write/validatable.rb +1 -1
  37. data/lib/mongo/client.rb +115 -24
  38. data/lib/mongo/cluster.rb +17 -10
  39. data/lib/mongo/cluster/app_metadata.rb +7 -1
  40. data/lib/mongo/cluster/periodic_executor.rb +1 -1
  41. data/lib/mongo/cluster/reapers/socket_reaper.rb +1 -1
  42. data/lib/mongo/cluster/topology.rb +12 -2
  43. data/lib/mongo/cluster/topology/replica_set.rb +9 -1
  44. data/lib/mongo/cluster/topology/sharded.rb +1 -1
  45. data/lib/mongo/cluster/topology/single.rb +1 -1
  46. data/lib/mongo/cluster/topology/unknown.rb +1 -1
  47. data/lib/mongo/collection.rb +75 -19
  48. data/lib/mongo/collection/view.rb +1 -1
  49. data/lib/mongo/collection/view/aggregation.rb +1 -1
  50. data/lib/mongo/collection/view/builder.rb +1 -1
  51. data/lib/mongo/collection/view/builder/aggregation.rb +3 -3
  52. data/lib/mongo/collection/view/builder/find_command.rb +1 -1
  53. data/lib/mongo/collection/view/builder/flags.rb +1 -1
  54. data/lib/mongo/collection/view/builder/map_reduce.rb +1 -1
  55. data/lib/mongo/collection/view/builder/modifiers.rb +1 -1
  56. data/lib/mongo/collection/view/builder/op_query.rb +1 -1
  57. data/lib/mongo/collection/view/change_stream.rb +193 -17
  58. data/lib/mongo/collection/view/change_stream/retryable.rb +3 -20
  59. data/lib/mongo/collection/view/explainable.rb +1 -1
  60. data/lib/mongo/collection/view/immutable.rb +1 -1
  61. data/lib/mongo/collection/view/iterable.rb +2 -2
  62. data/lib/mongo/collection/view/map_reduce.rb +1 -1
  63. data/lib/mongo/collection/view/readable.rb +108 -29
  64. data/lib/mongo/collection/view/writable.rb +3 -3
  65. data/lib/mongo/cursor.rb +44 -4
  66. data/lib/mongo/cursor/builder.rb +1 -1
  67. data/lib/mongo/cursor/builder/get_more_command.rb +1 -1
  68. data/lib/mongo/cursor/builder/kill_cursors_command.rb +1 -1
  69. data/lib/mongo/cursor/builder/op_get_more.rb +1 -1
  70. data/lib/mongo/cursor/builder/op_kill_cursors.rb +1 -1
  71. data/lib/mongo/database.rb +46 -3
  72. data/lib/mongo/database/view.rb +11 -11
  73. data/lib/mongo/dbref.rb +1 -1
  74. data/lib/mongo/error.rb +57 -1
  75. data/lib/mongo/error/bulk_write_error.rb +2 -2
  76. data/lib/mongo/error/change_stream_resumable.rb +37 -0
  77. data/lib/mongo/error/closed_stream.rb +1 -1
  78. data/lib/mongo/error/extra_file_chunk.rb +1 -1
  79. data/lib/mongo/error/failed_stringprep_validation.rb +38 -0
  80. data/lib/mongo/error/file_not_found.rb +1 -1
  81. data/lib/mongo/error/insufficient_iteration_count.rb +38 -0
  82. data/lib/mongo/error/invalid_application_name.rb +1 -1
  83. data/lib/mongo/error/invalid_bulk_operation.rb +1 -1
  84. data/lib/mongo/error/invalid_bulk_operation_type.rb +1 -1
  85. data/lib/mongo/error/invalid_collection_name.rb +1 -1
  86. data/lib/mongo/error/invalid_database_name.rb +1 -1
  87. data/lib/mongo/error/invalid_document.rb +1 -1
  88. data/lib/mongo/error/invalid_file.rb +1 -1
  89. data/lib/mongo/error/invalid_file_revision.rb +1 -1
  90. data/lib/mongo/error/invalid_min_pool_size.rb +1 -1
  91. data/lib/mongo/error/invalid_nonce.rb +1 -1
  92. data/lib/mongo/error/invalid_read_option.rb +35 -0
  93. data/lib/mongo/error/invalid_replacement_document.rb +1 -1
  94. data/lib/mongo/error/invalid_server_preference.rb +1 -1
  95. data/lib/mongo/error/invalid_session.rb +1 -1
  96. data/lib/mongo/error/invalid_signature.rb +1 -1
  97. data/lib/mongo/error/invalid_transaction_operation.rb +82 -0
  98. data/lib/mongo/error/invalid_txt_record.rb +1 -1
  99. data/lib/mongo/error/invalid_update_document.rb +1 -1
  100. data/lib/mongo/error/invalid_uri.rb +1 -1
  101. data/lib/mongo/error/invalid_write_concern.rb +1 -1
  102. data/lib/mongo/error/max_bson_size.rb +1 -1
  103. data/lib/mongo/error/max_message_size.rb +1 -1
  104. data/lib/mongo/error/mismatched_domain.rb +1 -1
  105. data/lib/mongo/error/missing_file_chunk.rb +1 -1
  106. data/lib/mongo/error/missing_resume_token.rb +1 -1
  107. data/lib/mongo/error/multi_index_drop.rb +1 -1
  108. data/lib/mongo/error/need_primary_server.rb +1 -1
  109. data/lib/mongo/error/no_server_available.rb +1 -1
  110. data/lib/mongo/error/no_srv_records.rb +1 -1
  111. data/lib/mongo/error/operation_failure.rb +108 -14
  112. data/lib/mongo/error/parser.rb +50 -1
  113. data/lib/mongo/error/socket_error.rb +5 -2
  114. data/lib/mongo/error/socket_timeout_error.rb +5 -2
  115. data/lib/mongo/error/unchangeable_collection_option.rb +1 -1
  116. data/lib/mongo/error/unexpected_chunk_length.rb +1 -1
  117. data/lib/mongo/error/unexpected_response.rb +1 -1
  118. data/lib/mongo/error/unknown_payload_type.rb +1 -1
  119. data/lib/mongo/error/unsupported_array_filters.rb +1 -1
  120. data/lib/mongo/error/unsupported_collation.rb +1 -1
  121. data/lib/mongo/error/unsupported_features.rb +1 -1
  122. data/lib/mongo/error/unsupported_message_type.rb +1 -1
  123. data/lib/mongo/error/write_retryable.rb +27 -0
  124. data/lib/mongo/event.rb +10 -9
  125. data/lib/mongo/event/base.rb +33 -0
  126. data/lib/mongo/event/description_changed.rb +2 -2
  127. data/lib/mongo/event/listeners.rb +1 -1
  128. data/lib/mongo/event/member_discovered.rb +4 -2
  129. data/lib/mongo/event/primary_elected.rb +2 -2
  130. data/lib/mongo/event/publisher.rb +1 -1
  131. data/lib/mongo/event/standalone_discovered.rb +2 -2
  132. data/lib/mongo/event/subscriber.rb +1 -1
  133. data/lib/mongo/grid.rb +1 -1
  134. data/lib/mongo/grid/file.rb +1 -1
  135. data/lib/mongo/grid/file/chunk.rb +3 -3
  136. data/lib/mongo/grid/file/info.rb +26 -3
  137. data/lib/mongo/grid/fs_bucket.rb +1 -1
  138. data/lib/mongo/grid/stream.rb +1 -1
  139. data/lib/mongo/grid/stream/read.rb +1 -1
  140. data/lib/mongo/grid/stream/write.rb +1 -1
  141. data/lib/mongo/index.rb +1 -1
  142. data/lib/mongo/index/view.rb +1 -1
  143. data/lib/mongo/loggable.rb +1 -1
  144. data/lib/mongo/logger.rb +1 -1
  145. data/lib/mongo/monitoring.rb +99 -62
  146. data/lib/mongo/monitoring/command_log_subscriber.rb +2 -2
  147. data/lib/mongo/monitoring/event.rb +2 -1
  148. data/lib/mongo/monitoring/event/command_failed.rb +19 -6
  149. data/lib/mongo/monitoring/event/command_started.rb +14 -3
  150. data/lib/mongo/monitoring/event/command_succeeded.rb +5 -3
  151. data/lib/mongo/monitoring/event/secure.rb +1 -1
  152. data/lib/mongo/monitoring/event/server_closed.rb +2 -2
  153. data/lib/mongo/monitoring/event/server_description_changed.rb +2 -2
  154. data/lib/mongo/monitoring/event/server_opening.rb +11 -2
  155. data/lib/mongo/monitoring/event/topology_changed.rb +13 -2
  156. data/lib/mongo/monitoring/event/topology_closed.rb +2 -2
  157. data/lib/mongo/monitoring/event/topology_opening.rb +11 -2
  158. data/lib/mongo/monitoring/publishable.rb +10 -6
  159. data/lib/mongo/monitoring/sdam_log_subscriber.rb +1 -1
  160. data/lib/mongo/monitoring/server_closed_log_subscriber.rb +1 -1
  161. data/lib/mongo/monitoring/server_description_changed_log_subscriber.rb +1 -1
  162. data/lib/mongo/monitoring/server_opening_log_subscriber.rb +1 -1
  163. data/lib/mongo/monitoring/topology_changed_log_subscriber.rb +1 -1
  164. data/lib/mongo/monitoring/topology_opening_log_subscriber.rb +1 -1
  165. data/lib/mongo/operation/aggregate/op_msg.rb +3 -0
  166. data/lib/mongo/operation/create/op_msg.rb +9 -0
  167. data/lib/mongo/operation/create_index/op_msg.rb +9 -0
  168. data/lib/mongo/operation/create_user/command.rb +1 -1
  169. data/lib/mongo/operation/create_user/op_msg.rb +10 -1
  170. data/lib/mongo/operation/delete/op_msg.rb +3 -0
  171. data/lib/mongo/operation/distinct/op_msg.rb +9 -0
  172. data/lib/mongo/operation/drop/op_msg.rb +9 -0
  173. data/lib/mongo/operation/drop_database/op_msg.rb +9 -0
  174. data/lib/mongo/operation/drop_index/op_msg.rb +9 -0
  175. data/lib/mongo/operation/explain/op_msg.rb +3 -0
  176. data/lib/mongo/operation/find/op_msg.rb +3 -0
  177. data/lib/mongo/operation/get_more.rb +1 -1
  178. data/lib/mongo/operation/get_more/command.rb +1 -1
  179. data/lib/mongo/operation/get_more/legacy.rb +1 -1
  180. data/lib/mongo/operation/get_more/op_msg.rb +3 -0
  181. data/lib/mongo/operation/indexes/op_msg.rb +3 -0
  182. data/lib/mongo/operation/indexes/result.rb +1 -1
  183. data/lib/mongo/operation/insert/bulk_result.rb +32 -2
  184. data/lib/mongo/operation/insert/op_msg.rb +3 -0
  185. data/lib/mongo/operation/insert/result.rb +1 -1
  186. data/lib/mongo/operation/kill_cursors/op_msg.rb +9 -0
  187. data/lib/mongo/operation/list_collections/op_msg.rb +3 -0
  188. data/lib/mongo/operation/list_collections/result.rb +5 -1
  189. data/lib/mongo/operation/map_reduce/op_msg.rb +3 -0
  190. data/lib/mongo/operation/map_reduce/result.rb +1 -1
  191. data/lib/mongo/operation/parallel_scan/op_msg.rb +3 -0
  192. data/lib/mongo/operation/remove_user/op_msg.rb +9 -0
  193. data/lib/mongo/operation/result.rb +27 -14
  194. data/lib/mongo/operation/shared/executable.rb +1 -0
  195. data/lib/mongo/operation/shared/sessions_supported.rb +78 -7
  196. data/lib/mongo/operation/shared/specifiable.rb +18 -2
  197. data/lib/mongo/operation/shared/write_concern_supported.rb +1 -1
  198. data/lib/mongo/operation/update/op_msg.rb +3 -0
  199. data/lib/mongo/operation/update_user/command.rb +1 -1
  200. data/lib/mongo/operation/update_user/op_msg.rb +10 -1
  201. data/lib/mongo/operation/users_info/op_msg.rb +3 -0
  202. data/lib/mongo/options.rb +1 -1
  203. data/lib/mongo/options/mapper.rb +1 -1
  204. data/lib/mongo/options/redacted.rb +1 -1
  205. data/lib/mongo/protocol/bit_vector.rb +1 -1
  206. data/lib/mongo/protocol/compressed.rb +1 -1
  207. data/lib/mongo/protocol/delete.rb +1 -1
  208. data/lib/mongo/protocol/get_more.rb +7 -7
  209. data/lib/mongo/protocol/insert.rb +1 -1
  210. data/lib/mongo/protocol/kill_cursors.rb +1 -1
  211. data/lib/mongo/protocol/message.rb +5 -5
  212. data/lib/mongo/protocol/msg.rb +9 -7
  213. data/lib/mongo/protocol/query.rb +1 -1
  214. data/lib/mongo/protocol/registry.rb +1 -1
  215. data/lib/mongo/protocol/reply.rb +10 -10
  216. data/lib/mongo/protocol/serializers.rb +1 -1
  217. data/lib/mongo/protocol/update.rb +1 -1
  218. data/lib/mongo/retryable.rb +22 -14
  219. data/lib/mongo/server.rb +1 -1
  220. data/lib/mongo/server/connectable.rb +1 -1
  221. data/lib/mongo/server/connection.rb +16 -4
  222. data/lib/mongo/server/connection_pool.rb +1 -1
  223. data/lib/mongo/server/connection_pool/queue.rb +1 -1
  224. data/lib/mongo/server/context.rb +1 -1
  225. data/lib/mongo/server/description.rb +14 -2
  226. data/lib/mongo/server/description/features.rb +10 -9
  227. data/lib/mongo/server/description/inspector.rb +1 -1
  228. data/lib/mongo/server/description/inspector/description_changed.rb +1 -1
  229. data/lib/mongo/server/description/inspector/member_discovered.rb +1 -1
  230. data/lib/mongo/server/description/inspector/primary_elected.rb +1 -1
  231. data/lib/mongo/server/description/inspector/standalone_discovered.rb +1 -1
  232. data/lib/mongo/server/monitor.rb +15 -3
  233. data/lib/mongo/server/monitor/connection.rb +1 -1
  234. data/lib/mongo/server_selector.rb +1 -1
  235. data/lib/mongo/server_selector/nearest.rb +1 -1
  236. data/lib/mongo/server_selector/primary.rb +1 -1
  237. data/lib/mongo/server_selector/primary_preferred.rb +1 -1
  238. data/lib/mongo/server_selector/secondary.rb +1 -1
  239. data/lib/mongo/server_selector/secondary_preferred.rb +1 -1
  240. data/lib/mongo/server_selector/selectable.rb +7 -2
  241. data/lib/mongo/session.rb +389 -12
  242. data/lib/mongo/session/server_session.rb +7 -2
  243. data/lib/mongo/session/session_pool.rb +1 -1
  244. data/lib/mongo/socket.rb +1 -1
  245. data/lib/mongo/socket/ssl.rb +1 -1
  246. data/lib/mongo/socket/tcp.rb +1 -1
  247. data/lib/mongo/socket/unix.rb +1 -1
  248. data/lib/mongo/uri.rb +6 -4
  249. data/lib/mongo/uri/srv_protocol.rb +1 -1
  250. data/lib/mongo/version.rb +2 -2
  251. data/lib/mongo/write_concern.rb +1 -1
  252. data/lib/mongo/write_concern/acknowledged.rb +1 -1
  253. data/lib/mongo/write_concern/normalizable.rb +1 -1
  254. data/lib/mongo/write_concern/unacknowledged.rb +1 -1
  255. data/mongo.gemspec +4 -1
  256. data/spec/atlas/atlas_connectivity_spec.rb +54 -0
  257. data/spec/integration/bulk_insert_spec.rb +78 -0
  258. data/spec/integration/change_stream_spec.rb +365 -0
  259. data/spec/integration/command_monitoring_spec.rb +92 -0
  260. data/spec/lite_spec_helper.rb +63 -0
  261. data/spec/mongo/address/ipv6_spec.rb +29 -1
  262. data/spec/mongo/address_spec.rb +34 -0
  263. data/spec/mongo/auth/scram/conversation_spec.rb +326 -120
  264. data/spec/mongo/auth/scram/negotiation_spec.rb +574 -0
  265. data/spec/mongo/auth/scram_spec.rb +107 -38
  266. data/spec/mongo/auth/stringprep/profiles/sasl_spec.rb +113 -0
  267. data/spec/mongo/auth/stringprep_spec.rb +188 -0
  268. data/spec/mongo/auth/user/view_spec.rb +5 -2
  269. data/spec/mongo/auth/user_spec.rb +1 -1
  270. data/spec/mongo/bulk_write/result_spec.rb +120 -0
  271. data/spec/mongo/bulk_write_spec.rb +42 -2
  272. data/spec/mongo/client_spec.rb +121 -9
  273. data/spec/mongo/cluster/app_metadata_spec.rb +14 -1
  274. data/spec/mongo/cluster/topology_spec.rb +1 -23
  275. data/spec/mongo/collection/view/change_stream_spec.rb +62 -180
  276. data/spec/mongo/collection_spec.rb +45 -12
  277. data/spec/mongo/cursor/builder/get_more_command_spec.rb +7 -7
  278. data/spec/mongo/cursor_spec.rb +2 -2
  279. data/spec/mongo/database_spec.rb +3 -3
  280. data/spec/mongo/docs_examples_spec.rb +194 -0
  281. data/spec/mongo/error/operation_failure_spec.rb +152 -0
  282. data/spec/mongo/error/parser_spec.rb +127 -0
  283. data/spec/mongo/grid/fs_bucket_spec.rb +32 -0
  284. data/spec/mongo/grid/stream/write_spec.rb +40 -1
  285. data/spec/mongo/monitoring/event/command_failed_spec.rb +30 -0
  286. data/spec/mongo/monitoring/event/command_started_spec.rb +26 -4
  287. data/spec/mongo/monitoring/event/command_succeeded_spec.rb +29 -7
  288. data/spec/mongo/monitoring_spec.rb +28 -3
  289. data/spec/mongo/protocol/get_more_spec.rb +2 -2
  290. data/spec/mongo/retryable_spec.rb +252 -34
  291. data/spec/mongo/retryable_writes_spec.rb +468 -544
  292. data/spec/mongo/server/connection_spec.rb +5 -5
  293. data/spec/mongo/server/description_spec.rb +23 -6
  294. data/spec/mongo/session/server_session_spec.rb +2 -2
  295. data/spec/mongo/session/session_pool_spec.rb +2 -2
  296. data/spec/mongo/transactions_examples_spec.rb +227 -0
  297. data/spec/mongo/transactions_spec.rb +44 -0
  298. data/spec/spec_helper.rb +135 -49
  299. data/spec/spec_tests/change_streams_spec.rb +42 -0
  300. data/spec/{mongo → spec_tests}/command_monitoring_spec.rb +8 -2
  301. data/spec/{mongo → spec_tests}/connection_string_spec.rb +1 -1
  302. data/spec/{mongo → spec_tests}/crud_spec.rb +5 -7
  303. data/spec/{mongo → spec_tests}/dns_seedlist_discovery_spec.rb +1 -1
  304. data/spec/{mongo → spec_tests}/gridfs_spec.rb +0 -0
  305. data/spec/{mongo → spec_tests}/max_staleness_spec.rb +0 -0
  306. data/spec/spec_tests/retryable_writes_spec.rb +78 -0
  307. data/spec/{mongo → spec_tests}/sdam_monitoring_spec.rb +4 -3
  308. data/spec/{mongo → spec_tests}/sdam_spec.rb +7 -7
  309. data/spec/{mongo → spec_tests}/server_selection_rtt_spec.rb +0 -0
  310. data/spec/{mongo → spec_tests}/server_selection_spec.rb +0 -0
  311. data/spec/support/authorization.rb +18 -6
  312. data/spec/support/change_streams.rb +265 -0
  313. data/spec/support/change_streams/operation.rb +62 -0
  314. data/spec/support/change_streams_tests/change-streams-errors.yml +53 -0
  315. data/spec/support/change_streams_tests/change-streams.yml +299 -0
  316. data/spec/support/command_monitoring.rb +1 -1
  317. data/spec/support/command_monitoring/bulkWrite.yml +4 -28
  318. data/spec/support/command_monitoring/command.yml +19 -0
  319. data/spec/support/command_monitoring/find.yml +17 -19
  320. data/spec/support/command_monitoring/insertMany.yml +2 -8
  321. data/spec/support/command_monitoring/unacknowledgedBulkWrite.yml +34 -0
  322. data/spec/support/connection_string.rb +1 -1
  323. data/spec/support/constraints.rb +56 -0
  324. data/spec/support/crud.rb +9 -4
  325. data/spec/support/crud/read.rb +24 -3
  326. data/spec/support/crud/write.rb +7 -2
  327. data/spec/support/crud_tests/read/count-collation.yml +12 -2
  328. data/spec/support/crud_tests/read/count.yml +43 -5
  329. data/spec/support/gridfs.rb +1 -1
  330. data/spec/support/primary_socket.rb +21 -0
  331. data/spec/support/retryable_writes_tests/bulkWrite-serverErrors.yml +90 -0
  332. data/spec/support/retryable_writes_tests/bulkWrite.yml +99 -1
  333. data/spec/support/retryable_writes_tests/deleteOne-serverErrors.yml +50 -0
  334. data/spec/support/retryable_writes_tests/deleteOne.yml +10 -1
  335. data/spec/support/retryable_writes_tests/findOneAndDelete-serverErrors.yml +50 -0
  336. data/spec/support/retryable_writes_tests/findOneAndDelete.yml +39 -30
  337. data/spec/support/retryable_writes_tests/findOneAndReplace-serverErrors.yml +54 -0
  338. data/spec/support/retryable_writes_tests/findOneAndReplace.yml +9 -0
  339. data/spec/support/retryable_writes_tests/findOneAndUpdate-serverErrors.yml +54 -0
  340. data/spec/support/retryable_writes_tests/findOneAndUpdate.yml +9 -0
  341. data/spec/support/retryable_writes_tests/insertMany-serverErrors.yml +59 -0
  342. data/spec/support/retryable_writes_tests/insertMany.yml +11 -6
  343. data/spec/support/retryable_writes_tests/insertOne-serverErrors.yml +471 -0
  344. data/spec/support/retryable_writes_tests/insertOne.yml +9 -0
  345. data/spec/support/retryable_writes_tests/replaceOne-serverErrors.yml +58 -0
  346. data/spec/support/retryable_writes_tests/replaceOne.yml +9 -0
  347. data/spec/support/retryable_writes_tests/updateOne-serverErrors.yml +58 -0
  348. data/spec/support/retryable_writes_tests/updateOne.yml +71 -53
  349. data/spec/support/sdam/rs/normalize_case_me.yml +100 -0
  350. data/spec/support/sdam/sharded/compatible.yml +38 -0
  351. data/spec/support/sdam/sharded/mongos_disconnect.yml +9 -3
  352. data/spec/support/sdam/sharded/multiple_mongoses.yml +6 -2
  353. data/spec/support/sdam/sharded/non_mongos_removed.yml +6 -2
  354. data/spec/support/sdam/sharded/too_new.yml +36 -0
  355. data/spec/support/sdam/sharded/too_old.yml +36 -0
  356. data/spec/support/sdam/single/compatible.yml +26 -0
  357. data/spec/support/sdam/single/direct_connection_external_ip.yml +3 -1
  358. data/spec/support/sdam/single/direct_connection_mongos.yml +3 -1
  359. data/spec/support/sdam/single/direct_connection_rsarbiter.yml +3 -1
  360. data/spec/support/sdam/single/direct_connection_rsprimary.yml +3 -1
  361. data/spec/support/sdam/single/direct_connection_rssecondary.yml +3 -1
  362. data/spec/support/sdam/single/direct_connection_slave.yml +3 -1
  363. data/spec/support/sdam/single/direct_connection_standalone.yml +3 -1
  364. data/spec/support/sdam/single/not_ok_response.yml +6 -2
  365. data/spec/support/sdam/single/standalone_removed.yml +3 -1
  366. data/spec/support/sdam/single/too_new.yml +26 -0
  367. data/spec/support/sdam/single/too_old.yml +24 -0
  368. data/spec/support/shared/session.rb +107 -0
  369. data/spec/support/transactions.rb +391 -0
  370. data/spec/support/transactions/operation.rb +373 -0
  371. data/spec/support/transactions_tests/abort.yml +403 -0
  372. data/spec/support/transactions_tests/bulk.yml +267 -0
  373. data/spec/support/transactions_tests/causal-consistency.yml +173 -0
  374. data/spec/support/transactions_tests/commit.yml +593 -0
  375. data/spec/support/transactions_tests/delete.yml +184 -0
  376. data/spec/support/transactions_tests/error-labels.yml +948 -0
  377. data/spec/support/transactions_tests/errors.yml +125 -0
  378. data/spec/support/transactions_tests/findOneAndDelete.yml +126 -0
  379. data/spec/support/transactions_tests/findOneAndReplace.yml +140 -0
  380. data/spec/support/transactions_tests/findOneAndUpdate.yml +228 -0
  381. data/spec/support/transactions_tests/insert.yml +264 -0
  382. data/spec/support/transactions_tests/isolation.yml +125 -0
  383. data/spec/support/transactions_tests/read-pref.yml +340 -0
  384. data/spec/support/transactions_tests/reads.yml +298 -0
  385. data/spec/support/transactions_tests/retryable-abort.yml +1292 -0
  386. data/spec/support/transactions_tests/retryable-commit.yml +1332 -0
  387. data/spec/support/transactions_tests/retryable-writes.yml +208 -0
  388. data/spec/support/transactions_tests/run-command.yml +189 -0
  389. data/spec/support/transactions_tests/transaction-options.yml +877 -0
  390. data/spec/support/transactions_tests/update.yml +246 -0
  391. data/spec/support/transactions_tests/write-concern.yml +236 -0
  392. metadata +494 -359
  393. metadata.gz.sig +0 -0
  394. data/lib/csasl/csasl.bundle +0 -0
@@ -0,0 +1,54 @@
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: "FindOneAndReplace 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: "findOneAndReplace"
21
+ arguments:
22
+ filter: { _id: 1 }
23
+ replacement: { _id: 1, x: 111 }
24
+ returnDocument: "Before"
25
+ outcome:
26
+ result: { _id: 1, x: 11 }
27
+ collection:
28
+ data:
29
+ - { _id: 1, x: 111 }
30
+ - { _id: 2, x: 22 }
31
+ -
32
+ description: "FindOneAndReplace succeeds after WriteConcernError ShutdownInProgress"
33
+ clientOptions:
34
+ retryWrites: true
35
+ failPoint:
36
+ configureFailPoint: failCommand
37
+ mode: { times: 1 }
38
+ data:
39
+ failCommands: ["findAndModify"]
40
+ writeConcernError:
41
+ code: 91
42
+ errmsg: Replication is being shut down
43
+ operation:
44
+ name: "findOneAndReplace"
45
+ arguments:
46
+ filter: { _id: 1 }
47
+ replacement: { _id: 1, x: 111 }
48
+ returnDocument: "Before"
49
+ outcome:
50
+ result: { _id: 1, x: 11 }
51
+ collection:
52
+ data:
53
+ - { _id: 1, x: 111 }
54
+ - { _id: 2, x: 22 }
@@ -7,7 +7,10 @@ minServerVersion: '3.6'
7
7
  tests:
8
8
  -
9
9
  description: "FindOneAndReplace 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: "findOneAndReplace"
@@ -23,7 +26,10 @@ tests:
23
26
  - { _id: 2, x: 22 }
24
27
  -
25
28
  description: "FindOneAndReplace is not committed on first attempt"
29
+ clientOptions:
30
+ retryWrites: true
26
31
  failPoint:
32
+ configureFailPoint: onPrimaryTransactionalWrite
27
33
  mode: { times: 1 }
28
34
  data: { failBeforeCommitExceptionCode: 1 }
29
35
  operation:
@@ -40,7 +46,10 @@ tests:
40
46
  - { _id: 2, x: 22 }
41
47
  -
42
48
  description: "FindOneAndReplace is never committed"
49
+ clientOptions:
50
+ retryWrites: true
43
51
  failPoint:
52
+ configureFailPoint: onPrimaryTransactionalWrite
44
53
  mode: { times: 2 }
45
54
  data: { failBeforeCommitExceptionCode: 1 }
46
55
  operation:
@@ -0,0 +1,54 @@
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: "FindOneAndUpdate 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: "findOneAndUpdate"
21
+ arguments:
22
+ filter: { _id: 1 }
23
+ update: { $inc: { x : 1 }}
24
+ returnDocument: "Before"
25
+ outcome:
26
+ result: { _id: 1, x: 11 }
27
+ collection:
28
+ data:
29
+ - { _id: 1, x: 12 }
30
+ - { _id: 2, x: 22 }
31
+ -
32
+ description: "FindOneAndUpdate succeeds after WriteConcernError ShutdownInProgress"
33
+ clientOptions:
34
+ retryWrites: true
35
+ failPoint:
36
+ configureFailPoint: failCommand
37
+ mode: { times: 1 }
38
+ data:
39
+ failCommands: ["findAndModify"]
40
+ writeConcernError:
41
+ code: 91
42
+ errmsg: Replication is being shut down
43
+ operation:
44
+ name: "findOneAndUpdate"
45
+ arguments:
46
+ filter: { _id: 1 }
47
+ update: { $inc: { x : 1 }}
48
+ returnDocument: "Before"
49
+ outcome:
50
+ result: { _id: 1, x: 11 }
51
+ collection:
52
+ data:
53
+ - { _id: 1, x: 12 }
54
+ - { _id: 2, x: 22 }
@@ -7,7 +7,10 @@ minServerVersion: '3.6'
7
7
  tests:
8
8
  -
9
9
  description: "FindOneAndUpdate 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: "findOneAndUpdate"
@@ -23,7 +26,10 @@ tests:
23
26
  - { _id: 2, x: 22 }
24
27
  -
25
28
  description: "FindOneAndUpdate is not committed on first attempt"
29
+ clientOptions:
30
+ retryWrites: true
26
31
  failPoint:
32
+ configureFailPoint: onPrimaryTransactionalWrite
27
33
  mode: { times: 1 }
28
34
  data: { failBeforeCommitExceptionCode: 1 }
29
35
  operation:
@@ -40,7 +46,10 @@ tests:
40
46
  - { _id: 2, x: 22 }
41
47
  -
42
48
  description: "FindOneAndUpdate is never committed"
49
+ clientOptions:
50
+ retryWrites: true
43
51
  failPoint:
52
+ configureFailPoint: onPrimaryTransactionalWrite
44
53
  mode: { times: 2 }
45
54
  data: { failBeforeCommitExceptionCode: 1 }
46
55
  operation:
@@ -0,0 +1,59 @@
1
+ data:
2
+ - { _id: 1, x: 11 }
3
+
4
+ # TODO: this should change to 4.0 once 4.0.0 is released.
5
+ minServerVersion: '3.99'
6
+
7
+ tests:
8
+ -
9
+ description: "InsertMany succeeds after PrimarySteppedDown"
10
+ clientOptions:
11
+ retryWrites: true
12
+ failPoint:
13
+ configureFailPoint: failCommand
14
+ mode: { times: 1 }
15
+ data:
16
+ failCommands: ["insert"]
17
+ errorCode: 189
18
+ operation:
19
+ name: "insertMany"
20
+ arguments:
21
+ documents:
22
+ - { _id: 2, x: 22 }
23
+ - { _id: 3, x: 33 }
24
+ options: { ordered: true }
25
+ outcome:
26
+ result:
27
+ insertedIds: { 0: 2, 1: 3 }
28
+ collection:
29
+ data:
30
+ - { _id: 1, x: 11 }
31
+ - { _id: 2, x: 22 }
32
+ - { _id: 3, x: 33 }
33
+ -
34
+ description: "InsertMany succeeds after WriteConcernError ShutdownInProgress"
35
+ clientOptions:
36
+ retryWrites: true
37
+ failPoint:
38
+ configureFailPoint: failCommand
39
+ mode: { times: 1 }
40
+ data:
41
+ failCommands: ["insert"]
42
+ writeConcernError:
43
+ code: 91
44
+ errmsg: Replication is being shut down
45
+ operation:
46
+ name: "insertMany"
47
+ arguments:
48
+ documents:
49
+ - { _id: 2, x: 22 }
50
+ - { _id: 3, x: 33 }
51
+ options: { ordered: true }
52
+ outcome:
53
+ result:
54
+ insertedIds: { 0: 2, 1: 3 }
55
+ collection:
56
+ data:
57
+ - { _id: 1, x: 11 }
58
+ - { _id: 2, x: 22 }
59
+ - { _id: 3, x: 33 }
@@ -6,7 +6,10 @@ minServerVersion: '3.6'
6
6
  tests:
7
7
  -
8
8
  description: "InsertMany succeeds after one network error"
9
+ clientOptions:
10
+ retryWrites: true
9
11
  failPoint:
12
+ configureFailPoint: onPrimaryTransactionalWrite
10
13
  mode: { times: 1 }
11
14
  operation:
12
15
  name: "insertMany"
@@ -17,9 +20,7 @@ tests:
17
20
  options: { ordered: true }
18
21
  outcome:
19
22
  result:
20
- insertedIds:
21
- - 2
22
- - 3
23
+ insertedIds: { 0: 2, 1: 3 }
23
24
  collection:
24
25
  data:
25
26
  - { _id: 1, x: 11 }
@@ -27,7 +28,10 @@ tests:
27
28
  - { _id: 3, x: 33 }
28
29
  -
29
30
  description: "InsertMany with unordered execution"
31
+ clientOptions:
32
+ retryWrites: true
30
33
  failPoint:
34
+ configureFailPoint: onPrimaryTransactionalWrite
31
35
  mode: { times: 1 }
32
36
  operation:
33
37
  name: "insertMany"
@@ -38,9 +42,7 @@ tests:
38
42
  options: { ordered: false }
39
43
  outcome:
40
44
  result:
41
- insertedIds:
42
- - 2
43
- - 3
45
+ insertedIds: { 0: 2, 1: 3 }
44
46
  collection:
45
47
  data:
46
48
  - { _id: 1, x: 11 }
@@ -48,6 +50,8 @@ tests:
48
50
  - { _id: 3, x: 33 }
49
51
  -
50
52
  description: "InsertMany fails after multiple network errors"
53
+ clientOptions:
54
+ retryWrites: true
51
55
  failPoint:
52
56
  # Normally, a mongod will insert the documents as a batch with a
53
57
  # single commit. If this fails, mongod may try to insert each
@@ -55,6 +59,7 @@ tests:
55
59
  # single insert command may trigger the failpoint twice on each
56
60
  # driver attempt. This test permanently enables the fail point to
57
61
  # ensure the retry attempt always fails.
62
+ configureFailPoint: onPrimaryTransactionalWrite
58
63
  mode: "alwaysOn"
59
64
  data: { failBeforeCommitExceptionCode: 1 }
60
65
  operation:
@@ -0,0 +1,471 @@
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: "InsertOne succeeds after connection failure"
11
+ clientOptions:
12
+ retryWrites: true
13
+ failPoint:
14
+ configureFailPoint: failCommand
15
+ mode: { times: 1 }
16
+ data:
17
+ failCommands: ["insert"]
18
+ closeConnection: true
19
+ operation:
20
+ name: "insertOne"
21
+ arguments:
22
+ document: { _id: 3, x: 33 }
23
+ outcome:
24
+ result:
25
+ insertedId: 3
26
+ collection:
27
+ data:
28
+ - { _id: 1, x: 11 }
29
+ - { _id: 2, x: 22 }
30
+ - { _id: 3, x: 33 }
31
+ -
32
+ description: "InsertOne succeeds after NotMaster"
33
+ clientOptions:
34
+ retryWrites: true
35
+ failPoint:
36
+ configureFailPoint: failCommand
37
+ mode: { times: 1 }
38
+ data:
39
+ failCommands: ["insert"]
40
+ errorCode: 10107
41
+ closeConnection: false
42
+ operation:
43
+ name: "insertOne"
44
+ arguments:
45
+ document: { _id: 3, x: 33 }
46
+ outcome:
47
+ result:
48
+ insertedId: 3
49
+ collection:
50
+ data:
51
+ - { _id: 1, x: 11 }
52
+ - { _id: 2, x: 22 }
53
+ - { _id: 3, x: 33 }
54
+ -
55
+ description: "InsertOne succeeds after NotMasterOrSecondary"
56
+ clientOptions:
57
+ retryWrites: true
58
+ failPoint:
59
+ configureFailPoint: failCommand
60
+ mode: { times: 1 }
61
+ data:
62
+ failCommands: ["insert"]
63
+ errorCode: 13436
64
+ closeConnection: false
65
+ operation:
66
+ name: "insertOne"
67
+ arguments:
68
+ document: { _id: 3, x: 33 }
69
+ outcome:
70
+ result:
71
+ insertedId: 3
72
+ collection:
73
+ data:
74
+ - { _id: 1, x: 11 }
75
+ - { _id: 2, x: 22 }
76
+ - { _id: 3, x: 33 }
77
+ -
78
+ description: "InsertOne succeeds after NotMasterNoSlaveOk"
79
+ clientOptions:
80
+ retryWrites: true
81
+ failPoint:
82
+ configureFailPoint: failCommand
83
+ mode: { times: 1 }
84
+ data:
85
+ failCommands: ["insert"]
86
+ errorCode: 13435
87
+ closeConnection: false
88
+ operation:
89
+ name: "insertOne"
90
+ arguments:
91
+ document: { _id: 3, x: 33 }
92
+ outcome:
93
+ result:
94
+ insertedId: 3
95
+ collection:
96
+ data:
97
+ - { _id: 1, x: 11 }
98
+ - { _id: 2, x: 22 }
99
+ - { _id: 3, x: 33 }
100
+ -
101
+ description: "InsertOne succeeds after InterruptedDueToReplStateChange"
102
+ clientOptions:
103
+ retryWrites: true
104
+ failPoint:
105
+ configureFailPoint: failCommand
106
+ mode: { times: 1 }
107
+ data:
108
+ failCommands: ["insert"]
109
+ errorCode: 11602
110
+ closeConnection: false
111
+ operation:
112
+ name: "insertOne"
113
+ arguments:
114
+ document: { _id: 3, x: 33 }
115
+ outcome:
116
+ result:
117
+ insertedId: 3
118
+ collection:
119
+ data:
120
+ - { _id: 1, x: 11 }
121
+ - { _id: 2, x: 22 }
122
+ - { _id: 3, x: 33 }
123
+ -
124
+ description: "InsertOne succeeds after InterruptedAtShutdown"
125
+ clientOptions:
126
+ retryWrites: true
127
+ failPoint:
128
+ configureFailPoint: failCommand
129
+ mode: { times: 1 }
130
+ data:
131
+ failCommands: ["insert"]
132
+ errorCode: 11600
133
+ closeConnection: false
134
+ operation:
135
+ name: "insertOne"
136
+ arguments:
137
+ document: { _id: 3, x: 33 }
138
+ outcome:
139
+ result:
140
+ insertedId: 3
141
+ collection:
142
+ data:
143
+ - { _id: 1, x: 11 }
144
+ - { _id: 2, x: 22 }
145
+ - { _id: 3, x: 33 }
146
+ -
147
+ description: "InsertOne succeeds after PrimarySteppedDown"
148
+ clientOptions:
149
+ retryWrites: true
150
+ failPoint:
151
+ configureFailPoint: failCommand
152
+ mode: { times: 1 }
153
+ data:
154
+ failCommands: ["insert"]
155
+ errorCode: 189
156
+ closeConnection: false
157
+ operation:
158
+ name: "insertOne"
159
+ arguments:
160
+ document: { _id: 3, x: 33 }
161
+ outcome:
162
+ result:
163
+ insertedId: 3
164
+ collection:
165
+ data:
166
+ - { _id: 1, x: 11 }
167
+ - { _id: 2, x: 22 }
168
+ - { _id: 3, x: 33 }
169
+ -
170
+ description: "InsertOne succeeds after ShutdownInProgress"
171
+ clientOptions:
172
+ retryWrites: true
173
+ failPoint:
174
+ configureFailPoint: failCommand
175
+ mode: { times: 1 }
176
+ data:
177
+ failCommands: ["insert"]
178
+ errorCode: 91
179
+ closeConnection: false
180
+ operation:
181
+ name: "insertOne"
182
+ arguments:
183
+ document: { _id: 3, x: 33 }
184
+ outcome:
185
+ result:
186
+ insertedId: 3
187
+ collection:
188
+ data:
189
+ - { _id: 1, x: 11 }
190
+ - { _id: 2, x: 22 }
191
+ - { _id: 3, x: 33 }
192
+ -
193
+ description: "InsertOne succeeds after HostNotFound"
194
+ clientOptions:
195
+ retryWrites: true
196
+ failPoint:
197
+ configureFailPoint: failCommand
198
+ mode: { times: 1 }
199
+ data:
200
+ failCommands: ["insert"]
201
+ errorCode: 7
202
+ closeConnection: false
203
+ operation:
204
+ name: "insertOne"
205
+ arguments:
206
+ document: { _id: 3, x: 33 }
207
+ outcome:
208
+ result:
209
+ insertedId: 3
210
+ collection:
211
+ data:
212
+ - { _id: 1, x: 11 }
213
+ - { _id: 2, x: 22 }
214
+ - { _id: 3, x: 33 }
215
+ -
216
+ description: "InsertOne succeeds after HostUnreachable"
217
+ clientOptions:
218
+ retryWrites: true
219
+ failPoint:
220
+ configureFailPoint: failCommand
221
+ mode: { times: 1 }
222
+ data:
223
+ failCommands: ["insert"]
224
+ errorCode: 6
225
+ closeConnection: false
226
+ operation:
227
+ name: "insertOne"
228
+ arguments:
229
+ document: { _id: 3, x: 33 }
230
+ outcome:
231
+ result:
232
+ insertedId: 3
233
+ collection:
234
+ data:
235
+ - { _id: 1, x: 11 }
236
+ - { _id: 2, x: 22 }
237
+ - { _id: 3, x: 33 }
238
+ -
239
+ description: "InsertOne succeeds after SocketException"
240
+ clientOptions:
241
+ retryWrites: true
242
+ failPoint:
243
+ configureFailPoint: failCommand
244
+ mode: { times: 1 }
245
+ data:
246
+ failCommands: ["insert"]
247
+ errorCode: 9001
248
+ closeConnection: false
249
+ operation:
250
+ name: "insertOne"
251
+ arguments:
252
+ document: { _id: 3, x: 33 }
253
+ outcome:
254
+ result:
255
+ insertedId: 3
256
+ collection:
257
+ data:
258
+ - { _id: 1, x: 11 }
259
+ - { _id: 2, x: 22 }
260
+ - { _id: 3, x: 33 }
261
+ -
262
+ description: "InsertOne succeeds after NetworkTimeout"
263
+ clientOptions:
264
+ retryWrites: true
265
+ failPoint:
266
+ configureFailPoint: failCommand
267
+ mode: { times: 1 }
268
+ data:
269
+ failCommands: ["insert"]
270
+ errorCode: 89
271
+ closeConnection: false
272
+ operation:
273
+ name: "insertOne"
274
+ arguments:
275
+ document: { _id: 3, x: 33 }
276
+ outcome:
277
+ result:
278
+ insertedId: 3
279
+ collection:
280
+ data:
281
+ - { _id: 1, x: 11 }
282
+ - { _id: 2, x: 22 }
283
+ - { _id: 3, x: 33 }
284
+ -
285
+ description: "InsertOne fails after Interrupted"
286
+ clientOptions:
287
+ retryWrites: true
288
+ failPoint:
289
+ configureFailPoint: failCommand
290
+ mode: { times: 1 }
291
+ data:
292
+ failCommands: ["insert"]
293
+ errorCode: 11601
294
+ closeConnection: false
295
+ operation:
296
+ name: "insertOne"
297
+ arguments:
298
+ document: { _id: 3, x: 33 }
299
+ outcome:
300
+ error: true
301
+ collection:
302
+ data:
303
+ - { _id: 1, x: 11 }
304
+ - { _id: 2, x: 22 }
305
+ -
306
+ description: "InsertOne succeeds after WriteConcernError InterruptedAtShutdown"
307
+ clientOptions:
308
+ retryWrites: true
309
+ failPoint:
310
+ configureFailPoint: failCommand
311
+ mode: { times: 1 }
312
+ data:
313
+ failCommands: ["insert"]
314
+ writeConcernError:
315
+ code: 11600
316
+ errmsg: Replication is being shut down
317
+ operation:
318
+ name: "insertOne"
319
+ arguments:
320
+ document: { _id: 3, x: 33 }
321
+ outcome:
322
+ result:
323
+ insertedId: 3
324
+ collection:
325
+ data:
326
+ - { _id: 1, x: 11 }
327
+ - { _id: 2, x: 22 }
328
+ - { _id: 3, x: 33 }
329
+ -
330
+ description: "InsertOne succeeds after WriteConcernError InterruptedDueToReplStateChange"
331
+ clientOptions:
332
+ retryWrites: true
333
+ failPoint:
334
+ configureFailPoint: failCommand
335
+ mode: { times: 1 }
336
+ data:
337
+ failCommands: ["insert"]
338
+ writeConcernError:
339
+ code: 11602
340
+ errmsg: Replication is being shut down
341
+ operation:
342
+ name: "insertOne"
343
+ arguments:
344
+ document: { _id: 3, x: 33 }
345
+ outcome:
346
+ result:
347
+ insertedId: 3
348
+ collection:
349
+ data:
350
+ - { _id: 1, x: 11 }
351
+ - { _id: 2, x: 22 }
352
+ - { _id: 3, x: 33 }
353
+ -
354
+ description: "InsertOne succeeds after WriteConcernError PrimarySteppedDown"
355
+ clientOptions:
356
+ retryWrites: true
357
+ failPoint:
358
+ configureFailPoint: failCommand
359
+ mode: { times: 1 }
360
+ data:
361
+ failCommands: ["insert"]
362
+ writeConcernError:
363
+ code: 189
364
+ errmsg: Replication is being shut down
365
+ operation:
366
+ name: "insertOne"
367
+ arguments:
368
+ document: { _id: 3, x: 33 }
369
+ outcome:
370
+ result:
371
+ insertedId: 3
372
+ collection:
373
+ data:
374
+ - { _id: 1, x: 11 }
375
+ - { _id: 2, x: 22 }
376
+ - { _id: 3, x: 33 }
377
+ -
378
+ description: "InsertOne succeeds after WriteConcernError ShutdownInProgress"
379
+ clientOptions:
380
+ retryWrites: true
381
+ failPoint:
382
+ configureFailPoint: failCommand
383
+ mode: { times: 1 }
384
+ data:
385
+ failCommands: ["insert"]
386
+ writeConcernError:
387
+ code: 91
388
+ errmsg: Replication is being shut down
389
+ operation:
390
+ name: "insertOne"
391
+ arguments:
392
+ document: { _id: 3, x: 33 }
393
+ outcome:
394
+ result:
395
+ insertedId: 3
396
+ collection:
397
+ data:
398
+ - { _id: 1, x: 11 }
399
+ - { _id: 2, x: 22 }
400
+ - { _id: 3, x: 33 }
401
+ -
402
+ description: "InsertOne fails after multiple retryable writeConcernErrors"
403
+ clientOptions:
404
+ retryWrites: true
405
+ failPoint:
406
+ configureFailPoint: failCommand
407
+ mode: { times: 2 }
408
+ data:
409
+ failCommands: ["insert"]
410
+ writeConcernError:
411
+ code: 91
412
+ errmsg: Replication is being shut down
413
+ operation:
414
+ name: "insertOne"
415
+ arguments:
416
+ document: { _id: 3, x: 33 }
417
+ outcome:
418
+ error: true
419
+ collection:
420
+ data:
421
+ - { _id: 1, x: 11 }
422
+ - { _id: 2, x: 22 }
423
+ - { _id: 3, x: 33 } # The write was still applied.
424
+ -
425
+ description: "InsertOne fails after WriteConcernError Interrupted"
426
+ clientOptions:
427
+ retryWrites: true
428
+ failPoint:
429
+ configureFailPoint: failCommand
430
+ mode: { times: 1 }
431
+ data:
432
+ failCommands: ["insert"]
433
+ writeConcernError:
434
+ code: 11601
435
+ errmsg: operation was interrupted
436
+ operation:
437
+ name: "insertOne"
438
+ arguments:
439
+ document: { _id: 3, x: 33 }
440
+ outcome:
441
+ error: true
442
+ collection:
443
+ data:
444
+ - { _id: 1, x: 11 }
445
+ - { _id: 2, x: 22 }
446
+ - { _id: 3, x: 33 } # The write was still applied.
447
+ -
448
+ description: "InsertOne fails after WriteConcernError WriteConcernFailed"
449
+ clientOptions:
450
+ retryWrites: true
451
+ failPoint:
452
+ configureFailPoint: failCommand
453
+ mode: { times: 1 }
454
+ data:
455
+ failCommands: ["insert"]
456
+ writeConcernError:
457
+ code: 64
458
+ codeName: WriteConcernFailed
459
+ errmsg: waiting for replication timed out
460
+ errInfo: {wtimeout: True}
461
+ operation:
462
+ name: "insertOne"
463
+ arguments:
464
+ document: { _id: 3, x: 33 }
465
+ outcome:
466
+ error: true
467
+ collection:
468
+ data:
469
+ - { _id: 1, x: 11 }
470
+ - { _id: 2, x: 22 }
471
+ - { _id: 3, x: 33 } # The write was still applied.