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

    XMLWordPrintable

    Details

    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Backport Requested:
      v4.4
    • Sprint:
      Sharding 2020-06-29
    • Linked BF Score:
      11

      Description

      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.

      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(),
      

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved: