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

db.disableFreeMonitoring() returns "not master" on secondary even after rs.slaveOk()

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: 4.0.6
    • Fix Version/s: 4.1.10, 4.0.10
    • Component/s: Admin, Shell
    • Labels:
      None
    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Backport Requested:
      v4.0
    • Steps To Reproduce:
      Hide

      After connecting to a secondary node in a 4.0.6 replica set:

      ...
      To enable free monitoring, run the following command: db.enableFreeMonitoring()
      To permanently disable this reminder, run the following command: db.disableFreeMonitoring()
      ---
       
      replset:SECONDARY> rs.slaveOk()
      replset:SECONDARY> db.disableFreeMonitoring()
      2019-03-13T15:32:54.998-0400 E QUERY    [js] Error: command failed: {
      	"operationTime" : Timestamp(1552505570, 1),
      	"ok" : 0,
      	"errmsg" : "not master",
      	"code" : 10107,
      	"codeName" : "NotMaster",
      	"$clusterTime" : {
      		"clusterTime" : Timestamp(1552505570, 1),
      		"signature" : {
      			"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
      			"keyId" : NumberLong(0)
      		}
      	}
      } :
      _getErrorWithCode@src/mongo/shell/utils.js:25:13
      doassert@src/mongo/shell/assert.js:18:14
      _assertCommandWorked@src/mongo/shell/assert.js:536:17
      assert.commandWorked@src/mongo/shell/assert.js:620:16
      DB.prototype.disableFreeMonitoring@src/mongo/shell/db.js:1994:9
      @(shell):1:1
      

      Show
      After connecting to a secondary node in a 4.0.6 replica set: ... To enable free monitoring, run the following command: db.enableFreeMonitoring() To permanently disable this reminder, run the following command: db.disableFreeMonitoring() ---   replset:SECONDARY> rs.slaveOk() replset:SECONDARY> db.disableFreeMonitoring() 2019-03-13T15:32:54.998-0400 E QUERY [js] Error: command failed: { "operationTime" : Timestamp(1552505570, 1), "ok" : 0, "errmsg" : "not master", "code" : 10107, "codeName" : "NotMaster", "$clusterTime" : { "clusterTime" : Timestamp(1552505570, 1), "signature" : { "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="), "keyId" : NumberLong(0) } } } : _getErrorWithCode@src/mongo/shell/utils.js:25:13 doassert@src/mongo/shell/assert.js:18:14 _assertCommandWorked@src/mongo/shell/assert.js:536:17 assert.commandWorked@src/mongo/shell/assert.js:620:16 DB.prototype.disableFreeMonitoring@src/mongo/shell/db.js:1994:9 @(shell):1:1
    • Sprint:
      Security 2019-03-25, Security 2019-04-08

      Description

      Despite specifying rs.slaveOk(), db.disableFreeMonitoring() returns a "not master" error.

      Original Description

      I disabled free monitoring from shell on a primary node without issues. When I connect to a secondary node I see the message:

      To enable free monitoring, run the following command: db.enableFreeMonitoring()
      To permanently disable this reminder, run the following command: db.disableFreeMonitoring()

      When I execute `db.disableFreeMonitoring()`, I'm getting the following error:

      2019-03-13T18:46:43.618+0000 E QUERY    [js] Error: command failed: {
      	"operationTime" : Timestamp(1552502797, 1),
      	"ok" : 0,
      	"errmsg" : "not master",
      	"code" : 10107,
      	"codeName" : "NotMaster",
      	"$clusterTime" : {
      		"clusterTime" : Timestamp(1552502797, 1),
      		"signature" : {
      			"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
      			"keyId" : NumberLong(0)
      		}
      	}
      } :
      _getErrorWithCode@src/mongo/shell/utils.js:25:13
      doassert@src/mongo/shell/assert.js:18:14
      _assertCommandWorked@src/mongo/shell/assert.js:536:17
      assert.commandWorked@src/mongo/shell/assert.js:620:16
      DB.prototype.disableFreeMonitoring@src/mongo/shell/db.js:1994:9
      @(shell):1:1
      

       I tried to repeat that command after "rs.slaveOk()", but I got exactly the same error.

      Just in case, "db.getFreeMonitoringStatus()" returns:

      {
      	"state" : "undecided",
      	"ok" : 1,
      	"operationTime" : Timestamp(1552503490, 1),
      	"$clusterTime" : {
      		"clusterTime" : Timestamp(1552503490, 1),
      		"signature" : {
      			"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
      			"keyId" : NumberLong(0)
      		}
      	}
      }
      

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: