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

Make direct writes against the config primary from a JS test throw in the continuous stepdown suite

    • Type: Icon: Improvement Improvement
    • Resolution: Won't Do
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Sharding
    • Labels:
    • Sharding EMEA

      Courtesy of max.hirschhorn,

      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/jstests/libs/override_methods/sharding_continuous_config_stepdown.js b/jstests/libs/override_methods/sharding_continuous_config_stepdown.js
      index 638dc8b..7d3039e 100644
      --- a/jstests/libs/override_methods/sharding_continuous_config_stepdown.js
      +++ b/jstests/libs/override_methods/sharding_continuous_config_stepdown.js
      @@ -251,6 +251,29 @@ tracking: {verbosity: 0} }";
       
               // Start the continuous config server stepdown thread
               this.configRS.startContinuousFailover();
      +
      +        // We override the functions on Mongo.prototype that send data over the wire to prevent a
      +        // test from running a command directly against the config servers and causing a spurious
      +        // network error if it coincided with a stepdown.
      +        this.configRS.nodes.forEach(function overrideConnectionMethods(node) {
      +            var methodsToOverride = [
      +                "find",
      +                "insert",
      +                "remove",
      +                "runCommand",
      +                "runCommandWithMetadata",
      +                "update",
      +            ];
      +
      +            methodsToOverride.forEach(function overrideMethod(name) {
      +                node[name] = function throwError() {
      +                    throw new Error(
      +                        "Cowardly refusing to talk directly to the config servers while running" +
      +                        " with the sharding_continuous_config_stepdown.js override enabled since" +
      +                        " it may lead to a spurious network error.");
      +                };
      +            });
      +        });
           };
       
           Object.extend(ShardingTest, originalShardingTest);
      

      This would catch future JS test additions that can lead to BFs – these operations directly against the config primary, rather than via the mongos, are currently not retriable.

            Assignee:
            backlog-server-sharding-emea [DO NOT USE] Backlog - Sharding EMEA
            Reporter:
            dianna.hohensee@mongodb.com Dianna Hohensee (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: