- 
                Notifications
    You must be signed in to change notification settings 
- Fork 246
DRIVERS-2884: CSOT avoid connection churn when operations timeout #1845
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Open
      
      
            sanych-sun
  wants to merge
  13
  commits into
  mongodb:master
  
    
      
        
          
  
    
      Choose a base branch
      
     
    
      
        
      
      
        
          
          
        
        
          
            
              
              
              
  
           
        
        
          
            
              
              
           
        
       
     
  
        
          
            
          
            
          
        
       
    
      
from
sanych-sun:DRIVERS-2884
  
      
      
   
  
    
  
  
  
 
  
      
    base: master
Could not load branches
            
              
  
    Branch not found: {{ refName }}
  
            
                
      Loading
              
            Could not load tags
            
            
              Nothing to show
            
              
  
            
                
      Loading
              
            Are you sure you want to change the base?
            Some commits from the old base branch may be removed from the timeline,
            and old review comments may become outdated.
          
          
      
        
          +3,639
        
        
          −31
        
        
          
        
      
    
  
  
     Open
                    Changes from 11 commits
      Commits
    
    
            Show all changes
          
          
            13 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      f3d26ba
              
                DRIVERS-2884: CSOT avoid connection churn when operations timeout
              
              
                sanych-sun 3e1f8e8
              
                pr
              
              
                sanych-sun 250c123
              
                Fix unified spec tests
              
              
                sanych-sun 1fcc099
              
                Update source/connection-monitoring-and-pooling/connection-monitoring…
              
              
                sanych-sun d97a995
              
                Update source/client-side-operations-timeout/tests/pending-response.yml
              
              
                sanych-sun f442cce
              
                PR
              
              
                sanych-sun e44e04c
              
                Fix test
              
              
                sanych-sun fca4dc0
              
                Fix test
              
              
                sanych-sun 473503f
              
                pr
              
              
                sanych-sun 8677cbc
              
                pr
              
              
                sanych-sun d33c5c2
              
                Move closed connection tests into separate file.
              
              
                sanych-sun b2c5752
              
                pr
              
              
                sanych-sun 131bcf0
              
                Pr
              
              
                sanych-sun File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
        
          
  
    
      
          
            180 changes: 180 additions & 0 deletions
          
          180 
        
  source/client-side-operations-timeout/tests/pending-response-close-connection.json
  
  
      
      
   
        
      
      
    Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
      
      Oops, something went wrong.
      
    
  
        
          
  
    
      
          
            98 changes: 98 additions & 0 deletions
          
          98 
        
  source/client-side-operations-timeout/tests/pending-response-close-connection.yml
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,98 @@ | ||
| description: "Connection churn is prevented by reading pending responses during connection checkout" | ||
| schemaVersion: "1.28" | ||
| runOnRequirements: | ||
| - minServerVersion: "5.0" | ||
| # FailPoint on Server before 5.0 do not wait for blockTimeMS before closing the connection | ||
| topologies: ["single", "replicaset"] | ||
| createEntities: | ||
| - client: | ||
| id: &failPointClient failPointClient | ||
| useMultipleMongoses: false | ||
| - client: | ||
| id: &client client | ||
| uriOptions: | ||
| maxPoolSize: 1 | ||
| minPoolSize: 1 | ||
| awaitMinPoolSizeMS: 10000 | ||
| useMultipleMongoses: false | ||
| observeEvents: | ||
| - commandFailedEvent | ||
| - commandSucceededEvent | ||
| - connectionCheckOutStartedEvent | ||
| - connectionCheckedOutEvent | ||
| - connectionCheckOutFailedEvent | ||
| - connectionCheckedInEvent | ||
| - connectionCreatedEvent | ||
| - connectionReadyEvent | ||
| - connectionClosedEvent | ||
| - connectionPendingResponseSucceededEvent | ||
| - connectionPendingResponseStartedEvent | ||
| - connectionPendingResponseFailedEvent | ||
| - database: | ||
| id: &database test | ||
| client: *client | ||
| databaseName: *database | ||
| - collection: | ||
| id: &collection coll | ||
| database: *database | ||
| collectionName: *collection | ||
| initialData: | ||
| - collectionName: *collection | ||
| databaseName: *database | ||
| documents: [] | ||
| tests: | ||
| # If the connection is closed server-side while draining the response, the | ||
| # driver must retry with a different connection. | ||
| - description: "write op retries when connection closes server-side while draining response" | ||
| operations: | ||
| # Create a failpoint to block the first and second operation. | ||
| - name: failPoint | ||
| object: testRunner | ||
| arguments: | ||
| client: *failPointClient | ||
| failPoint: | ||
| configureFailPoint: failCommand | ||
| mode: {times: 1} | ||
| data: | ||
| failCommands: ["insert"] | ||
| blockConnection: true | ||
| blockTimeMS: 200 | ||
| closeConnection: true | ||
| # Execute operation with timeout less than block time. | ||
| - name: insertOne | ||
| object: *collection | ||
| arguments: | ||
| timeoutMS: 50 | ||
| document: {_id: 3, x: 1} | ||
| expectError: | ||
| isTimeoutError: true | ||
| # Draining pending response should failure because of closed connection, | ||
|         
                  sanych-sun marked this conversation as resolved.
              Outdated
          
            Show resolved
            Hide resolved | ||
| # but another connection should be established within the checkout and operation should succeed. | ||
| - name: insertOne | ||
| object: *collection | ||
| arguments: | ||
| timeoutMS: 1000 | ||
| document: {_id: 3, x: 1} | ||
| expectEvents: | ||
| - client: *client | ||
| events: | ||
| - commandFailedEvent: | ||
| commandName: insert | ||
| - commandSucceededEvent: | ||
| commandName: insert | ||
| - client: *client | ||
| eventType: cmap | ||
| events: | ||
| - connectionCheckOutStartedEvent: { } | ||
| - connectionCheckedOutEvent: { } | ||
| - connectionCheckedInEvent: { } # Insert fails. | ||
| - connectionCheckOutStartedEvent: { } | ||
| - connectionPendingResponseStartedEvent: { } | ||
| - connectionPendingResponseFailedEvent: # Pending response failed. | ||
| reason: error | ||
| - connectionClosedEvent: | ||
| reason: error | ||
| - connectionCreatedEvent: { } # New connection should be created and checked out. | ||
| - connectionReadyEvent: { } | ||
| - connectionCheckedOutEvent: { } | ||
| - connectionCheckedInEvent: { } # Find finishes. | ||
      
      Oops, something went wrong.
        
    
  
      
      Oops, something went wrong.
        
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.