[SERVER-21193] mongos claims that config db is empty on CSRS cluster Created: 29/Oct/15  Updated: 25/Jan/17  Resolved: 11/Nov/15

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: 3.2.0-rc1
Fix Version/s: 3.2.0-rc3

Type: Bug Priority: Minor - P4
Reporter: Cailin Nelson Assignee: Randolph Tan
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
Backwards Compatibility: Fully Compatible
Operating System: ALL
Steps To Reproduce:

var st = new ShardingTest({ verbose:0, shards: 1});
var adminDb = st.s.getDB('admin');
var output = adminDb.runCommand('listDatabases');
jsTestLog(tojson(output));

Sprint: Sharding C (11/20/15)
Participants:

 Description   

My config db ctonains the usual expected stuff, but "show dbs" and the listDatabases commands executed via the mongos claim it is empty. On 3.0.x mongos we showed the actual size of the config db.

[scripts] (v20151027)$ /var/lib/mongodb-mms-automation/mongodb-osx-x86_64-3.2.0-rc1/bin/mongo localhost:28017
MongoDB shell version: 3.2.0-rc1
connecting to: localhost:28017/test
mongos> db.version()
3.2.0-rc1
mongos> show dbs
admin          (empty)
alphabet     0.000GB
config         (empty)
food         0.000GB
randomStuff  0.001GB
mongos> use admin
switched to db admin
mongos> db.runCommand({listDatabases:1})
{
	"databases" : [
		{
			"name" : "alphabet",
			"sizeOnDisk" : 131072,
			"empty" : false,
			"shards" : {
				"red_0" : 131072
			}
		},
		{
			"name" : "food",
			"sizeOnDisk" : 503808,
			"empty" : false,
			"shards" : {
				"red_0" : 356352,
				"red_1" : 147456
			}
		},
		{
			"name" : "randomStuff",
			"sizeOnDisk" : 1093632,
			"empty" : false,
			"shards" : {
				"red_0" : 1081344,
				"red_1" : 12288
			}
		},
		{
			"name" : "config"
		},
		{
			"name" : "admin"
		}
	],
	"totalSize" : 1728512,
	"totalSizeMb" : 1,
	"ok" : 1
}



 Comments   
Comment by Githook User [ 11/Nov/15 ]

Author:

{u'username': u'renctan', u'name': u'Randolph Tan', u'email': u'randolph@10gen.com'}

Message: SERVER-21193 Fix compile
Branch: master
https://github.com/mongodb/mongo/commit/a7aceb08e03a9d449a92b4f2031e1b9887e00a3d

Comment by Githook User [ 11/Nov/15 ]

Author:

{u'username': u'renctan', u'name': u'Randolph Tan', u'email': u'randolph@10gen.com'}

Message: SERVER-21193 mongos claims that config db is empty on CSRS cluster

dbStats don't support readConcern since database metadata in the server are not synchronized with the snapshots. This makes the listDatabase command in mongos to send listDatabase instead with primaryPreferred and without the readConcern option.

This also changed the listDatabase behavior to not include the config or admin in the result if they don't actually exist.
Branch: master
https://github.com/mongodb/mongo/commit/4ec5842d77444ff259a8bb5dd53e7b93f1031f22

Comment by Andy Schwerin [ 02/Nov/15 ]

I confirmed that this doesn't happen in 3.2.0-rc1 if you run with SCCC config servers, only CSRS. It's because we run the dbstats command to get information about the admin and config databases, and the catalog manager attaches a read concern, which dbstats does not support.

> st.config0.getDB("config").runCommand({dbstats: 1, readConcern: { level: "majority" }})
{
	"ok" : 0,
	"errmsg" : "Command dbStats does not support readConcern",
	"code" : 72
}

Comment by Daniel Pasette (Inactive) [ 02/Nov/15 ]

Added simple repro.

Generated at Thu Feb 08 03:56:36 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.