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

router should uassert that there was no writeConcern error when processing _configsvrCreateDatabase response

    XMLWordPrintableJSON

Details

    • Fully Compatible
    • ALL
    • v4.2
    • Sharding 2019-06-17
    • 6

    Description

      Currently it only uasserts on the commandStatus and then tries to refresh its cache to find the new (supposedly durable) entry for the database, which can lead to commands failing with with "Database <> not found":

              ConfigsvrCreateDatabase configCreateDatabaseRequest(dbName.toString());
              configCreateDatabaseRequest.setDbName(NamespaceString::kAdminDb);
       
              auto configShard = Grid::get(opCtx)->shardRegistry()->getConfigShard();
       
              auto createDbStatus =
                  uassertStatusOK(configShard->runCommandWithFixedRetryAttempts(
                                      opCtx,
                                      ReadPreferenceSetting(ReadPreference::PrimaryOnly),
                                      "admin",
                                      CommandHelpers::appendMajorityWriteConcern(
                                          configCreateDatabaseRequest.toBSON({})),
                                      Shard::RetryPolicy::kIdempotent))
                      .commandStatus;
       
              if (createDbStatus.isOK() || createDbStatus == ErrorCodes::NamespaceExists) {
                  dbStatus = Grid::get(opCtx)->catalogCache()->getDatabase(opCtx, dbName);
              } else {
                  dbStatus = createDbStatus;
              }
      

      Attachments

        Activity

          People

            jamie.heppenstall@mongodb.com James Heppenstall (Inactive)
            esha.maharishi@mongodb.com Esha Maharishi (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: