Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-9929

audit code for unprotected ScopedDbConnection and ShardConnection constructor calls

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • None
    • 2.5.1
    • Internal Client, Sharding
    • Sharding

    Description

      ... since these calls can fail with a DBException on failure to connect, failure to auth (in authenticated systems), or failure to initShardVersion (for ShardConnections). Need to be careful about unintended exception codepaths, and these are hard to catch during testing since the failure depends on conn pooling.

      For example:

      ScopedDbConn conn(...);
      Type result;
      try {
         result = conn->doSomething();
      }
      catch( const DBException& ex ){
         ...
      }
      done();

      is not exception-safe. Should be:

      Type result;
      try { 
        ScopedDbConn conn(...);
        result = conn.doSomething();
        conn.done();
      }
      catch( const DBException& ex ) {
         ...
      }

      Attachments

        Activity

          People

            backlog-server-sharding [DO NOT USE] Backlog - Sharding Team
            greg_10gen Greg Studer
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: