[SERVER-9672] indexes not visible while connected to replset Created: 13/May/13  Updated: 13/May/13  Resolved: 13/May/13

Status: Closed
Project: Core Server
Component/s: Replication, Shell
Affects Version/s: 2.2.3
Fix Version/s: None

Type: Question Priority: Critical - P2
Reporter: Siege Jackson Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

CentOS release 6.4 (Final)


Participants:

 Description   

I'm seeing odd behavior:

I have a shard that has a tagged member for ETL work, it's _id:5 in the following rs.conf():

s9:SECONDARY> rs.conf()
{
	"_id" : "s9",
	"version" : 16,
	"members" : [
		{
			"_id" : 3,
			"host" : "ec2-184-169-144-16.us-west-1.compute.amazonaws.com:27017",
			"priority" : 0,
			"hidden" : true,
			"buildIndexes" : false
		},
		{
			"_id" : 4,
			"host" : "50.23.75.133:28009",
			"priority" : 2
		},
		{
			"_id" : 5,
			"host" : "198.23.68.151:28009",
			"votes" : 0,
			"priority" : 0,
			"tags" : {
				"etlstafe" : "true"
			}
		},
		{
			"_id" : 6,
			"host" : "50.23.100.8:28009",
			"priority" : 3
		}
	]
}

When I connect to this secondary directly with (while logged on to the hosts console):

mongo --port 28009

I get the following:

MongoDB shell version: 2.2.3
connecting to: 127.0.0.1:28009/test
s9:SECONDARY> db.getMongo().setSlaveOk()
s9:SECONDARY> db.blocks.getIndexes()
[ ]
s9:SECONDARY>

When in fact, I should see

[
	{
		"v" : 1,
		"key" : {
			"_id" : 1
		},
		"ns" : "blocks.blocks",
		"name" : "_id_"
	},
	{
		"v" : 1,
		"key" : {
			"user_id" : 1,
			"visible_ts" : 1,
			"state" : 1,
			"private" : 1,
			"created" : 1
		},
		"ns" : "blocks.blocks",
		"name" : "user_id_1_visible_ts_1_state_1_private_1_created_1"
	},
	{
		"v" : 1,
		"key" : {
			"user_id" : 1
		},
		"ns" : "blocks.blocks",
		"name" : "user_id_1"
	},
	{
		"v" : 1,
		"key" : {
			"custom_id" : 1
		},
		"ns" : "blocks.blocks",
		"name" : "custom_id_1"
	},
	{
		"v" : 1,
		"key" : {
			"short_hash" : 1
		},
		"ns" : "blocks.blocks",
		"name" : "short_hash_1"
	},
	{
		"v" : 1,
		"key" : {
			"user_id" : 1,
			"private" : 1,
			"created" : -1
		},
		"ns" : "blocks.blocks",
		"name" : "user_id_1_private_1_created_-1"
	}
]

I'm only able to get the full list of indexes when I restart the member in stand alone mode (not part of replset and on a unique port, as though I'm doing maintenance).

Is this because of the tag in place on that member?



 Comments   
Comment by Siege Jackson [ 13/May/13 ]

You can resolve this; when this was tested from earlier (4/22) this appeared to work but there was missing info.

Comment by Siege Jackson [ 13/May/13 ]

this is user error.

Comment by Scott Hernandez (Inactive) [ 13/May/13 ]

You are in the wrong database in the first case you provided; db is "test" (the default) not "blocks" (your user db). You did not change to the blocks db from output posted.

Please run db.coll.stats() in both cases if you believe you were in the correct database and simply copied things incorrectly.

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