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

    XMLWordPrintable

    Details

    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Backport Requested:
      v4.2
    • Sprint:
      Sharding 2019-06-17
    • Linked BF Score:
      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

            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: