mongo 2.8.0 → 2.9.0.rc0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (276) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/Rakefile +12 -0
  5. data/lib/mongo.rb +15 -1
  6. data/lib/mongo/address/ipv6.rb +0 -2
  7. data/lib/mongo/auth/scram/conversation.rb +0 -3
  8. data/lib/mongo/bulk_write/result_combiner.rb +12 -2
  9. data/lib/mongo/client.rb +59 -6
  10. data/lib/mongo/cluster.rb +19 -8
  11. data/lib/mongo/cluster/reapers/cursor_reaper.rb +0 -2
  12. data/lib/mongo/cluster/reapers/socket_reaper.rb +12 -9
  13. data/lib/mongo/collection.rb +1 -1
  14. data/lib/mongo/collection/view/aggregation.rb +5 -1
  15. data/lib/mongo/collection/view/builder/map_reduce.rb +1 -1
  16. data/lib/mongo/collection/view/change_stream.rb +30 -10
  17. data/lib/mongo/collection/view/iterable.rb +13 -6
  18. data/lib/mongo/collection/view/map_reduce.rb +12 -10
  19. data/lib/mongo/collection/view/readable.rb +19 -14
  20. data/lib/mongo/cursor.rb +12 -8
  21. data/lib/mongo/database.rb +10 -7
  22. data/lib/mongo/database/view.rb +18 -11
  23. data/lib/mongo/error.rb +2 -2
  24. data/lib/mongo/error/connection_check_out_timeout.rb +49 -0
  25. data/lib/mongo/error/operation_failure.rb +9 -9
  26. data/lib/mongo/error/parser.rb +25 -3
  27. data/lib/mongo/error/pool_closed_error.rb +43 -0
  28. data/lib/mongo/error/sdam_error_detection.rb +18 -0
  29. data/lib/mongo/grid/file/chunk.rb +0 -2
  30. data/lib/mongo/grid/fs_bucket.rb +26 -12
  31. data/lib/mongo/grid/stream/read.rb +36 -21
  32. data/lib/mongo/index/view.rb +11 -7
  33. data/lib/mongo/logger.rb +0 -2
  34. data/lib/mongo/monitoring.rb +31 -0
  35. data/lib/mongo/monitoring/cmap_log_subscriber.rb +53 -0
  36. data/lib/mongo/monitoring/event.rb +1 -0
  37. data/lib/mongo/monitoring/event/cmap.rb +25 -0
  38. data/lib/mongo/monitoring/event/cmap/base.rb +28 -0
  39. data/lib/mongo/monitoring/event/cmap/connection_check_out_failed.rb +78 -0
  40. data/lib/mongo/monitoring/event/cmap/connection_check_out_started.rb +56 -0
  41. data/lib/mongo/monitoring/event/cmap/connection_checked_in.rb +63 -0
  42. data/lib/mongo/monitoring/event/cmap/connection_checked_out.rb +64 -0
  43. data/lib/mongo/monitoring/event/cmap/connection_closed.rb +103 -0
  44. data/lib/mongo/monitoring/event/cmap/connection_created.rb +64 -0
  45. data/lib/mongo/monitoring/event/cmap/connection_ready.rb +64 -0
  46. data/lib/mongo/monitoring/event/cmap/pool_cleared.rb +57 -0
  47. data/lib/mongo/monitoring/event/cmap/pool_closed.rb +57 -0
  48. data/lib/mongo/monitoring/event/cmap/pool_created.rb +63 -0
  49. data/lib/mongo/monitoring/event/command_started.rb +12 -3
  50. data/lib/mongo/monitoring/publishable.rb +10 -2
  51. data/lib/mongo/operation.rb +0 -1
  52. data/lib/mongo/operation/find/legacy/result.rb +1 -0
  53. data/lib/mongo/operation/list_collections/result.rb +7 -1
  54. data/lib/mongo/operation/result.rb +10 -1
  55. data/lib/mongo/operation/shared/executable.rb +15 -0
  56. data/lib/mongo/operation/shared/result/use_legacy_error_parser.rb +29 -0
  57. data/lib/mongo/operation/shared/specifiable.rb +0 -16
  58. data/lib/mongo/operation/update/legacy/result.rb +1 -0
  59. data/lib/mongo/protocol/compressed.rb +0 -2
  60. data/lib/mongo/protocol/msg.rb +25 -2
  61. data/lib/mongo/retryable.rb +171 -33
  62. data/lib/mongo/server.rb +26 -7
  63. data/lib/mongo/server/app_metadata.rb +0 -2
  64. data/lib/mongo/server/connectable.rb +8 -2
  65. data/lib/mongo/server/connection.rb +83 -13
  66. data/lib/mongo/server/connection_base.rb +1 -1
  67. data/lib/mongo/server/connection_pool.rb +439 -43
  68. data/lib/mongo/server/monitor/connection.rb +4 -1
  69. data/lib/mongo/session.rb +37 -5
  70. data/lib/mongo/session/session_pool.rb +2 -2
  71. data/lib/mongo/socket.rb +0 -2
  72. data/lib/mongo/socket/ssl.rb +0 -2
  73. data/lib/mongo/uri.rb +127 -66
  74. data/lib/mongo/uri/srv_protocol.rb +35 -13
  75. data/lib/mongo/version.rb +1 -1
  76. data/spec/README.md +190 -63
  77. data/spec/integration/change_stream_spec.rb +64 -0
  78. data/spec/integration/command_spec.rb +0 -7
  79. data/spec/integration/error_detection_spec.rb +39 -0
  80. data/spec/integration/read_concern.rb +83 -0
  81. data/spec/integration/retryable_writes_spec.rb +6 -50
  82. data/spec/integration/sdam_error_handling_spec.rb +60 -7
  83. data/spec/integration/ssl_uri_options_spec.rb +24 -0
  84. data/spec/integration/step_down_spec.rb +197 -0
  85. data/spec/lite_spec_helper.rb +4 -0
  86. data/spec/mongo/client_construction_spec.rb +42 -17
  87. data/spec/mongo/client_spec.rb +32 -1
  88. data/spec/mongo/cluster/socket_reaper_spec.rb +2 -2
  89. data/spec/mongo/cluster_spec.rb +36 -2
  90. data/spec/mongo/collection/view/aggregation_spec.rb +2 -0
  91. data/spec/mongo/collection/view/change_stream_spec.rb +28 -28
  92. data/spec/mongo/collection/view/readable_spec.rb +1 -1
  93. data/spec/mongo/collection/view_spec.rb +3 -1
  94. data/spec/mongo/cursor_spec.rb +5 -5
  95. data/spec/mongo/error/parser_spec.rb +61 -1
  96. data/spec/mongo/grid/stream/read_spec.rb +2 -2
  97. data/spec/mongo/monitoring/event/cmap/connection_check_out_failed_spec.rb +23 -0
  98. data/spec/mongo/monitoring/event/cmap/connection_check_out_started_spec.rb +19 -0
  99. data/spec/mongo/monitoring/event/cmap/connection_checked_in_spec.rb +23 -0
  100. data/spec/mongo/monitoring/event/cmap/connection_checked_out_spec.rb +23 -0
  101. data/spec/mongo/monitoring/event/cmap/connection_closed_spec.rb +27 -0
  102. data/spec/mongo/monitoring/event/cmap/connection_created_spec.rb +24 -0
  103. data/spec/mongo/monitoring/event/cmap/connection_ready_spec.rb +24 -0
  104. data/spec/mongo/monitoring/event/cmap/pool_cleared_spec.rb +19 -0
  105. data/spec/mongo/monitoring/event/cmap/pool_closed_spec.rb +19 -0
  106. data/spec/mongo/monitoring/event/cmap/pool_created_spec.rb +26 -0
  107. data/spec/mongo/operation/delete/bulk_spec.rb +1 -6
  108. data/spec/mongo/operation/delete/command_spec.rb +1 -1
  109. data/spec/mongo/operation/delete/op_msg_spec.rb +1 -1
  110. data/spec/mongo/operation/delete_spec.rb +4 -4
  111. data/spec/mongo/operation/insert/bulk_spec.rb +1 -1
  112. data/spec/mongo/operation/insert/command_spec.rb +1 -1
  113. data/spec/mongo/operation/insert/op_msg_spec.rb +1 -1
  114. data/spec/mongo/operation/update/bulk_spec.rb +1 -1
  115. data/spec/mongo/operation/update/command_spec.rb +2 -2
  116. data/spec/mongo/operation/update/op_msg_spec.rb +2 -2
  117. data/spec/mongo/protocol/msg_spec.rb +11 -0
  118. data/spec/mongo/retryable_spec.rb +78 -25
  119. data/spec/mongo/server/connection_pool_spec.rb +661 -126
  120. data/spec/mongo/server/connection_spec.rb +55 -7
  121. data/spec/mongo/server_spec.rb +5 -0
  122. data/spec/mongo/uri/srv_protocol_spec.rb +135 -2
  123. data/spec/mongo/uri_option_parsing_spec.rb +511 -0
  124. data/spec/mongo/uri_spec.rb +42 -6
  125. data/spec/spec_helper.rb +1 -84
  126. data/spec/spec_tests/cmap_spec.rb +50 -0
  127. data/spec/spec_tests/command_monitoring_spec.rb +7 -18
  128. data/spec/spec_tests/crud_spec.rb +3 -49
  129. data/spec/spec_tests/data/cmap/connection-must-have-id.yml +21 -0
  130. data/spec/spec_tests/data/cmap/connection-must-order-ids.yml +21 -0
  131. data/spec/spec_tests/data/cmap/pool-checkin-destroy-closed.yml +24 -0
  132. data/spec/spec_tests/data/cmap/pool-checkin-destroy-stale.yml +24 -0
  133. data/spec/spec_tests/data/cmap/pool-checkin-make-available.yml +21 -0
  134. data/spec/spec_tests/data/cmap/pool-checkin.yml +18 -0
  135. data/spec/spec_tests/data/cmap/pool-checkout-connection.yml +13 -0
  136. data/spec/spec_tests/data/cmap/pool-checkout-error-closed.yml +28 -0
  137. data/spec/spec_tests/data/cmap/pool-checkout-multiple.yml +34 -0
  138. data/spec/spec_tests/data/cmap/pool-checkout-no-idle.yml +31 -0
  139. data/spec/spec_tests/data/cmap/pool-checkout-no-stale.yml +29 -0
  140. data/spec/spec_tests/data/cmap/pool-close-destroy-conns.yml +26 -0
  141. data/spec/spec_tests/data/cmap/pool-close.yml +11 -0
  142. data/spec/spec_tests/data/cmap/pool-create-max-size.yml +56 -0
  143. data/spec/spec_tests/data/cmap/pool-create-min-size.yml +27 -0
  144. data/spec/spec_tests/data/cmap/pool-create-with-options.yml +20 -0
  145. data/spec/spec_tests/data/cmap/pool-create.yml +12 -0
  146. data/spec/spec_tests/data/cmap/wait-queue-fairness.yml +94 -0
  147. data/spec/spec_tests/data/cmap/wait-queue-timeout.yml +41 -0
  148. data/spec/spec_tests/data/retryable_reads/aggregate-serverErrors.yml +157 -0
  149. data/spec/spec_tests/data/retryable_reads/aggregate.yml +87 -0
  150. data/spec/spec_tests/data/retryable_reads/changeStreams-client.watch-serverErrors.yml +149 -0
  151. data/spec/spec_tests/data/retryable_reads/changeStreams-client.watch.yml +61 -0
  152. data/spec/spec_tests/data/retryable_reads/changeStreams-db.coll.watch-serverErrors.yml +149 -0
  153. data/spec/spec_tests/data/retryable_reads/changeStreams-db.coll.watch.yml +65 -0
  154. data/spec/spec_tests/data/retryable_reads/changeStreams-db.watch-serverErrors.yml +153 -0
  155. data/spec/spec_tests/data/retryable_reads/changeStreams-db.watch.yml +61 -0
  156. data/spec/spec_tests/data/retryable_reads/count-serverErrors.yml +150 -0
  157. data/spec/spec_tests/data/retryable_reads/count.yml +64 -0
  158. data/spec/spec_tests/data/retryable_reads/countDocuments-serverErrors.yml +150 -0
  159. data/spec/spec_tests/data/retryable_reads/countDocuments.yml +64 -0
  160. data/spec/spec_tests/data/retryable_reads/distinct-serverErrors.yml +156 -0
  161. data/spec/spec_tests/data/retryable_reads/distinct.yml +71 -0
  162. data/spec/spec_tests/data/retryable_reads/estimatedDocumentCount-serverErrors.yml +148 -0
  163. data/spec/spec_tests/data/retryable_reads/estimatedDocumentCount.yml +62 -0
  164. data/spec/spec_tests/data/retryable_reads/find-serverErrors.yml +160 -0
  165. data/spec/spec_tests/data/retryable_reads/find.yml +86 -0
  166. data/spec/spec_tests/data/retryable_reads/findOne-serverErrors.yml +154 -0
  167. data/spec/spec_tests/data/retryable_reads/findOne.yml +68 -0
  168. data/spec/spec_tests/data/retryable_reads/gridfs-download-serverErrors.yml +173 -0
  169. data/spec/spec_tests/data/retryable_reads/gridfs-download.yml +79 -0
  170. data/spec/spec_tests/data/retryable_reads/gridfs-downloadByName-serverErrors.yml +174 -0
  171. data/spec/spec_tests/data/retryable_reads/gridfs-downloadByName.yml +79 -0
  172. data/spec/spec_tests/data/retryable_reads/listCollectionNames-serverErrors.yml +143 -0
  173. data/spec/spec_tests/data/retryable_reads/listCollectionNames.yml +59 -0
  174. data/spec/spec_tests/data/retryable_reads/listCollectionObjects-serverErrors.yml +144 -0
  175. data/spec/spec_tests/data/retryable_reads/listCollectionObjects.yml +59 -0
  176. data/spec/spec_tests/data/retryable_reads/listCollections-serverErrors.yml +143 -0
  177. data/spec/spec_tests/data/retryable_reads/listCollections.yml +59 -0
  178. data/spec/spec_tests/data/retryable_reads/listDatabaseNames-serverErrors.yml +143 -0
  179. data/spec/spec_tests/data/retryable_reads/listDatabaseNames.yml +59 -0
  180. data/spec/spec_tests/data/retryable_reads/listDatabaseObjects-serverErrors.yml +144 -0
  181. data/spec/spec_tests/data/retryable_reads/listDatabaseObjects.yml +59 -0
  182. data/spec/spec_tests/data/retryable_reads/listDatabases-serverErrors.yml +144 -0
  183. data/spec/spec_tests/data/retryable_reads/listDatabases.yml +59 -0
  184. data/spec/spec_tests/data/retryable_reads/listIndexNames-serverErrors.yml +144 -0
  185. data/spec/spec_tests/data/retryable_reads/listIndexNames.yml +60 -0
  186. data/spec/spec_tests/data/retryable_reads/listIndexes-serverErrors.yml +145 -0
  187. data/spec/spec_tests/data/retryable_reads/listIndexes.yml +60 -0
  188. data/spec/spec_tests/data/retryable_reads/mapReduce.yml +60 -0
  189. data/spec/spec_tests/data/retryable_writes/bulkWrite-serverErrors.yml +10 -7
  190. data/spec/spec_tests/data/retryable_writes/bulkWrite.yml +15 -22
  191. data/spec/spec_tests/data/retryable_writes/deleteMany.yml +22 -0
  192. data/spec/spec_tests/data/retryable_writes/deleteOne-serverErrors.yml +8 -7
  193. data/spec/spec_tests/data/retryable_writes/deleteOne.yml +5 -8
  194. data/spec/spec_tests/data/retryable_writes/findOneAndDelete-serverErrors.yml +8 -7
  195. data/spec/spec_tests/data/retryable_writes/findOneAndDelete.yml +5 -8
  196. data/spec/spec_tests/data/retryable_writes/findOneAndReplace-serverErrors.yml +8 -7
  197. data/spec/spec_tests/data/retryable_writes/findOneAndReplace.yml +5 -8
  198. data/spec/spec_tests/data/retryable_writes/findOneAndUpdate-serverErrors.yml +8 -7
  199. data/spec/spec_tests/data/retryable_writes/findOneAndUpdate.yml +5 -8
  200. data/spec/spec_tests/data/retryable_writes/insertMany-serverErrors.yml +8 -7
  201. data/spec/spec_tests/data/retryable_writes/insertMany.yml +5 -8
  202. data/spec/spec_tests/data/retryable_writes/insertOne-serverErrors.yml +10 -45
  203. data/spec/spec_tests/data/retryable_writes/insertOne.yml +5 -8
  204. data/spec/spec_tests/data/retryable_writes/replaceOne-serverErrors.yml +8 -7
  205. data/spec/spec_tests/data/retryable_writes/replaceOne.yml +5 -8
  206. data/spec/spec_tests/data/retryable_writes/updateMany.yml +27 -0
  207. data/spec/spec_tests/data/retryable_writes/updateOne-serverErrors.yml +8 -7
  208. data/spec/spec_tests/data/retryable_writes/updateOne.yml +5 -14
  209. data/spec/spec_tests/data/transactions/abort.yml +7 -2
  210. data/spec/spec_tests/data/transactions/bulk.yml +7 -2
  211. data/spec/spec_tests/data/transactions/causal-consistency.yml +11 -4
  212. data/spec/spec_tests/data/transactions/commit.yml +11 -4
  213. data/spec/spec_tests/data/transactions/count.yml +64 -0
  214. data/spec/spec_tests/data/transactions/delete.yml +7 -2
  215. data/spec/spec_tests/data/transactions/error-labels.yml +8 -2
  216. data/spec/spec_tests/data/transactions/errors.yml +7 -2
  217. data/spec/spec_tests/data/transactions/findOneAndDelete.yml +7 -2
  218. data/spec/spec_tests/data/transactions/findOneAndReplace.yml +7 -2
  219. data/spec/spec_tests/data/transactions/findOneAndUpdate.yml +7 -2
  220. data/spec/spec_tests/data/transactions/insert.yml +9 -2
  221. data/spec/spec_tests/data/transactions/isolation.yml +7 -2
  222. data/spec/spec_tests/data/transactions/read-concern.yml +15 -6
  223. data/spec/spec_tests/data/transactions/read-pref.yml +7 -2
  224. data/spec/spec_tests/data/transactions/reads.yml +8 -48
  225. data/spec/spec_tests/data/transactions/retryable-abort.yml +7 -2
  226. data/spec/spec_tests/data/transactions/retryable-commit.yml +7 -2
  227. data/spec/spec_tests/data/transactions/retryable-writes.yml +7 -2
  228. data/spec/spec_tests/data/transactions/run-command.yml +7 -2
  229. data/spec/spec_tests/data/transactions/transaction-options.yml +7 -2
  230. data/spec/spec_tests/data/transactions/update.yml +7 -2
  231. data/spec/spec_tests/data/transactions/write-concern.yml +7 -2
  232. data/spec/spec_tests/data/transactions_api/callback-aborts.yml +6 -1
  233. data/spec/spec_tests/data/transactions_api/callback-commits.yml +6 -1
  234. data/spec/spec_tests/data/transactions_api/callback-retry.yml +6 -1
  235. data/spec/spec_tests/data/transactions_api/commit-retry.yml +6 -1
  236. data/spec/spec_tests/data/transactions_api/commit-transienttransactionerror-4.2.yml +6 -3
  237. data/spec/spec_tests/data/transactions_api/commit-transienttransactionerror.yml +6 -1
  238. data/spec/spec_tests/data/transactions_api/commit-writeconcernerror.yml +6 -1
  239. data/spec/spec_tests/data/transactions_api/commit.yml +6 -1
  240. data/spec/spec_tests/data/transactions_api/transaction-options.yml +6 -1
  241. data/spec/spec_tests/retryable_reads_spec.rb +11 -0
  242. data/spec/spec_tests/retryable_writes_spec.rb +4 -69
  243. data/spec/spec_tests/transactions_api_spec.rb +42 -37
  244. data/spec/spec_tests/transactions_spec.rb +42 -33
  245. data/spec/support/authorization.rb +12 -0
  246. data/spec/support/change_streams/operation.rb +1 -1
  247. data/spec/support/client_registry.rb +20 -0
  248. data/spec/support/cluster_config.rb +16 -15
  249. data/spec/support/cluster_tools.rb +346 -0
  250. data/spec/support/cmap.rb +367 -0
  251. data/spec/support/cmap/verifier.rb +46 -0
  252. data/spec/support/command_monitoring.rb +4 -6
  253. data/spec/support/common_shortcuts.rb +6 -0
  254. data/spec/support/connection_string.rb +2 -2
  255. data/spec/support/crud.rb +171 -184
  256. data/spec/support/crud/operation.rb +43 -0
  257. data/spec/support/crud/outcome.rb +53 -0
  258. data/spec/support/crud/read.rb +102 -12
  259. data/spec/support/crud/requirement.rb +69 -0
  260. data/spec/support/crud/spec.rb +68 -0
  261. data/spec/support/crud/test.rb +141 -0
  262. data/spec/support/crud/verifier.rb +96 -18
  263. data/spec/support/crud/write.rb +18 -3
  264. data/spec/support/event_subscriber.rb +15 -0
  265. data/spec/support/primary_socket.rb +2 -2
  266. data/spec/support/spec_config.rb +89 -20
  267. data/spec/support/transactions.rb +2 -306
  268. data/spec/support/transactions/operation.rb +7 -7
  269. data/spec/support/transactions/spec.rb +28 -0
  270. data/spec/support/transactions/test.rb +191 -0
  271. data/spec/support/utils.rb +123 -0
  272. metadata +202 -9
  273. metadata.gz.sig +0 -0
  274. data/lib/mongo/server/connection_pool/queue.rb +0 -359
  275. data/spec/mongo/server/connection_pool/queue_spec.rb +0 -353
  276. data/spec/support/transactions/verifier.rb +0 -97
