[SERVER-22234] Collection with a long key fails validation Created: 19/Jan/16  Updated: 22/Mar/23  Resolved: 09/Feb/16

Status: Closed
Project: Core Server
Component/s: Storage
Affects Version/s: 3.2.0
Fix Version/s: 3.3.2

Type: Bug Priority: Major - P3
Reporter: Jonathan Abrahams Assignee: Robert Guo (Inactive)
Resolution: Done Votes: 0
Labels: fuzzer-blacklist
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by SERVER-22231 Add additional test suites to run res... Closed
Documented
is documented by DOCS-9522 Docs for SERVER-22234: Collection wit... Closed
Related
is related to SERVER-19521 validate should check consistency of ... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Steps To Reproduce:

var coll=db.longindex;
coll.drop();
var shortVal = new Array(100).join('x');
var longVal = new Array(1025).join('x'); // Index key must be larger than 1024
 
db.adminCommand({setParameter: 1, failIndexKeyTooLong: false});
 
coll.insert({_id: shortVal});
var res = coll.validate({full: true, scandata: true});
assert(res.valid, tojson(res));
 
coll.insert({_id: longVal});
res = coll.validate({full: true, scandata: true});
assert(res.valid, tojson(res));

Sprint: TIG F (01/29/16), TIG 10 (02/19/16)
Participants:

 Description   

If a long index key (greater than 1024) is inserted into a collection (when the parameter failIndexKeyTooLong is set to false), then collection validate does not take it into account and fails. This seems to have been introduced from the work in SERVER-19521.

{
	"ns" : "test.longindex",
	"nrecords" : 2,
	"nIndexes" : 1,
	"keysPerIndex" : {
		"test.longindex.$_id_" : 1
	},
	"indexDetails" : {
		"test.longindex.$_id_" : {
			"valid" : true
		}
	},
	"valid" : false,
	"errors" : [
		"number of _id index entries (1) does not match the number of documents (2)"
	],
	"advice" : "ns corrupt. See http://dochub.mongodb.org/core/data-recovery",
	"ok" : 1
}



 Comments   
Comment by Githook User [ 09/Feb/16 ]

Author:

{u'username': u'guoyr', u'name': u'Robert Guo', u'email': u'robert.guo@10gen.com'}

Message: SERVER-22234 The Validate Command Should Work with failIndexKeyTooLong
Branch: master
https://github.com/mongodb/mongo/commit/8fce2322ec5a85181792cbf8a950e1ac14805578

Comment by Githook User [ 09/Feb/16 ]

Author:

{u'username': u'guoyr', u'name': u'Robert Guo', u'email': u'robert.guo@10gen.com'}

Message: Revert "SERVER-22234 The Validate Command Should Work with failIndexKeyTooLong"

This reverts commit e0c067b5f7a10308c5a52f2dbb662e7cfdb41e1e.
Branch: master
https://github.com/mongodb/mongo/commit/db7a4ebec8e5f8d027d1489ec9023dd223c0b362

Comment by Githook User [ 09/Feb/16 ]

Author:

{u'username': u'guoyr', u'name': u'Robert Guo', u'email': u'robert.guo@10gen.com'}

Message: SERVER-22234 The Validate Command Should Work with failIndexKeyTooLong
Branch: master
https://github.com/mongodb/mongo/commit/e0c067b5f7a10308c5a52f2dbb662e7cfdb41e1e

Comment by Githook User [ 09/Feb/16 ]

Author:

{u'username': u'guoyr', u'name': u'Robert Guo', u'email': u'robert.guo@10gen.com'}

Message: Revert "SERVER-22234 The Validate Command Should Work with failIndexKeyTooLong"

This reverts commit 066d5c3f49c415af84607603f6cbce82590c4da1.
Branch: master
https://github.com/mongodb/mongo/commit/5502beaa72ad05b8da994f9ff84aa976e0871649

Comment by Githook User [ 09/Feb/16 ]

Author:

{u'username': u'guoyr', u'name': u'Robert Guo', u'email': u'robert.guo@10gen.com'}

Message: Revert "SERVER-22234 add tests"

This reverts commit aff0ad5caf150d1ee547806b45db074eb0ec18d3.
Branch: master
https://github.com/mongodb/mongo/commit/4c9a823b6ec3de808c675c99f0fec40f48c491ca

Comment by Githook User [ 09/Feb/16 ]

Author:

{u'username': u'guoyr', u'name': u'Robert Guo', u'email': u'robert.guo@10gen.com'}

Message: SERVER-22234 The Validate Command Should Work with failIndexKeyTooLong
Branch: master
https://github.com/mongodb/mongo/commit/066d5c3f49c415af84607603f6cbce82590c4da1

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