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

Prevent creation of database "Admin" or any combination of upper/lowercase letters other than "admin"

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor - P4
    • Resolution: Gone away
    • Affects Version/s: 3.0.0
    • Fix Version/s: None
    • Component/s: Storage
    • Labels:
    • Operating System:
      ALL
    • Steps To Reproduce:
      Hide

      In order to reproduce follow these steps on a freshly created replica set:

      replset:PRIMARY> rs.status()
      {
      	"set" : "replset",
      	"date" : ISODate("2016-04-13T01:39:20.523Z"),
      	"myState" : 1,
      	"members" : [
      		{
      			"_id" : 0,
      			"name" : "127.0.0.1:27017",
      			"health" : 1,
      			"state" : 1,
      			"stateStr" : "PRIMARY",
      			"uptime" : 8,
      			"optime" : Timestamp(1460511552, 1),
      			"optimeDate" : ISODate("2016-04-13T01:39:12Z"),
      			"electionTime" : Timestamp(1460511556, 1),
      			"electionDate" : ISODate("2016-04-13T01:39:16Z"),
      			"configVersion" : 1,
      			"self" : true
      		},
      		{
      			"_id" : 1,
      			"name" : "127.0.0.1:27018",
      			"health" : 1,
      			"state" : 5,
      			"stateStr" : "STARTUP2",
      			"uptime" : 8,
      			"optime" : Timestamp(0, 0),
      			"optimeDate" : ISODate("1970-01-01T00:00:00Z"),
      			"lastHeartbeat" : ISODate("2016-04-13T01:39:18.523Z"),
      			"lastHeartbeatRecv" : ISODate("2016-04-13T01:39:18.523Z"),
      			"pingMs" : 0,
      			"configVersion" : 1
      		},
      		{
      			"_id" : 2,
      			"name" : "127.0.0.1:27019",
      			"health" : 1,
      			"state" : 5,
      			"stateStr" : "STARTUP2",
      			"uptime" : 8,
      			"optime" : Timestamp(0, 0),
      			"optimeDate" : ISODate("1970-01-01T00:00:00Z"),
      			"lastHeartbeat" : ISODate("2016-04-13T01:39:18.523Z"),
      			"lastHeartbeatRecv" : ISODate("2016-04-13T01:39:18.523Z"),
      			"pingMs" : 0,
      			"configVersion" : 1
      		}
      	],
      	"ok" : 1
      }
      replset:PRIMARY> db.version()
      3.0.11
      replset:PRIMARY> use Admin
      switched to db Admin
      replset:PRIMARY> db.Admin.insert({1:1})
      WriteResult({ "nInserted" : 1 })
      replset:PRIMARY> use gotham
      switched to db gotham
      replset:PRIMARY> db.arkham.insert({1:1})
      WriteResult({ "nInserted" : 1 })
      replset:PRIMARY> db.arkham.renameCollection("test")
      { "ok" : 1 }
      replset:PRIMARY> rs.status()
      2016-04-13T11:40:27.514+1000 I NETWORK  DBClientCursor::init call() failed
      2016-04-13T11:40:27.523+1000 E QUERY    Error: error doing query: failed
          at DBQuery._exec (src/mongo/shell/query.js:83:36)
          at DBQuery.hasNext (src/mongo/shell/query.js:240:10)
          at DBCollection.findOne (src/mongo/shell/collection.js:187:19)
          at DB.runCommand (src/mongo/shell/db.js:58:41)
          at DB.adminCommand (src/mongo/shell/db.js:66:41)
          at Function.rs.status (src/mongo/shell/utils.js:937:37)
          at (shell):1:4 at src/mongo/shell/query.js:83
      2016-04-13T11:40:27.524+1000 I NETWORK  trying reconnect to 127.0.0.1:27017 (127.0.0.1) failed
      2016-04-13T11:40:27.525+1000 I NETWORK  reconnect 127.0.0.1:27017 (127.0.0.1) ok
      replset:SECONDARY> rs.status()
      {
      	"set" : "replset",
      	"date" : ISODate("2016-04-13T01:40:31.705Z"),
      	"myState" : 2,
      	"members" : [
      		{
      			"_id" : 0,
      			"name" : "127.0.0.1:27017",
      			"health" : 1,
      			"state" : 2,
      			"stateStr" : "SECONDARY",
      			"uptime" : 79,
      			"optime" : Timestamp(1460511624, 1),
      			"optimeDate" : ISODate("2016-04-13T01:40:24Z"),
      			"configVersion" : 1,
      			"self" : true
      		},
      		{
      			"_id" : 1,
      			"name" : "127.0.0.1:27018",
      			"health" : 0,
      			"state" : 8,
      			"stateStr" : "(not reachable/healthy)",
      			"uptime" : 0,
      			"optime" : Timestamp(0, 0),
      			"optimeDate" : ISODate("1970-01-01T00:00:00Z"),
      			"lastHeartbeat" : ISODate("2016-04-13T01:40:30.642Z"),
      			"lastHeartbeatRecv" : ISODate("2016-04-13T01:40:24.625Z"),
      			"pingMs" : 0,
      			"lastHeartbeatMessage" : "Failed attempt to connect to 127.0.0.1:27018; couldn't connect to server 127.0.0.1:27018 (127.0.0.1), connection attempt failed",
      			"configVersion" : -1
      		},
      		{
      			"_id" : 2,
      			"name" : "127.0.0.1:27019",
      			"health" : 0,
      			"state" : 8,
      			"stateStr" : "(not reachable/healthy)",
      			"uptime" : 0,
      			"optime" : Timestamp(0, 0),
      			"optimeDate" : ISODate("1970-01-01T00:00:00Z"),
      			"lastHeartbeat" : ISODate("2016-04-13T01:40:30.641Z"),
      			"lastHeartbeatRecv" : ISODate("2016-04-13T01:40:24.625Z"),
      			"pingMs" : 0,
      			"lastHeartbeatMessage" : "Failed attempt to connect to 127.0.0.1:27019; couldn't connect to server 127.0.0.1:27019 (127.0.0.1), connection attempt failed",
      			"configVersion" : -1
      		}
      	],
      	"ok" : 1
      }
      replset:SECONDARY> 
      

      Regards,
      Markus

      Show
      In order to reproduce follow these steps on a freshly created replica set: replset:PRIMARY> rs.status() { "set" : "replset", "date" : ISODate("2016-04-13T01:39:20.523Z"), "myState" : 1, "members" : [ { "_id" : 0, "name" : "127.0.0.1:27017", "health" : 1, "state" : 1, "stateStr" : "PRIMARY", "uptime" : 8, "optime" : Timestamp(1460511552, 1), "optimeDate" : ISODate("2016-04-13T01:39:12Z"), "electionTime" : Timestamp(1460511556, 1), "electionDate" : ISODate("2016-04-13T01:39:16Z"), "configVersion" : 1, "self" : true }, { "_id" : 1, "name" : "127.0.0.1:27018", "health" : 1, "state" : 5, "stateStr" : "STARTUP2", "uptime" : 8, "optime" : Timestamp(0, 0), "optimeDate" : ISODate("1970-01-01T00:00:00Z"), "lastHeartbeat" : ISODate("2016-04-13T01:39:18.523Z"), "lastHeartbeatRecv" : ISODate("2016-04-13T01:39:18.523Z"), "pingMs" : 0, "configVersion" : 1 }, { "_id" : 2, "name" : "127.0.0.1:27019", "health" : 1, "state" : 5, "stateStr" : "STARTUP2", "uptime" : 8, "optime" : Timestamp(0, 0), "optimeDate" : ISODate("1970-01-01T00:00:00Z"), "lastHeartbeat" : ISODate("2016-04-13T01:39:18.523Z"), "lastHeartbeatRecv" : ISODate("2016-04-13T01:39:18.523Z"), "pingMs" : 0, "configVersion" : 1 } ], "ok" : 1 } replset:PRIMARY> db.version() 3.0.11 replset:PRIMARY> use Admin switched to db Admin replset:PRIMARY> db.Admin.insert({1:1}) WriteResult({ "nInserted" : 1 }) replset:PRIMARY> use gotham switched to db gotham replset:PRIMARY> db.arkham.insert({1:1}) WriteResult({ "nInserted" : 1 }) replset:PRIMARY> db.arkham.renameCollection("test") { "ok" : 1 } replset:PRIMARY> rs.status() 2016-04-13T11:40:27.514+1000 I NETWORK DBClientCursor::init call() failed 2016-04-13T11:40:27.523+1000 E QUERY Error: error doing query: failed at DBQuery._exec (src/mongo/shell/query.js:83:36) at DBQuery.hasNext (src/mongo/shell/query.js:240:10) at DBCollection.findOne (src/mongo/shell/collection.js:187:19) at DB.runCommand (src/mongo/shell/db.js:58:41) at DB.adminCommand (src/mongo/shell/db.js:66:41) at Function.rs.status (src/mongo/shell/utils.js:937:37) at (shell):1:4 at src/mongo/shell/query.js:83 2016-04-13T11:40:27.524+1000 I NETWORK trying reconnect to 127.0.0.1:27017 (127.0.0.1) failed 2016-04-13T11:40:27.525+1000 I NETWORK reconnect 127.0.0.1:27017 (127.0.0.1) ok replset:SECONDARY> rs.status() { "set" : "replset", "date" : ISODate("2016-04-13T01:40:31.705Z"), "myState" : 2, "members" : [ { "_id" : 0, "name" : "127.0.0.1:27017", "health" : 1, "state" : 2, "stateStr" : "SECONDARY", "uptime" : 79, "optime" : Timestamp(1460511624, 1), "optimeDate" : ISODate("2016-04-13T01:40:24Z"), "configVersion" : 1, "self" : true }, { "_id" : 1, "name" : "127.0.0.1:27018", "health" : 0, "state" : 8, "stateStr" : "(not reachable/healthy)", "uptime" : 0, "optime" : Timestamp(0, 0), "optimeDate" : ISODate("1970-01-01T00:00:00Z"), "lastHeartbeat" : ISODate("2016-04-13T01:40:30.642Z"), "lastHeartbeatRecv" : ISODate("2016-04-13T01:40:24.625Z"), "pingMs" : 0, "lastHeartbeatMessage" : "Failed attempt to connect to 127.0.0.1:27018; couldn't connect to server 127.0.0.1:27018 (127.0.0.1), connection attempt failed", "configVersion" : -1 }, { "_id" : 2, "name" : "127.0.0.1:27019", "health" : 0, "state" : 8, "stateStr" : "(not reachable/healthy)", "uptime" : 0, "optime" : Timestamp(0, 0), "optimeDate" : ISODate("1970-01-01T00:00:00Z"), "lastHeartbeat" : ISODate("2016-04-13T01:40:30.641Z"), "lastHeartbeatRecv" : ISODate("2016-04-13T01:40:24.625Z"), "pingMs" : 0, "lastHeartbeatMessage" : "Failed attempt to connect to 127.0.0.1:27019; couldn't connect to server 127.0.0.1:27019 (127.0.0.1), connection attempt failed", "configVersion" : -1 } ], "ok" : 1 } replset:SECONDARY> Regards, Markus
    • Sprint:
      Storage NYC 2018-07-02
    • Case:

      Description

      When creating a database called "Admin" (or any upper/lowercase letter combination of "Admin" other than "admin") and then executing db.collection.renameCollection() on a different collection crashes all secondaries in a replica set.

        Attachments

          Activity

            People

            Assignee:
            ben.judd Ben Judd
            Reporter:
            markus.thielsch Markus Thielsch
            Participants:
            Votes:
            1 Vote for this issue
            Watchers:
            14 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: