[JAVA-1388] Handle embedded "ns not found" errmsg from mongos Created: 18/Aug/14  Updated: 30/Jan/15  Resolved: 25/Sep/14

Status: Closed
Project: Java Driver
Component/s: Error Handling
Affects Version/s: None
Fix Version/s: 2.13.0, 3.0.0

Type: Improvement Priority: Major - P3
Reporter: Jeffrey Yemin Assignee: Jeffrey Yemin
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by JAVA-1413 Inconsistent Exception handling for d... Closed

 Description   

When running deleteIndexes command against a mongos on a non-existing collection, mongos returns:

{
	"raw" : {
		"shard02/new-host-4.home:27021,new-host-4.home:27022,new-host-4.home:27023" : {
			"ok" : 0,
			"errmsg" : "ns not found"
		}
	},
	"ok" : 0,
	"errmsg" : "{ shard02/new-host-4.home:27021,new-host-4.home:27022,new-host-4.home:27023: \"ns not found\" }"
}

Currently the driver is unable to swallow that error, as it does against a mongod, which just returns:

{ "ok" : 0, "errmsg" : "ns not found" }

because the driver is simply looking for an errmsg that equals "ns not found".



 Comments   
Comment by Githook User [ 30/Jan/15 ]

Author:

{u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}

Message: JAVA-1388: Changed check for non-existent collection to look for an errmsg that contains "ns not found". This will work with both mongod and mongos, the latter of which returns an errmsg that has "ns not found" embedded in the middle.
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/11e44e345caf1f8eb31db443aada42274193dfba

Comment by Jeffrey Yemin [ 29/Jan/15 ]

2.13.0 has been released. Closing issue.

Comment by Githook User [ 25/Sep/14 ]

Author:

{u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}

Message: To ensure that dropIndexes and drop on DBCollection don't throw an exception if the collection does not exist,
changed the check for "ns not found" in the errmsg from an equality match to a contains match.
This was an issue because mongos reports the error like:

{ new-host-4.home:27018: "ns not found" }

JAVA-1388
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/f22a427d6afe7614709e969002db4a329fc9d7ec

Comment by Githook User [ 18/Aug/14 ]

Author:

{u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}

Message: JAVA-1388: Changed check for non-existent collection to look for an errmsg that contains "ns not found". This will work with both mongod and mongos, the latter of which returns an errmsg that has "ns not found" embedded in the middle.
Branch: 3.0.x
https://github.com/mongodb/mongo-java-driver/commit/11e44e345caf1f8eb31db443aada42274193dfba

Generated at Thu Feb 08 08:54:30 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.