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

MaxTimeMS may expire in range_deleter_interacts_correctly_with_refine_shard_key.js test before _configsvrMoveChunk command started

    • Fully Compatible
    • ALL
    • v4.4
    • Sharding 2020-06-29
    • 11

      The range_deleter_interacts_correctly_with_refine_shard_key.js test tries to start a chunk migration without waiting for it to complete by setting the maxTimeMS for the command to 1 second.

      Using a higher maxTimeMS would make the test take longer but would be more robust to other parts of the moveChunk command taking longer. We could also consider introducing a failpoint to lower the maxTimeMS only before configsvr_client::moveChunk() is called.

      Unable to find source-code formatter for language: diff. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      diff --git a/src/mongo/s/commands/cluster_move_chunk_cmd.cpp b/src/mongo/s/commands/cluster_move_chunk_cmd.cpp
      index 398d8fc49c..da899c2550 100644
      --- a/src/mongo/s/commands/cluster_move_chunk_cmd.cpp
      +++ b/src/mongo/s/commands/cluster_move_chunk_cmd.cpp
      @@ -46,11 +46,14 @@
       #include "mongo/s/config_server_client.h"
       #include "mongo/s/grid.h"
       #include "mongo/s/request_types/migration_secondary_throttle_options.h"
      +#include "mongo/util/fail_point.h"
       #include "mongo/util/timer.h"
      
       namespace mongo {
       namespace {
      
      +MONGO_FAIL_POINT_DEFINE(startMoveChunkWithoutWaiting);
      +
       class MoveChunkCmd : public ErrmsgCommandDeprecated {
       public:
           MoveChunkCmd() : ErrmsgCommandDeprecated("moveChunk", "movechunk") {}
      @@ -190,6 +193,9 @@ public:
               chunkType.setShard(chunk->getShardId());
               chunkType.setVersion(cm->getVersion());
      
      +        if (MONGO_unlikely(startMoveChunkWithoutWaiting.shouldFail())) {
      +            opCtx->setDeadlineAfterNowBy(Microseconds(1), ErrorCodes::MaxTimeMSExpired);
      +        }
               uassertStatusOK(configsvr_client::moveChunk(opCtx,
                                                           chunkType,
                                                           to->getId(),
      

            Assignee:
            marcos.grillo@mongodb.com Marcos José Grillo Ramirez
            Reporter:
            max.hirschhorn@mongodb.com Max Hirschhorn
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: