Commit 04bee77
committed
RUBY-3824 Make Session#unpin idempotent
The transactions runner triggers Session#unpin twice for the same network
error on the bulk_write code path: once from the unpin_maybe handler in
Operation::Executable#do_execute, and again from the unpin_maybe handler
in BulkWrite#execute_operation wrapping the same OpMsg execution. The
second call tried to check the connection back into the pool that had
already received it, raising "Trying to check in a connection which is
not currently checked out by this pool". This regression had been hidden
since the rubocop autocorrect on the runner (commit 8db6431) skipped
all transactions tests; it surfaced as soon as PR 3033 re-enabled them
on sharded clusters.
Guard Session#unpin to return early when there is no pinned state. The
single-document path is unaffected (only one unpin_maybe layer there).1 parent c165d46 commit 04bee77
2 files changed
Lines changed: 29 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
936 | 936 | | |
937 | 937 | | |
938 | 938 | | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
939 | 946 | | |
940 | 947 | | |
941 | 948 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
340 | 340 | | |
341 | 341 | | |
342 | 342 | | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
343 | 365 | | |
0 commit comments