...

Text file src/go.mongodb.org/mongo-driver/testdata/connection-monitoring-and-pooling/pool-checkout-returned-connection-maxConnecting.yml

Documentation: go.mongodb.org/mongo-driver/testdata/connection-monitoring-and-pooling

     1version: 1
     2style: integration
     3description: threads blocked by maxConnecting check out returned connections
     4runOn:
     5  -
     6    # required for blockConnection in fail point
     7    minServerVersion: "4.4.0"
     8failPoint:
     9  configureFailPoint: failCommand
    10  # high amount to ensure not interfered with by monitor checks.
    11  mode: { times: 50 }
    12  data:
    13    failCommands: ["isMaster","hello"]
    14    closeConnection: false
    15    blockConnection: true
    16    blockTimeMS: 750
    17poolOptions:
    18  maxPoolSize: 10
    19  waitQueueTimeoutMS: 5000
    20operations:
    21  - name: ready
    22  # check out a connection and hold on to it.
    23  - name: checkOut
    24    label: conn0
    25  # then start three threads that all attempt to check out. Two threads
    26  # will fill maxConnecting, and the other should be waiting either for
    27  # the other two to finish or for the main thread to check its connection
    28  # back in.
    29  - name: start
    30    target: thread1
    31  - name: checkOut
    32    thread: thread1
    33  - name: start
    34    target: thread2
    35  - name: checkOut
    36    thread: thread2
    37  - name: start
    38    target: thread3
    39  - name: checkOut
    40    thread: thread3
    41  # wait for all three to start checking out and a little longer
    42  # for the establishments to begin.
    43  - name: waitForEvent
    44    event: ConnectionCheckOutStarted
    45    count: 4
    46  - name: wait
    47    ms: 100
    48  # check original connection back in, so the thread that isn't
    49  # currently establishing will become unblocked. Then wait for
    50  # all threads to complete.
    51  - name: checkIn
    52    connection: conn0
    53  - name: waitForEvent
    54    event: ConnectionCheckedOut
    55    count: 4
    56events:
    57  # main thread checking out a Connection and holding it
    58  - type: ConnectionCreated
    59    address: 42
    60    connectionId: 1
    61  - type: ConnectionCheckedOut
    62    address: 42
    63  # two threads creating their Connections
    64  - type: ConnectionCreated
    65    address: 42
    66  - type: ConnectionCreated
    67    address: 42
    68  # main thread checking its Connection back in
    69  - type: ConnectionCheckedIn
    70    connectionId: 1
    71    address: 42
    72  # remaining thread checking out the returned Connection
    73  - type: ConnectionCheckedOut
    74    connectionId: 1
    75    address: 42
    76  # first two threads finishing Connection establishment
    77  - type: ConnectionCheckedOut
    78    address: 42
    79  - type: ConnectionCheckedOut
    80    address: 42
    81ignore:
    82  - ConnectionPoolReady
    83  - ConnectionClosed
    84  - ConnectionReady
    85  - ConnectionPoolCreated
    86  - ConnectionCheckOutStarted

View as plain text