[SERVER-9819] Potential problem with mongodb upgrade from 2.2.2 to 2.4.3 Created: 30/May/13  Updated: 17/Aug/13  Resolved: 31/May/13

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Critical - P2
Reporter: Zeki Mokhtarzada Assignee: Scott Hernandez (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
Operating System: ALL
Participants:

 Description   

When I upgraded a secondary node from mongo 2.2.2 to 2.4.3, I get the following error when I connect from the command line:

Server has startup warnings:
Thu May 30 10:59:04.919 [initandlisten] Index { v: 1, key:

{ name: "siteId" }

, unique: true, ns: "web_qa.sites", name: "siteId_1" } claims to be of type 'siteId', which is either invalid or did not exist before v2.4. See the upgrade section: http://dochub.mongodb.org/core/upgrade-2.4

This is just a standard index. I've tried deleting and recreating the index but that did not help. Does anyone have any suggestions?



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

No problem; sometimes a second set of eyes is all that is needed.

Comment by Zeki Mokhtarzada [ 31/May/13 ]

Well now I just feel silly. I removed the index from the primary, restarted the upgraded secondary and it came up without any errors.

Thank you so much!

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

No s in the database name.
On May 30, 2013 11:01 PM, "Zeki Mokhtarzada (JIRA)" <jira@mongodb.org>

Comment by Zeki Mokhtarzada [ 31/May/13 ]

Yep. Just executed the following:

$ mongo
MongoDB shell version: 2.4.3
connecting to: test
Server has startup warnings:
Thu May 30 16:15:08.153 [initandlisten] Index { v: 1, key: { name: "siteId" }, unique: true, ns: "web_qa.sites", name: "siteId_1" } claims to be of type 'siteId', which is either invalid or did not exist before v2.4. See the upgrade section: http://dochub.mongodb.org/core/upgrade-2.4
webs:SECONDARY> use admin
switched to db admin
webs:SECONDARY> db.shutdownServer()
Thu May 30 22:58:12.953 DBClientCursor::init call() failed
server should be down...
Thu May 30 22:58:12.956 trying reconnect to 127.0.0.1:27017
Thu May 30 22:58:12.956 reconnect 127.0.0.1:27017 failed couldn't connect to server 127.0.0.1:27017
> exit
bye
$ sudo service mongodb start
mongodb start/running, process 17453
$ mongo
MongoDB shell version: 2.4.3
connecting to: test
Server has startup warnings:
Thu May 30 22:58:39.044 [initandlisten] Index { v: 1, key: { name: "siteId" }, unique: true, ns: "web_qa.sites", name: "siteId_1" } claims to be of type 'siteId', which is either invalid or did not exist before v2.4. See the upgrade section: http://dochub.mongodb.org/core/upgrade-2.4
webs:SECONDARY> use webs_qa
switched to db webs_qa
webs:SECONDARY> rs.slaveOk()
webs:SECONDARY> db.system.indexes.find({ns: "webs_qa.sites"}).toArray()
[
	{
		"v" : 1,
		"key" : {
			"_id" : 1
		},
		"ns" : "webs_qa.sites",
		"name" : "_id_"
	},
	{
		"v" : 1,
		"key" : {
			"domains" : 1
		},
		"unique" : true,
		"ns" : "webs_qa.sites",
		"name" : "domains_1",
		"sparse" : true
	},
	{
		"v" : 1,
		"key" : {
			"username" : 1
		},
		"unique" : true,
		"ns" : "webs_qa.sites",
		"name" : "username_1"
	}
]
webs:SECONDARY>

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

Did you restart after removing the index? The startup warnngs are created
when the instance starts and won't go away until you restart the node with
the warnings.

You can do a full resync from no data but that is not needed.

Comment by Zeki Mokhtarzada [ 31/May/13 ]

Here is a complete dialog including the error message and the indexes on the sites collection:

$ mongo
MongoDB shell version: 2.4.3
connecting to: test
Server has startup warnings:
Thu May 30 16:15:08.153 [initandlisten] Index { v: 1, key: { name: "siteId" }, unique: true, ns: "web_qa.sites", name: "siteId_1" } claims to be of type 'siteId', which is either invalid or did not exist before v2.4. See the upgrade section: http://dochub.mongodb.org/core/upgrade-2.4
webs:SECONDARY> rs.slaveOk()
webs:SECONDARY> use webs_qa
switched to db webs_qa
webs:SECONDARY> db.system.indexes.find({ns: "webs_qa.sites"}).toArray()
[
	{
		"v" : 1,
		"key" : {
			"_id" : 1
		},
		"ns" : "webs_qa.sites",
		"name" : "_id_"
	},
	{
		"v" : 1,
		"key" : {
			"domains" : 1
		},
		"unique" : true,
		"ns" : "webs_qa.sites",
		"name" : "domains_1",
		"sparse" : true
	},
	{
		"v" : 1,
		"key" : {
			"username" : 1
		},
		"unique" : true,
		"ns" : "webs_qa.sites",
		"name" : "username_1"
	}
]

I have considered blowing away the data directory and resyncing. That would be ok for my case, but may not be ok for other users.

Is it safe for a 2.4.3 secondary to rebuild off of a 2.2.2 primary?

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

Can you post the new error message?

Also, make sure you do "use web_qa" to get to the correct database first.

Here is code to show all the indexes in the db. You can run this on each replica if you want.

> use web_qa
> db.system.indexes.find().toArray() //return all indexes for db

Comment by Zeki Mokhtarzada [ 30/May/13 ]

FYI, I have not upgraded the primary yet.

Comment by Zeki Mokhtarzada [ 30/May/13 ]

Hmm... The strange thing is that after removing the index on the primary and bouncing the upgraded secondary, I still get the same error. Is it possible there is a phantom index somewhere in the catalog or something?

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

The problem with this index is that the word "siteId" is where there should be one of the following : 1/-1/hashed/text/2d/<etc> in the index specification.

This is not a valid index specification now that more error checking is done. You can remedy this situation by removing the index, and creating a valid one with the number 1 (for ascending) as described in the docs: http://docs.mongodb.org/manual/tutorial/create-an-index/

If you expect you created an index on the name field this would be what you want to run:

db.sites.ensureIndex({name:1})
db.sites.ensureIndex({siteId:1}) // or is the siteId the field you wanted?

Or if you wanted a compound index on name + siteId then this is what you want:

db.sites.ensureIndex({name:1, siteId:1})

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