-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: 3.3.1
-
Component/s: Diagnostics
-
None
-
Minor Change
-
ALL
-
TIG 12 (04/01/16), TIG 13 (04/22/16)
-
0
When the validate command is run against a sharded collection that does not have a chunk on every shard, the shards without a chunk will report "ns not found" with {ok: 0} and no valid field. This causes the command to report without a valid field at the top level.
This result is ambiguous and the drivers do different things to determine if the result is valid or not. For example, pymongo would search for the keyword "valid" and defaults to invalid if not found. The shell, on the other hand, searches for the string "exception" or "corrupt" in the stringified response object and defaults to valid if not found. As a result, pymongo fails but the shell doesn't in this scenario.
example output:
mongos> db.runCommand({validate:"test"}) { "raw" : { "Roberts-MacBook-Pro-347.local:20000" : { "ns" : "test.test", "nrecords" : 1, "nIndexes" : 1, "keysPerIndex" : { "test.test.$_id_" : 1 }, "valid" : true, "warnings" : [ "Some checks omitted for speed. use {full:true} option to do more thorough scan." ], "errors" : [ ], "ok" : 1 }, "Roberts-MacBook-Pro-347.local:20001" : { "ok" : 0, "errmsg" : "ns not found" } }, "ok" : 0, "errmsg" : "{ Roberts-MacBook-Pro-347.local:20001: \"ns not found\" }" }