@@ -0,0 +1,148 @@
1
+ runOn:
2
+ -
3
+ minServerVersion: "4.0"
4
+ topology: ["single", "replicaset"]
5
+ -
6
+ minServerVersion: "4.1.7"
7
+ topology: ["sharded"]
8
+
9
+ database_name: &database_name "retryable-reads-tests"
10
+ collection_name: &collection_name "coll"
11
+
12
+ data:
13
+ - { _id: 1, x: 11 }
14
+ - { _id: 2, x: 22 }
15
+
16
+ tests:
17
+ -
18
+ description: "EstimatedDocumentCount succeeds after InterruptedAtShutdown"
19
+ failPoint: &failCommand_failPoint
20
+ configureFailPoint: failCommand
21
+ mode: { times: 1 }
22
+ data: { failCommands: [count], errorCode: 11600 }
23
+ operations:
24
+ - &retryable_operation_succeeds
25
+ <<: &retryable_operation
26
+ name: estimatedDocumentCount
27
+ object: collection
28
+ result: 2
29
+ expectations:
30
+ - &retryable_command_started_event
31
+ command_started_event:
32
+ command:
33
+ count: *collection_name
34
+ database_name: *database_name
35
+ - *retryable_command_started_event
36
+ -
37
+ description: "EstimatedDocumentCount succeeds after InterruptedDueToStepDown"
38
+ failPoint:
39
+ <<: *failCommand_failPoint
40
+ data: { failCommands: [count], errorCode: 11602 }
41
+ operations: [*retryable_operation_succeeds]
42
+ expectations:
43
+ - *retryable_command_started_event
44
+ - *retryable_command_started_event
45
+ -
46
+ description: "EstimatedDocumentCount succeeds after NotMaster"
47
+ failPoint:
48
+ <<: *failCommand_failPoint
49
+ data: { failCommands: [count], errorCode: 10107 }
50
+ operations: [*retryable_operation_succeeds]
51
+ expectations:
52
+ - *retryable_command_started_event
53
+ - *retryable_command_started_event
54
+ -
55
+ description: "EstimatedDocumentCount succeeds after NotMasterNoSlaveOk"
56
+ failPoint:
57
+ <<: *failCommand_failPoint
58
+ data: { failCommands: [count], errorCode: 13435 }
59
+ operations: [*retryable_operation_succeeds]
60
+ expectations:
61
+ - *retryable_command_started_event
62
+ - *retryable_command_started_event
63
+ -
64
+ description: "EstimatedDocumentCount succeeds after NotMasterOrSecondary"
65
+ failPoint:
66
+ <<: *failCommand_failPoint
67
+ data: { failCommands: [count], errorCode: 13436 }
68
+ operations: [*retryable_operation_succeeds]
69
+ expectations:
70
+ - *retryable_command_started_event
71
+ - *retryable_command_started_event
72
+ -
73
+ description: "EstimatedDocumentCount succeeds after PrimarySteppedDown"
74
+ failPoint:
75
+ <<: *failCommand_failPoint
76
+ data: { failCommands: [count], errorCode: 189 }
77
+ operations: [*retryable_operation_succeeds]
78
+ expectations:
79
+ - *retryable_command_started_event
80
+ - *retryable_command_started_event
81
+ -
82
+ description: "EstimatedDocumentCount succeeds after ShutdownInProgress"
83
+ failPoint:
84
+ <<: *failCommand_failPoint
85
+ data: { failCommands: [count], errorCode: 91 }
86
+ operations: [*retryable_operation_succeeds]
87
+ expectations:
88
+ - *retryable_command_started_event
89
+ - *retryable_command_started_event
90
+ -
91
+ description: "EstimatedDocumentCount succeeds after HostNotFound"
92
+ failPoint:
93
+ <<: *failCommand_failPoint
94
+ data: { failCommands: [count], errorCode: 7 }
95
+ operations: [*retryable_operation_succeeds]
96
+ expectations:
97
+ - *retryable_command_started_event
98
+ - *retryable_command_started_event
99
+ -
100
+ description: "EstimatedDocumentCount succeeds after HostUnreachable"
101
+ failPoint:
102
+ <<: *failCommand_failPoint
103
+ data: { failCommands: [count], errorCode: 6 }
104
+ operations: [*retryable_operation_succeeds]
105
+ expectations:
106
+ - *retryable_command_started_event
107
+ - *retryable_command_started_event
108
+ -
109
+ description: "EstimatedDocumentCount succeeds after NetworkTimeout"
110
+ failPoint:
111
+ <<: *failCommand_failPoint
112
+ data: { failCommands: [count], errorCode: 89 }
113
+ operations: [*retryable_operation_succeeds]
114
+ expectations:
115
+ - *retryable_command_started_event
116
+ - *retryable_command_started_event
117
+ -
118
+ description: "EstimatedDocumentCount succeeds after SocketException"
119
+ failPoint:
120
+ <<: *failCommand_failPoint
121
+ data: { failCommands: [count], errorCode: 9001 }
122
+ operations: [*retryable_operation_succeeds]
123
+ expectations:
124
+ - *retryable_command_started_event
125
+ - *retryable_command_started_event
126
+ -
127
+ description: "EstimatedDocumentCount fails after two NotMaster errors"
128
+ failPoint:
129
+ <<: *failCommand_failPoint
130
+ mode: { times: 2 }
131
+ data: { failCommands: [count], errorCode: 10107 }
132
+ operations:
133
+ - &retryable_operation_fails
134
+ <<: *retryable_operation
135
+ error: true
136
+ expectations:
137
+ - *retryable_command_started_event
138
+ - *retryable_command_started_event
139
+ -
140
+ description: "EstimatedDocumentCount fails after NotMaster when retryReads is false"
141
+ clientOptions:
142
+ retryReads: false
143
+ failPoint:
144
+ <<: *failCommand_failPoint
145
+ data: { failCommands: [count], errorCode: 10107 }
146
+ operations: [*retryable_operation_fails]
147
+ expectations:
148
+ - *retryable_command_started_event
@@ -0,0 +1,62 @@
1
+ runOn:
2
+ -
3
+ minServerVersion: "4.0"
4
+ topology: ["single", "replicaset"]
5
+ -
6
+ minServerVersion: "4.1.7"
7
+ topology: ["sharded"]
8
+
9
+ database_name: &database_name "retryable-reads-tests"
10
+ collection_name: &collection_name "coll"
11
+
12
+ data:
13
+ - { _id: 1, x: 11 }
14
+ - { _id: 2, x: 22 }
15
+
16
+ tests:
17
+ -
18
+ description: "EstimatedDocumentCount succeeds on first attempt"
19
+ operations:
20
+ - &retryable_operation_succeeds
21
+ <<: &retryable_operation
22
+ name: estimatedDocumentCount
23
+ object: collection
24
+ result: 2
25
+ expectations:
26
+ - &retryable_command_started_event
27
+ command_started_event:
28
+ command:
29
+ count: *collection_name
30
+ database_name: *database_name
31
+ -
32
+ description: "EstimatedDocumentCount succeeds on second attempt"
33
+ failPoint: &failCommand_failPoint
34
+ configureFailPoint: failCommand
35
+ mode: { times: 1 }
36
+ data:
37
+ failCommands: [count]
38
+ closeConnection: true
39
+ operations: [*retryable_operation_succeeds]
40
+ expectations:
41
+ - *retryable_command_started_event
42
+ - *retryable_command_started_event
43
+ -
44
+ description: "EstimatedDocumentCount fails on first attempt"
45
+ clientOptions:
46
+ retryReads: false
47
+ failPoint: *failCommand_failPoint
48
+ operations:
49
+ - &retryable_operation_fails
50
+ <<: *retryable_operation
51
+ error: true
52
+ expectations:
53
+ - *retryable_command_started_event
54
+ -
55
+ description: "EstimatedDocumentCount fails on second attempt"
56
+ failPoint:
57
+ <<: *failCommand_failPoint
58
+ mode: { times: 2 }
59
+ operations: [*retryable_operation_fails]
60
+ expectations:
61
+ - *retryable_command_started_event
62
+ - *retryable_command_started_event
@@ -0,0 +1,160 @@
1
+ runOn:
2
+ -
3
+ minServerVersion: "4.0"
4
+ topology: ["single", "replicaset"]
5
+ -
6
+ minServerVersion: "4.1.7"
7
+ topology: ["sharded"]
8
+
9
+ database_name: &database_name "retryable-reads-tests"
10
+ collection_name: &collection_name "coll"
11
+
12
+ data:
13
+ - {_id: 1, x: 11}
14
+ - {_id: 2, x: 22}
15
+ - {_id: 3, x: 33}
16
+ - {_id: 4, x: 44}
17
+ - {_id: 5, x: 55}
18
+
19
+ tests:
20
+ -
21
+ description: "Find succeeds after InterruptedAtShutdown"
22
+ failPoint: &failCommand_failPoint
23
+ configureFailPoint: failCommand
24
+ mode: { times: 1 }
25
+ data: { failCommands: [find], errorCode: 11600 }
26
+ operations:
27
+ - &retryable_operation_succeeds
28
+ <<: &retryable_operation
29
+ name: find
30
+ object: collection
31
+ arguments: { filter: {}, sort: { _id: 1 }, limit: 4 }
32
+ result:
33
+ - {_id: 1, x: 11}
34
+ - {_id: 2, x: 22}
35
+ - {_id: 3, x: 33}
36
+ - {_id: 4, x: 44}
37
+ expectations:
38
+ - &retryable_command_started_event
39
+ command_started_event:
40
+ command:
41
+ find: *collection_name
42
+ filter: {}
43
+ sort: {_id: 1}
44
+ limit: 4
45
+ database_name: *database_name
46
+ - *retryable_command_started_event
47
+ -
48
+ description: "Find succeeds after InterruptedDueToStepDown"
49
+ failPoint:
50
+ <<: *failCommand_failPoint
51
+ data: { failCommands: [find], errorCode: 11602 }
52
+ operations: [*retryable_operation_succeeds]
53
+ expectations:
54
+ - *retryable_command_started_event
55
+ - *retryable_command_started_event
56
+ -
57
+ description: "Find succeeds after NotMaster"
58
+ failPoint:
59
+ <<: *failCommand_failPoint
60
+ data: { failCommands: [find], errorCode: 10107 }
61
+ operations: [*retryable_operation_succeeds]
62
+ expectations:
63
+ - *retryable_command_started_event
64
+ - *retryable_command_started_event
65
+ -
66
+ description: "Find succeeds after NotMasterNoSlaveOk"
67
+ failPoint:
68
+ <<: *failCommand_failPoint
69
+ data: { failCommands: [find], errorCode: 13435 }
70
+ operations: [*retryable_operation_succeeds]
71
+ expectations:
72
+ - *retryable_command_started_event
73
+ - *retryable_command_started_event
74
+ -
75
+ description: "Find succeeds after NotMasterOrSecondary"
76
+ failPoint:
77
+ <<: *failCommand_failPoint
78
+ data: { failCommands: [find], errorCode: 13436 }
79
+ operations: [*retryable_operation_succeeds]
80
+ expectations:
81
+ - *retryable_command_started_event
82
+ - *retryable_command_started_event
83
+ -
84
+ description: "Find succeeds after PrimarySteppedDown"
85
+ failPoint:
86
+ <<: *failCommand_failPoint
87
+ data: { failCommands: [find], errorCode: 189 }
88
+ operations: [*retryable_operation_succeeds]
89
+ expectations:
90
+ - *retryable_command_started_event
91
+ - *retryable_command_started_event
92
+ -
93
+ description: "Find succeeds after ShutdownInProgress"
94
+ failPoint:
95
+ <<: *failCommand_failPoint
96
+ data: { failCommands: [find], errorCode: 91 }
97
+ operations: [*retryable_operation_succeeds]
98
+ expectations:
99
+ - *retryable_command_started_event
100
+ - *retryable_command_started_event
101
+ -
102
+ description: "Find succeeds after HostNotFound"
103
+ failPoint:
104
+ <<: *failCommand_failPoint
105
+ data: { failCommands: [find], errorCode: 7 }
106
+ operations: [*retryable_operation_succeeds]
107
+ expectations:
108
+ - *retryable_command_started_event
109
+ - *retryable_command_started_event
110
+ -
111
+ description: "Find succeeds after HostUnreachable"
112
+ failPoint:
113
+ <<: *failCommand_failPoint
114
+ data: { failCommands: [find], errorCode: 6 }
115
+ operations: [*retryable_operation_succeeds]
116
+ expectations:
117
+ - *retryable_command_started_event
118
+ - *retryable_command_started_event
119
+ -
120
+ description: "Find succeeds after NetworkTimeout"
121
+ failPoint:
122
+ <<: *failCommand_failPoint
123
+ data: { failCommands: [find], errorCode: 89 }
124
+ operations: [*retryable_operation_succeeds]
125
+ expectations:
126
+ - *retryable_command_started_event
127
+ - *retryable_command_started_event
128
+ -
129
+ description: "Find succeeds after SocketException"
130
+ failPoint:
131
+ <<: *failCommand_failPoint
132
+ data: { failCommands: [find], errorCode: 9001 }
133
+ operations: [*retryable_operation_succeeds]
134
+ expectations:
135
+ - *retryable_command_started_event
136
+ - *retryable_command_started_event
137
+ -
138
+ description: "Find fails after two NotMaster errors"
139
+ failPoint:
140
+ <<: *failCommand_failPoint
141
+ mode: { times: 2 }
142
+ data: { failCommands: [find], errorCode: 10107 }
143
+ operations:
144
+ - &retryable_operation_fails
145
+ <<: *retryable_operation
146
+ error: true
147
+ expectations:
148
+ - *retryable_command_started_event
149
+ - *retryable_command_started_event
150
+ -
151
+ description: "Find fails after NotMaster when retryReads is false"
152
+ clientOptions:
153
+ retryReads: false
154
+ failPoint:
155
+ <<: *failCommand_failPoint
156
+ data: { failCommands: [find], errorCode: 10107 }
157
+ operations: [*retryable_operation_fails]
158
+ expectations:
159
+ - *retryable_command_started_event
160
+
@@ -0,0 +1,86 @@
1
+ runOn:
2
+ -
3
+ minServerVersion: "4.0"
4
+ topology: ["single", "replicaset"]
5
+ -
6
+ minServerVersion: "4.1.7"
7
+ topology: ["sharded"]
8
+
9
+ database_name: &database_name "retryable-reads-tests"
10
+ collection_name: &collection_name "coll"
11
+
12
+ data:
13
+ - {_id: 1, x: 11}
14
+ - {_id: 2, x: 22}
15
+ - {_id: 3, x: 33}
16
+ - {_id: 4, x: 44}
17
+ - {_id: 5, x: 55}
18
+
19
+ tests:
20
+ -
21
+ description: "Find succeeds on first attempt"
22
+ operations:
23
+ - &retryable_operation_succeeds
24
+ <<: &retryable_operation
25
+ name: find
26
+ object: collection
27
+ arguments:
28
+ filter: {}
29
+ sort: {_id: 1}
30
+ limit: 4
31
+ result:
32
+ - {_id: 1, x: 11}
33
+ - {_id: 2, x: 22}
34
+ - {_id: 3, x: 33}
35
+ - {_id: 4, x: 44}
36
+ expectations:
37
+ - &retryable_command_started_event
38
+ command_started_event:
39
+ command:
40
+ find: *collection_name
41
+ filter: {}
42
+ sort: {_id: 1}
43
+ limit: 4
44
+ database_name: *database_name
45
+ -
46
+ description: "Find succeeds on second attempt with explicit clientOptions"
47
+ clientOptions:
48
+ retryReads: true
49
+ failPoint: &failCommand_failPoint
50
+ configureFailPoint: failCommand
51
+ mode: { times: 1 }
52
+ data:
53
+ failCommands: [find]
54
+ closeConnection: true
55
+ operations: [*retryable_operation_succeeds]
56
+ expectations:
57
+ - *retryable_command_started_event
58
+ - *retryable_command_started_event
59
+ -
60
+ description: "Find succeeds on second attempt"
61
+ failPoint: *failCommand_failPoint
62
+ operations: [*retryable_operation_succeeds]
63
+ expectations:
64
+ - *retryable_command_started_event
65
+ - *retryable_command_started_event
66
+ -
67
+ description: "Find fails on first attempt"
68
+ clientOptions:
69
+ retryReads: false
70
+ failPoint: *failCommand_failPoint
71
+ operations:
72
+ - &retryable_operation_fails
73
+ <<: *retryable_operation
74
+ error: true
75
+ expectations:
76
+ - *retryable_command_started_event
77
+ -
78
+ description: "Find fails on second attempt"
79
+ failPoint:
80
+ <<: *failCommand_failPoint
81
+ mode: { times: 2 }
82
+ operations: [*retryable_operation_fails]
83
+ expectations:
84
+ - *retryable_command_started_event
85
+ - *retryable_command_started_event
86
+