audit code for unprotected ScopedDbConnection and ShardConnection constructor calls

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Done
    • Priority: Major - P3
    • None
    • Affects Version/s: 2.5.1
    • Component/s: Internal Client, Sharding
    • Sharding
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      ... 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 ) {
         ...
      }
      

            Assignee:
            [DO NOT USE] Backlog - Sharding Team
            Reporter:
            Greg Studer (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: